com.businessobjects.query
Interface QuerySpecification


public interface QuerySpecification

The actual query that you want to execute is specified using the QuerySpecification interface. This interface contains two important objects:

The QueryBase object can be either an instance of CombinedQuery or Query. The CombinedQuery may contain one or more additional QueryBase objects. This structure allows you to create a QuerySpecification made up of simple or complex query structures. The array of QueryProperty objects specifies various property values for the query. The example below describes how to construct a simple query using the QuerySpecification interface. Once you have constructed a QuerySpecification instance, you execute the query by passing the QuerySpecification instance to the QueryService.createDataProvider method.

For further examples about how to use the QuerySpecification interface, see the Business Objects web services Developer's Guide.

Example: Constructing a simple query.

Note: This example assumes that you have obtained a DataSourceSpecification instance. Additionally, it assumes that you have found query result objects in the Universe and have stored their keys in lists called dimensionKeys, detailKeys, and measureKeys.

 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 boQuery = 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[3];
 boQueryResultObjects[0] = QueryObject.Factory.newInstance();
 boQueryResultObjects[1] = QueryObject.Factory.newInstance();
 boQueryResultObjects[2] = QueryObject.Factory.newInstance();
 boQueryResultObjects[0].setKey((String)detailKeys.get(1));
 boQueryResultObjects[1].setKey((String)dimensionKeys.get(0));
 boQueryResultObjects[2].setKey((String)measureKeys.get(0));
 boQuery.setQueryResultArray(boQueryResultObjects);
 // Add the query to the QuerySpecification
 boQuerySpec.setQueryBase(boQuery);
 


Nested Class Summary
static class QuerySpecification.Factory
          A class with methods for creating instances of the QuerySpecification type.
 
Field Summary
static org.apache.xmlbeans.SchemaType type
          Internal Use Only.
 
Method Summary
 QueryBase addNewQueryBase()
          Appends and returns a new empty "QueryBase" element
 QueryProperty addNewQueryProperty()
          Appends and returns a new empty value (as xml) as the last QueryProperty element
 java.lang.String getName()
           Gets the name of this QuerySpecification instance.
 QueryBase getQueryBase()
           Gets the QueryBase instance (which may be a CombinedQuery or a Query instance) from this QuerySpecification instance.
 QueryProperty[] getQueryPropertyArray()
           Gets the array of QueryProperty instances for this QuerySpecification instance.
 QueryProperty getQueryPropertyArray(int i)
           Gets the QueryProperty instance specified by the array index i.
 SamplingMode.Enum getSamplingMode()
          Gets the "SamplingMode" type of this QuerySpecification instance
 int getSamplingSize()
          Gets the number of Rows of the Sampled Data
 QueryProperty insertNewQueryProperty(int i)
          Inserts and returns a new empty value (as xml) of the QueryProperty element at the specified index position.
 void removeQueryProperty(int i)
          Removes the QueryProperty element at the specified index position.
 void setName(java.lang.String name)
           Sets the name of this QuerySpecification instance.
 void setQueryBase(QueryBase queryBase)
           Sets the QueryBase instance (which may be a CombinedQuery or a Query instance) for this QuerySpecification instance.
 void setQueryPropertyArray(int i, QueryProperty queryProperty)
           Sets the QueryProperty instance specified by the parameter value to the array location specified by the index i.
 void setQueryPropertyArray(QueryProperty[] queryPropertyArray)
           Sets the array of QueryProperty instances for this QuerySpecification instance.
 void setSamplingMode(SamplingMode.Enum samplingMode)
           Sets "SamplingMode" type of this QuerySpecification instance
 void setSamplingSize(int samplingSize)
          Sets the number of Rows of the Sampled Data
 int sizeOfQueryPropertyArray()
          Returns the size of the QueryProperty array.
 org.apache.xmlbeans.XmlString xgetName()
          Internal Use Only.
 SamplingMode xgetSamplingMode()
          Internal Use Only.
 org.apache.xmlbeans.XmlInt xgetSamplingSize()
          Internal Use Only.
 void xsetName(org.apache.xmlbeans.XmlString name)
          Internal Use Only.
 void xsetSamplingMode(SamplingMode samplingMode)
          Internal Use Only.
 void xsetSamplingSize(org.apache.xmlbeans.XmlInt samplingSize)
          Internal Use Only.
 

Field Detail

type

static final org.apache.xmlbeans.SchemaType type

Internal Use Only.

Method Detail

getQueryBase

QueryBase getQueryBase()

Gets the QueryBase instance (which may be a CombinedQuery or a Query instance) from this QuerySpecification instance.

Returns:
the QueryBase instance for this QuerySpecification instance

setQueryBase

void setQueryBase(QueryBase queryBase)

