***  This class is subject to change   ***

com.sas.iquery.metadata.business
Interface BusinessQuery

All Superinterfaces:
PropertyChangeListenee,
All Known Subinterfaces:
DataSelection,
All Known Implementing Classes:

public interface BusinessQuery
extends com.sas.iquery.intelligentquery.IntelligentQueryInterface, java.beans.PropertyChangeListener, PropertyChangeListenee

Specifies the interface that models the information that is necessary to request a result set based on business items that are contained in business models that are managed by the Intelligent Query Metadata Service. The BusinessQuery helps define and manipulate a query based on business metadata. It supports multiple views and the ability to let each view be notified when the model changes.

Relational sorting of data items

Sort Direction

To specify how a particular data item's values are to be sorted, one may specify the sort direction for the data item. The sort direction attribute for a DataItemReference is inherited from its parent (base) data item if it is not explicitly set (overridden) in the DataItemReference.

Sort Order Precedence

To specify the precedence order of the data items to be sorted on, one may specify the "sort order precedence" list of data items for a business query.

OLAP Sorting for a business query

Sorting is applied to either a data item or a business query. Sorting is applied to the data item using methods in the DataItem class.

The sort criteria is defined for a data item is based either on the value of category data item label or the value of a measure defined in the definition of that category.

The sort criteria is defined for a business query is based on the value of a measure in the crossing of a set or tuples (which would generate a MDX phrase:

         CROSSJOIN({[TIME].[YEAR].MEMBERS}, {[GEOGRAPHIC].[COUNTRY].MEMBERS}),  [Measures].[ACTUAL_AVG], DESC) ) ON ROWS.
         

This type of sort would be achieved by defining the following:

 
                         List sortCriteria = new ArrayList();
                         String[]  measures = { measure };<<== where name is [ACTUAL_AVG]
                         sortCriteria.put(measures);
                         businessQuery.setSortCriteria(sortCriteria,com.sas.iquery.metadata.business.Role.ROW)
                         businessQuery.setSortDirection(BusinessQueryActionType.SORT_HIERARCHY_DESCENDING, com.sas.iquery.metadata.business.Role.ROW);

If sorting has been defined for both a data item and a business query, both will be honored if the BusinessQueryProperty.BUSINESS_QUERY_OLAP_SORT_PRECEDENCE property has been set to FALSE. If we applied the following:

businessQuery.setQueryProperty(BusinessQueryProperty.BUSINESS_QUERY_OLAP_SORT_PRECEDENCE, true);

then, we would generate a MDX phrase:

         generate ( ORDER([TIME].[YEAR].MEMBERS, [TIME].CURRENTMEMBER.NAME, bdesc),
         CrossJoin ( {[TIME].CURRENTMEMBER  },
         order( [GEOGRAPHIC].[COUNTRY].MEMBERS, [Measures].[ACTUAL_SUM],BDESC) ) )
         

OLAP Filtering for a business query

Business Query can be filtered by a particular value threshold in a measure, a particular value range or list in a catergory, or a particular ranking of value in a measure. This filtering is performed by applying steps to a business query. To determine out how steps can be applied to a business query for OLAP filtering and ranking, see com.sas.iquery.metadata.business.step.

OLAP Totaling

Totaling is applied for a business query for displayed member of a category. Aggregation returns a calculated value using the appropriate aggregate function, based on the aggregation type of the members being used. The Totals definition is defined as follows: Using the "Country" member of the "Geographic" dimension, a calculated member called [Geographic].[Total] is displayed first against the defined measures (in the order that they have been defined in the business model). Therefore, in the case of "Sales_Sum" , total is calculated by adding (with Sum). In the case of "Sales_Max" total is calculated by taking the maximum.

The type of totaling that can be applied are:

Unless otherwise noted, all getter/setter method pairs do not copy their outputs or inputs, respectively. That is, if one calls the setter method and immediately calls the getter method for that same attribute, the object that was just given on the setter method will be returned by the getter. The only general exception to this rule, which is not documented further on the getter/setter methods, is when the output or input is a List, in which case the List is copied but the contents of the list are not copied. (A shallow copy of the List is made in both the setter and getter methods).


Field Summary
static String ALLTOTAL
          This totalling action defines if either all rows or columns will be subtotaled and grandtotaled for a business model.
