Package com.microstrategy.web.objects
Interface WebSorts
-
public interface WebSortsThis interface represents a collection of sort objects. The order of sort objects in this collection affect the order of applying these sort objects. A sort object appears before another sort object, then it will be applied before another sort object. And only the results which are equivalent for the first sort will be affected by the second sort. This is so called N-key sorting. All kinds of sort objects only can be created from this interface, when add() is called. All possible types of sort object can be created are listed inEnumDSSXMLSortType. Sort object of type EnumDSSXMLSortType.DssXmlSortSubtotalsPosition and EnumDSSXMLSortType.DssXmlSortGroupByMetric will be represented byWebSortinterface. Sort object of type EnumDSSXMLSortType.DssXmlSortAttributeDefault, EnumDSSXMLSortType.DssXmlSortGroupBySubtotal, EnumDSSXMLSortType.DssXmlSortDimensionDefault, EnumDSSXMLSortType.DssXmlSortConsolidationDefault and EnumDSSXMLSortType.DssXmlSortCustomGroupDefault are represented byWebDefaultSort. Sort object of type EnumDSSXMLSortType.DssXmlSortAttributeForm and EnumDSSXMLSortType.DssXmlSortDimensionForm are represented byWebFormSort. Sort object of type EnumDSSXMLSortType.DssXmlSortMetric is represented byWebMetricSort. Sort objects of type EnumDSSXMLSortType.DssXmlSortMetricHierarchical are represented byWebMetricHierarchicalSort. Currently we do not support EnumDSSXMLSortType.DssXmlSortValue.- Since:
- MicroStrategy Web 7.3.1 or earlier
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description WebSortadd(int sortType)Create a new sort object according to the specified type, and add it at the end of this collection.WebSortadd(int sortType, int beforeKey)Create a new sort object according to the specified type, and add it before the existing object whose key equals the beforeKey.voidclear()Remove all sort objects in this collection.booleancontainsKey(int key)Returns whether this collection has a sort object whose key equals the input parameter.java.util.Enumerationelements()Returns an Enumeration of the sort objects inside this collection.WebSortget(int index)Returns the sort object in this collection according to the index (0-based).WebSortgetItemByKey(int key)Returns the sort object in this collection whose key equals the input parameter.booleangetRespectParent()Returns the Respect Parent flagbooleanisEmpty()Returns whether this collection is empty.voidmove(int fromPosition, int toPosition)Move sort object specified by fromPosition to the toPosition.voidremove(int index)Remove the sort object, specified by the index, from this collection.voidremove(WebObjectInfo oi)Removes all sorts associated with the given objectvoidremoveItemByKey(int key)Remove the sort object, whose key equals the input parameter, from this collection.voidremoveMetricSorts()voidsetRespectParent(boolean value)Sets the Respect Parent flagintsize()Returns the size of this collection.
-
-
-
Method Detail
-
add
WebSort add(int sortType) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
Create a new sort object according to the specified type, and add it at the end of this collection.- Parameters:
sortType- The type of sort object to add, values fromEnumDSSXMLSortType- Returns:
- The newly added sort object. According to the specified sortType, a more specific object (
WebDefaultSort,WebFormSort,WebMetricSortorWebMetricHierarchicalSort) may be returned. Should cast the return object to the specific interface to access the more specific information for that type. - Throws:
java.lang.IllegalArgumentException- Thrown if sortType is not fromEnumDSSXMLSortType.java.lang.UnsupportedOperationException- Thrown if sortType is EnumDSSXMLSortType.DssXmlSortValue, which currently is not supported.
-
add
WebSort add(int sortType, int beforeKey) throws java.lang.IllegalArgumentException, java.lang.UnsupportedOperationException
Create a new sort object according to the specified type, and add it before the existing object whose key equals the beforeKey.- Parameters:
sortType- The type of sort object to add, values fromEnumDSSXMLSortTypebeforeKey- The key of a reference sort object, which the newly created sort object will be inseart before.- Returns:
- The newly added sort object. According to the specified sortType, a more specific object (
WebDefaultSort,WebFormSort,WebMetricSortorWebMetricHierarchicalSort) may be returned. Should cast the return object to the specific interface to access the more specific information for that type. - Throws:
java.lang.IllegalArgumentException- Thrown if sortType is not fromEnumDSSXMLSortType.java.lang.UnsupportedOperationException- Thrown if sortType is EnumDSSXMLSortType.DssXmlSortValue, which currently is not supported.
-
get
WebSort get(int index) throws java.lang.IndexOutOfBoundsException
Returns the sort object in this collection according to the index (0-based).- Parameters:
index- The index of the sort object in the collection (0-based).- Returns:
- the sort object in this colleciton according to the index.
- Throws:
java.lang.IndexOutOfBoundsException- Thrown when the index is less than 0 or greater or equals to the size of the collection.
-
getItemByKey
WebSort getItemByKey(int key) throws java.lang.IllegalArgumentException
Returns the sort object in this collection whose key equals the input parameter.- Parameters:
key- The key of the sort object to be returned.- Returns:
- The sort object in this collection whose key equals the input parameter.
- Throws:
java.lang.IllegalArgumentException- Thrown if there is not sort object in this collection has the specified key.
-
remove
void remove(int index) throws java.lang.IndexOutOfBoundsExceptionRemove the sort object, specified by the index, from this collection.- Parameters:
index- The index of the sort object in the collection (0-based).- Throws:
java.lang.IndexOutOfBoundsException- Thrown when the index is less than 0 or greater or equals to the size of the collection.
-
removeItemByKey
void removeItemByKey(int key) throws java.lang.IllegalArgumentExceptionRemove the sort object, whose key equals the input parameter, from this collection.- Parameters:
key- The key of the sort object to be removed.- Throws:
java.lang.IllegalArgumentException- Thrown if there is not sort object in this collection has the specified key.
-
clear
void clear()
Remove all sort objects in this collection.
-
move
void move(int fromPosition, int toPosition) throws java.lang.IllegalArgumentExceptionMove sort object specified by fromPosition to the toPosition. This operation will affect the N-key sort order.- Parameters:
fromPosition- The position of the sort object, which will be moved. This is 1-based. The position of the sort object can be obtained by calling WebSort.getPosition().toPosition- The position where the object will be moved to.- Throws:
java.lang.IllegalArgumentException- Thrown when the any input parameter (fromPosition or toPosition) is less than 1 or greater than the size of this collection.
-
isEmpty
boolean isEmpty()
Returns whether this collection is empty.- Returns:
- True when this collection has no sort object inside, else false.
-
size
int size()
Returns the size of this collection.- Returns:
- The size of this collection.
-
containsKey
boolean containsKey(int key)
Returns whether this collection has a sort object whose key equals the input parameter.- Parameters:
key- The key of the sort object to check whether in this collection.- Returns:
- True when there is a sort object whose key equals the input parameter, else false.
-
elements
java.util.Enumeration elements()
Returns an Enumeration of the sort objects inside this collection.- Returns:
- An Enumeration of the sort objects inside this collection.
-
remove
void remove(WebObjectInfo oi) throws WebObjectsException
Removes all sorts associated with the given object- Parameters:
oi- Object- Throws:
WebObjectsException
-
setRespectParent
void setRespectParent(boolean value)
Sets the Respect Parent flag- Parameters:
value- value
-
getRespectParent
boolean getRespectParent()
Returns the Respect Parent flag- Returns:
-
removeMetricSorts
void removeMetricSorts() throws WebObjectsException- Throws:
WebObjectsException
-
-