arlut.csd.ganymede
Class Query

java.lang.Object
  |
  +--arlut.csd.ganymede.Query
All Implemented Interfaces:
java.io.Serializable

public class Query
extends java.lang.Object
implements java.io.Serializable

The Query class is used to submit query requests to the GANYMEDE server, both for complex database searches and for simple object listings. A Query class can fully specify a boolean search expression on any field of any object type in the GANYMEDE database. Each Query, however, can only search one object type at a time.

While providing support for arbitrarily complex queries, the Query class also includes constructors for the simple "list object" case.

See Also:
Serialized Form

Field Summary
(package private)  boolean editableOnly
          If true, this query will only be matched against objects in the database that the user has permission to edit.
(package private)  boolean filtered
          If true, this query will only be matched against the subset of objects in the database that the user has requested via the Session filter mechanism.
(package private)  java.util.Vector linkedQueries
          A Vector of Query's that can be associated with this query.

This vector is used to allow the inclusion of queries on embedded objects..
(package private)  java.lang.String objectName
          The name of the object type that the queryNodes are looking to match on.
(package private)  short objectType
          The id of the object type that the queryNodes are looking to match on.
(package private)  java.util.Hashtable permitList
          A list of field id's in Short form that the server will take into account when returning a data dump.
(package private)  java.lang.String returnName
          The name of the object type that the query should return..
(package private)  short returnType
          The id of the object type that the query should return..
(package private)  arlut.csd.ganymede.QueryNode root
          The root of a graph of QueryNodes that encodes the desired search criteria.
(package private)  java.lang.String saveName
          We want to be able to save a query on the server and re-issue it on behalf of the user.
(package private) static long serialVersionUID
           
 
Constructor Summary
Query(short objectType)
          Constructor for a query to list all editable objects of the specified type.
Query(short objectType, arlut.csd.ganymede.QueryNode root)
          Constructor to create a query returning only editable objects (base by id)
Query(short objectType, arlut.csd.ganymede.QueryNode root, boolean editableOnly)
          Constructor for fully specified query (base by id)
Query(java.lang.String objectName)
          Constructor for a query to list all editable objects of the specified type.
Query(java.lang.String objectName, arlut.csd.ganymede.QueryNode root)
          Constructor to create a query returning only editable objects (base by name)
Query(java.lang.String objectName, arlut.csd.ganymede.QueryNode root, boolean editableOnly)
          Constructor for fully specified query (base by name)
 
Method Summary
 void addField(short id)
          This method adds a field identifier to the list of fields that may be returned.
 void addQuery(arlut.csd.ganymede.Query query)
          This method allows the client to add a list of subordinate queries to this query.
 void resetPermitList()
          This method resets the permitList, allowing all fields to be returned by default.
 void setFiltered(boolean filtered)
          This method determines whether the query engine will filter the query according to the current list of visible owner groups.
 void setReturnType(short returnType)
          This method sets the desired return type, for use in performing queries on embedded types when a parent type is what is desired.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

objectName

java.lang.String objectName
The name of the object type that the queryNodes are looking to match on.


returnName

java.lang.String returnName
The name of the object type that the query should return.. used in the case where the search is performed on embedded objects.


saveName

java.lang.String saveName
We want to be able to save a query on the server and re-issue it on behalf of the user. If we are saved, the name to save under will be here. We may or may not want it here.


objectType

short objectType
The id of the object type that the queryNodes are looking to match on.


returnType

short returnType
The id of the object type that the query should return.. used in the case where the search is performed on embedded objects.


root

arlut.csd.ganymede.QueryNode root
The root of a graph of QueryNodes that encodes the desired search criteria.


editableOnly

boolean editableOnly
If true, this query will only be matched against objects in the database that the user has permission to edit.


filtered

boolean filtered
If true, this query will only be matched against the subset of objects in the database that the user has requested via the Session filter mechanism.


permitList

java.util.Hashtable permitList
A list of field id's in Short form that the server will take into account when returning a data dump. If null, the default fields will be returned.


linkedQueries

java.util.Vector linkedQueries
A Vector of Query's that can be associated with this query.

This vector is used to allow the inclusion of queries on embedded objects.. If linkedQueries != null, the server will issue a second (third, fourth) query, returning the intersection of the results.

It does no good to have linkedQueries that do not map back to the same result object type.

Constructor Detail

Query

public Query(short objectType,
             arlut.csd.ganymede.QueryNode root,
             boolean editableOnly)
Constructor for fully specified query (base by id)

Parameters:
objectType - numeric object type code to search over
root - root node of a boolean logic tree to be processed in an in-order traversal
editableOnly - if true, the server will only return objects that the user's session currently has permission to edit

Query

public Query(java.lang.String objectName,
             arlut.csd.ganymede.QueryNode root,
             boolean editableOnly)
Constructor for fully specified query (base by name)

Parameters:
objectName - name of object type to query
root - root node of a boolean logic tree to be processed in an in-order traversal
editableOnly - if true, the server will only return objects that the user's session currently has permission to edit

Query

public Query(short objectType,
             arlut.csd.ganymede.QueryNode root)
Constructor to create a query returning only editable objects (base by id)

Parameters:
objectType - numeric object type code to search over
root - root node of a boolean logic tree to be processed in an in-order traversal

Query

public Query(java.lang.String objectName,
             arlut.csd.ganymede.QueryNode root)
Constructor to create a query returning only editable objects (base by name)

Parameters:
objectName - name of object type to query
root - root node of a boolean logic tree to be processed in an in-order traversal

Query

public Query(short objectType)
Constructor for a query to list all editable objects of the specified type.

Parameters:
objectType - numeric object type code to search over

Query

public Query(java.lang.String objectName)
Constructor for a query to list all editable objects of the specified type.

Parameters:
objectName - name of object type to query
Method Detail

setFiltered

public void setFiltered(boolean filtered)

This method determines whether the query engine will filter the query according to the current list of visible owner groups. Queries by default are filtered.

Parameters:
filtered - If true, the query will be masked by ownership
See Also:
Session.filterQueries(java.util.Vector)

resetPermitList

public void resetPermitList()

This method resets the permitList, allowing all fields to be returned by default.


setReturnType

public void setReturnType(short returnType)

This method sets the desired return type, for use in performing queries on embedded types when a parent type is what is desired.


addField

public void addField(short id)

This method adds a field identifier to the list of fields that may be returned. Once this method is called with a field identifier, the query will only return fields that have been explicitly added.

resetPermitList() may be called to reset the list to the initial allow-all state.


addQuery

public void addQuery(arlut.csd.ganymede.Query query)

This method allows the client to add a list of subordinate queries to this query. The queries attached to this query *will not* have their subordinate queries processed.

Queries added with this method are used to allow queries to include checks on embedded objects.

It does no good to pass queries to addQuery that do not have the same return type as this query.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object