static String EVENT_EMPTY_DATA_FORMAT_CHANGED
          This event is fired when the empty data format has changed.
static String EVENT_FILTERS_CHANGED
          This event is fired when the list of filters has changed.
static String EVENT_QUERY_DEFINITION_CHANGED
          This event is fired when a change to an object has occurred that may cause query results to change from prior to the object change.
static String EVENT_QUERY_PROPERTY_CHANGED
          This event is fired when a query property has changed.
static String EVENT_REFERENCED_OBJECT_CHANGED
          This event is fired when any BusinessModelObject referenced by this BusinessQuery has changed.
static String EVENT_RESULT_ITEM_LIST_CHANGED
          This event is fired when the set of result items has changed.
static String EVENT_RESULT_ITEM_ROLE_CHANGED
          This event is fired when the role of a result item has changed.
static String EVENT_SOLVE_ORDER_CHANGED
          This event is fired when the solve order has changed.
static String EVENT_SORT_CRITERIA_CHANGED
          This event is fired when the OLAP sort criteria has changed.
static String EVENT_SORT_DIRECTION_CHANGED
          This event is fired when the OLAP sort direction has changed.
static String EVENT_SORT_ORDER_CHANGED
          This event is fired when the sort order precedence list has changed.
static String EVENT_STEPS_CHANGED
          This event is fired when the step list has changed.
static String EVENT_SUPPORTED_ACTION_CHANGED
          This event is fired when the list of supported actions has changed.
static String EVENT_TOTAL_CHANGED
          This event is fired when totaling has been changed.
static String EVENT_TOTAL_LABEL_CHANGED
          This event is fired when a total label has been changed.
static String GRANDTOTAL
          This action defines if grand totaling is applied to outermost dimension for a business model.
static String SUBTOTAL
          This action defines if either all innermost rows or columns will be subtotaled for a business model.
static String TOTAL_NONE
          This action defines if neither rows or columns will be totaled for a business model.
 
