]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/dbObjects/User.java
add: country information where verification took place
[gigi.git] / src / org / cacert / gigi / dbObjects / User.java
index 4312d9acd00a897e7a2159b0b6f34442ed9d978a..a6e1d3f13c3abb43a776cdbdde0e4b5b4839cb0e 100644 (file)
@@ -1,5 +1,8 @@
 package org.cacert.gigi.dbObjects;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
@@ -13,6 +16,7 @@ import org.cacert.gigi.database.GigiPreparedStatement;
 import org.cacert.gigi.database.GigiResultSet;
 import org.cacert.gigi.dbObjects.Assurance.AssuranceType;
 import org.cacert.gigi.dbObjects.CATS.CATSType;
+import org.cacert.gigi.dbObjects.CountryCode.CountryCodeType;
 import org.cacert.gigi.localisation.Language;
 import org.cacert.gigi.output.DateSelector;
 import org.cacert.gigi.pages.PasswordResetPage;
@@ -29,6 +33,8 @@ import org.cacert.gigi.util.TimeConditions;
  */
 public class User extends CertificateOwner {
 
+    private static final long serialVersionUID = -7915843843752264176L;
+
     private DayDate dob;
 
     private String email;
@@ -43,7 +49,7 @@ public class User extends CertificateOwner {
 
     public static final int MINIMUM_AGE = 16;
 
-    public static final int MAXIMUM_PLAUSIBLE_AGE = 110;
+    public static final int MAXIMUM_PLAUSIBLE_AGE = 120;
 
     public static final int POJAM_AGE = 14;
 
@@ -51,7 +57,7 @@ public class User extends CertificateOwner {
 
     public static final boolean POJAM_ENABLED = false;
 
-    public static final int EXPERIENCE_POINTS = 2;
+    public static final int EXPERIENCE_POINTS = 4;
 
     /**
      * Time in months a verification is considered "recent".
@@ -136,7 +142,7 @@ public class User extends CertificateOwner {
     public void setDoB(DayDate dob) throws GigiApiException {
         synchronized (Notary.class) {
             if (getReceivedAssurances().length != 0) {
-                throw new GigiApiException("No change after assurance allowed.");
+                throw new GigiApiException("No change after verification allowed.");
             }
 
             if ( !CalendarUtil.isOfAge(dob, User.MINIMUM_AGE)) {
@@ -257,6 +263,7 @@ public class User extends CertificateOwner {
      * 
      * @return the maximal points @
      */
+    @SuppressWarnings("unused")
     public int getMaxAssurePoints() {
         if ( !CalendarUtil.isOfAge(dob, ADULT_AGE) && POJAM_ENABLED) {
             return 10; // PoJAM
@@ -395,7 +402,7 @@ public class User extends CertificateOwner {
 
     }
 
-    public Name getPreferredName() {
+    public synchronized Name getPreferredName() {
         return preferredName;
     }
 
@@ -589,7 +596,11 @@ public class User extends CertificateOwner {
     }
 
     private Assurance assuranceByRes(GigiResultSet res) {
-        return new Assurance(res.getInt("id"), User.getById(res.getInt("from")), Name.getById(res.getInt("to")), res.getString("location"), res.getString("method"), res.getInt("points"), res.getString("date"));
+        try {
+            return new Assurance(res.getInt("id"), User.getById(res.getInt("from")), Name.getById(res.getInt("to")), res.getString("location"), res.getString("method"), res.getInt("points"), res.getString("date"), res.getString("country") == null ? null : CountryCode.getCountryCode(res.getString("country"), CountryCodeType.CODE_2_CHARS));
+        } catch (GigiApiException e) {
+            throw new Error(e);
+        }
     }
 
     public boolean isInVerificationLimit() {
@@ -602,4 +613,8 @@ public class User extends CertificateOwner {
         }
     }
 
+    private void writeObject(ObjectOutputStream oos) throws IOException {}
+
+    private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {}
+
 }