com.businessobjects.dsws.queryservice
Class QueryService

java.lang.Object
  extended by com.businessobjects.dsws.Consumer
      extended by com.businessobjects.dsws.queryservice.QueryService
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class QueryService
extends Consumer
implements java.io.Externalizable

The QueryService class provides the entry point for writing applications that use query web services. Before obtaining an instance of the QueryService class, you must first create Connection and Session objects. Once you have obtained Connection and Session objects, you then obtain a QueryService instance by passing the Session object and service URL for the QueryService to the QueryService.getInstance method.

The QueryService class provides services to list data sources and data providers of a document. It also provides the ability to create a new document, or modify or delete a document query.

Once you have obtained a QueryService instance, your next step depends on your particular work flow.

Creating a new query:
If you want to create a new query, and don't have a data source UID, you would use the getDataSourceList method to obtain a list of data sources. Then you would choose a data source, obtain its UID and use the getDataSource method to obtain a DataSourceSpecification instance. The DataSourceSpecification class contains information about the objects available in the chosen universe (data source). The next step is to create a QuerySpecification instance and use the information in the DataSourceSpecification instance to construct a QuerySpecification instance. Once you have created a QuerySpecification instance, the final step is to use the createDataProvider method to run the query. The DataProviderInformation instance returned by the createDataProvider method contains a document reference. You can use this document reference to work with the document using the Report Engine service.

Modifying an existing query:
To modify an existing query (or document), you use the getDataProviderInformation method to obtain the DataProviderInformation instance for a given document. You should also pass in true to return the QuerySpecification. You can then modify the QuerySpecification instance. Once you have modified a QuerySpecification instance, the final step is to use the modifyDataProvider method to run the query. The DataProviderInformation instance returned by the modifyDataProvider method contains a document reference. You can use this document reference to work with the document using the Report Engine service.

Example: Initializing a QueryService instance.

 URL objURLSession = new URL("http://boserver:port/dswsbobje/services/Session");
 Connection objConnection = new Connection(objURLSession);
 Session objSession = new Session(objConnection);

 EnterpriseCredential objEnterpriseCredential = EnterpriseCredential.Factory.newInstance();
 objEnterpriseCredential.setLogin("John");
 objEnterpriseCredential.setPassword("MyPassword1973");
 objEnterpriseCredential.setDomain("MyCMS");
 objEnterpriseCredential.setLocale("en_US");
 objEnterpriseCredential.setTimeZone("GMT+01:00");
 SessionInfo objSessionInfo = objSession.login(objEnterpriseCredential);

 String[] astrURLs = objSession.getAssociatedServicesURL("QueryService");

 // If no URL is returned, the service is not available
 if (astrURLs.length > 0)
 {
        QueryService objQueryService = QueryService.getInstance(objSession, astrURLs[0]);
 }
 

See the Business Objects web services Developer's Guide for further information on how to use the QueryService web service.

See Also:
Connection, AuthenticationCredential, Session, QuerySpecification, Serialized Form

Constructor Summary
QueryService()
          Instantiates a new QueryService object
QueryService(Connection objConnection, ConnectionState objConnectionState)
           Instantiates a new QueryService object using existing Connection and ConnectionState objects.
QueryService(java.lang.String strImplementation, ConnectionState objConnectionState)
          Internal Use Only.
 
Method Summary
 DataProviderInformation createDataProvider(java.lang.String dataSourceUID, QuerySpecification querySpecification, ReturnProperties returnProperties)
          The createDataProvider method is used to create a query (specified by the QuerySpecification parameter).
 DataProviderInformation createDataProvider(java.lang.String dataSourceUID, QuerySpecification querySpecification, ReturnProperties returnProperties, InputProperties inParams)
          The createDataProvider method is used to create a query (specified by the QuerySpecification parameter).
 java.lang.String deleteDataProvider(java.lang.String documentReference, java.lang.String dataProviderUID)
           The deleteDataProvider method deletes an existing data provider in a given document.
 DataProviderInformation getDataProviderInformation(java.lang.String documentReference, java.lang.String dataProviderUID, boolean includeQuerySpecification)
           The getDataProviderInformation method provides the DataProviderInformation for the document identified by documentReference and the data provider specified by dataProviderUID.
 DataProviderInformation[] getDataProviderList(java.lang.String documentReference, boolean includeQuerySpecification)
           The getDataProviderList method provides the list of DataProviderInformation objects for the document identified by documentReference.
 DataSourceSpecification getDataSource(java.lang.String dataSourceUID)
           The getDataSource method returns a DataSourceSpecification object that represents the universe.
 DataSource[] getDataSourceList()
           The getDataSourceList method provides the list of data sources on which you can perform a query.