Method Summary
 void addResultItem(DataItem dataItem, Role role)
          Adds a data item with the specified role to the set of data items contained in this business query that make up the requested results (called the result item list).
 void addResultItems(List dataItems, Role role)
          Adds a list of data items with the specified role to the set of data items contained in this business query that make up the requested results (called the result item list).
 void addStep(StepInterface step, Role stepRole)
          This method adds a Step to the ordered list of Steps that will be applied to a business query for a specific role.
 BusinessModel getBusinessModel()
          Returns the most extended business model object referenced by business items in this business query.
 String getEmptyDataFormat()
          Returns the replacement string to be used (in a resultset generated from this query) for empty data.
 com.sas.entities.EntityInterface getEntity()
          Returns a "rolled-up" entity containing all of the prompts referenced by the business items used in this BusinessQuery.
 List getFilters()
          Returns the list of FilterItem objects last set on this object via setFilters()
 StructureOfData getInputStructure()
          Returns an indication as to the type or structure of the data used as input to this query.
 BusinessQuery getParentQuery()
          Returns the parent query for this BusinessQuery
 boolean getQueryProperty(BusinessQueryProperty prop)
          Returns the value of a specified query property.
 List getReasonsNotValid()
          Returns a list of reasons why this object is not a valid business query.
 Role getResultItemRole(DataItem dataItem)
          Returns the role for the given data item contained in the result item list.
 List getResultItems()
          Returns the list of data items contained in the result item list of this business query.
 List getResultItems(Role withThisRole)
          Returns the list of data items contained in the result item list of this business query that have been assigned the given role.
 int getResultSetIndex(String dataItemID)
          Returns the column index in the resultset for the data item (contained in the result items list) with the given ID.
 List getSortCriteria(Role businessSortRole)
          This method gets the list of elements that are used to sort (order) on that was applied to this Business Query using the setSortCriteria method.
 BusinessQueryActionType getSortDirection(Role businessSortRole)
          This method gets the BusinessQueryActionType that describes the type of sorting that will be applied to this Business Query using the setSortDirection method.
 List getSortOrderPrecedence()
          This method gets the list of DataItems that was last set via setSortOrderPrecedence which specifies a precedence amongst a set of data items.
 StepInterface getStep(int stepNumber, Role stepRole)
          This method returns Step that has been applied to a business query for a specific role.
 List getSteps(Role stepRole)
          This method returns an ordered list of Steps that will be applied to a business query for a specific role.
 String getTotalLabel(Role businessTotalRole, String typeOfTotal)
          This method gets the total label used for all totaling rows or columns in a businesss query.
 String getTotalType(Role businessTotalRole)
          This method gets the type of totaling that has been applied to a business query.
 List getValidActions()
          Returns a List of (BusinessQueryActionType) elements.
 void insertResultItemsAt(DataItem dataItem, Role role, int index)
          Inserts the specified a data item with the specified role to the set of data items contained in this business query that make up the requested results.
 boolean isActionSupported(BusinessQueryActionType actionType)
          Returns whether or not the specified BusinessQueryActionType is currenly supported by the BusinessQuery.
 boolean isValid()
          Returns whether this business query passes a set of base checks determining whether it is valid.
 void removeResultItem(DataItem dataItem)
          Removes the specified data item from the set of result items contained in this object.
 void removeResultItems(List dataItems)
          Removes a list of data items from the list of data items contained in this business query that make up the requested results (called the result item list).
 void removeStep(int stepNumber, Role stepRole)
          This method removes a Step to the ordered list of Steps that will be applied to a business query for a specific role.
 void setActionSupported(BusinessQueryActionType actionType, boolean actionSupported)
          Sets whether or not the specified BusinessQueryActionType is supported for this BusinessQuery.
 void setEmptyDataFormat(String replacementString)
          This method specifies the replacement string to be used (in a resultset generated from this query) for empty data.
 void setFilters(List filters)
          Sets the List of FilterItem objects on this business query to limit the results when this query is run.
 void setQueryProperty(BusinessQueryProperty prop, boolean value)
          Sets the value of the specified query property in this object.
 void setResultItemRole(DataItem dataItem, Role role)
          Sets the role for the given data item contained in the result item list.
 void setResultItems(List dataItems)
          Sets the list of data items to use in the result item list.
 void setSortCriteria(List sortCriteria, Role businessSortRole)
          This method sets a list that contains the elements that will be used to sort (order) on.
 void setSortDirection(BusinessQueryActionType sortDirection, Role businessSortRole)
          This method sets the BusinessQueryActionType that describes the type of sorting that will be applied to this BusinessQuery.
 void setSortOrderPrecedence(List sortOrderPrecedence)
          This method sets the Sort Order Precedence for this query to the set of given data items.
 void setSteps(List steps, Role stepRole)
          This method sets an ordered list of Steps that will be applied to a business query for a specific role.
 void setTotalLabel(String totalLabel, Role businessTotalRole, String typeOfTotal)
          This method sets a total label for all totaling rows or columns in a businesss query.
 void setTotalType(String totalingType, Role businessTotalRole)
          This method sets the type of totaling that will be included in the resulting set of members defined as in a row or a column.
 Element write(Element parentElement)
          Serializes this model as a sub-element to the given DOM element and returns the subelement representing this model.
 
Methods inherited from interface java.beans.PropertyChangeListener
propertyChange
 
Methods inherited from interface com.sas.iquery.metadata.PropertyChangeListenee
addListener, getListeners, removeListener
 

Field Detail

EVENT_RESULT_ITEM_ROLE_CHANGED

public static final String EVENT_RESULT_ITEM_ROLE_CHANGED
This event is fired when the role of a result item has changed.

EVENT_RESULT_ITEM_LIST_CHANGED

public static final String EVENT_RESULT_ITEM_LIST_CHANGED
This event is fired when the set of result items has changed.

EVENT_FILTERS_CHANGED

public static final String EVENT_FILTERS_CHANGED
This event is fired when the list of filters has changed.

EVENT_SORT_ORDER_CHANGED

public static final String EVENT_SORT_ORDER_CHANGED
This event is fired when the sort order precedence list has changed.

EVENT_TOTAL_CHANGED

public static final String EVENT_TOTAL_CHANGED
This event is fired when totaling has been changed.

EVENT_TOTAL_LABEL_CHANGED

public static final String EVENT_TOTAL_LABEL_CHANGED
This event is fired when a total label has been changed.

EVENT_SORT_DIRECTION_CHANGED

public static final String EVENT_SORT_DIRECTION_CHANGED
This event is fired when the OLAP sort direction has changed.

