com.collabnet.tracker.xml
Class QueryXMLHelper

java.lang.Object
  extended by com.collabnet.tracker.xml.QueryXMLHelper

public class QueryXMLHelper
extends java.lang.Object

Helper class to parse <query> and <adhocQuery> tags; also produces schema for same.

Also used to generate XML representation of a QueryCriteriaBuilder

The format of the XML document is:
  <namedQuery xmlns="urn:ws.tracker.collabnet.com">
      <tagName>tagName</tagName>
      <namespace>namespace</namespace>
  </namedQuery>
 
or
  <adhocQuery xmlns="urn:ws.tracker.collabnet.com">
      <artifactTypes>
          <artifactType>
             <tagName>xml-name</tagName>
             <namespace>xml-uri</namespace>
          <artifactType>
          ... additional artifactType elements ...
      </artifactTypes>
      <attributes>
          <attribute>
             <tagName>xml-name</tagName>
             <namespace>xml-uri</namespace>
             <condition>
              ... condition definition see ConditionXMLHelper
             </condition>
          </attribute>
          ...
      </attributes>
      <idRange>
          <min>min</min>
          <max>max</max>
      </idRange>
      <modifiedOn>
                        [range] OR [relative] condition
      </modifiedOn>
      <createdOn>
          [range] OR [relative] condition
      </createdOn>
      <userConditions>
         <userAttrMap>
            ... see ConditionXMLHelper.buildUserConditions(XPathProcessor, Node)
         </userAttrMap>
         <unassociated>
            ... see ConditionXMLHelper.buildUnassocUserConditions(XPathProcessor, Node)
         </unassociated>
      </userConditions>
  </adhocQuery>
 

Author:
sszego

Constructor Summary
QueryXMLHelper()
           
 
Method Summary
 void acceptSchemaVisitor(SchemaVisitor visitor)
           
 com.collabnet.tracker.query.ProjectQueryCriteriaBuilder getQueryCriteriaBuilder(org.w3c.dom.Document document)
          Parses the request document and extracts the query portion (i.e.
 java.util.List getSchemaReferences()
           
 void visit(XMLVisitor visitor, com.collabnet.tracker.query.ProjectQueryCriteriaBuilder queryCriteria)
          Generates the XML representation of a QueryCriteriaBuilder.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryXMLHelper

public QueryXMLHelper()
Method Detail

getQueryCriteriaBuilder

public com.collabnet.tracker.query.ProjectQueryCriteriaBuilder getQueryCriteriaBuilder(org.w3c.dom.Document document)
                                                                                throws XMLBuilderException
Parses the request document and extracts the query portion (i.e. either the <query> or <adhocQuery> tags. The format of the XML document is:
 
 
  <namedQuery xmlns="urn:ws.tracker.collabnet.com">
      <tagName>tagName</tagName>
      <namespace>namespace</namespace>
  </namedQuery>
  
 
 
or
 
 
  <adhocQuery xmlns="urn:ws.tracker.collabnet.com">
      <artifactTypes>
          <artifactType>
             <tagName>xml-name</tagName>
             <namespace>xml-uri</namespace>
          <artifactType>
          ... additional artifactType elements ...
      </artifactTypes>
      <attributes>
          <attribute>
             <tagName>xml-name</tagName>
             <namespace>xml-uri</namespace>
             <condition>
              ... condition definition see ConditionXMLHelper
             </condition>
          </attribute>
          ...
      </attributes>
      <idRange>
          <min>min</min>
          <max>max</max>
      </idRange>
      <modifiedOn>
                        [range] OR [relative] condition
      </modifiedOn>
      <createdOn>
          [range] OR [relative] condition
      </createdOn>
      <userConditions>
         <userAttrMap>
            ... see ConditionXMLHelper.buildUserConditions(XPathProcessor, Node)
         </userAttrMap>
         <unassociated>
            ... see ConditionXMLHelper.buildUnassocUserConditions(XPathProcessor, Node)
         </unassociated>
      </userConditions>
  </adhocQuery>
  
 
 

Parameters:
document - the incoming document
Returns:
the definition of the query as a QueryCriteriaBuilder
Throws:
XMLBuilderException - if the query XML is not valid

getSchemaReferences

public java.util.List getSchemaReferences()
                                   throws SchemaReferenceException
Returns:
list of SchemaReference objects
Throws:
SchemaReferenceException

acceptSchemaVisitor

public void acceptSchemaVisitor(SchemaVisitor visitor)
                         throws SchemaGenerationException
Parameters:
visitor -
Throws:
SchemaGenerationException

visit

public void visit(XMLVisitor visitor,
                  com.collabnet.tracker.query.ProjectQueryCriteriaBuilder queryCriteria)
           throws XMLVisitorException
Generates the XML representation of a QueryCriteriaBuilder. Note that this method does NOT generate any ExtraFilterID and FilterReference that may be associated with this queryCriteria. Note also that this method does not generate the XML representation of the QueryResultPreference that may be associated with this QueryCriteriaBuilder.

Parameters:
visitor - the object to use for generating the XML
queryCriteria - the Query definition to convert to XML.
Throws:
XMLVisitorException