com.bea.p13n.content.model
Class ContentQueryModel

java.lang.Object
  extended by com.bea.p13n.model.Model
      extended by com.bea.p13n.model.XmlObjectModel
          extended by com.bea.p13n.content.model.ContentQueryModel
All Implemented Interfaces
Serializable, Cloneable

public class ContentQueryModel
extends XmlObjectModel

A ClauseModel representing a <contentQuery> from the http://www.bea.com/servers/p13n/xsd/content/query/1.1.1 namespace.

See Also
Serialized Form

Nested Class Summary
static class ContentQueryModel.Logic
          The logic types for the property containers this holds.
 
Nested classes/interfaces inherited from class com.bea.p13n.model.Model
Model.ChangeEvent, Model.ChangeListener, Model.ChangeSupport, Model.Debug
 
Field Summary
 
Fields inherited from class com.bea.p13n.model.XmlObjectModel
copyRootXmlObject, instanceUri, isComplete
 
Fields inherited from class com.bea.p13n.model.Model
childrenModels, docModel, parentModel, roChildrenModels
 
Constructor Summary
ContentQueryModel()
           
 
Method Summary
protected  void addComparisons(Operator op, List<Comparison> comparisons, com.bea.p13n.content.schema.ContentPropertyComparison cpc)
          Add an Operator which the specified children comparisons to the given ContentPropertyComparison.
protected  void addComparisons(PropertyContainer pc, com.bea.p13n.content.schema.Operator xmlOp)
          Add Comparisons corresponding to the literals and property refs under the Operator instance.
 void clearCachedData()
          Clear out any cached data we're holding, so we'll get it from the ContentQuery next time.
static String convertToExpression(boolean outerAnd, PropertyContainer[] pcs)
          Convert the specified set of PropertyContainers to the content query expression language.
 Model copy()
          Make a copy of this ContentQueryModel.
 org.apache.xmlbeans.XmlObject createNewXmlObject()
          Return a new, empty ContentQuery object.
protected  com.bea.p13n.content.schema.Operator createSchemaOperatorOn(Operator op, com.bea.p13n.content.schema.ContentPropertyComparison cpc)
          Create an xbeans content Operator for the specified Operator on the ContentPropertyComparison.
protected  boolean determineIsComplete()
          This is complete is it has set PropertyContainers or a content expression.
 String getContentExpression()
          Get the content query expression text.
 com.bea.p13n.content.schema.ContentQuery getContentQuery()
          Get the ContentQuery node this has.
protected  Operator getOperator(com.bea.p13n.content.schema.Operator xmlOp)
          Get the corresponding model operator for the specified schema operator.
static int getOrdinalValue(char ch)
          Get the ordinal (Unicode) value of a character.
 ContentQueryModel.Logic getPropertyContainerLogic()
          Get the logic on the content query.
protected  ContentQueryModel.Logic getPropertyContainerLogicNoCache()
          Get the logic on the content query from the ContentQuery.
 PropertyContainer[] getPropertyContainers()
          Get the list of PropertyContainer children.
protected  PropertyContainer[] getPropertyContainersNoCache()
          Get the property containers directly from the ContentQuery.
 boolean hasContentExpression()
          Tell if this model has a content query expression or has PropertyContaienrs.
 void initializeNew()
          Initialize this as a new, empty content query.
static List parseTokenAreas(String queryStr)
          Parser the specified query expression into a set of TokenAreas.
 void setContentExpression(String expr)
          Set this ContentQuery to use the specifiec content query expression.
 void setPropertyContainerLogic(ContentQueryModel.Logic l)
          Set the logic on the content query.
 void setPropertyContainers(PropertyContainer... propertyContainers)
          Set the property containers.
 void setXmlObject(org.apache.xmlbeans.XmlObject clause)
          Verify that the specified clause object is valid for this class.
protected  com.bea.p13n.content.schema.ContentPropertyComparison toContentPropertyComparison(PropertyContainer pc)
          Create a ContentPropertyComparison from a PropertyContainer.
protected  Object toLiteralValue(String val, PropertyRefModel.DataType dataType)
          Convert a literal value from the xml into the appropriate object according to the specified DataType.
protected  PropertyContainer toPropertyContainer(com.bea.p13n.content.schema.ContentPropertyComparison cpc)
          Create a PropertyContainer from a ContentProperytComparison.
static String toStringLiteral(String in)
          Get an ASCII String literal from a Java string.
static void validate(String queryStr)
          Check if the specified query expression is valid.
 
Methods inherited from class com.bea.p13n.model.XmlObjectModel
checkElement, childAdded, childRemoved, fixQName, getApplicationInstanceUri, getChild, getCopyXmlObject, getDocument, getLocalName, getParent, getQName, getRootXmlObject, isComplete, isNil, preRemove, propertyChanged, removeAllChildren, removeChild, setApplicationInstanceUri, setIsComplete, setIsComplete, setParent, setRootXmlObject
 
