Browse Source

Implements search function and test for search

feature-credentialneu
fdai5728 3 years ago
parent
commit
fbb7efedcf
  1. 7
      src/main/java/CredentialRepository.java
  2. 4
      src/main/java/CredentialRepositoryInterface.java

7
src/main/java/CredentialRepository.java

@ -33,11 +33,15 @@ public class CredentialRepository implements CredentialRepositoryInterface{
} }
@Override
public Credential getCredentialsViaName(String needle) { public Credential getCredentialsViaName(String needle) {
for(int c = 0; c < this.getListSize(); c++) for(int c = 0; c < this.getListSize(); c++)
{ {
Credential credential = this.credentials.get(c);
if(credential.getName().equals(needle))
return credential;
} }
return null; return null;
@ -45,8 +49,9 @@ public class CredentialRepository implements CredentialRepositoryInterface{
@Override @Override
public void getCredentialsViaId() {
public Credential getCredentialsViaId() {
return null;
} }
@Override @Override

4
src/main/java/CredentialRepositoryInterface.java

@ -3,8 +3,8 @@ public interface CredentialRepositoryInterface {
int createNewCredential(String name, String password); int createNewCredential(String name, String password);
void edit(); void edit();
void delete(); void delete();
void getCredentialsViaName();
void getCredentialsViaId();
Credential getCredentialsViaName(String needle);
Credential getCredentialsViaId();
void setCredentials(); void setCredentials();
void getAsJSON(); void getAsJSON();
void loadCredentialsFromJSON(); void loadCredentialsFromJSON();

Loading…
Cancel
Save