- From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 02 Sep 2009 15:45:45 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn
In directory hutz:/tmp/cvs-serv9242/src/org/w3c/unicorn
Modified Files:
UnicornCall.java
Log Message:
added group elements to output with special behavior (type=firstPassed will output only the first passed observation child)
Index: UnicornCall.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/UnicornCall.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- UnicornCall.java 2 Sep 2009 13:50:54 -0000 1.4
+++ UnicornCall.java 2 Sep 2009 15:45:42 -0000 1.5
@@ -32,6 +32,7 @@
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.event.EventCartridge;
import org.apache.velocity.app.event.implement.EscapeXmlReference;
+import org.w3.unicorn.tasklist.GroupType;
import org.w3c.dom.Document;
import org.w3c.unicorn.contract.CallParameter;
import org.w3c.unicorn.contract.EnumInputMethod;
@@ -599,10 +600,34 @@
* @return map of the observations of the check
*/
public LinkedHashMap<String, Response> getObservationList() {
+
LinkedHashMap<String, Response> tempMap = new LinkedHashMap<String, Response>();
- for (String observerId : aTask.getListOfOutput()) {
- tempMap.put(observerId, mapOfResponse.get(observerId));
+
+ for (GroupType group : aTask.getOutput().getGroupList()) {
+ if (!group.isSetType()) {
+ for (String observerId : group.getObservationList()) {
+ tempMap.put(observerId, mapOfResponse.get(observerId));
+ }
+ } else {
+ String type = group.getType().toString();
+ if (type.equals("firstPassed")) {
+
+ String passedId = null;
+
+ for (String observerId : group.getObservationList()) {
+ if (mapOfResponse.get(observerId).isPassed()) {
+ passedId = observerId;
+ break;
+ }
+ }
+ if (passedId == null)
+ tempMap.put(group.getObservationList().get(0), mapOfResponse.get(group.getObservationList().get(0)));
+ else
+ tempMap.put(passedId, mapOfResponse.get(passedId));
+ }
+ }
}
+
return tempMap;
}
Received on Wednesday, 2 September 2009 15:45:54 UTC