net.sf.csutils.core.query.impl
Class AbstractQueryGenerator

java.lang.Object
  extended by net.sf.csutils.core.query.impl.AbstractQueryGenerator
Direct Known Subclasses:
SqlQueryGenerator, XQueryGenerator

public abstract class AbstractQueryGenerator
extends java.lang.Object

Abstract base class for implementing query generators.


Nested Class Summary
static class AbstractQueryGenerator.NamedParameter
           
static class AbstractQueryGenerator.NumberedParameter
           
protected static class AbstractQueryGenerator.ObjectTypeInfo
           
static class AbstractQueryGenerator.Parameter
           
 
Field Summary
protected  int autoParameterNumber
           
static java.lang.String NS_QUERY
          The "query" namespace.
protected  java.util.List<AbstractQueryGenerator.Parameter> parameters
           
static QName QNAME_ALLTYPES
          The "allTypes" QName.
protected  java.lang.StringBuilder sb
           
 
Constructor Summary
AbstractQueryGenerator()
           
 
Method Summary
protected  AbstractQueryGenerator.ObjectTypeInfo createJoin(ObjectType pQueryType)
           
protected  ROType findMatchingObjectType(Statement pStatement, ObjectType pQueryType)
           
protected  java.util.List<AbstractQueryGenerator.ObjectTypeInfo> findObjectTypes(SelectStatement pQuery)
           
protected  AbstractQueryGenerator.ObjectTypeInfo getAlias(java.lang.String pPath, java.lang.String pAlias)
           
protected  ROMetaModel getModel()
           
protected  AbstractQueryGenerator.ObjectTypeInfo getObjectType(java.lang.String pAlias)
           
protected  java.util.List<AbstractQueryGenerator.Parameter> getParameters()
           
protected  AbstractQueryGenerator.ObjectTypeInfo newObjectTypeInfo(java.lang.String pAlias, ROType pType, AbstractQueryGenerator.ObjectTypeInfo pSourceType, RORelation pAttribute)
          Creates a new instance of AbstractQueryGenerator.ObjectTypeInfo.
protected  void parse(AdditiveExpression pExpr)
           
protected  void parse(And pAnd)
           
protected abstract  void parse(java.lang.Boolean pBoolean)
           
protected abstract  void parse(java.util.Calendar pCalendar)
           
protected  void parse(Concatenation pConcatenation)
           
protected  void parse(Eq pEq)
           
protected abstract  void parse(FunctionCall pFunctionCall)
           
protected  void parse(Ge pGe)
           
protected  void parse(Gt pGt)
           
protected abstract  void parse(Identifier pIdentifier)
           
protected abstract  void parse(In pIn)
           
protected  void parse(IsEmpty pEmpty)
          Checks, whether a string is empty.
protected abstract  void parse(IsNull pIsNull)
           
protected  void parse(Le pLe)
           
protected abstract  void parse(Like pLike)
           
protected  void parse(Lt pLt)
           
protected abstract  void parse(MethodCall pMethodCall)
           
protected  void parse(MultiplicativeExpression pExpr)
           
protected  void parse(Ne pNe)
           
protected abstract  void parse(Negation pNegation)
           
protected  void parse(java.lang.Number pValue)
          Adds the given number.
protected  void parse(Or pOr)
           
protected  void parse(Parameter pParameter)
          Adds the given parameter to the query.
protected  void parse(RelationalExpression pExpr, java.lang.String pOp)
           
 CsqlStatement parse(ROMetaModel pModel, Statement pQuery)
           
protected abstract  CsqlStatement parse(SelectStatement pQuery)
           
protected abstract  void parse(java.lang.String pString)
           
protected  void parse(UnaryMinus pObject)
           
protected  void parseExpression(java.lang.Object pObject)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NS_QUERY

public static final java.lang.String NS_QUERY
The "query" namespace.

See Also:
Constant Field Values

QNAME_ALLTYPES

public static final QName QNAME_ALLTYPES
The "allTypes" QName.


sb

protected java.lang.StringBuilder sb

autoParameterNumber

protected int autoParameterNumber

parameters

protected final java.util.List<AbstractQueryGenerator.Parameter> parameters
Constructor Detail

AbstractQueryGenerator

public AbstractQueryGenerator()
Method Detail

getModel

protected ROMetaModel getModel()

