|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface SubQuery
The SubQuery interface is used to provide a set of results to the main query.
Example: Applying SubQuery to the Query.
For example, if you want
to list all of the stores in states that have a total sales revenue greater than two
million dollars, you can create a subquery that returns the states which have total
sales greater than two million dollars; your main query would then list only stores
in those states.
QuerySpecification boQuerySpec = QuerySpecification.Factory.newInstance();
// Create a Query array. We are only using a single query in this example, so the array is of size 1.
Query boQuery1 = Query.Factory.newInstance();
// The query will contain three result objects (these objects represent the fields that are contained in the query result). Create an array of QueryObject objects to store the result objects. You can use Detail, Dimension, or Measure objects as result objects.
QueryObject[] boQueryResultObjects = new QueryObject[2];
boQueryResultObjects[0] = QueryObject.Factory.newInstance();
boQueryResultObjects[1] = QueryObject.Factory.newInstance();
boQueryResultObjects[0].setKey((String)dimensionKeys.get(0));
boQueryResultObjects[1].setKey((String)measureKeys.get(0));
QueryObject boBasedOnObject = QueryObject.Factory.newInstance();
boBasedOnObject.setKey((String)dimensionKeys.get(0));
QueryObject boFilteredObject = QueryObject.Factory.newInstance();
boFilteredObject.setKey((String)dimensionKeys.get(0));
SubQuery subquery = SubQuery.Factory.newInstance();
subquery.setConditionOperator(ConditionOperator.LESS);
subquery.setComparisonOperator(ComparisonOperator.ANY);
subquery.setFilteredObjectArray(0,boFilteredObject);
subquery.setResultObjectArray(1,boBasedOnObject);
ConditionBase[] boConditionBase = new ConditionBase[1];
boConditionBase[0] = subquery;
QueryCondition boQueryCondition = QueryCondition.Factory.newInstance();
boQueryCondition.setItemArray(boConditionBase);
boQuery1.setQueryCondition(boQueryCondition);
// Add the array of result objects to the Query.
boQuery1.setQueryResultArray(boQueryResultObjects);
// Add the Query to the QuerySpecification
boQuerySpec.setQueryBase(boQuery1);
In this case, the field "State" would be the filtered object. The condition operator would be set to "InList". The result object (the fields returned to the main query) would also be "State". Furthermore, the subquery would contain a query condition specifying that we only want states where the total revenue is greater than two million dollars.
Note: The subquery can contain one or more filtered objects, one or more result objects and one or more query conditions.
| Nested Class Summary | |
|---|---|
static class |
SubQuery.Factory
A class with methods for creating instances of the SubQuery type. |
| Field Summary | |
|---|---|
static org.apache.xmlbeans.SchemaType |
type
Internal Use Only. |
| Method Summary | |
|---|---|
QueryObject |
addNewFilteredObject()
Appends and returns a new empty value (as xml) as the last FilteredObject element |
QueryCondition |
addNewQueryCondition()
Appends and returns a new empty QueryCondition element |
QueryObject |
addNewResultObject()
Appends and returns a new empty value (as xml) as the last ResultObject element |
ComparisonOperator.Enum |
getComparisonOperator()
Gets the ComparisonOperator attribute |
ConditionOperator.Enum |
getConditionOperator()
Gets the operator used between the filtered objects and the result objects in the subquery. |
QueryObject[] |
getFilteredObjectArray()
Gets the objects in the main query that the subquery is returning filtered results for. |
QueryObject |
getFilteredObjectArray(int i)
Gets the object in the main query that the subquery is returning filtered results for. |
QueryCondition |
getQueryCondition()
Gets the query condition to use in the subquery to filter results returned by the subquery. |
QueryObject[] |
getResultObjectArray()
Gets the fields returned by the subquery to the main query. |
QueryObject |
getResultObjectArray(int i)
Gets the fields returned by the subquery to the main query. |
QueryObject |
insertNewFilteredObject(int i)
Inserts and returns a new empty value (as xml) of the "FilteredObject" element at the specified index position. |
QueryObject |
insertNewResultObject(int i)
Inserts and returns a new empty value (as xml) of the ResultObject element as the specified index position. |
boolean |
isSetComparisonOperator()
Checks if the ComparisonOperator attribute has been set. |
boolean |
isSetQueryCondition()
Checks if the QueryCondition element has been set. |
void |
removeFilteredObject(int i)
Removes the "FilteredObject" element at the specified index position. |
void |
removeResultObject(int i)
Removes the "ResultObject" element as the specified index position. |
void |
setComparisonOperator(ComparisonOperator.Enum comparisonOperator)
Sets the ComparisonOperator attribute. |
void |
setConditionOperator(ConditionOperator.Enum conditionOperator)
Sets the operator used between the filtered objects and the result objects in the subquery. |
void |
setFilteredObjectArray(int i,
QueryObject filteredObject)
Sets the object in the main query that the subquery is returning filtered results for. |
void |
setFilteredObjectArray(QueryObject[] filteredObjectArray)
Sets the objects in the main query that the subquery is returning filtered results for. |
void |
setQueryCondition(QueryCondition queryCondition)
Sets the query condition to use in the subquery to filter results returned by the subquery. |
void |
setResultObjectArray(int i,
QueryObject resultObject)
Sets the fields returned by the subquery to the main query. |
void |
setResultObjectArray(QueryObject[] resultObjectArray)
Sets the fields returned by the subquery to the main query. |
int |
sizeOfFilteredObjectArray()
Returns the size of the FilteredObject array. |
int |
sizeOfResultObjectArray()
Returns the size of the ResultObject array. |
void |
unsetComparisonOperator()
Deletes or unsets the ComparisonOperator attribute |
void |
unsetQueryCondition()
Deletes or unsets the "QueryCondition" element |
ComparisonOperator |
xgetComparisonOperator()
Internal Use Only. |
ConditionOperator |
xgetConditionOperator()
Internal Use Only. |
void |
xsetComparisonOperator(ComparisonOperator comparisonOperator)
Internal Use Only. |
void |
xsetConditionOperator(ConditionOperator conditionOperator)
Internal Use Only. |
| Methods inherited from interface com.businessobjects.query.ConditionBase |
|---|
getID, isSetID, setID, unsetID, xgetID, xsetID |
| Field Detail |
|---|
static final org.apache.xmlbeans.SchemaType type
Internal Use Only.
| Method Detail |
|---|
QueryObject[] getFilteredObjectArray()
Gets the objects in the main query that the subquery is returning filtered results for.
Example:
For example, if you want
to list all of the stores in states that have a total sales revenue greater than two
million dollars, you can create a subquery that returns the states which have total
sales greater than two million dollars; your main query would then list only stores
in those states.
In this case, the field "State" would be the filtered object. The condition operator would be set to "InList". The result object (the fields returned to the main query) would also be "State". Furthermore, the subquery would contain a query condition specifying that we only want states where the total revenue is greater than two million dollars.
QueryObject getFilteredObjectArray(int i)
Gets the object in the main query that the subquery is returning filtered results for.
Example:
For example, if you want
to list all of the stores in states that have a total sales revenue greater than two
million dollars, you can create a subquery that returns the states which have total
sales greater than two million dollars; your main query would then list only stores
in those states.
In this case, the field "State" would be the filtered object. The condition operator would be set to "InList". The result object (the fields returned to the main query) would also be "State". Furthermore, the subquery would contain a query condition specifying that we only want states where the total revenue is greater than two million dollars.
i - the index in the array that contains the requested filtered object
iint sizeOfFilteredObjectArray()
void setFilteredObjectArray(QueryObject[] filteredObjectArray)
Sets the objects in the main query that the subquery is returning filtered results for.
Example:
For example, if you want
to list all of the stores in states that have a total sales revenue greater than two
million dollars, you can create a subquery that returns the states which have total
sales greater than two million dollars; your main query would then list only stores
in those states.
In this case, the field "State" would be the filtered object. The condition operator would be set to "InList". The result object (the fields returned to the main query) would also be "State". Furthermore, the subquery would contain a query condition specifying that we only want states where the total revenue is greater than two million dollars.
filteredObject - the objects in the main query that the subquery is returning filtered results for
void setFilteredObjectArray(int i,
QueryObject filteredObject)
Sets the object in the main query that the subquery is returning filtered results for.
Example:
For example, if you want
to list all of the stores in states that have a total sales revenue greater than two
million dollars, you can create a subquery that returns the states which have total
sales greater than two million dollars; your main query would then list only stores
in those states.
In this case, the field "State" would be the filtered object. The condition operator would be set to "InList". The result object (the fields returned to the main query) would also be "State". Furthermore, the subquery would contain a query condition specifying that we only want states where the total revenue is greater than two million dollars.
i - the index in the array at which to store the filtered objectvalue - the filtered object to store in the arrayQueryObject insertNewFilteredObject(int i)
i - the index of the FilterObject element
QueryObject addNewFilteredObject()
void removeFilteredObject(int i)
i - the index of the FilteredObject elementQueryObject[] getResultObjectArray()
Gets the fields returned by the subquery to the main query.
Example:
For example, if you want
to list all of the stores in states that have a total sales revenue greater than two
million dollars, you can create a subquery that returns the states which have total
sales greater than two million dollars; your main query would then list only stores
in those states.
In this case, the field "State" would be the filtered object. The condition operator would be set to "InList". The result object (the fields returned to the main query) would also be "State". Furthermore, the subquery would contain a query condition specifying that we only want states where the total revenue is greater than two million dollars.
QueryObject getResultObjectArray(int i)
Gets the fields returned by the subquery to the main query.
Example:
For example, if you want
to list all of the stores in states that have a total sales revenue greater than two
million dollars, you can create a subquery that returns the states which have total
sales greater than two million dollars; your main query would then list only stores
in those states.
In this case, the field "State" would be the filtered object. The condition operator would be set to "InList". The result object (the fields returned to the main query) would also be "State". Furthermore, the subquery would contain a query condition specifying that we only want states where the total revenue is greater than two million dollars.
i - the index in the array where the result object is stored
int sizeOfResultObjectArray()
void setResultObjectArray(QueryObject[] resultObjectArray)
Sets the fields returned by the subquery to the main query.
Example:
For example, if you want
to list all of the stores in states that have a total sales revenue greater than two
million dollars, you can create a subquery that returns the states which have total
sales greater than two million dollars; your main query would then list only stores
in those states.
In this case, the field "State" would be the filtered object. The condition operator would be set to "InList". The result object (the fields returned to the main query) would also be "State". Furthermore, the subquery would contain a query condition specifying that we only want states where the total revenue is greater than two million dollars.
resultObject - the fields returned by the subquery to the main query
void setResultObjectArray(int i,
QueryObject resultObject)
Sets the fields returned by the subquery to the main query.
Example:
For example, if you want
to list all of the stores in states that have a total sales revenue greater than two
million dollars, you can create a subquery that returns the states which have total
sales greater than two million dollars; your main query would then list only stores
in those states.
In this case, the field "State" would be the filtered object. The condition operator would be set to "InList". The result object (the fields returned to the main query) would also be "State". Furthermore, the subquery would contain a query condition specifying that we only want states where the total revenue is greater than two million dollars.
i - the index in the array in which to store the result objectvalue - the result object to store in the arrayQueryObject insertNewResultObject(int i)
i - the index of the ResultObject element
QueryObject addNewResultObject()
void removeResultObject(int i)
i - the index of the ResultObject elementQueryCondition getQueryCondition()
Gets the query condition to use in the subquery to filter results returned by the subquery.
Example:
For example, if you want
to list all of the stores in states that have a total sales revenue greater than two
million dollars, you can create a subquery that returns the states which have total
sales greater than two million dollars; your main query would then list only stores
in those states.
In this case, the field "State" would be the filtered object. The condition operator would be set to "InList". The result object (the fields returned to the main query) would also be "State". Furthermore, the subquery would contain a query condition specifying that we only want states where the total revenue is greater than two million dollars.
boolean isSetQueryCondition()
true if the QueryCondition element is set, otherwise falsevoid setQueryCondition(QueryCondition queryCondition)
Sets the query condition to use in the subquery to filter results returned by the subquery.
Example:
For example, if you want
to list all of the stores in states that have a total sales revenue greater than two
million dollars, you can create a subquery that returns the states which have total
sales greater than two million dollars; your main query would then list only stores
in those states.
In this case, the field "State" would be the filtered object. The condition operator would be set to "InList". The result object (the fields returned to the main query) would also be "State". Furthermore, the subquery would contain a query condition specifying that we only want states where the total revenue is greater than two million dollars.
queryCondition - the query condition to use in the subquery to filter results returned by the subqueryQueryCondition addNewQueryCondition()
void unsetQueryCondition()
ConditionOperator.Enum getConditionOperator()
Gets the operator used between the filtered objects and the result objects in the subquery.
Example:
For example, if you want
to list all of the stores in states that have a total sales revenue greater than two
million dollars, you can create a subquery that returns the states which have total
sales greater than two million dollars; your main query would then list only stores
in those states.
In this case, the field "State" would be the filtered object. The condition operator would be set to "InList". The result object (the fields returned to the main query) would also be "State". Furthermore, the subquery would contain a query condition specifying that we only want states where the total revenue is greater than two million dollars.
ConditionOperator xgetConditionOperator()
Internal Use Only.
void setConditionOperator(ConditionOperator.Enum conditionOperator)
Sets the operator used between the filtered objects and the result objects in the subquery.
Example:
For example, if you want
to list all of the stores in states that have a total sales revenue greater than two
million dollars, you can create a subquery that returns the states which have total
sales greater than two million dollars; your main query would then list only stores
in those states.
In this case, the field "State" would be the filtered object. The condition operator would be set to "InList". The result object (the fields returned to the main query) would also be "State". Furthermore, the subquery would contain a query condition specifying that we only want states where the total revenue is greater than two million dollars.
conditionOperator - the operator used between the filtered objects and the result objects in the subqueryvoid xsetConditionOperator(ConditionOperator conditionOperator)
Internal Use Only.
ComparisonOperator.Enum getComparisonOperator()
ComparisonOperator xgetComparisonOperator()
Internal Use Only.
boolean isSetComparisonOperator()
true if the ComparisonOperator element is set, otherwise falsevoid setComparisonOperator(ComparisonOperator.Enum comparisonOperator)
comparisonOperator - the operator used to compare objects.void xsetComparisonOperator(ComparisonOperator comparisonOperator)
Internal Use Only.
void unsetComparisonOperator()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||