static QueryService getInstance(Consumer objConsumer, java.lang.String strURL)
          GetInstance static method returns a QueryService by passing the Web Service URL and an already logged Consumer object.
 DataProviderInformation modifyDataProvider(java.lang.String documentReference, java.lang.String dataProviderUID, java.lang.String dataSourceUID, QuerySpecification querySpecification, ReturnProperties returnProperties)
           The modifyDataProvider method modifies an existing data provider in a given document.
 DataProviderInformation modifyDataProvider(java.lang.String documentReference, java.lang.String dataProviderUID, java.lang.String dataSourceUID, QuerySpecification querySpecification, ReturnProperties returnProperties, InputProperties inParams)
           The modifyDataProvider method modifies an existing data provider in a given document.
 void readExternal(java.io.ObjectInput in)
          Internal Use Only.
 void writeExternal(java.io.ObjectOutput out)
          Internal Use Only.
 
Methods inherited from class com.businessobjects.dsws.Consumer
CreateAxisFault, displayException, GetAxisFaultDetails, getConnection, getConnection, getConnectionState, getConsumer, getConsumer
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryService

public QueryService(java.lang.String strImplementation,
                    ConnectionState objConnectionState)
             throws AxisFault

Internal Use Only.

Throws:
AxisFault

QueryService

public QueryService(Connection objConnection,
                    ConnectionState objConnectionState)
             throws AxisFault

Instantiates a new QueryService object using existing Connection and ConnectionState objects. Before using this method, you must have valid Connection, ConnectionState, and Session objects.

Example: Initializing a QueryService instance.

 Connection objConnection = new Connection(objURLSession);
 SessionInfo objSessionInfo = objSession.Login(objEnterpriseCredential);
 String[] astrURLs = objSession.getAssociatedServicesURL("QueryService");

 if (astrURLs.length > 0)
 {
        objConnection.setURL(new URL(astrURLs[0]));
        QueryService objQueryService = new QueryService(objConnection, objSession.getConnectionState());
 }
 

Parameters:
objConnection - a valid Connection object with the URL set to the QueryService service.
objConnectionState - the ConnectionState of the current user session.
Throws:
AxisFault
See Also:
Connection, ConnectionState

QueryService

public QueryService()
Instantiates a new QueryService object

Method Detail

getInstance

public static QueryService getInstance(Consumer objConsumer,
                                       java.lang.String strURL)
                                throws AxisFault
GetInstance static method returns a QueryService by passing the Web Service URL and an already logged Consumer object.

Parameters:
objConsumer - one of the current user's consumer objects.
strURL - URL to connect to the QueryService web service.
Returns:
An instance of QueryService.
Throws:
DSWSException - Exception raised either as a Web Service SOAP Fault or as a Consumer side trapped exception.
Note:If the user is not logged in or the service name is unknown, NULL will be returned.

Example: Initializing a QueryService instance.

 URL objURLSession = new URL("http://boserver:port/dswsbobje/services/Session");
 Connection objConnection = new Connection(objURLSession);
 Session objSession = new Session(objConnection);

 EnterpriseCredential objEnterpriseCredential = EnterpriseCredential.Factory.newInstance();
 objEnterpriseCredential.setLogin("John");
 objEnterpriseCredential.setPassword("MyPassword1973");
 objEnterpriseCredential.setDomain("MyCMS");
 objEnterpriseCredential.setLocale("en_US");
 objEnterpriseCredential.setTimeZone("GMT+01:00");
 SessionInfo objSessionInfo = objSession.login(objEnterpriseCredential);
 String[] astrURLs = objSession.getAssociatedServicesURL("QueryService");

 if (astrURLs.length > 0)
 {
        QueryService objQueryService = QueryService.getInstance(objSession, astrURLs[0]);
 }
 
AxisFault
See Also:
Connection, AuthenticationCredential, Session

getDataSourceList

public DataSource[] getDataSourceList()
                               throws AxisFault