Sets the QueryBase instance (which may be a CombinedQuery or a Query instance) for this QuerySpecification instance.

Parameters:
queryBase - the QueryBase instance to set in this QuerySpecification instance

addNewQueryBase

QueryBase addNewQueryBase()
Appends and returns a new empty "QueryBase" element

Returns:
a new empty "QueryBase" element

getQueryPropertyArray

QueryProperty[] getQueryPropertyArray()

Gets the array of QueryProperty instances for this QuerySpecification instance. The QueryProperty class specifies the name and value of a property for a query. For example, to set the maximum number of rows fetched by the query, you would set the name of a QueryProperty instance to "MaxRowFetched" and the value to an integer representing the maximum number of rows fetched.

Returns:
an array of QueryProperty instances, each of which represent a name and value of a query property

getQueryPropertyArray

QueryProperty getQueryPropertyArray(int i)

Gets the QueryProperty instance specified by the array index i. To retrieve the fifth QueryProperty instance in the array, you would pass in 4 as the index parameter.
The QueryProperty class specifies the name and value of a property for a query. For example, to set the maximum number of rows fetched by the query, you would set the name of a QueryProperty instance to "MaxRowFetched" and the value to an integer representing the maximum number of rows fetched.

Parameters:
i - the index of the QueryProperty instance to retrieve (using a zero-based index)
Returns:
the requested QueryProperty instance

sizeOfQueryPropertyArray

int sizeOfQueryPropertyArray()
Returns the size of the QueryProperty array.

Returns:
the size of the QueryProperty array.

setQueryPropertyArray

void setQueryPropertyArray(QueryProperty[] queryPropertyArray)

Sets the array of QueryProperty instances for this QuerySpecification instance. The QueryProperty class specifies the name and value of a property for a query. For example, to set the maximum number of rows fetched by the query, you would set the name of a QueryProperty instance to "MaxRowFetched" and the value to an integer representing the maximum number of rows fetched.

Parameters:
queryProperty - an array of QueryProperty instances, each of which represent a name and value of a query property

setQueryPropertyArray

void setQueryPropertyArray(int i,
                           QueryProperty queryProperty)

Sets the QueryProperty instance specified by the parameter value to the array location specified by the index i. To place the QueryProperty instance in the fifth spot in the array, you would pass in 4 as the index parameter.
The QueryProperty class specifies the name and value of a property for a query. For example, to set the maximum number of rows fetched by the query, you would set the name of a QueryProperty instance to "MaxRowFetched" and the value to an integer representing the maximum number of rows fetched.

Parameters:
i - the index (location) in the array where to store the QueryProperty instance
value - the QueryProperty instance to store

insertNewQueryProperty

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

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

addNewQueryProperty

QueryProperty addNewQueryProperty()
Appends and returns a new empty value (as xml) as the last QueryProperty element

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

removeQueryProperty

void removeQueryProperty(int i)
Removes the QueryProperty element at the specified index position.

Parameters:
i - the index of the QueryProperty element

getName

java.lang.String getName()

Gets the name of this QuerySpecification instance.

Returns:
a String that specifies the name of this QuerySpecification instance

xgetName

org.apache.xmlbeans.XmlString xgetName()

Internal Use Only.


setName

void setName(java.lang.String name)

Sets the name of this QuerySpecification instance.

Parameters:
name - a String that specifies the name of this QuerySpecification instance

xsetName

void xsetName(org.apache.xmlbeans.XmlString name)

Internal Use Only.


getSamplingMode

SamplingMode.Enum getSamplingMode()
Gets the "SamplingMode" type of this QuerySpecification instance

Returns:
a SamplingMode that specifies the Sampling Mode type of this QuerySpecification instance

xgetSamplingMode

SamplingMode xgetSamplingMode()

Internal Use Only.


setSamplingMode

void setSamplingMode(SamplingMode.Enum samplingMode)

Sets "SamplingMode" type of this QuerySpecification instance

Parameters:
a - SamplingMode that specifies the Sampling Mode type of this QuerySpecification instance

xsetSamplingMode

void xsetSamplingMode(SamplingMode samplingMode)

Internal Use Only.


getSamplingSize

int getSamplingSize()
Gets the number of Rows of the Sampled Data

Returns:
the number of Rows of the Sampled Data

xgetSamplingSize

org.apache.xmlbeans.XmlInt xgetSamplingSize()

Internal Use Only.


setSamplingSize

void setSamplingSize(int samplingSize)
Sets the number of Rows of the Sampled Data

Parameters:
the - number of Rows of the Sampled Data to be retrieved.

xsetSamplingSize

void xsetSamplingSize(org.apache.xmlbeans.XmlInt samplingSize)

Internal Use Only.