On Wednesday 13 August 2008 16:45, [EMAIL PROTECTED] wrote:
> Author: batosai
> Date: 2008-08-13 15:45:23 +0000 (Wed, 13 Aug 2008)
> New Revision: 21816
>
> Modified:
> trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
> Log:
> Handle GetTrusters and GetTrustees FCP messages.
>
> Modified: trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
> ===================================================================
> --- trunk/apps/WoT/src/plugins/WoT/WoTplugin.java 2008-08-13 15:19:23 UTC
(rev 21815)
> +++ trunk/apps/WoT/src/plugins/WoT/WoTplugin.java 2008-08-13 15:45:23 UTC
(rev 21816)
> @@ -569,6 +575,44 @@
> return sfs;
> }
>
> + private SimpleFieldSet handleGetTrusters(SimpleFieldSet params) throws
InvalidParameterException, MalformedURLException, UnknownIdentityException {
> +
> + SimpleFieldSet sfs = new SimpleFieldSet(false);
> +
> + if(params.get("Identity") == null) throw new
InvalidParameterException("Missing mandatory parameter");
> +
> + sfs.putAppend("Message", "Identities");
> +
> + ObjectSet<Trust> result = db.queryByExample(new Trust(null,
wot.getIdentityByURI(params.get("Identity")),0));
> +
> + for(int i = 1 ; result.hasNext() ; i++) {
> + Trust trust = result.next();
> + sfs.putAppend("Identity"+i,
trust.getTruster().getRequestURI().toString());
> + sfs.putAppend("Value"+i,
> String.valueOf(trust.getValue()));
> + sfs.putAppend("Comment"+i, trust.getComment());
> + }
> + return sfs;
> + }
Wouldn't it be better to have the Identity, Value and Comment all within a
single level of the tree?
FCPPluginMessage
Originator=WoT // I have no idea how we really do this without looking it up!
Message=Identity
Results.1.Identity=xyz
Results.1.Value=64
Results.1.Comment=He's okay
Results.2.identity=abc
...
??
> +
> + private SimpleFieldSet handleGetTrustees(SimpleFieldSet params) throws
InvalidParameterException, MalformedURLException, UnknownIdentityException {
> +
> + SimpleFieldSet sfs = new SimpleFieldSet(false);
> +
> + if(params.get("Identity") == null) throw new
InvalidParameterException("Missing mandatory parameter");
> +
> + sfs.putAppend("Message", "Identities");
> +
> + ObjectSet<Trust> result = db.queryByExample(new
Trust(wot.getIdentityByURI(params.get("Identity")), null, 0));
> +
> + for(int i = 1 ; result.hasNext() ; i++) {
> + Trust trust = result.next();
> + sfs.putAppend("Identity"+i,
trust.getTrustee().getRequestURI().toString());
> + sfs.putAppend("Value"+i,
> String.valueOf(trust.getValue()));
> + sfs.putAppend("Comment"+i, trust.getComment());
> + }
> + return sfs;
> + }
> +
> private SimpleFieldSet errorMessageFCP (Exception e) {
>
> SimpleFieldSet sfs = new SimpleFieldSet(false);
>
> _______________________________________________
> cvs mailing list
> [EMAIL PROTECTED]
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
>
>
pgp36iba00Qpf.pgp
Description: PGP signature
_______________________________________________ Devl mailing list [email protected] http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
