diff --git a/src/main/java/CredentialRepository.java b/src/main/java/CredentialRepository.java index f8f66f3..2c49131 100644 --- a/src/main/java/CredentialRepository.java +++ b/src/main/java/CredentialRepository.java @@ -33,11 +33,15 @@ public class CredentialRepository implements CredentialRepositoryInterface{ } + @Override public Credential getCredentialsViaName(String needle) { for(int c = 0; c < this.getListSize(); c++) { + Credential credential = this.credentials.get(c); + if(credential.getName().equals(needle)) + return credential; } return null; @@ -45,8 +49,9 @@ public class CredentialRepository implements CredentialRepositoryInterface{ @Override - public void getCredentialsViaId() { + public Credential getCredentialsViaId() { + return null; } @Override diff --git a/src/main/java/CredentialRepositoryInterface.java b/src/main/java/CredentialRepositoryInterface.java index de543eb..85db2ed 100644 --- a/src/main/java/CredentialRepositoryInterface.java +++ b/src/main/java/CredentialRepositoryInterface.java @@ -3,8 +3,8 @@ public interface CredentialRepositoryInterface { int createNewCredential(String name, String password); void edit(); void delete(); - void getCredentialsViaName(); - void getCredentialsViaId(); + Credential getCredentialsViaName(String needle); + Credential getCredentialsViaId(); void setCredentials(); void getAsJSON(); void loadCredentialsFromJSON();