Interface WebTemplateMetrics


  • public interface WebTemplateMetrics
    The WebTemplateMetrics object represents the metrics collection which exists on a template. This object contains a collection of metrics, ordered by position. The WebTemplateMetrics object can be used to add, remove, and examine metrics on the template.
    Since:
    MicroStrategy Web 7.3.1 or earlier
    • Method Detail

      • add

        WebTemplateMetric add​(WebObjectInfo object)
                       throws java.lang.UnsupportedOperationException,
                              java.lang.IllegalArgumentException
        Adds the given object to the end of the metrics collection. This object must be of type DssXmlTypeMetric.
        Parameters:
        object - The metric to add to the collection.
        Returns:
        The WebTemplateMetric object created to hold the WebObjectInfo object.
        Throws:
        java.lang.UnsupportedOperationException - Signals that the template is marked read-only.
        java.lang.IllegalArgumentException - Signals that the object passed to this method is not of type metric.
      • add

        WebTemplateMetric add​(WebObjectInfo object,
                              boolean copyFormatting)
                       throws java.lang.UnsupportedOperationException,
                              java.lang.IllegalArgumentException
        Throws:
        java.lang.UnsupportedOperationException
        java.lang.IllegalArgumentException
      • add

        WebTemplateMetric add​(WebObjectInfo object,
                              int beforeKey)
                       throws java.lang.UnsupportedOperationException,
                              java.lang.IllegalArgumentException
        Adds the given object to the metrics collection before the object with the given key. This object must be of type DssXmlTypeMetric.
        Parameters:
        object - The metric to add to the collection.
        beforeKey - The key of another metric in the collection, which the new metric will be placed before.
        Returns:
        The WebTemplateMetric object created to hold the WebObjectInfo object.
        Throws:
        java.lang.UnsupportedOperationException - Signals that the template is marked read-only.
        java.lang.IllegalArgumentException - Signals that the object passed to this method is not of type metric, or if the key is not found in the metrics collection.
      • get

        WebTemplateMetric get​(int index)
                       throws java.lang.IndexOutOfBoundsException
        Returns the WebTemplateMetric object with the given index.
        Parameters:
        index - The index of the object to return from the collection.
        Returns:
        The WebTemplateMetric object which the given key refers to.
        Throws:
        java.lang.IndexOutOfBoundsException - Thrown if the index is outside the bounds of the collection.
      • getItemByKey

        WebTemplateMetric getItemByKey​(int key)
                                throws java.lang.IllegalArgumentException
        Returns the WebTemplateMetric object with the given key.
        Parameters:
        key - The key of the object to search for in the collection.
        Returns:
        The WebTemplateMetric object which the given key refers to.
        Throws:
        java.lang.IllegalArgumentException - Thrown if the key is not found in the metrics collection.
      • remove

        void remove​(int index)
             throws java.lang.UnsupportedOperationException,
                    java.lang.IndexOutOfBoundsException
        Removes the WebTemplateMetric object at the given index from the collection.
        Parameters:
        index - The index of the object to remove from the collection.
        Throws:
        java.lang.IndexOutOfBoundsException - Thrown if the given index is out of the bounds of the collection.
        java.lang.UnsupportedOperationException - Thrown if the template which this collection resides upon is marked to be read-only.
      • remove

        void remove​(int index,
                    boolean isDisableOnly)
             throws java.lang.UnsupportedOperationException,
                    java.lang.IndexOutOfBoundsException
        Removes the WebTemplateMetric object at the given index from the collection.
        Parameters:
        index - The index of the object to remove from the collection.
        isDisableOnly - Indicate if it is a 'disable from grid' or 'remove from grid' for RWD
        Throws:
        java.lang.IndexOutOfBoundsException - Thrown if the given index is out of the bounds of the collection.
        java.lang.UnsupportedOperationException - Thrown if the template which this collection resides upon is marked to be read-only.
      • removeItemByKey

        void removeItemByKey​(int key)
                      throws java.lang.UnsupportedOperationException,
                             java.lang.IllegalArgumentException
        Removes the WebTemplateMetric object with the given key from the collection.
        Parameters:
        key - The key of the object to remove from the collection.
        Throws:
        java.lang.IllegalArgumentException - Thrown if the key is not found in the metrics collection.
        java.lang.UnsupportedOperationException - Thrown if the template which this collection resides upon is marked to be read-only.
      • removeItemByKey

        void removeItemByKey​(int key,
                             boolean isDisableOnly)
                      throws java.lang.UnsupportedOperationException,
                             java.lang.IllegalArgumentException
        Removes the WebTemplateMetric object with the given key from the collection.
        Parameters:
        key - The key of the object to remove from the collection.
        isDisableOnly - Indicate if it is a 'disable from grid' or 'remove from grid' for RWD
        Throws:
        java.lang.IllegalArgumentException - Thrown if the key is not found in the metrics collection.
        java.lang.UnsupportedOperationException - Thrown if the template which this collection resides upon is marked to be read-only.
      • clear

        void clear()
            throws java.lang.UnsupportedOperationException
        Clears all metrics from the collection. Equivalent to calling remove on every object in the collection.
        Throws:
        java.lang.UnsupportedOperationException - Thrown if the template which this collection resides upon is marked to be read-only.
      • clear

        void clear​(boolean isDisableOnly)
            throws java.lang.UnsupportedOperationException
        Clears all metrics from the collection. Equivalent to calling remove on every object in the collection.
        Parameters:
        isDisableOnly - Indicate if it is a 'disable from grid' or 'remove from grid' for RWD
        Throws:
        java.lang.UnsupportedOperationException - Thrown if the template which this collection resides upon is marked to be read-only.
      • move

        void move​(int fromPosition,
                  int toPosition)
           throws java.lang.UnsupportedOperationException,
                  java.lang.IllegalArgumentException
        Moves the WebTemplateMetric object at the given position in the collection to the new position. Note that position is a 1-based index on the collection. Note that elements will be shifted as follows:
        If fromPosition < toPosition then objects between the two given positions will be shifted to the left.
        If fromPosition > toPosition then objects between the two given positions will be shifted to the right
        Parameters:
        fromPosition - The position of the WebTemplateMetric object in the metrics collection.
        toPosition - The position to move the WebTemplateMetric object to.
        Throws:
        java.lang.IllegalArgumentException - Thrown if either position given to this method does not exist in the collection.
        java.lang.UnsupportedOperationException - Thrown if the template which the metrics collection exists upon is marked read-only.
      • move

        void move​(int fromPosition,
                  int toPosition,
                  boolean needSetAlias)
           throws java.lang.UnsupportedOperationException,
                  java.lang.IllegalArgumentException
        Moves the WebTemplateMetric object at the given position in the collection to the new position. Note that position is a 1-based index on the collection. Note that elements will be shifted as follows:
        If fromPosition < toPosition then objects between the two given positions will be shifted to the left.
        If fromPosition > toPosition then objects between the two given positions will be shifted to the right
        Parameters:
        fromPosition - The position of the WebTemplateMetric object in the metrics collection.
        toPosition - The position to move the WebTemplateMetric object to.
        needSetAlias - : For new added metrics, we need to set alias in delta. Otherwise we don't need.
        Throws:
        java.lang.IllegalArgumentException - Thrown if either position given to this method does not exist in the collection.
        java.lang.UnsupportedOperationException - Thrown if the template which the metrics collection exists upon is marked read-only.
      • size

        int size()
        Returns the number of WebTemplateMetric objects in the metrics collection.
        Returns:
        The size of the metrics collection.
      • isEmpty

        boolean isEmpty()
        Returns true if the collection has no metrics in it.
        Returns:
        Whether the metrics collection is empty.
      • containsKey

        boolean containsKey​(int key)
        Returns whether the given key exists in the metrics collection.
        Parameters:
        key - The key whose existence we're verifying.
        Returns:
        True if the given key exists in the collection; false otherwise
      • contains

        boolean contains​(WebObjectInfo object)
        Searches for the WebTemplateMetric object which refers to the given WebObjectInfo object in the metrics collection.
        Parameters:
        object - The WebObjectInfo object to search for in the metrics collection.
        Returns:
        True if the collection contains the given object, false otherwise.
      • keyOf

        int keyOf​(WebObjectInfo object)
           throws java.lang.IllegalArgumentException
        Searches for the WebTemplateMetric object which refers to the given WebObjectInfo object in the metrics collection, and returns the key of that object.
        Parameters:
        object - The WebObjectInfo object whose key should be returned.
        Returns:
        The key corresponding to the given WebObjectInfo object.
        Throws:
        java.lang.IllegalArgumentException - Signals that the given object was not found in the collection.
      • elements

        java.util.Enumeration elements()
        Returns a java.util.Enumeration, which can be used to iterate through the WebTemplateMetric objects in the collection in position ordering.
        Returns:
        A java.util.Enumeration which will iterate through the metrics collection and return WebTemplateMetric objects.
      • addSubtotal

        void addSubtotal​(int subtotalType,
                         int subtotalStyle,
                         int axisIndex)
                  throws java.lang.IllegalArgumentException
        Deprecated.
        Subtotals are no longer defined at the template metrics level. They are now defined at the template level. Use WebTemplateSubtotals.activateAxisSubtotal(int, int, int) instead.
        Adds a subtotal of the given type, with the given style, to the given index. This is done for all metrics on the report.
        Parameters:
        subtotalType - The type of subtotal to add, from EnumDSSXMLMetricType.
        subtotalStyle - The style of subtotal to add, from EnumDSSXMLSubtotalStyle.
        axisIndex - The axis to add the subtotal to, from EnumDSSXMLAxisName.
        Throws:
        java.lang.IllegalArgumentException - Thrown if one of the parameters are invalid.
      • removeSubtotal

        void removeSubtotal​(int subtotalType)
                     throws java.lang.IllegalArgumentException
        Deprecated.
        Subtotals are no longer defined at the template metrics level. They are now defined at the template level. Use WebTemplateSubtotals.deActivate(int) instead.
        Removes the subtotal with the given type from all metrics it is set on.
        Parameters:
        subtotalType - The type of the subtotal to remove, from EnumDSSXMLMetricType.
        Throws:
        java.lang.IllegalArgumentException - Thrown if the subtotal type is invalid.
      • removeAllSubtotals

        void removeAllSubtotals()
        Deprecated.
        Subtotals are no longer defined at the template metrics level. They are now defined at the template level. Use WebTemplateSubtotals.deActivateAll() instead.
        Removes all subtotals from all metrics on the report.
      • hasThresholds

        boolean hasThresholds()
        Indicates whether there are any thresholds defined on the underlying metrics
        Returns:
        boolean
        Since:
        MicroStrategy Web 8.0.0
      • setShowThresholds

        void setShowThresholds​(boolean show)
        Set or clear all threasholds of all metrics. To see the changes in data, WebReportManipulation.applyChanges() need to be called to retrieve another instance, which will have the changed data.
        Parameters:
        show - boolean to indicate whether to show or to hide all thresholds.
        Since:
        MicroStrategy Web 8.0.0
      • isThresholdsDisplayEnabled

        boolean isThresholdsDisplayEnabled()
        Indicates whether at least one of the thresholds defined on the underlying metrics is enabled
        Returns:
        boolean
        Since:
        MicroStrategy Web 8.0.0
      • canToggleThresholds

        boolean canToggleThresholds()
                             throws WebObjectsException
        Indicates whether thresholds display can be turned on/off
        Returns:
        whether thresholds display can be turned on/off
        Throws:
        WebObjectsException
        Since:
        MicroStrategy Web 8.0.0
      • getItemById

        WebTemplateMetric getItemById​(java.lang.String id)
        Finds a template metric based on metric DSS ID. Returns null if metric not found.
        Parameters:
        id - metric DSS ID
        Returns:
        template metric.
        Since:
        MicroStrategy Web 8.1.2
      • indexOf

        int indexOf​(java.lang.String id)
        Returns an index of the template metric for specified metric DSS ID or -1 if it is not found.
        Parameters:
        id - metric DSS ID
        Returns:
        an index of the template metric
        Since:
        MicroStrategy Web 8.1.2