org.caleigo.core
Class DataQuery

java.lang.Object
  extended byorg.caleigo.core.DataQuery
All Implemented Interfaces:
java.io.Serializable

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

This is a simple container class that wraps data that speciffies parametres for performing data querys. Note that all DataServices may not implement all the query parameters which could result in an exception being thrown.

Version:
1.00
Author:
Dennis Zikovic
See Also:
Serialized Form

Nested Class Summary
 class DataQuery.ExternalQualifier
           
 
Constructor Summary
DataQuery()
          Default constructor.
DataQuery(IEntityDescriptor entityDescriptor)
          Creates a DataQuery instance.
DataQuery(IEntityDescriptor entityDescriptor, Qualifier qualifier)
          Creates a DataQuery instance.
 
Method Summary
 void addCollationField(IFieldDescriptor fieldDescriptor)
          Help method that allows the entity order to be defined using multiple IFieldDescriptors by calling this method repeatedly.
 void addCollationField(IFieldDescriptor fieldDescriptor, boolean ascending)
          Help method that allows the entity order to be defined using multiple IFieldDescriptors by calling this method repeatedly.
 void addExternalQualifier(Qualifier qualifier, IEntityRelationPath relationPath)
          Add an external qualifier to the data query, used to construct relation queries.
 void clearCollationFields()
          Help method the resets the query's order data causing the entities to be returned in their default order.
 ISelection execute()
          This conviniance method will run the query using the default datasource defined for the DataSourceDescriptor that the requested EntityDescriptor belongs to.
 EntityCollator getEntityCollator()
          Returns the EntityCollator object that the DataQuery uses to order the qualified entities.
 IEntityDescriptor getEntityDescriptor()
          Returns the IEntityDescriptorobject that the DataQuery targets.
 DataQuery.ExternalQualifier[] getExternalQualifierArray()
           
 Qualifier getQualifier()
          Returns the Qualifier object that the DataQuery uses to qualify individual entities of the targeted entity descriptor type.
 void setCollationField(IFieldDescriptor fieldDescriptor)
          Help method that allows the entity order to be set using a single IFieldDescriptor.
 void setCollationField(IFieldDescriptor fieldDescriptor, boolean ascending)
          Help method that allows the entity order to be set using a single IFieldDescriptor.
 void setEntityCollator(EntityCollator collator)
          Sets the EntityCollator object that the DataQuery uses to order the qualified entities.
 void setEntityDescriptor(IEntityDescriptor descriptor)
          Sets the IEntityDescriptorobject that the DataQuery targets.
 void setQualifier(Qualifier qualifier)
          Sets the Qualifier object that the DataQuery uses to qualify individual entities of the tageted entity descriptor type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataQuery

public DataQuery()
Default constructor.


DataQuery

public DataQuery(IEntityDescriptor entityDescriptor)
Creates a DataQuery instance. The created query will if executed with no further modification return all entities of the specified kind.


DataQuery

public DataQuery(IEntityDescriptor entityDescriptor,
                 Qualifier qualifier)
Creates a DataQuery instance. The qualifier must be able to select entities of the type defined by the provided entity descriptor without the nead of any complementary data, null is also valid.

Throws:
InvalidQualifierException
See Also:
Qualifier.canDirectlyQualify(IEntityDescriptor entityDescriptor)
Method Detail

addExternalQualifier

public void addExternalQualifier(Qualifier qualifier,
                                 IEntityRelationPath relationPath)
Add an external qualifier to the data query, used to construct relation queries. The qualifier must be able to select entities of the type defined by the first entity descriptor in the entity relation path without the nead of any complementary data.

Parameters:
qualifier - that qualifies the first entity descriptor in the relationPath.
relationPath - the path to the entity descriptor that the qualifier qualifies.
See Also:
Qualifier.canDirectlyQualify(IEntityDescriptor entityDescriptor)

execute

public ISelection execute()
This conviniance method will run the query using the default datasource defined for the DataSourceDescriptor that the requested EntityDescriptor belongs to.


getEntityDescriptor

public IEntityDescriptor getEntityDescriptor()
Returns the IEntityDescriptorobject that the DataQuery targets.


setEntityDescriptor

public void setEntityDescriptor(IEntityDescriptor descriptor)
Sets the IEntityDescriptorobject that the DataQuery targets.


getQualifier

public Qualifier getQualifier()
Returns the Qualifier object that the DataQuery uses to qualify individual entities of the targeted entity descriptor type.


getExternalQualifierArray

public DataQuery.ExternalQualifier[] getExternalQualifierArray()
Returns:
an array with all external qualifiers in this data query, if no external qualifiers have been added an empty array is returned.

setQualifier

public void setQualifier(Qualifier qualifier)
Sets the Qualifier object that the DataQuery uses to qualify individual entities of the tageted entity descriptor type.


getEntityCollator

public EntityCollator getEntityCollator()
Returns the EntityCollator object that the DataQuery uses to order the qualified entities.


setEntityCollator

public void setEntityCollator(EntityCollator collator)
Sets the EntityCollator object that the DataQuery uses to order the qualified entities.


setCollationField

public void setCollationField(IFieldDescriptor fieldDescriptor)
Help method that allows the entity order to be set using a single IFieldDescriptor.


setCollationField

public void setCollationField(IFieldDescriptor fieldDescriptor,
                              boolean ascending)
Help method that allows the entity order to be set using a single IFieldDescriptor.


addCollationField

public void addCollationField(IFieldDescriptor fieldDescriptor)
Help method that allows the entity order to be defined using multiple IFieldDescriptors by calling this method repeatedly.


addCollationField

public void addCollationField(IFieldDescriptor fieldDescriptor,
                              boolean ascending)
Help method that allows the entity order to be defined using multiple IFieldDescriptors by calling this method repeatedly.


clearCollationFields

public void clearCollationFields()
Help method the resets the query's order data causing the entities to be returned in their default order.



Copyright © 2005 Caleigo. All Rights Reserved.