X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2FdbObjects%2FGroup.java;h=a40403e8aedadb481c95badd82d356c307c390f5;hb=70b23989058140bce576713168d0be4365c71037;hp=69f8e40bf7434422bf56a957ffaceec528a0601a;hpb=6100ce303e0cf82bdbd699ec7c3672dcbe8fae7c;p=gigi.git diff --git a/src/org/cacert/gigi/dbObjects/Group.java b/src/org/cacert/gigi/dbObjects/Group.java index 69f8e40b..a40403e8 100644 --- a/src/org/cacert/gigi/dbObjects/Group.java +++ b/src/org/cacert/gigi/dbObjects/Group.java @@ -1,14 +1,11 @@ package org.cacert.gigi.dbObjects; -import java.util.HashMap; - import org.cacert.gigi.database.DatabaseConnection; import org.cacert.gigi.database.GigiPreparedStatement; import org.cacert.gigi.database.GigiResultSet; -public class Group { - - private static HashMap cache = new HashMap<>(); +public enum Group { + SUPPORTER("supporter"), ARBITRATOR("arbitrator"), BLOCKEDASSURER("blockedassurer"), BLOCKEDASSUREE("blockedassuree"), BLOCKEDLOGIN("blockedlogin"), TTP_ASSURER("ttp-assurer"), TTP_APPLICANT("ttp-applicant"), CODESIGNING("codesigning"), ORGASSURER("orgassurer"); private final String dbName; @@ -16,43 +13,8 @@ public class Group { dbName = name; } - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((dbName == null) ? 0 : dbName.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - Group other = (Group) obj; - if (dbName == null) { - if (other.dbName != null) { - return false; - } - } else if ( !dbName.equals(other.dbName)) { - return false; - } - return true; - } - - public static synchronized Group getByString(String name) { - Group g = cache.get(name); - if (g == null) { - g = new Group(name); - cache.put(name, g); - } - return g; + public static Group getByString(String name) { + return valueOf(name.toUpperCase().replace('-', '_')); } public String getDatabaseName() {