com.businessobjects.rebean.wi
Interface RankCondition

All Superinterfaces:
FilterConditionNode, TreeNode

public interface RankCondition
extends FilterConditionNode

Warning: This interface is no longer functional from the SAP BusinessObjects 4.0 release onwards.

The RankCondition interface represents a ranking applied to a Query.

Applying ranking to a DataSource permits the results of the Query to be filtered in such a way that only results relating to only the highest and lowest n values of a defined data column are displayed.

Example:Applying percentage ranking to a query.

         String universeId =((IUniverse)ceInfoobject).buildUniverseIdString();
         DocumentInstance doc = repEng.newDocument(universeId);
         ReportContainer report = doc.createReport("Report1");
         DataProviders dps = doc.getDataProviders();
         // Retrieve the 1st data provider
         DataProvider dp = dps.getItem(0);
         // Retrieve the universe objects
         DataSource ds = dp.getDataSource();
         DataSourceObject country = ds.getClasses().getChildByName("Country");
         DataSourceObject revenue = ds.getClasses().getChildByName ("Revenue");
         Query q = dp.getQuery();
         // Add result objects to the query
         q.addResultObject(country);
         q.addResultObject(revenue);
         ConditionContainer cond = q.createCondition(LogicalOperator.AND);
         RankCondition rank = cond.createRankCondition(Podium.BOTTOM_PERCENTAGE,1,country,revenue);
         // Run the query and fetch the data
         dp.runQuery();
 

Since:
11.5
See Also:
Query, Podium, ObjectQualification, DataSource.isRankConditionSupported(), ConditionContainer.createRankCondition(com.businessobjects.rebean.wi.Podium, int, com.businessobjects.rebean.wi.DataSourceObject, com.businessobjects.rebean.wi.DataSourceObject)

Method Summary
 void addForEachObject(DataSourceObject forEach)
          Adds a DataSourceObject of type ObjectQualification.DIMENSION.
 ConditionContainer copyCondition(ConditionContainer cont)
          Makes a copy of a ConditionContainer and adds it in this RankCondition.
 ConditionContainer createCondition(LogicalOperator op)
          Creates a ConditionContainer for this RankCondition.
 RankConditionPrompt createRankConditionPrompt(java.lang.String question)
          Creates a RankConditionPrompt for rank size input.
 DataSourceObject getBasedOnObject()
          Returns the DataSourceObject of type ObjectQualification.MEASURE the RankCondition is based on.
 ConditionContainer getCondition()
          Returns the condition part of this RankCondition.
 DataSourceObject getFilteredObject()
          Returns the object being filtered on to create the ranking.
 DataSourceObject getForEachObject(int index)
          Returns the ForEach dimension at a specified index.
 int getForEachObjectsCount()
          Returns the number of ForEach dimensions.
 Podium getPodium()
          Returns the Podium applied on this object.
 java.lang.String getPromptForSize()
          Returns the question of the rank prompt size.
 RankConditionPrompt getRankConditionPrompt()
          Returns the RankConditionPrompt when RankCondition.isPromptSizeActive() returns true.
 int getSize()
          Returns rank reference value.
 boolean hasCondition()
          Checks if any conditions have been set on this RankCondition.
 boolean isPromptSizeActive()
          Checks if rank size is defined in a prompt or have a static value.
 void removeCondition()
          Deletes the condition part of this RankCondition.
 void removeForEachObject(int index)
          Removes a ForEach dimension at the specified index.
 void setBasedOnObject(DataSourceObject basedOnObject)
          Sets the DataSourceObject of type ObjectQualification.MEASURE the RankCondition will be based on.
 void setFilteredObject(DataSourceObject filterObject)
          Sets the object being filtered upon to create the ranking.
 void setPodium(Podium op)
          Changes the Podium applied to the RankCondition object.
 void setPromptForSize(java.lang.String question)
          Sets a prompt in RankCondition.
 void setSize(int value)
          Sets rank reference value.
 
Methods inherited from interface com.businessobjects.rebean.wi.FilterConditionNode
getFilterConditionNode, getID, getName, remove, removeAllChildren
 
Methods inherited from interface com.businessobjects.rebean.wi.TreeNode
getChildAt, getChildCount, getIndex, getParent, isLeaf
 

Method Detail

getPodium

Podium getPodium()
Returns the Podium applied on this object. Depending on whether the RankCondition is designed to return the highest or lowest n values of the Query, the returned value will be either:

Returns:
A Podium instance.
See Also:
Query, Podium, DataSource.isRankConditionSupported()

setPodium

void setPodium(Podium op)
Changes the Podium applied to the RankCondition object. Depending on whether the RankCondition is required to return the highest or lowest n values or n percent values of the Query, op will be either:

Parameters:
op - A Podium instance.
Throws:
java.lang.NullPointerException - When op is null.

setSize

void setSize(int value)
Sets rank reference value.

If Podium is TOP or BOTTOM, the rank reference value is the number of results should returned. If Podium is TOP_PERCENTAGE or BOTTOM_PERCENTAGE,the rank reference value is 100 based.

This call will remove the RankConditionPrompt if it exists and than RankCondition.isPromptSizeActive() becomes false.

Parameters:
value - The rank reference.
Throws:
java.lang.IllegalArgumentException - When value < 0 .
FilterConditionException - while Podium = TOP_PERCENTAGE/BOTTOM_PERCENTAGE and value > 100.

getSize

int getSize()
Returns rank reference value.

Returns:
the rank reference value.

setPromptForSize

