com.sas.entities.edit.models.providers
Class BusinessQueryDynamicValuesProvider

com.sas.entities.edit.models.providers.BusinessQueryDynamicValuesProvider
All Implemented Interfaces:
DynamicValuesProviderInterface

public class BusinessQueryDynamicValuesProvider
implements DynamicValuesProviderInterface

Provider of distinct formatted and unformatted values for a data item from an information map.

The ID of the data item and the path to the information map containing this data item are passed to the BusinessQueryDynamicValueProvider through its constructor. The values are retrieved by the getMapOfValues method.


Field Summary
static java.lang.String RB_KEY
           
 
Constructor Summary
BusinessQueryDynamicValuesProvider(java.lang.String mapPath, java.lang.String dataItemID, com.sas.iquery.metadata.business.DataItemActionType sortDirection, int maxValues)
          Constructs a new BusinessQueryDynamicValuesProvider.
 
Method Summary
 java.lang.String getDataItemID()
          Returns the ID of the data item to retrieve values for when the getMapOfValues method is called.
 java.util.Map getMapOfValues(java.lang.Object context)
          Returns a map of distinct data item unformatted\formatted value pairs from an information map.
 java.lang.String getMapPath()
          Returns the string representation of the path to the information map containing the data item to retrieve values for when the getMapOfValues method is called.
 int getMaxValues()
          Returns the maximum number of values returned from the getMapOfValues method, or -1 if all values should be returned.
 com.sas.iquery.metadata.business.DataItemActionType getSortDirection()
          Returns the DataItemActionType constant that determines how the values returned from the getMapOfValues method will be sorted.
static java.util.Map getValueMap(com.sas.iquery.dataretrieval.QueryConnectorInterface queryConnector, com.sas.services.session.SessionContextInterface sessionContext, java.lang.String mapPath, java.lang.String dataItemID, com.sas.iquery.metadata.business.DataItemActionType sortDirection, int maxValues)
          Returns a map of distinct unformatted\formatted value pairs for the specified data item ID and information map defined by the mapPath.
 

Field Detail

RB_KEY

public static final java.lang.String RB_KEY
See Also:
Constant Field Values
Constructor Detail

BusinessQueryDynamicValuesProvider

public BusinessQueryDynamicValuesProvider(java.lang.String mapPath,
                                          java.lang.String dataItemID,
                                          com.sas.iquery.metadata.business.DataItemActionType sortDirection,
                                          int maxValues)
Constructs a new BusinessQueryDynamicValuesProvider.

A default sort order of DataItemActionType.SORT_NONE will be used if the sortDirection argument is null. A value of -1 should be used for the maxValues argument to return all values for the data item.

Parameters:
mapPath - a string of the form SBIP://repository/root[/path]/mapName[(type)] used to construct a PathURL to the information map containing the data item to retrieve values for
dataItemId - the ID of the data item to retrieve values for
sortDirection - the DataItemActionType constant determining the sort order of the values returned
maxValues - the maximum number of values to return, or -1 to return all values
Method Detail

getDataItemID

public java.lang.String getDataItemID()
Returns the ID of the data item to retrieve values for when the getMapOfValues method is called.

Returns:
the ID of the data item to retrieve values for when the getMapOfValues method is called
See Also:
getMapOfValues(java.lang.Object)

getMapPath

public java.lang.String getMapPath()
Returns the string representation of the path to the information map containing the data item to retrieve values for when the getMapOfValues method is called. A valid map path must start with "SBIP://", have a repository name, a root tree name, and a map name. It may also have a path, and a type.

Returns:
a string of the form SBIP://repository/root[/path]/mapName[(type)] used to construct a PathURL to the information map
See Also:
getMapOfValues(java.lang.Object)

getSortDirection

public com.sas.iquery.metadata.business.DataItemActionType getSortDirection()
Returns the DataItemActionType constant that determines how the values returned from the getMapOfValues method will be sorted. Possible values are DataItemActionType.SORT_DESCENDING, DataItemActionType.SORT_ASCENDING, and DataItemActionType.SORT_NONE.

Returns:
the DataItemActionType constant determining the sort order of the values returned from the getMapOfValues method
See Also:
getMapOfValues(java.lang.Object)

getMaxValues

public int getMaxValues()
Returns the maximum number of values returned from the getMapOfValues method, or -1 if all values should be returned.

Returns:
the maximum number of values to return, or -1 to return all values
See Also:
getMapOfValues(java.lang.Object)

getMapOfValues

public java.util.Map getMapOfValues(java.lang.Object context)
Returns a map of distinct data item unformatted\formatted value pairs from an information map. The data item id and information map path used are those that were specified when this BusinessQueryDynamicValueProvider was constructed. The keys in the Map are the unformatted values and the values are the formatted values. An IllegalStateException is thrown if any error occurs while retrieving values.

The specified context must be an Object[] containing a valid SessionContextInterface as the first item in the array and a QueryConnectorInterface as the second item in the array. If the second item (the QueryConnectorInterface) is null, then a new QueryConnector with a connection lifetime of ACQUIRE_RELEASE will be used.

Specified by:
getMapOfValues in interface DynamicValuesProviderInterface
Parameters:
context - an Object[] containing a SessionContextInterface as the first item and a QueryConnectorInterface (or null) as the second item
Returns:
a map of distinct data item unformatted\formatted value pairs from an information map
Throws:
java.lang.IllegalStateException - if an error occurs while obtaining the data item values
See Also:
getMapPath(), getDataItemID(), #getMapSortDirection, getMaxValues()

getValueMap

public static java.util.Map getValueMap(com.sas.iquery.dataretrieval.QueryConnectorInterface queryConnector,
                                        com.sas.services.session.SessionContextInterface sessionContext,
                                        java.lang.String mapPath,
                                        java.lang.String dataItemID,
                                        com.sas.iquery.metadata.business.DataItemActionType sortDirection,
                                        int maxValues)
                                 throws com.sas.iquery.intelligentquery.IntelligentQueryException,
                                        com.sas.iquery.execution2.ExecutionException,
                                        com.sas.iquery.metadata.MetadataException,
                                        java.sql.SQLException
Returns a map of distinct unformatted\formatted value pairs for the specified data item ID and information map defined by the mapPath. The keys in the Map are the unformatted values and the values are the formatted values.

Parameters:
queryConnector -
sessionContext - The session to use to perform this function within the context of.
mapPath - a string of the form SBIP://repository/root[/path]/mapName[(type)] used to construct a PathURL to the information map
dataItemID - the ID of the dataItem to return the values for
sortDirection - the sort order of the returned values
maxValues - the max number of values to return; -1 to return all values
service - An IQ metadata service containing IQ's configuration/knowledge/etc.
Returns:
a map of distinct unformatted\formatted value pairs
Throws:
com.sas.iquery.intelligentquery.IntelligentQueryException
com.sas.iquery.execution2.ExecutionException
com.sas.iquery.metadata.MetadataException
com.sas.iquery.dataservices.DataServicesException
java.sql.SQLException



Copyright © 2009 SAS Institute Inc. All Rights Reserved.