Methods inherited from class com.bea.p13n.model.Model
addChangeListener, addChild, addChild, clone, doubleEquals, equals, getChildren, getDebug, getDebug, getDocument, getParent, longEquals, removeChangeListener, removeChild, removeChild, removeEmpties, setDocument
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentQueryModel

public ContentQueryModel()
Method Detail

setXmlObject

public void setXmlObject(org.apache.xmlbeans.XmlObject clause)
                  throws IllegalArgumentException
Verify that the specified clause object is valid for this class.

Throws
IllegalArgumentException - if clause is not a ContentQuery instance.

createNewXmlObject

public org.apache.xmlbeans.XmlObject createNewXmlObject()
Return a new, empty ContentQuery object.


initializeNew

public void initializeNew()
Initialize this as a new, empty content query.


copy

public Model copy()
Make a copy of this ContentQueryModel.

Specified by:
copy in class Model

clearCachedData

public void clearCachedData()
Clear out any cached data we're holding, so we'll get it from the ContentQuery next time.

Specified by:
clearCachedData in class XmlObjectModel

hasContentExpression

public boolean hasContentExpression()
Tell if this model has a content query expression or has PropertyContaienrs.


getContentExpression

public String getContentExpression()
Get the content query expression text.


setContentExpression

public void setContentExpression(String expr)
Set this ContentQuery to use the specifiec content query expression. This will clear out any set PropertyContainers.


getPropertyContainerLogic

public ContentQueryModel.Logic getPropertyContainerLogic()
Get the logic on the content query.

See Also
getPropertyContainerLogicNoCache()

getPropertyContainerLogicNoCache

protected ContentQueryModel.Logic getPropertyContainerLogicNoCache()
Get the logic on the content query from the ContentQuery.


setPropertyContainerLogic

public void setPropertyContainerLogic(ContentQueryModel.Logic l)
Set the logic on the content query.


getPropertyContainers

public PropertyContainer[] getPropertyContainers()
Get the list of PropertyContainer children.


getPropertyContainersNoCache

protected PropertyContainer[] getPropertyContainersNoCache()
Get the property containers directly from the ContentQuery.


setPropertyContainers

public void setPropertyContainers(PropertyContainer... propertyContainers)
Set the property containers.


getContentQuery

public com.bea.p13n.content.schema.ContentQuery getContentQuery()
Get the ContentQuery node this has.


toContentPropertyComparison

protected com.bea.p13n.content.schema.ContentPropertyComparison toContentPropertyComparison(PropertyContainer pc)
Create a ContentPropertyComparison from a PropertyContainer.


addComparisons

protected void addComparisons(Operator op,
                              List<Comparison> comparisons,
                              com.bea.p13n.content.schema.ContentPropertyComparison cpc)
Add an Operator which the specified children comparisons to the given ContentPropertyComparison.


createSchemaOperatorOn

protected com.bea.p13n.content.schema.Operator createSchemaOperatorOn(Operator op,
                                                                      com.bea.p13n.content.schema.ContentPropertyComparison cpc)
Create an xbeans content Operator for the specified Operator on the ContentPropertyComparison.


toPropertyContainer

protected PropertyContainer toPropertyContainer(com.bea.p13n.content.schema.ContentPropertyComparison cpc)
Create a PropertyContainer from a ContentProperytComparison.


addComparisons

protected void addComparisons(PropertyContainer pc,
                              com.bea.p13n.content.schema.Operator xmlOp)
Add Comparisons corresponding to the literals and property refs under the Operator instance.


getOperator

protected Operator getOperator(com.bea.p13n.content.schema.Operator xmlOp)
Get the corresponding model operator for the specified schema operator.


toLiteralValue

protected Object toLiteralValue(String val,
                                PropertyRefModel.DataType dataType)
Convert a literal value from the xml into the appropriate object according to the specified DataType.


determineIsComplete

protected boolean determineIsComplete()
This is complete is it has set PropertyContainers or a content expression.

Overrides:
determineIsComplete in class XmlObjectModel

validate

public static void validate(String queryStr)
                     throws com.bea.p13n.content.model.parser.ExprParser.ParseException,
                            IllegalArgumentException
Check if the specified query expression is valid. If the query is not valid this will throw an exception.

Throws
com.bea.p13n.content.model.parser.ExprParser.ParseException
IllegalArgumentException
See Also
ExprParser.ParseException

parseTokenAreas

public static List parseTokenAreas(String queryStr)
Parser the specified query expression into a set of TokenAreas.

See Also
ExprParser.TokenArea

convertToExpression

public static String convertToExpression(boolean outerAnd,
                                         PropertyContainer[] pcs)
Convert the specified set of PropertyContainers to the content query expression language.

Parameters
outerAnd - true for an outer boolean AND, false for OR.
pcs - the property containers

toStringLiteral

public static String toStringLiteral(String in)
Get an ASCII String literal from a Java string.

This will quote some special characters with back-slashes.

The output of this can be sent through #fromStringLiteral to result in the original String.


getOrdinalValue

public static int getOrdinalValue(char ch)
Get the ordinal (Unicode) value of a character.



Copyright © 2011, Oracle. All rights reserved.