EVENT_SORT_CRITERIA_CHANGED

public static final String EVENT_SORT_CRITERIA_CHANGED
This event is fired when the OLAP sort criteria has changed.

EVENT_SOLVE_ORDER_CHANGED

public static final String EVENT_SOLVE_ORDER_CHANGED
This event is fired when the solve order has changed.

EVENT_STEPS_CHANGED

public static final String EVENT_STEPS_CHANGED
This event is fired when the step list has changed.

EVENT_QUERY_PROPERTY_CHANGED

public static final String EVENT_QUERY_PROPERTY_CHANGED
This event is fired when a query property has changed.

EVENT_SUPPORTED_ACTION_CHANGED

public static final String EVENT_SUPPORTED_ACTION_CHANGED
This event is fired when the list of supported actions has changed.

EVENT_EMPTY_DATA_FORMAT_CHANGED

public static final String EVENT_EMPTY_DATA_FORMAT_CHANGED
This event is fired when the empty data format has changed.

EVENT_REFERENCED_OBJECT_CHANGED

public static final String EVENT_REFERENCED_OBJECT_CHANGED
This event is fired when any BusinessModelObject referenced by this BusinessQuery has changed. This means that of the objects that have been set on the BusinessQuery interface, one of those objects' definitions has changed.

EVENT_QUERY_DEFINITION_CHANGED

public static final String EVENT_QUERY_DEFINITION_CHANGED
This event is fired when a change to an object has occurred that may cause query results to change from prior to the object change. This event may be used to monitor whether a query's definition has changed since last producing a resultset from the query.

ALLTOTAL

public static final String ALLTOTAL
This totalling action defines if either all rows or columns will be subtotaled and grandtotaled for a business model.

SUBTOTAL

public static final String SUBTOTAL
This action defines if either all innermost rows or columns will be subtotaled for a business model.

TOTAL_NONE

public static final String TOTAL_NONE
This action defines if neither rows or columns will be totaled for a business model.

GRANDTOTAL

public static final String GRANDTOTAL
This action defines if grand totaling is applied to outermost dimension for a business model.
Method Detail

getParentQuery

public BusinessQuery getParentQuery()
Returns the parent query for this BusinessQuery
Returns:
the parent query for this BusinessQuery or null if none exists

getFilters

public List getFilters()
Returns the list of FilterItem objects last set on this object via setFilters()
Returns:
List of FilterItem objects.
See Also:
setFilters(java.util.List)

setFilters

public void setFilters(List filters)
                throws MetadataException
Sets the List of FilterItem objects on this business query to limit the results when this query is run.

Property change events signaled:

Parameters:
filters - List of FilterItem objects to be set on this business query
Throws:
MetadataException - if the operation could not be performed
See Also:

getQueryProperty

public boolean getQueryProperty(BusinessQueryProperty prop)
Returns the value of a specified query property.

When a business query is initially created, all properties are initialized to a "false" value.

Parameters:
prop - specifies the query property whose value is to be returned.
Returns:
The value of the query property
See Also:
setQueryProperty(BusinessQueryProperty, boolean)

setQueryProperty

public void setQueryProperty(BusinessQueryProperty prop,
                             boolean value)
                      throws MetadataException
Sets the value of the specified query property in this object.

Property change events signaled:

Parameters:
prop - The query property whose value is to be changed.
value - The value to change the the query property to.
Throws:
MetadataException - if the operation could not be performed

getEmptyDataFormat

public String getEmptyDataFormat()
Returns the replacement string to be used (in a resultset generated from this query) for empty data.
Returns:
the value of the replacement string to use when empty data is found
See Also:
setEmptyDataFormat(java.lang.String)

setEmptyDataFormat

public void setEmptyDataFormat(String replacementString)
                        throws MetadataException
This method specifies the replacement string to be used (in a resultset generated from this query) for empty data.

Property change events signaled:

Parameters:
replacementString - The value used to represent empty data in a ResultSet.
See Also:
getEmptyDataFormat()

getInputStructure

public StructureOfData getInputStructure()
Returns an indication as to the type or structure of the data used as input to this query. The returned object gives information like whether the input data is OLAP, relational, both, etc. The returned object does not give any indication on the type of data in the resultset when this query is run.
Returns:
an object describing the type of data *referenced* when this query is run.