The getDataSourceList method provides the list of data sources on which you can perform a query. A data source represents a universe that you can use to build your query. Once you have obtained an array of DataSource objects, you use the getUID method to obtain the UID for the universe (data source) that you want to use to construct a query. You then pass the UID for the data source to the getDataSource method, which returns a DataSourceSpecification object that represents the universe. The DataSourceSpecification class contains all of the Detail, Dimension, Measure and PreConditionObject objects that you can use in a query.

Example: Using the getDataSourceList method to obtain a list of data sources:

 DataSource[] boUniverseList = objQueryService.getDataSourceList();
 String boUniverseUID = boUniverseList[4].getUID();
 DataSourceSpecification boUniverseSpec = objQueryService.getDataSource(boUniverseUID);
 

Returns:
an array of DataSource objects.
Throws:
AxisFault
See Also:
DataSource

getDataSource

public DataSourceSpecification getDataSource(java.lang.String dataSourceUID)
                                      throws AxisFault

The getDataSource method returns a DataSourceSpecification object that represents the universe. The DataSourceSpecification class contains all of the Detail, Dimension, Measure and PreConditionObject objects that you can use in a query.

Example: Using the getDataSource method to obtain a DataSourceSpecification:

 DataSource[] boUniverseList = objQueryService.getDataSourceList();
 String boUniverseUID = boUniverseList[4].getUID();
 DataSourceSpecification boUniverseSpec = objQueryService.getDataSource(boUniverseUID);
 

Parameters:
dataSourceUID - the UID of the DataSource (or Universe)
Returns:
the DataSourceSpecification for the Universe (data source) represented by the dataSourceUID
Throws:
AxisFault
See Also:
DataSourceSpecification, DataSource

getDataProviderList

public DataProviderInformation[] getDataProviderList(java.lang.String documentReference,
                                                     boolean includeQuerySpecification)
                                              throws AxisFault

The getDataProviderList method provides the list of DataProviderInformation objects for the document identified by documentReference. The DataProviderInformation class provides access to the QuerySpecification for a given document. As such, the getDataProviderList method is useful when you want to obtain an existing QuerySpecification for a document and then modify the QuerySpecification (or use it as a basis for a new document or query).

Parameters:
documentReference - The unique ID or document reference for the instance of a document. The documentReference can be retrieved using the BICatalog service or from a DocumentInformation object. The document reference can be either a UID or a document reference String.
includeQuerySpecification - A boolean that specifies whether the QuerySpecification attribute of the returned DataProviderInformation object should be filled.
Returns:
An array of DataProviderInformation objects.
Throws:
AxisFault
See Also:
DataProviderInformation, QuerySpecification

getDataProviderInformation

public DataProviderInformation getDataProviderInformation(java.lang.String documentReference,
                                                          java.lang.String dataProviderUID,
                                                          boolean includeQuerySpecification)
                                                   throws AxisFault

The getDataProviderInformation method provides the DataProviderInformation for the document identified by documentReference and the data provider specified by dataProviderUID. The DataProviderInformation class provides access to the QuerySpecification for a given document. As such, the getDataProviderInformation method is useful when you want to obtain an existing QuerySpecification for a document and then modify the QuerySpecification (or use it as a basis for a new document or query).

Parameters:
documentReference - The unique ID or document reference for the instance of a document. The documentReference can be retrieved using the BICatalog service or from a DocumentInformation object. The document reference can be either a UID or a document reference String.
dataProviderUID - The UID of the DataProviderInfo for which to retrieve the DataProviderInformation.
includeQuerySpecification - A boolean that specifies whether the QuerySpecification attribute of the returned DataProviderInformation object should be filled.
Returns:
the requested DataProviderInformation.
Throws:
AxisFault
See Also:
DataProviderInformation, QuerySpecification

createDataProvider

public DataProviderInformation createDataProvider(java.lang.String dataSourceUID,
                                                  QuerySpecification querySpecification,
                                                  ReturnProperties returnProperties,
                                                  InputProperties inParams)
                                           throws AxisFault
The createDataProvider method is used to create a query (specified by the QuerySpecification parameter). When the query is processed, a new document instance and data provider are created. The DataProviderInformation object that represents the created data provider is returned. The document reference for the created document instance can be obtained from the returned DataProviderInformation object. This method is used to create a new document instance and new data provider using a QuerySpecification. If you are creating a new query, this is the method that should be called once you have constructed a QuerySpecification object.

