@PublicApi
public interface AttributeTrail
AttributeTrail
carries information about what dependencies were used when calculating values for an
attribute. It can be used to correctly implement caching, which needs to invalidate a value if its recalculation
may provide a different result.
Note that attribute trail may be different each time. Item dependencies may change based on how specific
value was calculated. And forest dependency type may change if a plugin with AttributeLoaderProvider
is
enabled or disabled.
StructureAttributeService
,
VersionedRowValues
Modifier and Type | Interface and Description |
---|---|
static class |
AttributeTrail.EmptyTrail
Empty trail implementation
|
Modifier and Type | Field and Description |
---|---|
static AttributeTrail |
EMPTY
Empty trail
|
Modifier and Type | Method and Description |
---|---|
TrailItemSet |
getAdditionalItemDependencies(Long row)
Returns a set of additional items that need to be tracked.
|
Set<ForestDependencyType> |
getTrailMode()
Returns all types of in-forest dependencies that were used to calculate this value.
|
boolean |
isCacheable(Long row)
Returns true if the value for the row can be reliably cached and invalidated, by observing forest changes
(according to trail mode), and item changes (according to row's item and additional dependencies).
|
static final AttributeTrail EMPTY
@NotNull Set<ForestDependencyType> getTrailMode()
Returns all types of in-forest dependencies that were used to calculate this value.
An attribute value may be calculated using only the row requested (ForestDependencyType.INDEPENDENT
),
or all sub-rows in the forest (ForestDependencyType.AGGREGATE
), or in "top-down" manner
(ForestDependencyType.PROPAGATE
), or a combination of these calculations.
Depending on the type, forest change and other items need to be
tracked for correct invalidation.
@Nullable TrailItemSet getAdditionalItemDependencies(Long row)
row
- row ID for which the trail is retrievedboolean isCacheable(Long row)
false
is returned only when the row
has been mapped to another row, and so correct invalidation according to forest updates is impossibleCopyright © 2019 ALM Works. All Rights Reserved.