addResultItem

public void addResultItem(DataItem dataItem,
                          Role role)
                   throws MetadataException
Adds a data item with the specified role to the set of data items contained in this business query that make up the requested results (called the result item list).

Property change events signaled:

Parameters:
dataItem - The data item to add to the result item list
role - The role that the data item plays in the business query. If this is null no role is associated with the result item and a default role will be determined when this business query is run.
Throws:
MetadataException - if the operation could not be performed

addResultItems

public void addResultItems(List dataItems,
                           Role role)
                    throws MetadataException
Adds a list of data items with the specified role to the set of data items contained in this business query that make up the requested results (called the result item list).

Property change events signaled:

Parameters:
dataItems - a list of DataItem objects to add to the result item list
role - The role that the data items play in the business query. If this is null no role is associated with the specified data items and default roles will be determined when this business query is run.
Throws:
MetadataException - if the operation could not be performed

insertResultItemsAt

public void insertResultItemsAt(DataItem dataItem,
                                Role role,
                                int index)
                         throws MetadataException
Inserts the specified a data item with the specified role to the set of data items contained in this business query that make up the requested results. Each data item in the list with an index greater or equal to the specified index is shifted upward to have an index one greater than the value it had previously. The index must be a value greater than or equal to 0. (If the index is equal to the current size of the list, the data item is append to the end of the list.)

Property change events signaled:

Parameters:
dataItem - The data item to add to the result item list
role - The role that the data item plays in the business query. If this is null no role is associated with the result item and a default role will be determined when this business query is run.
index - where to insert the data item.
Throws:
MetadataException - if the operation could not be performed
IllegalArgumentException - if the data item is null or the index is less then zero

removeResultItem

public void removeResultItem(DataItem dataItem)
                      throws MetadataException
Removes the specified data item from the set of result items contained in this object. If the data item is not a result item, no action is taken.

Property change events signaled:

Parameters:
dataItem - a data item object to remove from the result item list
Throws:
MetadataException - if the operation could not be performed

removeResultItems

public void removeResultItems(List dataItems)
                       throws MetadataException
Removes a list of data items from the list of data items contained in this business query that make up the requested results (called the result item list). Any dataItems not contained in the result item list cause no action to be taken.

Property change events signaled:

Parameters:
dataItems - a list of DataItem objects to be removed from the result item list
Throws:
MetadataException - if the operation could not be performed

setResultItems

public void setResultItems(List dataItems)
                    throws MetadataException
Sets the list of data items to use in the result item list. Any previous items in that list are removed from the list of result items contained within this query. No roles are specified for the

Property change events signaled:

Parameters:
dataItems - a list of data items to set in the result item list
Throws:
MetadataException - if the operation could not be performed

getResultItems

public List getResultItems()
Returns the list of data items contained in the result item list of this business query.
Returns:
a list of DataItem objects

getResultItems

public List getResultItems(Role withThisRole)
                    throws MetadataException
Returns the list of data items contained in the result item list of this business query that have been assigned the given role.
Returns:
a list of DataItem objects
Throws:
MetadataException - if the operation could not be performed

getResultItemRole

public Role getResultItemRole(DataItem dataItem)
                       throws MetadataException
Returns the role for the given data item contained in the result item list. If the data item is inherited from a parent query but not returned in this query then the role will be returned as HIDDEN.
Returns:
a Role for the given data item in this business query or null if no role was specified when the data item was added as a result item, in which case a default role for the result item is determined when this business query is run.
Throws:
MetadataException - if the given data item is not in the result item list

setResultItemRole

public void setResultItemRole(DataItem dataItem,
                              Role role)
                       throws MetadataException
Sets the role for the given data item contained in the result item list.

Property change events signaled:

Parameters:
dataItem - a Role for the given data item in this business query
Throws:
MetadataException - if the given data item is not in the result item list

addStep

public void addStep(StepInterface step,
                    Role stepRole)
             throws MetadataException
This method adds a Step to the ordered list of Steps that will be applied to a business query for a specific role.

Property change events signaled:

Parameters:
step - The step to be added to the StepManager
stepRole - The role (either Column or Row) where step will be applied.

getStep

public StepInterface getStep(int stepNumber,
                             Role stepRole)