void setPromptForSize(java.lang.String question)
Sets a prompt in RankCondition. While running query, you must fill the prompt for size of the rank. By example top X customer, X being the prompt size.

This is a easier way to create a RankConditionPrompt. You could get the new RankConditionPrompt by RankCondition.getRankConditionPrompt().

Parameters:
question - the question will be presented to user while running query.
Throws:
java.lang.NullPointerException - when question is null.

Example:

 DataSource ds;
 DocumentInstance doc;
 DataProvider dp;
 Query query;
 // you should check if DataSource supports rankcondition query
 if (ds.isRankConditionSupported()) {
     ConditionContainer condCont = query.createCondition(LogicalOperator.AND);
     RankCondition rkObj = condCont.createRankCondition(Podium.TOP, 5,
             filterObj, baseonObj);
     rkObj.setPromptForSize(promptQuestion);
     dp.runQuery();
     if (doc.getMustFillPrompts()) {
         Prompts prompts = doc.getPrompts();
         Prompt prompt = prompts.getItem(0);
         prompt.enterValues(new String[] { "7" });
         doc.setPrompts();
     }
 }
 

See Also:
RankCondition.createRankConditionPrompt(String)

isPromptSizeActive

boolean isPromptSizeActive()
Checks if rank size is defined in a prompt or have a static value. In this case, RankCondition.getPromptForSize() returns the prompt's question.

Returns:
true rank size should be defined via a running query prompt. false rank size is defined by RankCondition.setSize(int sz)

getPromptForSize

java.lang.String getPromptForSize()
Returns the question of the rank prompt size.

Returns:
the question in prompt dialog box

createRankConditionPrompt

RankConditionPrompt createRankConditionPrompt(java.lang.String question)
Creates a RankConditionPrompt for rank size input. While running query, a prompt for size will be shown.

Note: RankCondition.isPromptSizeActive() returns true after this call. You should use RankCondition.setSize(int) to remove a RankConditionPrompt.

Returns:
a rank condition prompt
Since:
11.7
See Also:
RankConditionPrompt

getRankConditionPrompt

RankConditionPrompt getRankConditionPrompt()
Returns the RankConditionPrompt when RankCondition.isPromptSizeActive() returns true.

Returns:
the RankConditionPrompt
Since:
11.7
See Also:
RankConditionPrompt

getFilteredObject

DataSourceObject getFilteredObject()
Returns the object being filtered on to create the ranking.

Returns:
The DataSourceObject being used as a filter.
See Also:
DataSourceObject

setFilteredObject

void setFilteredObject(DataSourceObject filterObject)
Sets the object being filtered upon to create the ranking.

Note: the object to be filtered on has to be of type ObjectQualification.DIMENSION or ObjectQualification.DETAIL.

Parameters:
filterObject - A DataSourceObject>/code> instance.
Throws:
java.lang.NullPointerException - When filterObject is null.
java.lang.IllegalArgumentException - When filterObject is neither of type ObjectQualification.DIMENSION nor ObjectQualification.DETAIL.

getBasedOnObject

DataSourceObject getBasedOnObject()
Returns the DataSourceObject of type ObjectQualification.MEASURE the RankCondition is based on.

Returns:
The measure the RankCondition is based on.

setBasedOnObject

void setBasedOnObject(DataSourceObject basedOnObject)
Sets the DataSourceObject of type ObjectQualification.MEASURE the RankCondition will be based on.

Parameters:
basedOnObject - A DataSourceObject instance of type ObjectQualification.MEASURE.
Throws:
java.lang.NullPointerException - When basedOnObject is null.
java.lang.IllegalArgumentException - When basedOnObject isn't a ObjectQualification.MEASURE object.

addForEachObject

void addForEachObject(DataSourceObject forEach)
Adds a DataSourceObject of type ObjectQualification.DIMENSION. A for each object is a DIMENSION on which a ranking will be applied for each different value.

Parameters:
forEach - A DataSourceObject.

getForEachObjectsCount

int getForEachObjectsCount()
Returns the number of ForEach dimensions.

Returns:
The ForEach dimension.

getForEachObject

DataSourceObject getForEachObject(int index)
Returns the ForEach dimension at a specified index.

Parameters:
index - The index.
Returns:
data source object at index position
Throws:
java.lang.IndexOutOfBoundsException - When index >= v.size() or index < 0.

removeForEachObject

void removeForEachObject(int index)
Removes a ForEach dimension at the specified index.

Parameters:
index - The index of the object to be romoved.
Throws:
java.lang.IndexOutOfBoundsException - When index >= v.size() or index < 0.

hasCondition

boolean hasCondition()
Checks if any conditions have been set on this RankCondition.

Returns:
Returns true when at least one condition has been set.

getCondition

ConditionContainer getCondition()
Returns the condition part of this RankCondition.

Returns:
The ConditionContainer or null when there is no condition.

createCondition

ConditionContainer createCondition(LogicalOperator op)
Creates a ConditionContainer for this RankCondition. If this RankCondition has already a condition container, that will be replaced with the new one.

Parameters:
op - The logical operator to be applied on this condition.
Returns:
The new ConditionContainer.

copyCondition

ConditionContainer copyCondition(ConditionContainer cont)
Makes a copy of a ConditionContainer and adds it in this RankCondition. If this RankCondition has already a condition container, then it will be replaced with the new one.

Parameters:
cont - The ConditionContainer to be copied.
Returns:
The new ConditionContainer.

removeCondition

void removeCondition()
Deletes the condition part of this RankCondition.