Parameters:
dataSourceUID - The UID of the DataSource (or universe) on which the query is to be performed.
querySpecification - The QuerySpecification instance that defines the query.
returnProperties - The ReturnProperties instance describing what is returned by this method call.
inParams - The InputProperties instance describing the input parameter to this method call.
Returns:
the DataProviderInformation object that represents the new data provider
Throws:
AxisFault
See Also:
DataProviderInformation, QuerySpecification

createDataProvider

public DataProviderInformation createDataProvider(java.lang.String dataSourceUID,
                                                  QuerySpecification querySpecification,
                                                  ReturnProperties returnProperties)
                                           throws AxisFault
The createDataProvider method is used to create a query (specified by the QuerySpecification parameter). When the query is processed, a new document instance and data provider are created. The DataProviderInformation object that represents the created data provider is returned. The document reference for the created document instance can be obtained from the returned DataProviderInformation object. This method is used to create a new document instance and new data provider using a QuerySpecification. If you are creating a new query, this is the method that should be called once you have constructed a QuerySpecification object.

Parameters:
dataSourceUID - The UID of the DataSource (or universe) on which the query is to be performed.
querySpecification - The QuerySpecification instance that defines the query.
returnProperties - The ReturnProperties instance describing what is returned by this method call.
Returns:
the DataProviderInformation object that represents the new data provider
Throws:
AxisFault
See Also:
DataProviderInformation, QuerySpecification

modifyDataProvider

public DataProviderInformation modifyDataProvider(java.lang.String documentReference,
                                                  java.lang.String dataProviderUID,
                                                  java.lang.String dataSourceUID,
                                                  QuerySpecification querySpecification,
                                                  ReturnProperties returnProperties,
                                                  InputProperties inParams)
                                           throws AxisFault

The modifyDataProvider method modifies an existing data provider in a given document. The QuerySpecification passed into this method as a parameter is used as the query specification for the modified data provider. Once the data provider is modified using the new query specification, the returned DataProviderInformation instance contains the information about the updated data provider and especially, the document reference for the modified document.

Parameters:
documentReference - The unique ID or document reference for the instance of a document. The documentReference can be retrieved using the BICatalog service or from a DocumentInformation object. The document reference can be either a UID or a document reference String.
dataProviderUID - The UID of the DataProviderInfo to be updated
dataSourceUID - The UID of the DataSource on which the query has to be performed
querySpecification - The specification of the updated query
returnProperties - The ReturnProperties instance describing what will actually be returned by this method call
inParams - The InputProperties instance describing the input parameter to this method call.
Returns:
the updated DataProviderInformation.
Throws:
AxisFault
See Also:
DataProviderInformation, QuerySpecification

modifyDataProvider

public DataProviderInformation modifyDataProvider(java.lang.String documentReference,
                                                  java.lang.String dataProviderUID,
                                                  java.lang.String dataSourceUID,
                                                  QuerySpecification querySpecification,
                                                  ReturnProperties returnProperties)
                                           throws AxisFault

The modifyDataProvider method modifies an existing data provider in a given document. The QuerySpecification passed into this method as a parameter is used as the query specification for the modified data provider. Once the data provider is modified using the new query specification, the returned DataProviderInformation instance contains the information about the updated data provider and especially, the document reference for the modified document.

Parameters:
documentReference - The unique ID or document reference for the instance of a document. The documentReference can be retrieved using the BICatalog service or from a DocumentInformation object. The document reference can be either a UID or a document reference String.
dataProviderUID - The UID of the DataProviderInfo to be updated
dataSourceUID - The UID of the DataSource on which the query has to be performed
querySpecification - The specification of the updated query
returnProperties - The ReturnProperties instance describing what will actually be returned by this method call
Returns:
the updated DataProviderInformation.
Throws:
AxisFault
See Also:
DataProviderInformation, QuerySpecification

deleteDataProvider

public java.lang.String deleteDataProvider(java.lang.String documentReference,
                                           java.lang.String dataProviderUID)
                                    throws AxisFault

The deleteDataProvider method deletes an existing data provider in a given document.

Parameters:
documentReference - The unique ID or document reference for the instance of a document. The documentReference can be retrieved using the BICatalog service or from a DocumentInformation object. The document reference can be either a UID or a document reference String.
dataProviderUID - The UID of the DataProviderInfo to be deleted
Returns:
the new document reference for the modified document
Throws:
AxisFault

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException

Internal Use Only.

Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException

Internal Use Only.

Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException