com.businessobjects.query
Interface QueryCondition

All Superinterfaces:
ConditionBase

public interface QueryCondition
extends ConditionBase

Specifies the conditions to be added to a given query. For example, you can use this interface to limit the results of your query, or constrain the query to return results within a particular range.

A Query is made up of query result objects, query condition objects, and query scope objects. To add query condition objects to a query, you construct a QueryCondition instance. Once you have constructed a QueryCondition instance, you then add it to a Query.
A QueryCondition instance contains an array of ConditionBase instances. The ConditionBase interface is a parent interface for Filter, PreCondition, Rank, SubQuery, and [notably] QueryCondition. So, to add a filter condition to the query, you would create a Filter instance, and then add it to the ConditionBase array for this QueryCondition instance. Furthermore, if you want to add additional query conditions to the query, you can add a QueryCondition instance to the ConditionBase array.

You can also add a PreConditionObject object found in the Universe to a query condition. See PreCondition for information on how to add a PreConditionObject to a query condition.

Example: Creating a custom query condition.

Note: This example assumes that you have created a QueryObject array called boQueryResultObjects that contains query result object keys from the Universe.

        QuerySpecification boQuerySpec = QuerySpecification.Factory.newInstance();
        Query boQuery1 = Query.Factory.newInstance();
        QueryCondition boQueryCondition = QueryCondition.Factory.newInstance();
        Filter boCondFilter = Filter.Factory.newInstance();
        QueryObject boQueryConditionObject = QueryObject.Factory.newInstance();
        boQueryConditionObject.setKey((String)dimensionKeys.get(0));
        boCondFilter.setFilteredObject(boQueryConditionObject);
        boCondFilter.setFilterOperator(FilterOperator.EQUAL);
        Operand[] boConditionValues = new Operand[1];
        Values boFreeValues = Values.Factory.newInstance();
        String[] boConditionValueString = new String[] {"France"};
        boFreeValues.setFreeValueArray(boConditionValueString);
        boConditionValues[0] = boFreeValues;
        boCondFilter.setOperandArray(boConditionValues);
        ConditionBase[] boConditionBase = new ConditionBase[1];
        boConditionBase[0] = boCondFilter;
        boQueryCondition.setItemArray(boConditionBase);
        boQuery1.setQueryCondition(boQueryCondition);
        boQuery1.setQueryResultArray(boQueryResultObjects);
        boQuerySpec.setQueryBase(boQuery1);
 

See Also:
PreCondition, PreConditionObject, ConditionBase

Nested Class Summary
static class QueryCondition.Factory
          A class with methods for creating instances of the QueryCondition type.
 
Field Summary
static org.apache.xmlbeans.SchemaType type
          Internal Use Only.
 
Method Summary
 ConditionBase addNewItem()
          Appends and returns a new empty value (as xml) as the last Item element.
 ConditionBase[] getItemArray()
           Gets the array of ConditionBase instances for this QueryCondition instance.
 ConditionBase getItemArray(int i)
           Gets the ConditionBase instance at the position indexed by i.
 QueryConditionOperator.Enum getQueryConditionOperator()
           Gets the operator used between the ConditionBase instances in the ConditionBase array.
 ConditionBase insertNewItem(int i)
          Inserts and returns a new empty value (as xml) of the Item element at the specified index position.
 boolean isSetQueryConditionOperator()
          Checks if the QueryConditionOperator attribute has been set.
 void removeItem(int i)
          Removes the Item element a new empty value (as xml) of the Item element at the specified index position.
 void setItemArray(ConditionBase[] itemArray)
           Sets the array of ConditionBase instances for this QueryCondition instance.
 void setItemArray(int i, ConditionBase item)
           Sets the ConditionBase instance to the array location indexed by i.
 void setQueryConditionOperator(QueryConditionOperator.Enum queryConditionOperator)
           Sets the operator used between the ConditionBase instances in the ConditionBase array.
 int sizeOfItemArray()
          Returns the size of the Item array.
 void unsetQueryConditionOperator()
          Deletes or unsets the QueryConditionOperator attribute.
 QueryConditionOperator xgetQueryConditionOperator()
          Internal Use Only.
 void xsetQueryConditionOperator(QueryConditionOperator queryConditionOperator)
          Internal Use Only.
 
