Author: batosai
Date: 2008-09-05 15:32:26 +0000 (Fri, 05 Sep 2008)
New Revision: 22460

Modified:
   trunk/apps/WoT/src/plugins/WoT/OwnIdentity.java
   trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
Log:
Small refactor.

Modified: trunk/apps/WoT/src/plugins/WoT/OwnIdentity.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/OwnIdentity.java     2008-09-05 15:06:57 UTC 
(rev 22459)
+++ trunk/apps/WoT/src/plugins/WoT/OwnIdentity.java     2008-09-05 15:32:26 UTC 
(rev 22460)
@@ -58,8 +58,15 @@
                this(new FreenetURI(insertURI), new FreenetURI(requestURI), 
nickName, publishTrustList, context);
        }

+       public void initTrustTree (ObjectContainer db) throws 
DuplicateScoreException {
+               try {
+                       getScore(this,db);
+                       return;
+               } catch (NotInTrustTreeException e) {
+                       db.store(new Score(this, this, 100, 0, 100));
+               }
+       }

-       
        @SuppressWarnings("unchecked")
        public static OwnIdentity getById (ObjectContainer db, ByteArrayWrapper 
id) throws UnknownIdentityException, DuplicateIdentityException {
                Query query = db.query();

Modified: trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/WoTplugin.java       2008-09-05 15:06:57 UTC 
(rev 22459)
+++ trunk/apps/WoT/src/plugins/WoT/WoTplugin.java       2008-09-05 15:32:26 UTC 
(rev 22460)
@@ -325,8 +325,8 @@

                // TODO Add context in the creation form
                OwnIdentity identity = new OwnIdentity(insertURI, requestURI, 
nickName, publishTrustList, "testing");
-               identity.addContext(context, db);
                db.store(identity);
+               identity.initTrustTree(db);             

                // This identity has capacity on its own trust tree
                Score score = new Score(identity, identity, 100, 0, 100);  


Reply via email to