com.sun.mdm.index.query
Class QueryParser

java.lang.Object
  extended bycom.sun.mdm.index.query.QueryParser
Direct Known Subclasses:
MultiQueryParser, SingleQueryParser

abstract class QueryParser
extends java.lang.Object

This abstract QueryParser provides helper methods that can be used to parse a QueryObject. The concrete Parsers should subclass this class. The actual parsing method parse() should be implemented by the concrete class.


Constructor Summary
(package private) QueryParser(QueryObject qo)
          create a new QueryParser for this QueryObject.
 
Method Summary
(package private)  void checkForInvalidObjects(java.util.HashSet objects, QPath[] qpaths)
           
(package private)  ConditionMap[] createConditionMap(java.util.HashSet objects, QPath[] qpaths, Condition[] conditions)
           
(package private)  QPath[] createQPath(java.lang.String root, java.util.HashSet objectsHS)
          This is the actual method that creates the QPath[] each of which is a path from root to a different leaf.
(package private)  java.util.HashSet findObjects(QualifiedField[] selectFields)
           
(package private)  java.util.HashSet findObjects(QualifiedField[] selectFields, Condition[] conditions)
           
(package private)  QueryObject getQueryObject()
           
(package private)  java.lang.String getRoot()
           
(package private)  java.lang.String getRoot(QualifiedField[] selectFields, Condition[] conditions)
           
(package private)  java.lang.String[] getRootId()
          Returns full qualified path for root object primary key
(package private) abstract  SQLDescWithBindParameters[] parse()
          parse a QueryObject and return Array of SQLDescriptor.
(package private)  QualifiedField[] qualify(java.lang.String[] selectFields)
           
(package private)  void setQueryObject(QueryObject qo)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryParser

QueryParser(QueryObject qo)
create a new QueryParser for this QueryObject.

Parameters:
qo - QueryObject that needs to be parsed.
Method Detail

checkForInvalidObjects

void checkForInvalidObjects(java.util.HashSet objects,
                            QPath[] qpaths)
                      throws QMException
Throws:
QMException

createConditionMap

ConditionMap[] createConditionMap(java.util.HashSet objects,
                                  QPath[] qpaths,
                                  Condition[] conditions)

createQPath

QPath[] createQPath(java.lang.String root,
                    java.util.HashSet objectsHS)
This is the actual method that creates the QPath[] each of which is a path from root to a different leaf. So if objectsHS contain objects which belong to object graph: System Person Address Phone Alias, then QPaths would be { System, Person, Address }, { System, Person, Phone }, { System, Person, Alias } This method uses a variation of Breadth First Search algorithm to create SQL paths.

Parameters:
root - root of the tree that contains objects
objectsHS - HashSet contains the objects.

findObjects

java.util.HashSet findObjects(QualifiedField[] selectFields)

findObjects

java.util.HashSet findObjects(QualifiedField[] selectFields,
                              Condition[] conditions)

getQueryObject

QueryObject getQueryObject()

getRoot

java.lang.String getRoot()

getRoot

java.lang.String getRoot(QualifiedField[] selectFields,
                         Condition[] conditions)

getRootId

java.lang.String[] getRootId()
                       throws QMException
Returns full qualified path for root object primary key

Returns:
Throws:
QMException

parse

abstract SQLDescWithBindParameters[] parse()
                                    throws QMException
parse a QueryObject and return Array of SQLDescriptor. Client needs to call parse() after creating the QueryParser object.

Returns:
SQLDescriptor[] each SQLDescriptor contains a seperator SQL query.
Throws:
QMException - QMException

qualify

QualifiedField[] qualify(java.lang.String[] selectFields)
                   throws QMException
Throws:
QMException

setQueryObject

void setQueryObject(QueryObject qo)


Sun Microsystems, Inc.