com.sas.dataselectors.calculations.percent
Class PercentCalculationsSelectorDataSource

com.sas.dataselectors.calculations.percent.PercentCalculationsSelectorDataSource
All Implemented Interfaces:
PercentCalculationsSelectorDataSourceInterface
Direct Known Subclasses:
PercentCalculationsSelectorOLAPDataSource

public class PercentCalculationsSelectorDataSource
implements PercentCalculationsSelectorDataSourceInterface

Contains attributes and methods to provide a BusinessQuery-based implementation of the PercentCalculationsSelectorDataSourceInterface.

Since:
3.1.4

Field Summary
protected  com.sas.iquery.intelligentquery.BusinessQueryProviderInterface model
          The BusinessQueryProviderInterface on which this dataSource operates.
 
Constructor Summary
PercentCalculationsSelectorDataSource()
          Default constructor.
PercentCalculationsSelectorDataSource(com.sas.iquery.intelligentquery.BusinessQueryProviderInterface model)
          BusinessQueryProviderInterface Constructor.
 
Method Summary
 void addItem(FractionalItemInfo itemInfo)
           Adds a new fractional expression DataItem to the model.
 void commit()
           Commits the new set of fractional items to the model.
protected  FractionalItemInfo createFractionalItemInfo(com.sas.iquery.metadata.business.DataItem dataItem)
          Returns a FractionalItemInfo object to represent the specified DataItem.
 java.util.Map getDenominators()
          Returns a map where the keys are the denominator ids and the the values are the denominator labels.
 java.util.List getFractionalItems()
           Returns a list of items representing the current set of fractional items.
 java.util.Locale getLocale()
          Returns the locale
protected  com.sas.iquery.intelligentquery.BusinessQueryProviderInterface getModel()
          Returns the BusinessQueryProviderInterface on which this dataSource operates.
 java.util.Map getNumerators()
          Returns a map where the keys are the numerator ids and the the values are the numerator labels.
protected  java.lang.String getResourceKeyForDenominatorType(int denominatorType)
          Returns the resource key to use in fetching the label for one of the aggregate denominator types.
 boolean isOLAP()
          Returns true if the data source is OLAP based.
static boolean isValidNumerator(com.sas.iquery.metadata.business.DataItem dataItem, com.sas.iquery.metadata.business.DataSelection dataSelection)
          Returns a boolean indicating whether the dataItem may be used as the numerator in a FractionOfTotalExpression.
 void removeAllItems()
           Remove all fractional expression DataItems from the model.
 void removeItem(FractionalItemInfo itemInfo)
           Removes the item associated with the specified FractionalItemInfo.
 void setLocale(java.util.Locale locale)
          Sets the locale
protected  void setModel(com.sas.iquery.intelligentquery.BusinessQueryProviderInterface model)
          Sets the BusinessQueryProviderInterface on which this dataSource operates.
 void updateItem(FractionalItemInfo existingItemInfo, FractionalItemInfo newItemInfo)
           Updates the label of an existing fractional expression DataItem on the model.
 

Field Detail

model

protected com.sas.iquery.intelligentquery.BusinessQueryProviderInterface model
The BusinessQueryProviderInterface on which this dataSource operates.

Constructor Detail

PercentCalculationsSelectorDataSource

public PercentCalculationsSelectorDataSource()
Default constructor.


PercentCalculationsSelectorDataSource

public PercentCalculationsSelectorDataSource(com.sas.iquery.intelligentquery.BusinessQueryProviderInterface model)
BusinessQueryProviderInterface Constructor.

Method Detail

setModel

protected void setModel(com.sas.iquery.intelligentquery.BusinessQueryProviderInterface model)
Sets the BusinessQueryProviderInterface on which this dataSource operates.

Parameters:
model - BusinessQueryProviderInterface on which this dataSource operates.

getModel

protected com.sas.iquery.intelligentquery.BusinessQueryProviderInterface getModel()
Returns the BusinessQueryProviderInterface on which this dataSource operates.

Returns:
the BusinessQueryProviderInterface on which this dataSource operates.

isOLAP

public boolean isOLAP()
Returns true if the data source is OLAP based.

Specified by:
isOLAP in interface PercentCalculationsSelectorDataSourceInterface
Returns:
TRUE if the data source is OLAP based

getNumerators

public java.util.Map getNumerators()
Returns a map where the keys are the numerator ids and the the values are the numerator labels.

