com.businessobjects.query
Interface Query

All Superinterfaces:
QueryBase

public interface Query
extends QueryBase

Provides access to a single query consisting of query result, query condition, and query scope objects from the Universe (data source). A QueryService query request containing a QuerySpecification has QueryBase instance, that can be either a Query or a CombinedQuery instance. In turn, a CombinedQuery instance contain one or more QueryBase instances. As a result, you can construct a number of Query instances and group them together logically using the CombinedQuery interface. Finally, you can place a CombinedQuery instance in a QuerySpecification and process the query using the QueryService service. You can also construct a Query instance, place it in a QuerySpecification and process the query using the QueryService service.

A query has four components:

  • Query result objects from the Universe - These are instances of Detail, Dimension, and Measure. These objects represent the data fields you want the query results to contain (for example, a product name, price, and quantity sold).
  • Query conditions - These are instances of PreConditionObject from a Universe or a custom condition created using a QueryCondition. These objects provide a filter for the query results (for example, to limit the results to a particular region, you set the value for the object representing a country or region).
  • Query scope objects - Defines the scope of the data (depth of data) returned by the query. This results in the query containing sufficient data so that additional requests are not required when drilling. These are objects in the Universe found in Hierarchy instances in a DataSourceSpecification. These objects specifies how drilling is performed in the document resulting from the query (for example, to drill down from country to town, you add the objects representing a country and town).
  • Query Sort Objects - Sorting can be provided at Query level using QueryObjectSort. Typical sortType values are Ascending, Descending, and None (default) QueryObjectSort. When you apply sorting on a query object, Query Specification is updated to prepare query along with sort information.

    Example: Constructing a simple query with only query result objects.
    Note: This example assumes that you have obtained a DataSourceSpecification instance. It also assumes that you have found query result objects in the Universe and have stored their keys in these lists: 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);
     

    See Also:
    QuerySpecification, QueryBase, CombinedQuery, QueryCondition, QueryObject, Hierarchy

    Nested Class Summary
    static class Query.Factory
              A class with methods for creating instances of the Query type.
     
    Field Summary
    static org.apache.xmlbeans.SchemaType type
              Internal Use Only.
     
    Method Summary
     QueryCondition addNewQueryCondition()
              Appends and returns a new empty "QueryCondition" element
     QueryObjectSort addNewQueryObjectSort()
              Appends and returns a new empty value (as xml) as the last "QueryObjectSort" element
     QueryObject addNewQueryResult()
              Appends and returns a new empty value (as xml) as the last "QueryResult" element.
     QueryObject addNewQueryScope()
              Appends and returns a new empty value (as xml) as the last "QueryScope" element
     QueryCondition getQueryCondition()
               Gets the query condition object for this Query instance.
     QueryObjectSort[] getQueryObjectSortArray()
               Gets the array of query sort objects for this Query instance.
     QueryObjectSort getQueryObjectSortArray(int i)
               Gets the query sort object to array location i.
     QueryObject[] getQueryResultArray()
               Gets an array of query result objects for this Query instance.
     QueryObject getQueryResultArray(int i)
               Gets the query result object stored at array location .
     QueryObject[] getQueryScopeArray()
               Gets the array of query scope objects for this Query instance.
     QueryObject getQueryScopeArray(int i)
               Gets the query scope object stored at array location i.
     QueryScopeLevel.Enum getQueryScopeLevel()
               Gets the scope level for the query as a QueryScopeLevel object.
     QueryObjectSort insertNewQueryObjectSort(int i)
              Inserts and returns a new empty value (as xml) of the "QueryObjectSort" element at the specified index position.
     QueryObject insertNewQueryResult(int i)
              Inserts and returns a new empty value (as xml) of the "QueryResult" element at the specified index position.
     QueryObject insertNewQueryScope(int i)
              Inserts and returns a new empty value (as xml) of the "QueryScope" element at the specified index position.
     boolean isSetQueryCondition()
              Checks if the "QueryCondition" element has been set.
     boolean isSetQueryScopeLevel()
              Checks if the "QueryScopeLevel" element has been set.
     void removeQueryObjectSort(int i)
              Removes the "QueryObjectSort" element at the specified index position.
     void removeQueryResult(int i)
              Removes the "QueryResult" element at the specified index position.
     void removeQueryScope(int i)
              Removes the "QueryScope" element at the specified index position.
     void setQueryCondition(QueryCondition queryCondition)
               Sets the query condition object for this Query instance.
     void setQueryObjectSortArray(int i, QueryObjectSort queryObjectSort)
               Sets the query sort object to array location i.
     void setQueryObjectSortArray(QueryObjectSort[] queryObjectSortArray)
               Sets the array of query sort objects for this Query instance.
     void setQueryResultArray(int i, QueryObject queryResult)
               Sets the query result object to array location i.
     void setQueryResultArray(QueryObject[] queryResultArray)
               Sets an array of query result objects for this Query instance.
     void setQueryScopeArray(int i, QueryObject queryScope)
               Sets the query scope object to array location i.
     void setQueryScopeArray(QueryObject[] queryScopeArray)
               Sets the array of query scope objects for this Query instance.
     void setQueryScopeLevel(QueryScopeLevel.Enum queryScopeLevel)
               Sets the scope level for the query as a QueryScopeLevel object.
     int sizeOfQueryObjectSortArray()
              Returns the size of the QueryObjectSortArray.
     int sizeOfQueryResultArray()
              Returns the size of the QueryResult array.
     int sizeOfQueryScopeArray()
              Returns the size of the QueryScope array
     void unsetQueryCondition()
              Deletes or unsets the "QueryCondition" element
     void unsetQueryScopeLevel()
              Deletes or unsets the "QueryScopeLevel" element.
     QueryScopeLevel xgetQueryScopeLevel()
              Internal Use Only.
     void xsetQueryScopeLevel(QueryScopeLevel queryScopeLevel)
              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

    getQueryResultArray

    QueryObject[] getQueryResultArray()

    Gets an array of query result objects for this Query instance. The query result object array is an array of QueryObject instances whose keys have been set to the keys of query result objects (Dimension, Detail or Measure instances) found in the Universe DataSourceSpecification.

    Returns:
    The array of query result objects for this Query

    getQueryResultArray

    QueryObject getQueryResultArray(int i)

    Gets the query result object stored at array location .i.

    Parameters:
    i - The index of the query result object to retrieve.
    Returns:
    A query result object as a QueryObject.

    sizeOfQueryResultArray

    int sizeOfQueryResultArray()
    Returns the size of the QueryResult array.

    Returns:
    The size of the QueryResult array.

    setQueryResultArray

    void setQueryResultArray(QueryObject[] queryResultArray)

    Sets an array of query result objects for this Query instance. The query result object array is an array of QueryObject instances whose keys have been set to the keys of query result objects (Dimension, Detail, or Measure instances) found in the Universe DataSourceSpecification.

    Parameters:
    queryResult - the array of query result objects for this Query

    setQueryResultArray

    void setQueryResultArray(int i,
                             QueryObject queryResult)

    Sets the query result object to array location i.

    Parameters:
    i - the index in the array at which to store the query result object.
    value - a query result object as a QueryObject.

    insertNewQueryResult

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

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

    addNewQueryResult

    QueryObject addNewQueryResult()
    Appends and returns a new empty value (as xml) as the last "QueryResult" element.

    Returns:
    S new empty value (as xml) as the last "QueryResult" element.

    removeQueryResult

    void removeQueryResult(int i)
    Removes the "QueryResult" element at the specified index position.

    Parameters:
    i - The index of the QueryResult element.

    getQueryScopeArray

    QueryObject[] getQueryScopeArray()

    Gets the array of query scope objects for this Query instance. The query scope object array is an array of QueryObject instances whose keys have been set to the keys of query scope objects found in the Hierarchy instances in the Universe DataSourceSpecification.

    Returns:
    the array of query scope objects for this Query instance

    getQueryScopeArray

    QueryObject getQueryScopeArray(int i)

    Gets the query scope object stored at array location i.

    Parameters:
    i - The index of the query scope object to retrieve.
    Returns:
    A query scope object as a QueryObject.

    sizeOfQueryScopeArray

    int sizeOfQueryScopeArray()
    Returns the size of the QueryScope array

    Returns:
    The size of the QueryScope array

    setQueryScopeArray

    void setQueryScopeArray(QueryObject[] queryScopeArray)

    Sets the array of query scope objects for this Query instance. The query scope object array is an array of QueryObject instances whose keys have been set to the keys of query scope objects found in the Hierarchy instances in the Universe DataSourceSpecification.

    Parameters:
    queryScope - the array of query scope objects for this Query instance

    setQueryScopeArray

    void setQueryScopeArray(int i,
                            QueryObject queryScope)

    Sets the query scope object to array location i.

    Parameters:
    i - The index in the array at which to store the query scope object.
    value - A query scope object as a QueryObject.

    insertNewQueryScope

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

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

    addNewQueryScope

    QueryObject addNewQueryScope()
    Appends and returns a new empty value (as xml) as the last "QueryScope" element

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

    removeQueryScope

    void removeQueryScope(int i)
    Removes the "QueryScope" element at the specified index position.

    Parameters:
    i - the index of the QueryScope element

    getQueryScopeLevel

    QueryScopeLevel.Enum getQueryScopeLevel()

    Gets the scope level for the query as a QueryScopeLevel object.

    Returns:
    the scope level for the query as a QueryScopeLevel object

    xgetQueryScopeLevel

    QueryScopeLevel xgetQueryScopeLevel()

    Internal Use Only.


    isSetQueryScopeLevel

    boolean isSetQueryScopeLevel()
    Checks if the "QueryScopeLevel" element has been set.

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

    setQueryScopeLevel

    void setQueryScopeLevel(QueryScopeLevel.Enum queryScopeLevel)

    Sets the scope level for the query as a QueryScopeLevel object.

    Parameters:
    queryScopeLevel - the scope level for the query as a QueryScopeLevel object

    xsetQueryScopeLevel

    void xsetQueryScopeLevel(QueryScopeLevel queryScopeLevel)

    Internal Use Only.


    unsetQueryScopeLevel

    void unsetQueryScopeLevel()
    Deletes or unsets the "QueryScopeLevel" element.


    getQueryObjectSortArray

    QueryObjectSort[] getQueryObjectSortArray()

    Gets the array of query sort objects for this Query instance. The query sort object array is an array of QueryObjectSort instances, which is inherited from QueryObject and has a member property SortType which defines QueryObjects Sort Type value.

    Returns:
    the array of query sort objects for this Query

    getQueryObjectSortArray

    QueryObjectSort getQueryObjectSortArray(int i)

    Gets the query sort object to array location i.

    Parameters:
    i - the index in the array at which to store the query sort object
    value - a query sort object as a QueryObjectSort

    sizeOfQueryObjectSortArray

    int sizeOfQueryObjectSortArray()
    Returns the size of the QueryObjectSortArray.

    Returns:
    the size of the QueryObjectSortArray.

    setQueryObjectSortArray

    void setQueryObjectSortArray(QueryObjectSort[] queryObjectSortArray)

    Sets the array of query sort objects for this Query instance. The query sort object array is an array of QueryObjectSort instances, which is inherited from QueryObject and has a member property SortType which defines QueryObjects Sort Type value.

    Parameters:
    QueryObjectSort - the array of query sort objects for this Query

    setQueryObjectSortArray

    void setQueryObjectSortArray(int i,
                                 QueryObjectSort queryObjectSort)

    Sets the query sort object to array location i.

    Parameters:
    i - the index in the array at which to store the query sort object
    value - a query sort object as a QueryObjectSort

    insertNewQueryObjectSort

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

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

    addNewQueryObjectSort

    QueryObjectSort addNewQueryObjectSort()
    Appends and returns a new empty value (as xml) as the last "QueryObjectSort" element

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

    removeQueryObjectSort

    void removeQueryObjectSort(int i)
    Removes the "QueryObjectSort" element at the specified index position.

    Parameters:
    i - the index of the QueryObjectSort element

    getQueryCondition

    QueryCondition getQueryCondition()

    Gets the query condition object for this Query instance. The query condition object array is an array of QueryCondition instances.

    Returns:
    the array of query condition objects for this Query instance

    isSetQueryCondition

    boolean isSetQueryCondition()
    Checks if the "QueryCondition" element has been set.

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

    setQueryCondition

    void setQueryCondition(QueryCondition queryCondition)

    Sets the query condition object for this Query instance. The query condition object array is an array of QueryCondition instances.

    Parameters:
    queryCondition - the array of query condition objects for this Query instance

    addNewQueryCondition

    QueryCondition addNewQueryCondition()
    Appends and returns a new empty "QueryCondition" element

    Returns:
    a new empty "QueryCondition" element

    unsetQueryCondition

    void unsetQueryCondition()
    Deletes or unsets the "QueryCondition" element