Package com.microstrategy.web.objects
Interface WebTemplateMetrics
-
public interface WebTemplateMetricsThe 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 WebTemplateMetricadd(WebObjectInfo object)Adds the given object to the end of the metrics collection.WebTemplateMetricadd(WebObjectInfo object, boolean copyFormatting)WebTemplateMetricadd(WebObjectInfo object, int beforeKey)Adds the given object to the metrics collection before the object with the given key.voidaddSubtotal(int subtotalType, int subtotalStyle, int axisIndex)Deprecated.Subtotals are no longer defined at the template metrics level.booleancanToggleThresholds()Indicates whether thresholds display can be turned on/offvoidclear()Clears all metrics from the collection.voidclear(boolean isDisableOnly)Clears all metrics from the collection.booleancontains(WebObjectInfo object)Searches for theWebTemplateMetricobject which refers to the givenWebObjectInfoobject in the metrics collection.booleancontainsKey(int key)Returns whether the given key exists in the metrics collection.java.util.Enumerationelements()Returns a java.util.Enumeration, which can be used to iterate through theWebTemplateMetricobjects in the collection in position ordering.WebTemplateMetricget(int index)Returns theWebTemplateMetricobject with the given index.WebTemplateMetricgetItemById(java.lang.String id)Finds a template metric based on metric DSS ID.WebTemplateMetricgetItemByKey(int key)Returns theWebTemplateMetricobject with the given key.WebTemplateUnitgetTemplateUnit()Returns theWebTemplateUnitwhich this object is associated with.booleanhasThresholds()Indicates whether there are any thresholds defined on the underlying metricsintindexOf(java.lang.String id)Returns an index of the template metric for specified metric DSS ID or -1 if it is not found.booleanisEmpty()Returns true if the collection has no metrics in it.booleanisThresholdsDisplayEnabled()Indicates whether at least one of the thresholds defined on the underlying metrics is enabledintkeyOf(WebObjectInfo object)Searches for theWebTemplateMetricobject which refers to the givenWebObjectInfoobject in the metrics collection, and returns the key of that object.voidmove(int fromPosition, int toPosition)Moves theWebTemplateMetricobject at the given position in the collection to the new position.voidmove(int fromPosition, int toPosition, boolean needSetAlias)Moves theWebTemplateMetricobject at the given position in the collection to the new position.voidremove(int index)Removes theWebTemplateMetricobject at the given index from the collection.voidremove(int index, boolean isDisableOnly)Removes theWebTemplateMetricobject at the given index from the collection.voidremoveAllSubtotals()Deprecated.Subtotals are no longer defined at the template metrics level.voidremoveItemByKey(int key)Removes theWebTemplateMetricobject with the given key from the collection.voidremoveItemByKey(int key, boolean isDisableOnly)Removes theWebTemplateMetricobject with the given key from the collection.voidremoveSubtotal(int subtotalType)Deprecated.Subtotals are no longer defined at the template metrics level.voidsetShowThresholds(boolean show)Set or clear all threasholds of all metrics.intsize()Returns the number ofWebTemplateMetricobjects in the metrics collection.
-
-
-
Method Detail
-
getTemplateUnit
WebTemplateUnit getTemplateUnit()
Returns theWebTemplateUnitwhich this object is associated with.- Returns:
- A
WebTemplateUnitobject 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
WebTemplateMetricobject created to hold theWebObjectInfoobject. - 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.UnsupportedOperationExceptionjava.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
WebTemplateMetricobject created to hold theWebObjectInfoobject. - 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 theWebTemplateMetricobject with the given index.- Parameters:
index- The index of the object to return from the collection.- Returns:
- The
WebTemplateMetricobject 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 theWebTemplateMetricobject with the given key.- Parameters:
key- The key of the object to search for in the collection.- Returns:
- The
WebTemplateMetricobject 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.IndexOutOfBoundsExceptionRemoves theWebTemplateMetricobject 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.IndexOutOfBoundsExceptionRemoves theWebTemplateMetricobject 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.IllegalArgumentExceptionRemoves theWebTemplateMetricobject 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.IllegalArgumentExceptionRemoves theWebTemplateMetricobject 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.UnsupportedOperationExceptionClears 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.UnsupportedOperationExceptionClears 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.IllegalArgumentExceptionMoves theWebTemplateMetricobject 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 theWebTemplateMetricobject in the metrics collection.toPosition- The position to move theWebTemplateMetricobject 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.IllegalArgumentExceptionMoves theWebTemplateMetricobject 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 theWebTemplateMetricobject in the metrics collection.toPosition- The position to move theWebTemplateMetricobject 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 ofWebTemplateMetricobjects 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 theWebTemplateMetricobject which refers to the givenWebObjectInfoobject in the metrics collection.- Parameters:
object- TheWebObjectInfoobject 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 theWebTemplateMetricobject which refers to the givenWebObjectInfoobject in the metrics collection, and returns the key of that object.- Parameters:
object- TheWebObjectInfoobject whose key should be returned.- Returns:
- The key corresponding to the given
WebObjectInfoobject. - 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 theWebTemplateMetricobjects in the collection in position ordering.- Returns:
- A java.util.Enumeration which will iterate through the metrics collection and
return
WebTemplateMetricobjects.
-
addSubtotal
void addSubtotal(int subtotalType, int subtotalStyle, int axisIndex) throws java.lang.IllegalArgumentExceptionDeprecated.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
void removeSubtotal(int subtotalType) throws java.lang.IllegalArgumentExceptionDeprecated.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
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 WebObjectsExceptionIndicates 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
-
-