Interface WebSorts


  • public interface WebSorts
    This 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 in EnumDSSXMLSortType. Sort object of type EnumDSSXMLSortType.DssXmlSortSubtotalsPosition and EnumDSSXMLSortType.DssXmlSortGroupByMetric will be represented by WebSort interface. Sort object of type EnumDSSXMLSortType.DssXmlSortAttributeDefault, EnumDSSXMLSortType.DssXmlSortGroupBySubtotal, EnumDSSXMLSortType.DssXmlSortDimensionDefault, EnumDSSXMLSortType.DssXmlSortConsolidationDefault and EnumDSSXMLSortType.DssXmlSortCustomGroupDefault are represented by WebDefaultSort. Sort object of type EnumDSSXMLSortType.DssXmlSortAttributeForm and EnumDSSXMLSortType.DssXmlSortDimensionForm are represented by WebFormSort. Sort object of type EnumDSSXMLSortType.DssXmlSortMetric is represented by WebMetricSort. Sort objects of type EnumDSSXMLSortType.DssXmlSortMetricHierarchical are represented by WebMetricHierarchicalSort. 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
      WebSort add​(int sortType)
      Create a new sort object according to the specified type, and add it at the end of this collection.
      WebSort add​(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.
      void clear()
      Remove all sort objects in this collection.
      boolean containsKey​(int key)
      Returns whether this collection has a sort object whose key equals the input parameter.
      java.util.Enumeration elements()
      Returns an Enumeration of the sort objects inside this collection.
      WebSort get​(int index)
      Returns the sort object in this collection according to the index (0-based).
      WebSort getItemByKey​(int key)
      Returns the sort object in this collection whose key equals the input parameter.
      boolean getRespectParent()
      Returns the Respect Parent flag
      boolean isEmpty()
      Returns whether this collection is empty.
      void move​(int fromPosition, int toPosition)
      Move sort object specified by fromPosition to the toPosition.
      void remove​(int index)
      Remove the sort object, specified by the index, from this collection.
      void remove​(WebObjectInfo oi)
      Removes all sorts associated with the given object
      void removeItemByKey​(int key)
      Remove the sort object, whose key equals the input parameter, from this collection.
      void removeMetricSorts()  
      void setRespectParent​(boolean value)
      Sets the Respect Parent flag
      int size()
      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 from EnumDSSXMLSortType
        Returns:
        The newly added sort object. According to the specified sortType, a more specific object (WebDefaultSort, WebFormSort, WebMetricSort or WebMetricHierarchicalSort) 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 from EnumDSSXMLSortType.
        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 from EnumDSSXMLSortType
        beforeKey - 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, WebMetricSort or WebMetricHierarchicalSort) 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 from EnumDSSXMLSortType.
        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.IndexOutOfBoundsException
        Remove 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.IllegalArgumentException
        Remove 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.IllegalArgumentException
        Move 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.
      • setRespectParent

        void setRespectParent​(boolean value)
        Sets the Respect Parent flag
        Parameters:
        value - value
      • getRespectParent

        boolean getRespectParent()
        Returns the Respect Parent flag
        Returns: