Does setTrust() delete the old Trust?

On Monday 11 August 2008 01:15, batosai at freenetproject.org wrote:
> Author: batosai
> Date: 2008-08-11 00:15:53 +0000 (Mon, 11 Aug 2008)
> New Revision: 21726
> 
> Modified:
>    trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
> Log:
> Fix display errors and start processing the new trust relationship.
> 
> Modified: trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
> ===================================================================
> --- trunk/apps/WoT/src/plugins/WoT/WoTplugin.java     2008-08-10 20:01:46 UTC 
(rev 21725)
> +++ trunk/apps/WoT/src/plugins/WoT/WoTplugin.java     2008-08-11 00:15:53 UTC 
(rev 21726)
> @@ -215,9 +215,7 @@
>               if(wot.getNbIdentities() == 0) { // Should never happen
>                       listBoxContent.addChild("p", "You know no other 
> identites yet, we are 
fetching the seedfile that contains a first set of identities (Freenet 
developpers).");
>               }
> -             else {
> -                     //HTMLNode listForm = pr.addFormChild(listBoxContent, 
> SELF_URI 
+ "/setTrust", "setTrustForm");
> -                     
> +             else {                  
>                       HTMLNode identitiesTable = 
listBoxContent.addChild("table", "border", "0");
>                       HTMLNode row=identitiesTable.addChild("tr");
>                       row.addChild("th", "NickName");
> @@ -226,7 +224,6 @@
>                       if(treeOwner != null) {
>                               row.addChild("th", "Score (Rank)");
>                               row.addChild("th", "Trust/Comment");
> -                             //listForm.addChild("input", new String[] { 
> "type", "name", "value" }, 
new String[] { "hidden", "owner", treeOwner.getRequestURI().toString() });
>                       }
>                       
>                       ObjectSet<Identity> identities = 
> db.queryByExample(Identity.class);
> @@ -266,7 +263,7 @@
>                                       trustForm.addChild("input", new 
> String[] { "type", "name", "value" }, 
new String[] { "hidden", "truster", treeOwner.getRequestURI().toString() });
>                                       trustForm.addChild("input", new 
> String[] { "type", "name", "value" }, 
new String[] { "hidden", "trustee", id.getRequestURI().toString() });
>                                       trustForm.addChild("input", new 
> String[] 
{ "type", "name", "size", "value" }, new String[] { "text", "value", "2", 
String.valueOf(trustValue) });
> -                                     trustForm.addChild("input", new 
> String[] 
{ "type", "name", "size", "comment" }, new String[] 
{ "text", "comment", "20", trustComment });
> +                                     trustForm.addChild("input", new 
> String[] 
{ "type", "name", "size", "value" }, new String[] { "text", "comment", "20", 
trustComment });
>                                       trustForm.addChild("input", new 
> String[] { "type", "name", "value" }, 
new String[] { "submit", "update", "Update !" });
>                               }
>                       }
> @@ -336,7 +333,32 @@
>       }
>  
>       private String updateTrust(HTTPRequest request) {
> -             return request.getPartAsString("truster", 
1024)+"<br>"+request.getPartAsString("trustee", 
1024)+"<br>"+request.getPartAsString("value", 
1024)+"<br>"+request.getPartAsString("comment", 1024)+"\n";
> +
> +             try {
> +                     Identity truster = wot.getIdentityByURI(new 
FreenetURI(request.getPartAsString("truster", 1024)));
> +                     Identity trustee = wot.getIdentityByURI(new 
FreenetURI(request.getPartAsString("trustee", 1024)));
> +                     int value = 
> Integer.parseInt(request.getPartAsString("value", 1024));
> +                     String comment = request.getPartAsString("comment", 
> 1024);
> +
> +                     wot.setTrust(new Trust(truster, trustee, value, 
> comment));
> +                     db.commit();
> +                     
> +                     String out = "";
> +                     ObjectSet<Trust> trusts = 
> db.queryByExample(Trust.class);
> +                     while (trusts.hasNext()) {
> +                             out += trusts.next().toString() + "<br>";
> +                     }
> +                     
> +                     ObjectSet<Score> scores = 
> db.queryByExample(Score.class);
> +                     while (scores.hasNext()) {
> +                             out += scores.next().toString() + "<br>";
> +                     }
> +                     
> +                     return out;
> +                     //return 
> makeKnownIdentitiesPage(request.getPartAsString("truster", 
1024));*/
> +             } catch (MalformedURLException e) {
> +                     return e.getLocalizedMessage();
> +             }
>       }
>  
>       private String addIdentity(HTTPRequest request) {
> 
> _______________________________________________
> cvs mailing list
> cvs at freenetproject.org
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 
<https://emu.freenetproject.org/pipermail/devl/attachments/20080812/f2651f46/attachment.pgp>

Reply via email to