com.businessobjects.query
Interface CombinedQuery

All Superinterfaces:
QueryBase

public interface CombinedQuery
extends QueryBase

Provides the ability to group a number of Query and CombinedQuery instances into a single query. The main role of this interface is to provide the structure that enables you to create complex queries. A CombinedQuery instance can contain both Query and CombinedQuery objects, thus enabling you to create a complex query structure.

CombinedQuery can be used for the construction of the whole query for a given data provider, as well as being used for representing a combination of queries.

The following example describes how to use the CombinedQuery interface to construct a complex query made as one Query minus one CombinedQuery, being itself made as an intersection between two Query instances.

Example: Constructing a complex query (Q1 MINUS (Q2 INTERSECT Q3)).

Note: This example assumes that you have obtained a DataSourceSpecification instance. Additionally, it assumes that you have created three simple Query instances and have stored them in variables called boQuery1, boQuery2, and boQuery3.

        CombinedQuery boInnerCombinedQuery = CombinedQuery.Factory.newInstance();
        boInnerCombinedQuery.setQueriesArray(new QueryBase[]{boQuery2,boQuery3});
        boInnerCombinedQuery.setCombinedQueryOperator(CombinedQueryOperator.UNION);
        CombinedQuery boOuterCombinedQuery = CombinedQuery.Factory.newInstance();
        boOuterCombinedQuery.setQueriesArray(new QueryBase[]{boQuery1,boInnerCombinedQuery});
        boOuterCombinedQuery.setCombinedQueryOperator(CombinedQueryOperator.INTERSECT);
        QuerySpecification boQuerySpec = QuerySpecification.Factory.newInstance();
        boQuerySpec.setQueryBase(boOuterCombinedQuery);
 

See Also:
Query, QueryObject

Nested Class Summary
static class CombinedQuery.Factory
          A class with methods for creating instances of the CombinedQuery type.
 
Field Summary
static org.apache.xmlbeans.SchemaType type
          Internal use only
 
Method Summary
 QueryBase addNewQueries()
          Appends and returns a new empty value (as xml) as the last Queries element.
 CombinedQueryOperator.Enum getCombinedQueryOperator()
           Gets the CombinedQueryOperator used between the QueryBase instances in this CombinedQuery instance.
 QueryBase[] getQueriesArray()
           Gets the array of QueryBase instances for this CombinedQuery.
 QueryBase getQueriesArray(int i)
           Gets the QueryBase instance located at index i in the QueryBase array contained in this CombinedQuery instance.
 QueryBase insertNewQueries(int i)
          Inserts and returns a new empty value (as xml) of the Queries element at the specified index position.
 boolean isNilQueriesArray(int i)
          Checks if the Queries element is nil at the specified index position.
 boolean isSetCombinedQueryOperator()
          Checks if the CombinedQueryOperator attribute has been set.
 void removeQueries(int i)
          Removes the Queries element at the specified index position.
 void setCombinedQueryOperator(CombinedQueryOperator.Enum combinedQueryOperator)
           Sets the CombinedQueryOperator to use between the QueryBase instances in this CombinedQuery instance.
 void setNilQueriesArray(int i)
          Nils the Queries element at the specified index position.
 void setQueriesArray(int i, QueryBase queries)
           Sets the QueryBase instance, value, into the QueryBase array at the location specified by the index i.
 void setQueriesArray(QueryBase[] queriesArray)
           Sets the array of QueryBase instances for this CombinedQuery.
 int sizeOfQueriesArray()
          Returns the size of the Queries array.
 void unsetCombinedQueryOperator()
          Deletes or unsets the CombinedQuery attribute.
 CombinedQueryOperator xgetCombinedQueryOperator()
          Internal Use Only.
 void xsetCombinedQueryOperator(CombinedQueryOperator combinedQueryOperator)
          Internal Use Only.
 
Methods inherited from interface com.businessobjects.query.QueryBase
getID, isSetID, setID, unsetID, xgetID, xsetID
 

Field Detail

type

static final org.apache.xmlbeans.SchemaType type
Internal use only