This method returns Step that has been applied to a business query for a specific role. A CompoundStep can contain CompoundSteps or Steps, but can't directly or indirectly contain itself.
Parameters:
stepNumber -  
stepRole - The role (either Column or Row) where step will be applied.
Returns:
a Step

getSteps

public List getSteps(Role stepRole)
This method returns an ordered list of Steps that will be applied to a business query for a specific role. A CompoundStep can contain CompoundSteps or Steps, but can't directly or indirectly contain itself.
Parameters:
stepRole - The role (either Column or Row) where step will be applied.
Returns:
An ordered list of Steps

setSteps

public void setSteps(List steps,
                     Role stepRole)
              throws MetadataException
This method sets an ordered list of Steps that will be applied to a business query for a specific role. A CompoundStep can contain CompoundSteps or Steps, but can't directly or indirectly contain itself.

Property change events signaled:

Parameters:
steps - the list of steps
stepRole - The role (either Column or Row) where step will be applied.
Throws:
MetadataException -  

removeStep

public void removeStep(int stepNumber,
                       Role stepRole)
                throws MetadataException
This method removes a Step to the ordered list of Steps that will be applied to a business query for a specific role.

Property change events signaled:

Parameters:
stepNumber -  
stepRole -  
Throws:
MetadataException -  

getValidActions

public List getValidActions()
Returns a List of (BusinessQueryActionType) elements. This list contains all all the Action Types that could be valid for this BusinessQuery. This differs from the getActionsSupported method in that this list does not define the set of Action that are currently supported by the BusinessQuery, but rather the list of Actions that can optionally be turned on or off. If an Action does not appear in this list then the consumer does not have the option of controlling this Action.
Returns:
List (of type BusinessQueryActionType) of valid Action Types.

isActionSupported

public boolean isActionSupported(BusinessQueryActionType actionType)
Returns whether or not the specified BusinessQueryActionType is currenly supported by the BusinessQuery. This method is used by consumers to determine whether an Action should be enabled.
Parameters:
actionType - The type of BusinessQuery Action that is being queried.
Returns:
A boolean indicating whether a particular Action is supported for this BusinessQuery.

setActionSupported

public void setActionSupported(BusinessQueryActionType actionType,
                               boolean actionSupported)
                        throws MetadataException
Sets whether or not the specified BusinessQueryActionType is supported for this BusinessQuery. Typically any Action can be disabled, but only the Action returned from the getValidActionTypes method can be enabled.

Property change events signaled:

Parameters:
actionType - The type of BusinessQuery Action to enable or disable
actionSupported - A boolean indicating whether to enable or disable the BusinessQuery Action
Throws:
MetadataException - when trying to set an action to be supported when not in the valid list of supported actions

getSortOrderPrecedence

public List getSortOrderPrecedence()
This method gets the list of DataItems that was last set via setSortOrderPrecedence which specifies a precedence amongst a set of data items.

Returns:
the user set list of data items defining the sort order precedence
See Also:

setSortOrderPrecedence

public void setSortOrderPrecedence(List sortOrderPrecedence)
                            throws MetadataException
This method sets the Sort Order Precedence for this query to the set of given data items.

Property change events signaled:

Parameters:
sortOrderPrecedence - a list a DataItem objects providing sort precedence
Throws:
MetadataException - when the action is not supported
See Also:

getSortDirection

public BusinessQueryActionType getSortDirection(Role businessSortRole)
This method gets the BusinessQueryActionType that describes the type of sorting that will be applied to this Business Query using the setSortDirection method. To define a sucessful sort, both a sort direction and a sort criteria must be specified.

Sort directions that can be retrieved are:

Note: This method is specifically used to perform ordering for OLAP. This method is not used for relational business model. If businessSortRole is null, COLUMN is assumed. If an invalid Role is presented to this method, an error will be displayed and an SORT_NONE is returned. The valid sortDirection arguments that can be returned are:

Property change events signaled:

Parameters:
businessSortRole - Defines whether this sort applied to a row or column.
Returns:
the type of sorting that will be applied to this Business Query.
See Also:
setSortDirection(BusinessQueryActionType, Role), setSortCriteria(java.util.List, Role)

setSortDirection

public void setSortDirection(BusinessQueryActionType sortDirection,
                             Role businessSortRole)
                      throws MetadataException
