com.businessobjects.query
Interface Filter

All Superinterfaces:
ConditionBase

public interface Filter
extends ConditionBase

Provides the functionality to create a filter query condition. For example, you can use this interface to create a condition where the query results are limited based on criteria defined in the filter. The following example shows you how to create a filter query condition where only data for the "Country" equaling "France" are returned in the query results.

Example: Creating a filter 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:
Operand, Values, Prompt

Nested Class Summary
static class Filter.Factory
          A class with methods for creating instances of the Filter type.
 
Field Summary
static org.apache.xmlbeans.SchemaType type
          Internal Use Only.
 
Method Summary
 QueryObject addNewFilteredObject()
          Appends and returns a new empty "FilteredObject" element
 Operand addNewOperand()
          Appends and returns a new empty value (as xml) as the last "Operand" element.
 QueryObject getFilteredObject()
           Gets the result object that the filter is based on.
 FilterOperator.Enum getFilterOperator()
           Gets the operator used between the object being filtered (for example, a field representing Country) and the operand (for example, an object that represents the String "France").
 Operand[] getOperandArray()
           Gets the values that are used as the operand in the filter condition.
 Operand getOperandArray(int i)
           Gets a value used as a operand in the filter condition that is stored in the operand array position indexed by the parameter i.
 Operand insertNewOperand(int i)
          Inserts and returns a new empty value (as xml) of the "Operand" element at the specified index position.
 void removeOperand(int i)
          Removes the Operand element at the specified index position.
 void setFilteredObject(QueryObject filteredObject)
           Sets the result object to base the filter on.
 void setFilterOperator(FilterOperator.Enum filterOperator)
           Sets the operator used between the object being filtered (for example, a field representing Country) and the operand (for example, an object that represents the String "France").
 void setOperandArray(int i, Operand operand)
           Sets a value used as an operand in the filter condition to the position in the operand array indicated by the index parameter i.
 void setOperandArray(Operand[] operandArray)
           Sets the values to be used as the operand in the filter condition.
 int sizeOfOperandArray()
          Returns number of "Operand" element
 FilterOperator xgetFilterOperator()
          Internal Use Only.
 void xsetFilterOperator(FilterOperator filterOperator)
          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

getFilteredObject

QueryObject getFilteredObject()

Gets the result object that the filter is based on. For more information see, setFilteredObject.

Returns:
The result object that the filter is based on

setFilteredObject

void setFilteredObject(QueryObject filteredObject)

Sets the result object to base the filter on. For example, if the Universe contains a field called "Country", and you want to limit the results based on the Country field, you would pass in a QueryObject instance whose Key is set to the Key of the query result object that represents the Country field.

Parameters:
filteredObject - a QueryObject instance whose Key is set to the Key of the query result object that represents the field you want to base the filter on

addNewFilteredObject

QueryObject addNewFilteredObject()
Appends and returns a new empty "FilteredObject" element

Returns:
A new empty "FilteredObject" element

getOperandArray

Operand[] getOperandArray()

Gets the values that are used as the operand in the filter condition. For example, given the filter condition, "Country = France", the operand is "France". This method returns an array containing either Values, Prompt, or ObjectComparison instances.

Returns:
An array containing either Values, Prompt, or ObjectComparison instances

getOperandArray

Operand getOperandArray(int i)

Gets a value used as a operand in the filter condition that is stored in the operand array position indexed by the parameter i. Given the filter condition, "Country = France", the operand is "France". This method returns either a Values, Prompt, or ObjectComparison instance.

Parameters:
i - The position in the operand array from which the operand is retrieved
Returns:
Either a Values, Prompt, or ObjectComparison instance
See Also:
com.businessobjects.query.Filter#getOperand()

sizeOfOperandArray

int sizeOfOperandArray()
Returns number of "Operand" element

Returns:
The size of the Operand array.

setOperandArray

void setOperandArray(Operand[] operandArray)

Sets the values to be used as the operand in the filter condition. For example, given the filter condition, "Country = France", the operand is "France". You must pass in an array containing either Values, Prompt, or ObjectComparison instances to this method.

Note: To set the operand to a String (or a String array), you must use a Values instance.

Parameters:
operandArray - an array containing Values, Prompt, or ObjectComparison instances
See Also:
Values, Prompt, ObjectComparison

setOperandArray

void setOperandArray(int i,
                     Operand operand)

Sets a value used as an operand in the filter condition to the position in the operand array indicated by the index parameter i. You must pass in either a Values, Prompt, or ObjectComparison to this method.

Given the filter condition, "Country = France", the operand is "France".

Note: To set the operand to a String (or a String array), you must use a Values instance.

Parameters:
i - The position in the operand array where the operand is to be stored
operand - a Values, Prompt, or ObjectComparison instance

insertNewOperand

Operand insertNewOperand(int i)
Inserts and returns a new empty value (as xml) of the "Operand" element at the specified index position.

Parameters:
i - The index of the Operand element
Returns:
A new empty value (as xml) of the "Operand" element at the specified index position.

addNewOperand

Operand addNewOperand()
Appends and returns a new empty value (as xml) as the last "Operand" element.

Returns:
A new empty value (as xml) as the last "Operand" element.

removeOperand

void removeOperand(int i)
Removes the Operand element at the specified index position.

Parameters:
i - The index of the Operand element.

getFilterOperator

FilterOperator.Enum getFilterOperator()

Gets the operator used between the object being filtered (for example, a field representing Country) and the operand (for example, an object that represents the String "France"). So, if the condition filter is set to Country = "France", this method would return FilterOperator.Equal.

Returns:
The operator used between the object being filtered and the operand
See Also:
FilterOperator

xgetFilterOperator

FilterOperator xgetFilterOperator()

Internal Use Only.


setFilterOperator

void setFilterOperator(FilterOperator.Enum filterOperator)

Sets the operator used between the object being filtered (for example, a field representing Country) and the operand (for example, an object that represents the String "France"). So, if you want to return results where the Country = "France", you would set the filter operator to FilterOperator.Equal.

Parameters:
filterOperator - the operator used between the object being filtered and the operand
See Also:
FilterOperator

xsetFilterOperator

void xsetFilterOperator(FilterOperator filterOperator)

Internal Use Only.