|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.mdm.index.query.QueryParser
com.sun.mdm.index.query.MultiQueryParser
This Parser parses a QueryObject and produces SQLDescriptors[] containing SQL statements. Each SQL statement correspond to a path from a root to a leaf, specified in selectfields in QueryObject. Example if we have an object graph like: System Person Address Phone Alias Here System is the root object and has one child Person. Person has children: Address, Phone, ALias. So the three SQL statements would consists of select fields: {System.attributes, Person.attributes, Address.attributes}, {System.keyfield, Person.keyfield, Phone.attributes}, {System.keyfield, Person.keyfield, Alias.attributes} Say if QueryObject has conditions: Address.city = ‘Monrovia’ and Phone.phoneType = ‘Business’. Select fields are Person.firstName, Phone.phoneNumber, Address.city, Alias.lastName. Primary keys are: System (euid), Person (personid), Address (addressid), Phone (phoneid), Alias (aliasid). So this would generate the three SQL statements as: SQL1: Select system.euid, person.personid, person.firstname, address.addressid, address.city From system, person, address Where system.euid = person.euid And person.personid = address.personid And address.city = ‘Monrovia’ And personid in ( Select personid from person, phone where person.personid = phone.personid and phone.phoneType = ‘Business’ ) Order by system.euid, person.personid SQL2: Select system.euid, person.personid, phone.phoneid, phone.phonenumber From system, person, phone Where system.euid = person.euid And person.personid = address.personid And phone.phoneType = ‘Business’ And personid in ( Select person.personid from person, address where person.personid = address.personid and address.city = ‘Monrovia’) Order by system.euid, person.personid SQL3: Select system.euid, person.personid, phone.phoneid, alias.lastName From system, person, alias Where system.euid = person.euid And person.personid = alias.personid And personid in ( Select person.personid from person, address where person.personid = address.personid and address.city = ‘Monrovia’) And personid in ( Select person.personid from person, phone where person.personid = phone.personid and phone.phoneType = ‘Business’ ) Order by system.euid, person.personid
| Constructor Summary | |
(package private) |
MultiQueryParser(QueryObject qo)
Creates a new instance of QueryParser |
| 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) void |
createsubQPath(QPath[] selectQpaths,
QPath[] cqpaths,
ConditionMap[] conditionMap)
|
(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 |
SQLDescWithBindParameters[] |
parse()
parses the QueryObject. |
(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 |
MultiQueryParser(QueryObject qo)
qo - QueryObject to parse| Method Detail |
void checkForInvalidObjects(java.util.HashSet objects,
QPath[] qpaths)
throws QMException
QMException
ConditionMap[] createConditionMap(java.util.HashSet objects,
QPath[] qpaths,
Condition[] conditions)
QPath[] createQPath(java.lang.String root,
java.util.HashSet objectsHS)
root - root of the tree that contains objectsobjectsHS - HashSet contains the objects.
void createsubQPath(QPath[] selectQpaths,
QPath[] cqpaths,
ConditionMap[] conditionMap)
java.util.HashSet findObjects(QualifiedField[] selectFields)
java.util.HashSet findObjects(QualifiedField[] selectFields,
Condition[] conditions)
QueryObject getQueryObject()
java.lang.String getRoot()
java.lang.String getRoot(QualifiedField[] selectFields,
Condition[] conditions)
java.lang.String[] getRootId()
throws QMException
QMException
public SQLDescWithBindParameters[] parse()
throws QMException
parse in class QueryParserQMException - if there is any exception
QualifiedField[] qualify(java.lang.String[] selectFields)
throws QMException
QMExceptionvoid setQueryObject(QueryObject qo)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Sun Microsystems, Inc.