Changeset 261:d4599d39e689

Show
Ignore:
Timestamp:
09/02/09 15:45:43 (4 years ago)
Author:
tgambet
Branch:
default
convert_revision:
svn:cdcfb263-7567-472c-a848-e2c2df3466e7/trunk@262
Message:

added group elements to output with special behavior (type=firstPassed will output only the first passed observation child)

Files:
7 modified

Legend:

Unmodified
Added
Removed
  • WebContent/WEB-INF/resources/schemas/tasklist.xsd

    r258 r261  
    3434  <xs:complexType name="outputType"> 
    3535    <xs:sequence> 
    36             <xs:element type="xs:string" name="observation" maxOccurs="unbounded" minOccurs="0" xmlns:tas="http://www.w3.org/unicorn/tasklist" /> 
     36 
     37            <xs:element name="group" type="tas:groupType" minOccurs="0" maxOccurs="unbounded"></xs:element> 
    3738    </xs:sequence> 
    3839  </xs:complexType> 
     
    9495  </xs:complexType> 
    9596  <xs:complexType name="execType" mixed="true"> 
    96     <xs:sequence> 
    97       <xs:element type="tas:paramType" name="param" minOccurs="0" xmlns:tas="http://www.w3.org/unicorn/tasklist"/> 
    98     </xs:sequence> 
    99     <xs:attribute type="xs:string" name="value" use="optional"/> 
    100     <xs:attribute type="xs:string" name="type" use="optional"/> 
     97        <xs:sequence> 
     98                <xs:element type="tas:paramType" name="param" minOccurs="0" 
     99                        xmlns:tas="http://www.w3.org/unicorn/tasklist" /> 
     100        </xs:sequence> 
     101 
     102        <xs:attribute type="xs:string" name="value" use="optional" /> 
     103        <xs:attribute type="xs:string" name="type" use="optional" /> 
     104 
     105        <xs:attribute name="id" type="xs:string" use="required"></xs:attribute> 
    101106  </xs:complexType> 
    102     <xs:simpleType name="tInputMethod" xmlns:tas="http://www.w3.org/unicorn/tasklist"> 
     107  <xs:simpleType name="tInputMethod" xmlns:tas="http://www.w3.org/unicorn/tasklist"> 
    103108        <xs:restriction base="xs:string"> 
    104109            <xs:enumeration value="file"/> 
     
    125130        </xs:restriction> 
    126131    </xs:simpleType> 
     132 
     133    <xs:complexType name="groupType"> 
     134        <xs:sequence> 
     135                <xs:element name="observation" type="xs:string" maxOccurs="unbounded" minOccurs="1"></xs:element> 
     136        </xs:sequence> 
     137        <xs:attribute name="type" use="optional"> 
     138                <xs:simpleType> 
     139                        <xs:restriction base="xs:string"> 
     140                                <xs:enumeration value="firstPassed"></xs:enumeration> 
     141                        </xs:restriction> 
     142                </xs:simpleType> 
     143        </xs:attribute> 
     144    </xs:complexType> 
    127145</xs:schema> 
  • WebContent/WEB-INF/resources/tasklist/new-tasklist.xml

    r258 r261  
    3838                        <if test="is-css"> 
    3939                        <then> 
    40                                 <exec value="css-validator" type="observation" /> 
     40                                <exec id="css-validator" value="css-validator" type="observation" /> 
    4141                        </then> 
    4242                        <else> 
    43                                 <exec value="markup-validator" type="observation" /> 
     43                                <exec id="markup-validator" value="markup-validator" type="observation" /> 
    4444                                <if test="is-html"> 
    4545                                <then> 
    46                                         <exec value="appc-checker" type="observation" /> 
     46                                        <exec id="css-validator" value="appc-checker" type="observation" /> 
    4747                                </then> 
    4848                                </if> 
    49                                 <exec value="css-validator" type="observation" /> 
     49                                <!-- <exec value="css-validator" type="observation" /> --> 
     50                                <exec id="css2" value="css2-validator" type="observation" /> 
     51                                <exec id="css21" value="css21-validator" type="observation" /> 
     52                                <exec id="css3" value="css3-validator" type="observation" /> 
    5053                        </else> 
    5154                        </if> 
     
    5861 
    5962                <output> 
    60                         <observation>markup-validator</observation> 
    61                         <observation>appc-checker</observation> 
    62                         <observation>css-validator</observation> 
     63                        <group> 
     64                                <observation>markup-validator</observation> 
     65                                <observation>appc-checker</observation> 
     66                        </group> 
     67                        <group type="firstPassed"> 
     68                                <observation>css21-validator</observation> 
     69                                <observation>css2-validator</observation> 
     70                                <observation>css3-validator</observation> 
     71                        </group> 
    6372                </output> 
    6473 
     
    6877        <task id="full-css"> 
    6978                <routine> 
    70                         <exec value="css1-validator" type="observation" /> 
    71                         <exec value="css2-validator" type="observation" /> 
    72                         <exec value="css21-validator" type="observation" /> 
    73                         <exec value="css3-validator" type="observation" /> 
     79                        <exec id="css1" value="css1-validator" type="observation" /> 
     80                        <exec id="css2" value="css2-validator" type="observation" /> 
     81                        <exec id="css21" value="css21-validator" type="observation" /> 
     82                        <exec id="css3" value="css3-validator" type="observation" /> 
    7483                </routine> 
    7584 
     
    234243 
    235244                <output> 
    236                         <observation>css3-validator</observation> 
    237                         <observation>css21-validator</observation> 
    238                         <observation>css2-validator</observation> 
    239                         <observation>css1-validator</observation> 
     245                        <group> 
     246                                <observation>css21-validator</observation> 
     247                                <observation>css2-validator</observation> 
     248                                <observation>css3-validator</observation> 
     249                                <observation>css1-validator</observation> 
     250                        </group> 
    240251                </output> 
    241252        </task> 
  • src/org/w3c/unicorn/UnicornCall.java

    r258 r261  
    1 // $Id: UnicornCall.java,v 1.4 2009-09-02 13:50:54 tgambet Exp $ 
     1// $Id: UnicornCall.java,v 1.5 2009-09-02 15:45:42 tgambet Exp $ 
    22// Author: Jean-Guilhem Rouel 
    33// (c) COPYRIGHT MIT, ERCIM and Keio, 2006. 
     
    3333import org.apache.velocity.app.event.EventCartridge; 
    3434import org.apache.velocity.app.event.implement.EscapeXmlReference; 
     35import org.w3.unicorn.tasklist.GroupType; 
    3536import org.w3c.dom.Document; 
    3637import org.w3c.unicorn.contract.CallParameter; 
     
    600601         */ 
    601602        public LinkedHashMap<String, Response> getObservationList() { 
     603                 
    602604                LinkedHashMap<String, Response> tempMap = new LinkedHashMap<String, Response>(); 
    603                 for (String observerId : aTask.getListOfOutput()) { 
    604                         tempMap.put(observerId, mapOfResponse.get(observerId)); 
    605                 } 
     605                 
     606                for (GroupType group : aTask.getOutput().getGroupList()) { 
     607                        if (!group.isSetType()) { 
     608                                for (String observerId : group.getObservationList()) { 
     609                                        tempMap.put(observerId, mapOfResponse.get(observerId)); 
     610                                } 
     611                        } else { 
     612                                String type = group.getType().toString(); 
     613                                if (type.equals("firstPassed")) { 
     614                                         
     615                                        String passedId = null; 
     616                                         
     617                                        for (String observerId : group.getObservationList()) { 
     618                                                if (mapOfResponse.get(observerId).isPassed()) { 
     619                                                        passedId = observerId; 
     620                                                        break; 
     621                                                } 
     622                                        } 
     623                                        if (passedId == null) 
     624                                                tempMap.put(group.getObservationList().get(0), mapOfResponse.get(group.getObservationList().get(0))); 
     625                                        else 
     626                                                tempMap.put(passedId, mapOfResponse.get(passedId)); 
     627                                } 
     628                        } 
     629                } 
     630                 
    606631                return tempMap; 
    607632        } 
  • src/org/w3c/unicorn/tasklist/Task.java

    r258 r261  
    1 // $Id: Task.java,v 1.3 2009-09-02 13:50:54 tgambet Exp $ 
     1// $Id: Task.java,v 1.4 2009-09-02 15:45:42 tgambet Exp $ 
    22// Author: Jean-Guilhem Rouel 
    33// (c) COPYRIGHT MIT, ERCIM and Keio, 2006. 
     
    1313import javax.activation.MimeType; 
    1414 
     15import org.w3.unicorn.tasklist.OutputType; 
    1516import org.w3c.unicorn.contract.Observer; 
    1617import org.w3c.unicorn.tasklist.parameters.Parameter; 
     
    5758        private TLTNode root; 
    5859 
    59         private List<String> listOfOutput; 
     60        //private List<String> listOfOutput; 
     61 
     62        private OutputType output; 
    6063 
    6164        /** 
     
    418421        } 
    419422 
    420         public void setOutputList(List<String> observationList) { 
     423        /*public void setOutputList(List<String> observationList) { 
    421424                this.listOfOutput = observationList; 
    422425        } 
     
    424427        public List<String> getListOfOutput() { 
    425428                return listOfOutput; 
    426         } 
    427          
    428          
     429        }*/ 
     430 
     431        public void setOutput(OutputType output) { 
     432                this.output = output; 
     433        } 
     434 
     435        public OutputType getOutput() { 
     436                return output; 
     437        } 
    429438 
    430439} 
  • src/org/w3c/unicorn/tasklist/TaskListUnmarshallerBeans.java

    r258 r261  
    9494                 
    9595                // Add the OutputList 
    96                 aTaskCurrent.setOutputList(aTask.getOutput().getObservationList()); 
     96                aTaskCurrent.setOutput(aTask.getOutput()); 
    9797                 
    9898                // parameters