Package com.microstrategy.web.objects
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 Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description WebTemplateMetric
add(WebObjectInfo object)
Adds the given object to the end of the metrics collection.WebTemplateMetric
add(WebObjectInfo object, boolean copyFormatting)
WebTemplateMetric
add(WebObjectInfo object, int beforeKey)
Adds the given object to the metrics collection before the object with the given key.void
addSubtotal(int subtotalType, int subtotalStyle, int axisIndex)
Deprecated.Subtotals are no longer defined at the template metrics level.boolean
canToggleThresholds()
Indicates whether thresholds display can be turned on/offvoid
clear()
Clears all metrics from the collection.void
clear(boolean isDisableOnly)
Clears all metrics from the collection.void
clearCubeMetrics()
Clear cube template metrics.boolean
contains(WebObjectInfo object)
Searches for theWebTemplateMetric
object which refers to the givenWebObjectInfo
object in the metrics collection.boolean
containsKey(int key)
Returns whether the given key exists in the metrics collection.java.util.Enumeration
elements()
Returns a java.util.Enumeration, which can be used to iterate through theWebTemplateMetric
objects in the collection in position ordering.WebTemplateMetric
get(int index)
Returns theWebTemplateMetric
object with the given index.WebTemplateMetric
getItemById(java.lang.String id)
Finds a template metric based on metric DSS ID.WebTemplateMetric
getItemByKey(int key)
Returns theWebTemplateMetric
object with the given key.WebTemplateUnit
getTemplateUnit()
Returns theWebTemplateUnit
which this object is associated with.boolean
hasThresholds()
Indicates whether there are any thresholds defined on the underlying metricsint
indexOf(java.lang.String id)
Returns an index of the template metric for specified metric DSS ID or -1 if it is not found.boolean
isEmpty()
Returns true if the collection has no metrics in it.boolean
isThresholdsDisplayEnabled()
Indicates whether at least one of the thresholds defined on the underlying metrics is enabledint
keyOf(WebObjectInfo object)
Searches for theWebTemplateMetric
object which refers to the givenWebObjectInfo
object in the metrics collection, and returns the key of that object.void
move(int fromPosition, int toPosition)
Moves theWebTemplateMetric
object at the given position in the collection to the new position.void
move(int fromPosition, int toPosition, boolean needSetAlias)
Moves theWebTemplateMetric
object at the given position in the collection to the new position.void
remove(int index)
Removes theWebTemplateMetric
object at the given index from the collection.void
remove(int index, boolean isDisableOnly)
Removes theWebTemplateMetric
object at the given index from the collection.void
removeAllSubtotals()
Deprecated.Subtotals are no longer defined at the template metrics level.void
removeItemByKey(int key)
Removes theWebTemplateMetric
object with the given key from the collection.void
removeItemByKey(int key, boolean isDisableOnly)
Removes theWebTemplateMetric
object with the given key from the collection.void
removeSubtotal(int subtotalType)
Deprecated.Subtotals are no longer defined at the template metrics level.void
setShowThresholds(boolean show)
Set or clear all threasholds of all metrics.int
size()
Returns the number ofWebTemplateMetric
objects in the metrics collection.
-
-
-
Method Detail
-
getTemplateUnit
WebTemplateUnit getTemplateUnit()
Returns theWebTemplateUnit
which this object is associated with.- Returns:
- A
WebTemplateUnit
object which contains the WebTemplateMetrics object.
-
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 theWebObjectInfo
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 theWebObjectInfo
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 theWebTemplateMetric
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 theWebTemplateMetric
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 theWebTemplateMetric
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 theWebTemplateMetric
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 theWebTemplateMetric
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 theWebTemplateMetric
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 theWebTemplateMetric
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 theWebTemplateMetric
object in the metrics collection.toPosition
- The position to move theWebTemplateMetric
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 theWebTemplateMetric
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 theWebTemplateMetric
object in the metrics collection.toPosition
- The position to move theWebTemplateMetric
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 ofWebTemplateMetric
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 theWebTemplateMetric
object which refers to the givenWebObjectInfo
object in the metrics collection.- Parameters:
object
- TheWebObjectInfo
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 theWebTemplateMetric
object which refers to the givenWebObjectInfo
object in the metrics collection, and returns the key of that object.- Parameters:
object
- TheWebObjectInfo
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 theWebTemplateMetric
objects in the collection in position ordering.- Returns:
- A java.util.Enumeration which will iterate through the metrics collection and
return
WebTemplateMetric
objects.
-
addSubtotal
@Deprecated 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. UseWebTemplateSubtotals.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, fromEnumDSSXMLMetricType
.subtotalStyle
- The style of subtotal to add, fromEnumDSSXMLSubtotalStyle
.axisIndex
- The axis to add the subtotal to, fromEnumDSSXMLAxisName
.- Throws:
java.lang.IllegalArgumentException
- Thrown if one of the parameters are invalid.
-
removeSubtotal
@Deprecated 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. UseWebTemplateSubtotals.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, fromEnumDSSXMLMetricType
.- Throws:
java.lang.IllegalArgumentException
- Thrown if the subtotal type is invalid.
-
removeAllSubtotals
@Deprecated void removeAllSubtotals()
Deprecated.Subtotals are no longer defined at the template metrics level. They are now defined at the template level. UseWebTemplateSubtotals.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
-
clearCubeMetrics
void clearCubeMetrics()
Clear cube template metrics.
-
-