This method sets the BusinessQueryActionType that describes the type of sorting that will be applied to this BusinessQuery. Only BusinessQueryActionTypes that are categorized as SORT and returned by getValidActions can be used in this method.

Note: This method is specifically used to perform ordering for OLAP. This method is not used for relational business model. There is no validation that occurs on the items defined in the sort criteria list. "Order" will arranges members of a specified set, optionally preserving or breaking the hierarchy. There are two varieties of Order: hierarchized (ASC or DESC) and nonhierarchized (BASC or BDESC, where B stands for Break hierarchy). The hierarchized ordering first arranges members according to their position in the hierarchy. Then it orders each level. The nonhierarchized ordering arranges members in the set without regard to the hierarchy.

Valid sortDirection arguments are:

To define a sucessful sort, both a sort direction and a sort criteria must be specified.

Property change events signaled:

Parameters:
sortDirection - the type of sorting that will be applied to this query.
businessSortRole - Defines whether this sort applied to a row or column. If businessSortRole is null, COLUMN is assumed.
Throws:
MetadataException - when the action is not supported
IllegalArgumentException - when either a invalid sortDirection or invalid businessSortRole is applied.
See Also:
getSortDirection(Role), setSortCriteria(List, Role)

getTotalType

public String getTotalType(Role businessTotalRole)
This method gets the type of totaling that has been applied to a business query. The type of totaling that will be returned are:
Parameters:
businessTotalRole - define whether this totaling is being set for a row or a column. If businessTotalRole is null, COLUMN is assumed.
Returns:
totalingType the type of totaling that was applied to query.

setTotalType

public void setTotalType(String totalingType,
                         Role businessTotalRole)
                  throws MetadataException
This method sets the type of totaling that will be included in the resulting set of members defined as in a row or a column. This is performed using MDX function called "Aggregation". Aggregation returns a calculated value using the appropriate aggregate function, based on the aggregation type of the members being used. The Totals definition is defined as follows: Using the "Country" member of the "Geographic" dimension, a calculated member called [Geographic].[Total] is displayed first against the defined measures (in the order that they have been defined in the business model). Therefore, in the case of "Sales_Sum" , total is calculated by adding (with Sum). In the case of "Sales_Max" total is calculated by taking the maximum.

Note: Several other methods will be added to support totaling in the future such as setTotalStyle (set label and formatting of the total row or column) and setTotalAggregation set aggregation factor).

The type of totaling applied can be:

Property change events signalled:

Parameters:
totalingType - the type of totaling that will be applied to this query.
businessTotalRole - define whether this totaling is being set for a row or a column. If businessTotalRole is null, COLUMN is assumed.
Throws:
MetadataException - when the action is not supported
IllegalArgumentException - when a businessTotalRole is applied.

getTotalLabel

public String getTotalLabel(Role businessTotalRole,
                            String typeOfTotal)
This method gets the total label used for all totaling rows or columns in a businesss query.

Note: If businessTotalRole is null, COLUMN is assumed. If an invalid Role is presented to this method, an error will be displayed and an empty string will be returned.

Parameters:
businessTotalRole - define whether this totaling is being set for a row or a column. If businessTotalRole is null, COLUMN is assumed.
typeOfTotal - defines whether total label will be applied to subtotal or grandtotal label.
Returns:
label defines label that is be used.

setTotalLabel

public void setTotalLabel(String totalLabel,
                          Role businessTotalRole,
                          String typeOfTotal)
                   throws MetadataException
This method sets a total label for all totaling rows or columns in a businesss query. If no total label has been set, the default label that will be used is the combination of the dataItem plus the constant of "Total". If a specific total label for a dataitem needs to be set, use the method called "DataItem.setTotalLabel(String totalLabel)" to set a total label for a specific dataitem.

Note: This method may be deprecated for another method that will apply a full style name string pair. This pair would apply items such as labeling and formating (color, font, etc.)

Property change events signaled:

Parameters:
totalLabel - defines label that will be used.
businessTotalRole - define whether this totaling is being set for a row or a column. If businessTotalRole is null, COLUMN is assumed.
typeOfTotal - defines whether total label will be applied to subtotal or grandtotal label.
Throws:
IllegalArgumentException - when a businessTotalRole is applied.

getSortCriteria

