Per-subscription list of measured usage against each of the account's configured usage factors, over a license period. Built by KademiSubscriptionManager, which reads the relevant sales data series for every UsageFactor and adds one MetricUsageData entry per factor. calcOverage then compares this measured usage against a set of included quotas to work out how far the subscription has gone over its plan.
Extends: CommonList
Properties
| Property | Returns | Description |
|---|---|---|
| license | KademiLicense | The license this usage data was measured against, if one has been set on this list. |
| sub | KademiSubscription | The subscription that this usage data was measured for. |
Inherited from CommonList
Properties
| Property | Returns | Description |
|---|---|---|
| attributes | Map<String,Object> | A general-purpose map for stashing arbitrary values alongside this list, for example to cache data computed while rendering a template. Lazily created on first access, so it is never null. |
| first | T | The first element in this list. |
| last | T | The last element in this list. |
| random | T | Picks a single element from this list at random. |
| randomSort | CommonList<T> | Builds a new list containing this list's elements in a random order. This list is not modified. |
| reverse | CommonList<T> | Builds a new list with the elements of this one in reverse order. This list is not modified. |
Methods
getAttributes() · addQuiet(T t) · getFirst() · getLast() · removeLast() · removeFirst() · getRandom() · getReverse() · getRandomSort() · upTo(int n) · after(int n) · truncate(int maxSize) · forEach(Consumer<? super T> action) · sortByProperty(String propertyName) · sortReverse()
getAttributes()
Returns: Map<String,Object>
A general-purpose map for stashing arbitrary values alongside this list, for example to cache data computed while rendering a template. Lazily created on first access, so it is never null.
addQuiet(T t)
Returns: String
Appends an element to this list, for use directly inside a template expression. Behaves like add(), but returns an empty string instead of a boolean so it does not generate unwanted output when called from a template.
| Parameter | Description |
|---|---|
t | the element to append |
getFirst()
Returns: T
The first element in this list.
getLast()
Returns: T
The last element in this list.
removeLast()
Returns: T
Removes and returns the last element of this list.
removeFirst()
Returns: T
Removes and returns the first element of this list.
getRandom()
Returns: T
Picks a single element from this list at random.
getReverse()
Returns: CommonList<T>
Builds a new list with the elements of this one in reverse order. This list is not modified.
getRandomSort()
Returns: CommonList<T>
Builds a new list containing this list's elements in a random order. This list is not modified.
upTo(int n)
Returns: CommonList<T>
Builds a new list containing at most the first n elements of this list.
| Parameter | Description |
|---|---|
n | the maximum number of leading elements to keep |
after(int n)
Returns: CommonList<T>
Builds a new list with the leading n elements of this list skipped. For example after(2) returns a list without the first 2 elements. The count is 1-indexed, so after(1) skips only the first element and after(0) skips none.
| Parameter | Description |
|---|---|
n | the number of leading elements to skip |
truncate(int maxSize)
Returns: CommonList<T>
Builds a new list containing at most maxSize elements of this list, taken from the start.
| Parameter | Description |
|---|---|
maxSize | the maximum number of elements the new list may contain |
forEach(Consumer<? super T> action)
Returns: void
Applies the given action to each element in this list, in order. Yields to the Governor between elements so that long-running iterations over large lists can be interrupted or throttled.
| Parameter | Description |
|---|---|
action | the action to apply to each element |
sortByProperty(String propertyName)
Returns: CommonList<T>
Builds a new list containing this list's elements sorted by a named bean property, using reflection to read the property from each element. If propertyName is null, or sorting fails for any reason, this same list is returned unchanged.
| Parameter | Description |
|---|---|
propertyName | the name of the bean property to sort elements by |
sortReverse()
Returns: CommonList<T>
Builds a new list with this list's elements in reverse order, by inserting each element at the head of the new list.
Methods
getSub()
Returns: KademiSubscription
The subscription that this usage data was measured for.
getLicense()
Returns: KademiLicense
The license this usage data was measured against, if one has been set on this list.
add(UsageFactor factor, BigDecimal actual)
Returns: void
Records the measured usage for one usage factor by wrapping it in a MetricUsageData entry and appending it to this list.
| Parameter | Description |
|---|---|
factor | the usage factor the value was measured for |
actual | the raw measured usage, before the factor's scale factor is applied, or null if no usage was found |
calcOverage(ProductSku tier, Map<String,BigDecimal> inclusions)
Returns: List<OverageData>
Compares the measured usage in this list against a set of included quotas to work out overage for each usage factor. For the profiles and monthly active user factors, an included quota supplied by the given tier, if any, takes precedence over the value in inclusions.
| Parameter | Description |
|---|---|
tier | the product tier whose limits may override the given inclusions for profiles and monthly active users, or null to use inclusions only |
inclusions | the quota included in the license for each usage factor, keyed by usage factor id |