]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/dbObjects/CertificateOwner.java
upd: Ordering, remove items on orga-view
[gigi.git] / src / org / cacert / gigi / dbObjects / CertificateOwner.java
index 9560224e3601283bce748b51033ba29b2365112a..661033fbf903996e43c8bdbe3826a0660de787d2 100644 (file)
@@ -12,11 +12,16 @@ public abstract class CertificateOwner implements IdCachable {
 
     private int id;
 
-    public CertificateOwner(int id) {
+    protected CertificateOwner(int id) {
         this.id = id;
     }
 
-    public CertificateOwner() {}
+    protected CertificateOwner() {
+        GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("INSERT INTO `certOwners` DEFAULT VALUES");
+        ps.execute();
+        id = ps.lastInsertId();
+        myCache.put(this);
+    }
 
     public int getId() {
         return id;
@@ -43,20 +48,6 @@ public abstract class CertificateOwner implements IdCachable {
         return u;
     }
 
-    protected int insert() {
-        synchronized (User.class) {
-            if (id != 0) {
-                throw new Error("refusing to insert");
-            }
-            GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("INSERT INTO `certOwners` DEFAULT VALUES");
-            ps.execute();
-            id = ps.lastInsertId();
-            myCache.put(this);
-        }
-
-        return id;
-    }
-
     public Domain[] getDomains() {
         GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT `id` FROM `domains` WHERE `memid`=? AND `deleted` IS NULL");
         ps.setInt(1, getId());
@@ -96,7 +87,7 @@ public abstract class CertificateOwner implements IdCachable {
         for (Domain d : getDomains()) {
             String sfx = d.getSuffix();
             if (domainname.equals(sfx) || domainname.endsWith("." + sfx)) {
-                return true;
+                return d.isVerified();
             }
         }