diff --git a/src/main/java/io/github/astrapi69/mystic/crypt/panel/dbtree/MysticCryptEntryModelBean.java b/src/main/java/io/github/astrapi69/mystic/crypt/panel/dbtree/MysticCryptEntryModelBean.java index e2251eb0..1567f667 100644 --- a/src/main/java/io/github/astrapi69/mystic/crypt/panel/dbtree/MysticCryptEntryModelBean.java +++ b/src/main/java/io/github/astrapi69/mystic/crypt/panel/dbtree/MysticCryptEntryModelBean.java @@ -25,10 +25,14 @@ package io.github.astrapi69.mystic.crypt.panel.dbtree; import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.UUID; +import io.github.astrapi69.collection.list.ListExtensions; +import io.github.astrapi69.collection.pair.KeySetPair; +import io.github.astrapi69.collection.set.SetExtensions; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Builder; @@ -64,4 +68,36 @@ public class MysticCryptEntryModelBean @Builder.Default List> properties = new ArrayList<>(); + + public String getProperty(String name) { + String property = KeyValuePair.toMap(properties).get(name); + return property; + } + + public void setProperty(String name, String value){ + properties.add(KeyValuePair.builder().key(name).value(value).build()); + } + + public boolean removeProperty(String name) { + String value = getProperty(name); + KeyValuePair remove = KeyValuePair.builder().key(name).value(value).build(); + int indexToRemove = properties.indexOf(remove); + if(-1 < indexToRemove) { + properties.remove(indexToRemove); + return true; + } + return false; + } + + public List getPropertyNames() { + return ListExtensions.toList(KeyValuePair.toMap(properties).keySet()); + } + + public KeySetPair getKeySetPair(){ + return null; + } + + public String getPath(){ + return ""; + } } diff --git a/src/test/java/io/github/astrapi69/mystic/crypt/keepass2/KeePass2Test.java b/src/test/java/io/github/astrapi69/mystic/crypt/keepass2/KeePass2Test.java index 4dce4775..f174fa51 100644 --- a/src/test/java/io/github/astrapi69/mystic/crypt/keepass2/KeePass2Test.java +++ b/src/test/java/io/github/astrapi69/mystic/crypt/keepass2/KeePass2Test.java @@ -57,12 +57,12 @@ public void testKeePass2() throws Exception { } - public static List getAllGroups(Group someA) { + public static List getAllGroups(Group group) { List returnList = new ArrayList<>(); - returnList.addAll(someA.getGroups()); + returnList.addAll(group.getGroups()); - for(Object otherA: someA.getGroups()) { - returnList.addAll(getAllGroups((Group)otherA)); + for(Object currentGroup: group.getGroups()) { + returnList.addAll(getAllGroups((Group)currentGroup)); } return returnList;