From e3013269d2470e3c02d1d5a7b003b1fefe01af15 Mon Sep 17 00:00:00 2001 From: fdai5728 Date: Wed, 16 Feb 2022 16:47:55 +0100 Subject: [PATCH] Implements Skeleton for CredentialRepository Defines Constructor - Credentials are Held in ArrayList for ease of use Defines public function to add new credential with incrementing indizes --- src/main/java/CredentialRepository.java | 55 +++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/main/java/CredentialRepository.java diff --git a/src/main/java/CredentialRepository.java b/src/main/java/CredentialRepository.java new file mode 100644 index 0000000..3964dd6 --- /dev/null +++ b/src/main/java/CredentialRepository.java @@ -0,0 +1,55 @@ +import java.util.ArrayList; + +public class CredentialRepository implements CredentialRepositoryInterface{ + + private int idCounter = 0; + private ArrayList credentials; + + public CredentialRepository() + { + this.credentials = new ArrayList(); + } + + public void createNewCredential(String name, String password) + { + try { + this.credentials.add(new Credential(name, password, this.idCounter++)); + } + catch(Exception fail) + { + System.err.println(fail.getMessage()); + } + } + + @Override + public void edit() { + + } + + @Override + public void delete() { + + } + + @Override + public void getCredentials() { + + } + + @Override + public void setCredentials() { + + } + + @Override + public void getAsJSON() { + + } + + @Override + public void loadCredentialsFromJSON() { + + } +} + +