T
- type of the loaded value@PublicSpi public interface AggregateAttributeLoader<T> extends MultiRowAttributeLoader<T>
Aggregate attributes have values calculated up through the hierarchy. The parent row's value depends on the values of its children. For example, a total time spent for all issues under a folder is an aggregate.
Aggregate attribute loader represents an aggregate attribute. Aggregate loading function for a row R
can calculate values based on:
StructureRow
data for R and its children;AttributeLoader.getContextDependencies()
.The loader must be a stable function. It must not depend on any other inputs, and should
provide the same result for the same inputs every time: V(row) = AGGREGATE([V(children(row))], dependencies(row))
.
The values for children rows and the dependencies for the current row are guaranteed to be loaded by the time the loading function is called.
Note that sometimes an aggregate loader will need to store more data in AttributeValue
than the resulting Java
type allows. In that case, use loader data - see AttributeValue.withData(java.lang.Object)
.
An aggregate, as well as all multi-row loaders, is potentially capable of accessing data calculated for rows that the requesting user is not allowed to see. For example, a total budget may be calculated over a number of sub-budgets, and a user may not have access to all of them.
If the aggregated attribute is
considered sensitive (according to StructureConfiguration.getAttributeSensitivitySettings()
), then
the calls to AttributeLoaderContext.getDependencyValue(com.almworks.jira.structure.api.attribute.AttributeSpec<V>)
will not disclose the hidden value. Instead,
the loader function will receive AttributeValue.inaccessible()
.
In other words, you should not worry about implementing security checks in an aggregate, the system does it for you.
An aggregate may be called to calculate a value for a super-root row (see SuperRootRow
),
passing all root values as children values.
Modifier and Type | Method and Description |
---|---|
AttributeValue<T> |
loadValue(List<AttributeValue<T>> childrenValues,
AggregateAttributeContext context)
Performs aggregate loading.
|
getCachingStrategy
isWholeForestDependent, preload
getAttributeDependencies, getAttributeSpec, getContextDependencies, getGlobalTrail
@Nullable AttributeValue<T> loadValue(@NotNull List<AttributeValue<T>> childrenValues, @NotNull AggregateAttributeContext context)
Performs aggregate loading.
If the value is missing or empty, the loader should return AttributeValue.undefined()
. If for some reason this loader
is not applicable for the given row, it should return null
. (Note, however, that if multiple aggregate loaders work on the same
attribute, it could be tricky and lead to unexpected results.)
Note: children values may contain loop markers
childrenValues
- the values of this attribute for all children rows, in the same order as the children rowscontext
- loading contextCopyright © 2024 Tempo Software. All Rights Reserved.