public List getSortCriteria(Role businessSortRole)
This method gets the list of elements that are used to sort (order) on that was applied to this Business Query using the setSortCriteria method. This list can contain a specific measure or a specific member/level of a dimension.

Note: If businessSortRole is null, COLUMN is assumed. If an invalid Role is presented to this method, an error will be displayed and an empty list will be returned.

Note: This method is specifically used to perform ordering for OLAP. This method is not used for relational business model.

Parameters:
businessSortRole - Defines whether this sort applied to a row or column.
Returns:
sort criteria This return list could contain a list of two string arrays (first array would be measures and second array would be member - represent by the string value of the measure or the member). The parameter could also contain a list that contains items that are either string values that represent members and data item entries that represent measure dataitems.
See Also:
setSortCriteria(java.util.List, com.sas.iquery.metadata.business.Role)

setSortCriteria

public void setSortCriteria(List sortCriteria,
                            Role businessSortRole)
                     throws MetadataException
This method sets a list that contains the elements that will be used to sort (order) on. This "criteria" list can contain a specific measure or a specific member/level of a dimension. "Order" will arranges members of a specified set, optionally preserving or breaking the hierarchy. This method specifies what items (measure or member) will be sorted (ordered). To define a sucessful sort, both a sort direction and a sort criteria must be specified.

Note: There is no validation that occurs on the items defined in the sort criteria list.

Note: This method is specifically used to perform ordering for OLAP. This method is not used for relational information maps.

Property change events signaled:

Parameters:
sortCriteria - This parameter could contain a list of two string arrays (first array would be measures and second array would be member - represent by the string value of the measure or the member). The parameter could also contain a list that contains items that are either string values that represent members and data item entries that represent measure dataitems.
businessSortRole - Defines whether this sort applied to a row or column.
Throws:
MetadataException - when the action is not supported
IllegalArgumentException - when an invalid businessSortRole is applied.
See Also:
getSortCriteria(com.sas.iquery.metadata.business.Role), getSortDirection(com.sas.iquery.metadata.business.Role)

isValid

public boolean isValid()
Returns whether this business query passes a set of base checks determining whether it is valid. Essentially this returns true if getReasonsNotValid() returns an empty list. If this object is not valid, one can call getReasonsNotValid() to find out why.
Returns:
a boolean value indicating whether this object is valid

getReasonsNotValid

public List getReasonsNotValid()
Returns a list of reasons why this object is not a valid business query. If this object is a valid business query, an empty list is returned.

This method is a union of all validation testing done by this object ... so it tests for role assignment validation, and other basic validation required in order to be a valid query to run.

Returns:
a List of Reason objects indicating why this object is not a valid business query

write

public Element write(Element parentElement)
              throws MetadataException
Serializes this model as a sub-element to the given DOM element and returns the subelement representing this model.
Parameters:
parentElement - element under which a new element should be created which holds this model's XML form.
Returns:
the subelement representing this model
Throws:
MetadataException - if the write fails
NullPointerException - if given a null element argument

getBusinessModel

public BusinessModel getBusinessModel()
Returns the most extended business model object referenced by business items in this business query.
Returns:
a BusinessModel object or null if no business items are contained in this business query

getResultSetIndex

public int getResultSetIndex(String dataItemID)
Returns the column index in the resultset for the data item (contained in the result items list) with the given ID. This method can be helpful in matching up columns in result sets to the original data items provided.

Parameters:
dataItemID - ID of a DataItem contained in the result item list

Returns:
the index into the resultset for the data item (contained in the result items list) with the given ID or -1 if no data item with the specified ID could be found in the result items that should be returned in a result set.

getEntity

public com.sas.entities.EntityInterface getEntity()
Returns a "rolled-up" entity containing all of the prompts referenced by the business items used in this BusinessQuery. The first call to this method returns a new entity object with the Prompt object's attribute descriptors. Subsequent calls to this method return the same entity object with a refreshed set of attribute descriptors matching those currently referenced by prompts in use at the time of the call.
Returns:
EntityInterface the entity containing the attribute descriptors for the prompts referenced by items used in this BusinessQuery.

***  This class is subject to change   ***




Copyright © 2005 SAS Institute Inc. All Rights Reserved.
javadoc generated Fri, 10 Feb 2006 16:03:55