Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

nectar.data
Class Query  view Query download Query.java

java.lang.Object
  extended bynectar.data.Query

public class Query
extends java.lang.Object

Query objects are used to define the criteria for a query to the DataSource. It is essentially an object oriented analogy to SQL's SELECT statement. With this analogy, the variables that a Query is defined by could be described as: SELECT (list of fieldnames) FROM (list of tables) WHERE (dataConditions tree) (list of postElements).


Field Summary
private  DataConditions dcs
           
private  java.util.Vector extraFields
           
private  java.util.Vector fields
           
private  MatchConditions mcs
           
private  PostElements pes
           
private  java.util.Vector tables
           
 
Constructor Summary
Query()
          Creates a new empty instance of Query
Query(java.util.Collection f, java.util.Collection t)
          Creates a new Query instance, with a shorthand to set the fields and tables from a Collection of field Strings and a Collection of table Strings.
Query(java.util.Collection f, java.util.Collection t, DataConditions d, PostElements p)
          Creates a new instance of Query with field names, table names, DataConditions and PostElements set.
Query(nectar.record.RecordDescriptor rd)
          Create a new instance of a Query object based on the criteria determined in the RecordDescriptor object.
 
Method Summary
 void addDataCondition(byte operator, DataCondition dc)
          Append a DataCondition to the top level DataConditions object in this Query.
 void addDataCondition(byte operator, DataConditions dc)
          Append a DataConditions to the top level DataConditions object in this Query.
 void addField(java.lang.String field)
          append a field name to this Query.
 void addPostElement(PostElement pe)
          Append a PostElement to this Query's PostElements object.
 void addTable(java.lang.String table)
          add's a table name to the internal list in this Query.
 void clearDataConditions()
          remove all data conditions from this Query.
 void clearFields()
          Clears the internal list of field names.
 void clearTables()
          Clears the internal list of table names.
 java.lang.Object clone()
          create a deep copy of this Query.
 DataConditions getDataConditions()
          returns the DataConditions for this Query.
 java.util.Collection getExtraFields()
          Returns a collection of extra field names.
 java.util.Collection getFields()
          get the Collection of field names defined in this query.
 MatchConditions getMatchConditions()
          Returns the MatchConditions defined in this Query.
 PostElements getPostElements()
          Returns the PostElements object for this Query.
 java.util.Collection getTables()
          Return the collection of table name strings used in this Query.
 void redefine(nectar.record.RecordDescriptor rd)
          reset, then set all values according to the criteria defined in the given RecordDescriptor.
 void reset()
          reset this Query object so that it looks like a new object created with the empty constructor.
 void setDataConditions(DataConditions dcs)
          Sets the DataConditions for this Query.
 void setFields(java.util.Collection fields)
          Set the Collection of field names for this Query.
 void setMatchConditions(MatchConditions mcs)
          Set the MatchConditions object for this Query.
 void setPostElements(PostElements pes)
          Sets the PostElements object for this Query.
 void setTables(java.util.Collection tables)
          Set the list of tables this Query uses.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fields

private java.util.Vector fields

extraFields

private java.util.Vector extraFields

tables

private java.util.Vector tables

dcs

private DataConditions dcs

mcs

private MatchConditions mcs

pes

private PostElements pes
Constructor Detail

Query

public Query()
Creates a new empty instance of Query


Query

public Query(nectar.record.RecordDescriptor rd)
Create a new instance of a Query object based on the criteria determined in the RecordDescriptor object.


Query

public Query(java.util.Collection f,
             java.util.Collection t)
Creates a new Query instance, with a shorthand to set the fields and tables from a Collection of field Strings and a Collection of table Strings.


Query

public Query(java.util.Collection f,
             java.util.Collection t,
             DataConditions d,
             PostElements p)
Creates a new instance of Query with field names, table names, DataConditions and PostElements set.

Method Detail

reset

public void reset()
reset this Query object so that it looks like a new object created with the empty constructor.


redefine

public void redefine(nectar.record.RecordDescriptor rd)
reset, then set all values according to the criteria defined in the given RecordDescriptor.


clone

public java.lang.Object clone()
create a deep copy of this Query. As Query objects in their entirety may be rather complex, this method may put a pretty heavy load on the system if used frequently.


getFields

public java.util.Collection getFields()
get the Collection of field names defined in this query.


setFields

public void setFields(java.util.Collection fields)
Set the Collection of field names for this Query. Calling setFields(null) is equivalent to clearFields().


clearFields

public void clearFields()
Clears the internal list of field names.


addField

public void addField(java.lang.String field)
append a field name to this Query.


getExtraFields

public java.util.Collection getExtraFields()
Returns a collection of extra field names. Extra field names are ones with have not been specified through setFields() or addField() but are necessary for this Query to work correctly. For example, adding a MatchCondition to a query will add an extra field to contain the score of a match.


getTables

public java.util.Collection getTables()
Return the collection of table name strings used in this Query.


setTables

public void setTables(java.util.Collection tables)
Set the list of tables this Query uses. Calling getTables(null) is equivalent to clearTables().


clearTables

public void clearTables()
Clears the internal list of table names.


addTable

public void addTable(java.lang.String table)
add's a table name to the internal list in this Query.


getDataConditions

public DataConditions getDataConditions()
returns the DataConditions for this Query.


setDataConditions

public void setDataConditions(DataConditions dcs)
Sets the DataConditions for this Query.


clearDataConditions

public void clearDataConditions()
remove all data conditions from this Query.


addDataCondition

public void addDataCondition(byte operator,
                             DataCondition dc)
Append a DataCondition to the top level DataConditions object in this Query.


addDataCondition

public void addDataCondition(byte operator,
                             DataConditions dc)
Append a DataConditions to the top level DataConditions object in this Query.


setMatchConditions

public void setMatchConditions(MatchConditions mcs)
Set the MatchConditions object for this Query.


getMatchConditions

public MatchConditions getMatchConditions()
Returns the MatchConditions defined in this Query.


getPostElements

public PostElements getPostElements()
Returns the PostElements object for this Query.


setPostElements

public void setPostElements(PostElements pes)
Sets the PostElements object for this Query.


addPostElement

public void addPostElement(PostElement pe)
Append a PostElement to this Query's PostElements object.