Methods inherited from interface com.businessobjects.query.ConditionBase
getID, isSetID, setID, unsetID, xgetID, xsetID
 

Field Detail

type

static final org.apache.xmlbeans.SchemaType type

Internal Use Only.

Method Detail

getItemArray

ConditionBase[] getItemArray()

Gets the array of ConditionBase instances for this QueryCondition instance. The ConditionBase class is a parent class for Filter, PreCondition, Rank, SubQuery, and [notably] QueryCondition.

Returns:
the array of ConditionBase instances for this QueryCondition

getItemArray

ConditionBase getItemArray(int i)

Gets the ConditionBase instance at the position indexed by i. The ConditionBase class is a parent class for Filter, PreCondition, Rank, SubQuery, and [notably] QueryCondition.

Parameters:
i - an int used to reference a location in the array.
Returns:
the ConditionBase instance at array position i.

sizeOfItemArray

int sizeOfItemArray()
Returns the size of the Item array.

Returns:
the size of the Item array.

setItemArray

void setItemArray(ConditionBase[] itemArray)

Sets the array of ConditionBase instances for this QueryCondition instance. The ConditionBase class is a parent class for Filter, PreCondition, Rank, SubQuery, and [notably] QueryCondition. So, to add a filter condition to the query, you would create a Filter instance, and then add it to the ConditionBase array for this QueryCondition instance. Furthermore, if you want to add additional query conditions to the query, you can add a QueryCondition instance to the ConditionBase array.

Parameters:
item - an array of ConditionBase instances

setItemArray

void setItemArray(int i,
                  ConditionBase item)

Sets the ConditionBase instance to the array location indexed by i. The ConditionBase class is a parent class for Filter, PreCondition, Rank, SubQuery, and [notably] QueryCondition. So, to add a filter condition to the query, you would create a Filter instance, and then add it to the ConditionBase array for this QueryCondition instance. Furthermore, if you want to add additional query conditions to the query, you can add a QueryCondition instance to the ConditionBase array.

Parameters:
i - an int used to reference a location in the array
value - a ConditionBase instance to put in the array

insertNewItem

ConditionBase insertNewItem(int i)
Inserts and returns a new empty value (as xml) of the Item element at the specified index position.

Parameters:
i - the index of the Item element
Returns:
a new empty value (as xml) of the Item element at the specified index position.

addNewItem

ConditionBase addNewItem()
Appends and returns a new empty value (as xml) as the last Item element.

Returns:
a new empty value (as xml) as the last Item element.

removeItem

void removeItem(int i)
Removes the Item element a new empty value (as xml) of the Item element at the specified index position.

Parameters:
i - the index of the Item element.

getQueryConditionOperator

QueryConditionOperator.Enum getQueryConditionOperator()

Gets the operator used between the ConditionBase instances in the ConditionBase array. For example, if there are two conditions in the ConditionBase array (such as a filter and a prompt), you would set the QueryConditionOperator to "AND" if you want the result to include data where both conditions are true, or "OR" if you want the result to contain data where either condition is true.

Returns:
the QueryConditionOperator set for this QueryCondition instance

xgetQueryConditionOperator

QueryConditionOperator xgetQueryConditionOperator()

Internal Use Only.


isSetQueryConditionOperator

boolean isSetQueryConditionOperator()
Checks if the QueryConditionOperator attribute has been set.

Returns:
true if the QueryConditionOperator element is set, otherwise false

setQueryConditionOperator

void setQueryConditionOperator(QueryConditionOperator.Enum queryConditionOperator)

Sets the operator used between the ConditionBase instances in the ConditionBase array. For example, if there are two conditions in the ConditionBase array (such as a filter and a prompt), you would set the QueryConditionOperator to "AND" if you want the result to include data where both conditions are true, or "OR" if you want the result to contain data where either condition is true.

Parameters:
queryConditionOperator - the QueryConditionOperator to use between the conditions in the ConditionBase array

xsetQueryConditionOperator

void xsetQueryConditionOperator(QueryConditionOperator queryConditionOperator)

Internal Use Only.


unsetQueryConditionOperator

void unsetQueryConditionOperator()
Deletes or unsets the QueryConditionOperator attribute.