Overview | Package | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.mdm.index.query
Class SingleQueryParser

    java.lang.Object
      com.sun.mdm.index.query.QueryParser
          com.sun.mdm.index.query.SingleQueryParser

class SingleQueryParser
extends QueryParser

This Parser parses a QueryObject and produces a single SQL statement. The SQL statement would contain all the objects queried in QueryObject. Say if we have an object graph like: System Person Address Phone Alias This would produce SQL statement: select system.attributes, person.attributes, address.attributes, phone.attribute, alias.attributes from System, person, address, phone, alias where system.euid = person.euid and person.personid = address.personid and person.personid = phone.personid and person.personid = alias.personid The SQL statement created by it would produce lots of redundant data as it would use cartesian product among secondary objects. So this is more useful where the applications want tuples.

Constructor Summary
`(package private)` | `SingleQueryParser(QueryObject qo)` Creates a new instance of SingleQueryParser

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
`static void` | `main(java.lang.String[] args)` Test code
`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

### SingleQueryParser

    SingleQueryParser(QueryObject qo)

  Creates a new instance of SingleQueryParser

  Parameters:
    `qo` - QueryObject

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`

### main

    public static void main(java.lang.String[] args)

  Test code

  Parameters:
    `args` - args

### parse

    public SQLDescWithBindParameters[] parse()
                                      throws QMException

  parses the QueryObject. This is the main interface method for parsing.

  Specified by:
    `parse` in class `QueryParser`
  Returns:
    SQLDescriptor[]. The return array is of size 1, since SingleQueryParser generates a single SQL statement.
  Throws:
    `QMException` - QMException

### qualify

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

  Throws:
    `QMException`

### setQueryObject

    void setQueryObject(QueryObject qo)

Overview | Package | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Sun Microsystems, Inc.