getParameters

protected java.util.List<AbstractQueryGenerator.Parameter> getParameters()

parse

protected void parse(And pAnd)
              throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected void parse(Or pOr)
              throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected void parse(RelationalExpression pExpr,
                     java.lang.String pOp)
              throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected abstract void parse(In pIn)
                       throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected void parse(Eq pEq)
              throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected void parse(Ne pNe)
              throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected void parse(Ge pGe)
              throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected void parse(Gt pGt)
              throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected void parse(Le pLe)
              throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected void parse(Lt pLt)
              throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected abstract void parse(Identifier pIdentifier)
                       throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected abstract void parse(MethodCall pMethodCall)
                       throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected abstract void parse(FunctionCall pFunctionCall)
                       throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected abstract void parse(Like pLike)
                       throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected abstract void parse(IsNull pIsNull)
                       throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected abstract void parse(Negation pNegation)
                       throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected abstract void parse(java.lang.String pString)
                       throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected abstract void parse(java.util.Calendar pCalendar)
                       throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected abstract void parse(java.lang.Boolean pBoolean)
                       throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected void parse(Concatenation pConcatenation)
              throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected void parse(AdditiveExpression pExpr)
              throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected void parse(MultiplicativeExpression pExpr)
              throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected void parse(UnaryMinus pObject)
              throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected void parse(IsEmpty pEmpty)
              throws javax.xml.registry.JAXRException
Checks, whether a string is empty.

Parameters:
pEmpty - The empty value
Throws:
javax.xml.registry.JAXRException - Could not add the check for emptiness.

parse

protected void parse(java.lang.Number pValue)
              throws javax.xml.registry.JAXRException
Adds the given number.

Parameters:
pValue - The number to add to the query.
Throws:
javax.xml.registry.JAXRException - The number could not be added.

parseExpression

protected void parseExpression(java.lang.Object pObject)
                        throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected void parse(Parameter pParameter)
              throws javax.xml.registry.JAXRException
Adds the given parameter to the query.

Parameters:
pParameter - The parameter to add to the query.
Throws:
javax.xml.registry.JAXRException - Failed to add the parameter.

getAlias

protected AbstractQueryGenerator.ObjectTypeInfo getAlias(java.lang.String pPath,
                                                         java.lang.String pAlias)
                                                  throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

createJoin

protected AbstractQueryGenerator.ObjectTypeInfo createJoin(ObjectType pQueryType)
                                                    throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

newObjectTypeInfo

protected AbstractQueryGenerator.ObjectTypeInfo newObjectTypeInfo(java.lang.String pAlias,
                                                                  ROType pType,
                                                                  AbstractQueryGenerator.ObjectTypeInfo pSourceType,
                                                                  RORelation pAttribute)
                                                           throws javax.xml.registry.JAXRException
Creates a new instance of AbstractQueryGenerator.ObjectTypeInfo. This is invoked for the main registry object type in the query as well as for any JOIN clause.

Parameters:
pAlias - The alias to use for the registry object type.
pType - The registry object type.
pSourceType - Contains the left hand side of the join clause (the source type of a relationship attribute), if the method is invoked to implement such a clause, otherwise null.
pAttribute - Contains the relationship attribute of the join clause, if the method is invoked to implement such a clause, otherwise null.
Returns:
The created object.
Throws:
javax.xml.registry.JAXRException - Creating the ObjectTypeInfo failed.

findMatchingObjectType

protected ROType findMatchingObjectType(Statement pStatement,
                                        ObjectType pQueryType)
                                 throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

getObjectType

protected AbstractQueryGenerator.ObjectTypeInfo getObjectType(java.lang.String pAlias)

findObjectTypes

protected java.util.List<AbstractQueryGenerator.ObjectTypeInfo> findObjectTypes(SelectStatement pQuery)
                                                                         throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

protected abstract CsqlStatement parse(SelectStatement pQuery)
                                throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException

parse

public CsqlStatement parse(ROMetaModel pModel,
                           Statement pQuery)
                    throws javax.xml.registry.JAXRException
Throws:
javax.xml.registry.JAXRException


Copyright © 2009-2010. All Rights Reserved.