Author: batosai
Date: 2008-09-05 14:34:23 +0000 (Fri, 05 Sep 2008)
New Revision: 22455

Modified:
   trunk/apps/WoT/src/plugins/WoT/WebInterface.java
   trunk/apps/WoT/src/plugins/WoT/WoT.java
Log:
Hunt down non-SODA requests.

Modified: trunk/apps/WoT/src/plugins/WoT/WebInterface.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/WebInterface.java    2008-09-05 14:19:42 UTC 
(rev 22454)
+++ trunk/apps/WoT/src/plugins/WoT/WebInterface.java    2008-09-05 14:34:23 UTC 
(rev 22455)
@@ -74,7 +74,8 @@
                HTMLNode box = pm.getInfobox("Own Identities");
                HTMLNode boxContent = pm.getContentNode(box);

-               ObjectSet<OwnIdentity> ownIdentities = 
db.queryByExample(OwnIdentity.class);
+               
+               ObjectSet<OwnIdentity> ownIdentities = OwnIdentity.getAll(db);
                if(ownIdentities.size() == 0) {
                        boxContent.addChild("p", "You have no own identity yet, 
you should create one...");
                }
@@ -140,15 +141,15 @@
                return pageNode.generate();
        }

-       public String makeKnownIdentitiesPage() throws Db4oIOException, 
DatabaseClosedException, InvalidParameterException, NotInTrustTreeException, 
DuplicateScoreException {
+       public String makeKnownIdentitiesPage() throws Db4oIOException, 
DatabaseClosedException, InvalidParameterException, NotInTrustTreeException, 
DuplicateScoreException, DuplicateTrustException {
                return makeKnownIdentitiesPage("");
        }

-       public String makeKnownIdentitiesPage(HTTPRequest request) throws 
Db4oIOException, DatabaseClosedException, InvalidParameterException, 
NotInTrustTreeException, DuplicateScoreException {
+       public String makeKnownIdentitiesPage(HTTPRequest request) throws 
Db4oIOException, DatabaseClosedException, InvalidParameterException, 
NotInTrustTreeException, DuplicateScoreException, DuplicateTrustException {
                return 
makeKnownIdentitiesPage(request.getPartAsString("ownerURI", 1024));
        }

-       public String makeKnownIdentitiesPage(String owner) throws 
Db4oIOException, DatabaseClosedException, InvalidParameterException, 
NotInTrustTreeException, DuplicateScoreException {
+       public String makeKnownIdentitiesPage(String owner) throws 
Db4oIOException, DatabaseClosedException, InvalidParameterException, 
NotInTrustTreeException, DuplicateScoreException, DuplicateTrustException {

                OwnIdentity treeOwner = null;

@@ -177,12 +178,12 @@
                        return pageNode.generate();
                }
                else if (nbOwnIdentities == 1) {
-                       treeOwner = (OwnIdentity) 
db.queryByExample(OwnIdentity.class).next();
+                       treeOwner = OwnIdentity.getAll(db).next();
                }
                else {
                        // Get the identity the user asked for, or the first 
one if he didn't
                        if(owner.equals("")) {
-                               treeOwner = wot.getOwnIdentities().next();
+                               treeOwner = OwnIdentity.getAll(db).next();
                        }
                        else {
                                try {
@@ -218,7 +219,7 @@
                row.addChild("th", "Score (Rank)");
                row.addChild("th", "Trust/Comment");

-               ObjectSet<Identity> identities = 
db.queryByExample(Identity.class);
+               ObjectSet<Identity> identities = wot.getAllIdentities();
                while(identities.hasNext()) {
                        Identity id = identities.next();

@@ -249,12 +250,13 @@
                        // Trust
                        String trustValue = "";
                        String trustComment = "";
-                       ObjectSet<Trust> trusts = db.queryByExample(new 
Trust(treeOwner, id, 0, null));
-                       if(trusts.hasNext()) {
-                               Trust trust = trusts.next();
+                       
+                       Trust trust;
+                       try {
+                               trust = treeOwner.getGivenTrust(id, db);
                                trustValue = String.valueOf(trust.getValue());
                                trustComment = trust.getComment();
-                       }
+                       } catch (NotTrustedException e) {}

                        HTMLNode cell = row.addChild("td");
                        HTMLNode trustForm = pr.addFormChild(cell, SELF_URI + 
"/setTrust", "setTrustForm");

Modified: trunk/apps/WoT/src/plugins/WoT/WoT.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/WoT.java     2008-09-05 14:19:42 UTC (rev 
22454)
+++ trunk/apps/WoT/src/plugins/WoT/WoT.java     2008-09-05 14:34:23 UTC (rev 
22455)
@@ -33,13 +33,11 @@
        }

        public int getNbOwnIdentities() {
-               ObjectSet<OwnIdentity> ownIdentities = 
db.queryByExample(OwnIdentity.class);
-               return ownIdentities.size();
+               return db.queryByExample(OwnIdentity.class).size();
        }

        public int getNbIdentities() {
-               ObjectSet<Identity> identities = 
db.queryByExample(Identity.class);
-               return identities.size() - getNbOwnIdentities();
+               return db.queryByExample(Identity.class).size() - 
getNbOwnIdentities();
        }

        public ObjectSet<OwnIdentity> getOwnIdentities() {
@@ -69,8 +67,7 @@
                        query.descend("score").constrain(new 
Integer(0)).smaller();
                }
                else throw new InvalidParameterException("Unhandled select 
value ("+select+")");
-               
-               // Same problem here
+
                return query.execute();
        }
 }


Reply via email to