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<String, Group> 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;
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() {