Specified by:
getNumerators in interface PercentCalculationsSelectorDataSourceInterface
Returns:
the map of numerator ids and labels.
Throws:
{@link - java.lang.IllegalStateException} if model is null.

isValidNumerator

public static boolean isValidNumerator(com.sas.iquery.metadata.business.DataItem dataItem,
                                       com.sas.iquery.metadata.business.DataSelection dataSelection)
Returns a boolean indicating whether the dataItem may be used as the numerator in a FractionOfTotalExpression.

Parameters:
dataItem - The DataItem to validate.
dataSelection - The DataSelection to which the DataItem belongs.
Returns:
a boolean indicating whether the dataItem may be used as the numerator in a FractionOfTotalExpression.

getDenominators

public java.util.Map getDenominators()
Returns a map where the keys are the denominator ids and the the values are the denominator labels.

Specified by:
getDenominators in interface PercentCalculationsSelectorDataSourceInterface
Returns:
the map of denominator ids and labels.

getFractionalItems

public java.util.List getFractionalItems()

Returns a list of items representing the current set of fractional items.

Specified by:
getFractionalItems in interface PercentCalculationsSelectorDataSourceInterface
Returns:
a list of items representing the current set of fractional items.
Throws:
{@link - java.lang.IllegalStateException} if model is null.

createFractionalItemInfo

protected FractionalItemInfo createFractionalItemInfo(com.sas.iquery.metadata.business.DataItem dataItem)
Returns a FractionalItemInfo object to represent the specified DataItem.

Parameters:
dataItem - The DataItem to be represented by the FractionalItemInfo.
Returns:
a FractionalItemInfo object to represent the specified DataItem.

getResourceKeyForDenominatorType

protected java.lang.String getResourceKeyForDenominatorType(int denominatorType)
Returns the resource key to use in fetching the label for one of the aggregate denominator types.

Parameters:
denominatorType - the type of aggreggate denominator.
Returns:
the resource key to use in fetching the label for one of the aggregate denominator types.

removeItem

public void removeItem(FractionalItemInfo itemInfo)

Removes the item associated with the specified FractionalItemInfo.

Specified by:
removeItem in interface PercentCalculationsSelectorDataSourceInterface
Parameters:
itemInfo - the FractionalItemInfo with information describing the item to be removed.
Throws:
{@link - java.lang.IllegalStateException} if model is null.
{@link - java.lang.IllegalStateException} if model's businessQuery is not a DataSelection.
{@link - java.lang.RuntimeException} with MetadataException cause if operation fails.

addItem

public void addItem(FractionalItemInfo itemInfo)

Adds a new fractional expression DataItem to the model.

Specified by:
addItem in interface PercentCalculationsSelectorDataSourceInterface
Parameters:
itemInfo - The FractionalItemInfo that describes the new fractional expression DataItem to be added.
Throws:
{@link - java.lang.IllegalStateException} if model is null.
{@link - java.lang.RuntimeException} with MetadataException cause if operation fails.

updateItem

public void updateItem(FractionalItemInfo existingItemInfo,
                       FractionalItemInfo newItemInfo)

Updates the label of an existing fractional expression DataItem on the model.

Specified by:
updateItem in interface PercentCalculationsSelectorDataSourceInterface
Parameters:
existingItemInfo - information about the existing item.
newItemInfo - information to apply to the updated version of the item.
Throws:
{@link - java.lang.IllegalStateException} if model is null.
{@link - java.lang.RuntimeException} with MetadataException cause if operation fails.

removeAllItems

public void removeAllItems()

Remove all fractional expression DataItems from the model.

Specified by:
removeAllItems in interface PercentCalculationsSelectorDataSourceInterface
Throws:
{@link - java.lang.IllegalStateException} if model is null.
{@link - java.lang.IllegalStateException} if model's businessQuery is not a DataSelection.
{@link - java.lang.RuntimeException} with MetadataException cause if operation fails.

commit

public void commit()

Commits the new set of fractional items to the model.

Specified by:
commit in interface PercentCalculationsSelectorDataSourceInterface
Throws:
{@link - java.lang.IllegalStateException} if model is null.
{@link - java.lang.RuntimeException} with IntelligentQueryException cause if operation fails.

setLocale

public void setLocale(java.util.Locale locale)
Sets the locale

Specified by:
setLocale in interface PercentCalculationsSelectorDataSourceInterface
Parameters:
locale - The locale.

getLocale

public java.util.Locale getLocale()
Returns the locale

Specified by:
getLocale in interface PercentCalculationsSelectorDataSourceInterface
Returns:
The locale.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.