Method Detail

getQueriesArray

QueryBase[] getQueriesArray()

Gets the array of QueryBase instances for this CombinedQuery. As the class QueryBase is an abstract one, the array of QueryBase contains in fact instances of Query and CombinedQuery. It is important to note that a given CombinedQuery instance can (but does not necessarily) contain additional CombinedQuery instances.

Returns:
the array of QueryBase instances for this CombinedQuery

getQueriesArray

QueryBase getQueriesArray(int i)

Gets the QueryBase instance located at index i in the QueryBase array contained in this CombinedQuery instance.

Parameters:
i - the index of the QueryBase instance in the array.
Returns:
the requested QueryBase instance.

isNilQueriesArray

boolean isNilQueriesArray(int i)
Checks if the Queries element is nil at the specified index position.

Parameters:
i - the index of the query instance in the array.
Returns:
true if the query element is nil at ith position, otherwise false

sizeOfQueriesArray

int sizeOfQueriesArray()
Returns the size of the Queries array.

Returns:
the size of the query array.

setQueriesArray

void setQueriesArray(QueryBase[] queriesArray)

Sets the array of QueryBase instances for this CombinedQuery. The Query class provides access to query result, query condition and query scope objects from the Universe to a query. You can group together a number of Query and of CombinedQuery instances in a CombinedQuery object and set the operators to be used between them. See Query for further information on how to create Query instances. Once you have created Query and CombinedQuery instances, use this method to assign an array of them to a CombinedQuery instance. Please note that the order you put your QueryBase instances in the array Queries matters for the CombinedQueryOperator.Minus.

Parameters:
queriesArray - the array of QueryBase objects to put in this CombinedQuery

setQueriesArray

void setQueriesArray(int i,
                     QueryBase queries)

Sets the QueryBase instance, value, into the QueryBase array at the location specified by the index i.

Parameters:
i - The index of the QueryBase array where the QueryBase instance is placed.
queries - The QueryBase instance to place in the array.

setNilQueriesArray

void setNilQueriesArray(int i)
Nils the Queries element at the specified index position.

Parameters:
i - The index of the queries element

insertNewQueries

QueryBase insertNewQueries(int i)
Inserts and returns a new empty value (as xml) of the Queries element at the specified index position.

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

addNewQueries

QueryBase addNewQueries()
Appends and returns a new empty value (as xml) as the last Queries element.

Returns:
A new empty value (as xml) as the last Queries element

removeQueries

void removeQueries(int i)
Removes the Queries element at the specified index position.

Parameters:
i - The index of the Queries element.

getCombinedQueryOperator

CombinedQueryOperator.Enum getCombinedQueryOperator()

Gets the CombinedQueryOperator used between the QueryBase instances in this CombinedQuery instance. For example, if this CombinedQuery instance contains a CombinedQuery instance and a Query instance, the CombinedQueryOperator is used between them.

Returns:
the CombinedQueryOperator used between the QueryBase instances in this CombinedQuery instance

xgetCombinedQueryOperator

CombinedQueryOperator xgetCombinedQueryOperator()

Internal Use Only.


isSetCombinedQueryOperator

boolean isSetCombinedQueryOperator()
Checks if the CombinedQueryOperator attribute has been set.

Returns:
true if the CombinedQueryOperator is set, otherwise false

setCombinedQueryOperator

void setCombinedQueryOperator(CombinedQueryOperator.Enum combinedQueryOperator)

Sets the CombinedQueryOperator to use between the QueryBase instances in this CombinedQuery instance. For example, if this CombinedQuery instance contains a CombinedQuery instance and a Query instance, the CombinedQueryOperator is used between them.

Parameters:
combinedQueryOperator - the CombinedQueryOperator to use between the QueryBase instances in this CombinedQuery instance

xsetCombinedQueryOperator

void xsetCombinedQueryOperator(CombinedQueryOperator combinedQueryOperator)

Internal Use Only.


unsetCombinedQueryOperator

void unsetCombinedQueryOperator()
Deletes or unsets the CombinedQuery attribute.