Author: batosai
Date: 2008-08-15 20:54:27 +0000 (Fri, 15 Aug 2008)
New Revision: 21922
Modified:
trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
Log:
Handle context choice on FCP requests.
Modified: trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/WoTplugin.java 2008-08-15 20:54:01 UTC
(rev 21921)
+++ trunk/apps/WoT/src/plugins/WoT/WoTplugin.java 2008-08-15 20:54:27 UTC
(rev 21922)
@@ -345,16 +345,17 @@
SimpleFieldSet sfs = new SimpleFieldSet(false);
- if(params.get("TreeOwner") == null || params.get("Select") ==
null) throw new InvalidParameterException("Missing mandatory parameter");
+ if(params.get("TreeOwner") == null || params.get("Select") ==
null || params.get("Context") == null) throw new
InvalidParameterException("Missing mandatory parameter");
sfs.putAppend("Message", "Identities");
-
- // TODO Add context selection
ObjectSet<Score> result =
wot.getIdentitiesByScore(params.get("TreeOwner"), params.get("Select").trim());
- for(int i = 1 ; result.hasNext() ; i++)
- sfs.putAppend("Identity"+i,
result.next().getTarget().getRequestURI().toString());
-
+ for(int i = 1 ; result.hasNext() ; i++) {
+ Score score = result.next();
+ // Maybe there is a way to do this through SODA
+ if(score.getTarget().hasContext(params.get("Context"))
|| params.get("Context").equals("all"))
+ sfs.putAppend("Identity"+i,
score.getTarget().getRequestURI().toString());
+ }
return sfs;
}
@@ -362,19 +363,20 @@
SimpleFieldSet sfs = new SimpleFieldSet(false);
- if(params.get("Identity") == null) throw new
InvalidParameterException("Missing mandatory parameter");
+ if(params.get("Identity") == null || params.get("Context") ==
null) throw new InvalidParameterException("Missing mandatory parameter");
sfs.putAppend("Message", "Identities");
-
+
ObjectSet<Trust> result =
wot.getTrusters(params.get("Identity"));
-
- // TODO Add context selection
-
+
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());
+ // Maybe there is a way to do this through SODA
+ if(trust.getTruster().hasContext(params.get("Context"))
|| params.get("Context").equals("all")) {
+ sfs.putAppend("Identity"+i,
trust.getTruster().getRequestURI().toString());
+ sfs.putAppend("Value"+i,
String.valueOf(trust.getValue()));
+ sfs.putAppend("Comment"+i, trust.getComment());
+ }
}
return sfs;
}
@@ -383,19 +385,20 @@
SimpleFieldSet sfs = new SimpleFieldSet(false);
- if(params.get("Identity") == null) throw new
InvalidParameterException("Missing mandatory parameter");
+ if(params.get("Identity") == null || params.get("Context") ==
null) throw new InvalidParameterException("Missing mandatory parameter");
sfs.putAppend("Message", "Identities");
ObjectSet<Trust> result =
wot.getTrustees(params.get("Identity"));
-
- // TODO Add context selection
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());
+ // Maybe there is a way to do this through SODA
+ if(trust.getTrustee().hasContext(params.get("Context"))
|| params.get("Context").equals("all")) {
+ sfs.putAppend("Identity"+i,
trust.getTrustee().getRequestURI().toString());
+ sfs.putAppend("Value"+i,
String.valueOf(trust.getValue()));
+ sfs.putAppend("Comment"+i, trust.getComment());
+ }
}
return sfs;
}