Interface SortPositionStrategy<P>
- Type Parameters:
P
- The business domain type
- All Known Implementing Classes:
DecimalSplitSortPositionStrategy
public interface SortPositionStrategy<P>
Represents an approach for updating a sorted field's value. This is generally more difficult and
specialized than a normal field update since sorting represents a relationship between multiple
records. Often, sorting field changes not only result in a change to the target record, but also
a resequence of all the other records in the group. This is especially problematic in the context
of sandboxing and catalog hierarchies. The expectation is that a single record is being updated
and sandbox versions or catalog overrides are being established. Brute-force resequencing would
likely have an impact on this structure (e.g. you wouldn't want to create a new sandbox version
for every resequenced record, as this could be overwhelming). Common tenants that a sort
positioning strategy should try to achieve are:
- Try to avoid resequencing records to keep the sort accurate
- Without resequencing, try to adopt solutions that provide enough buffer for positioning. For example, a viable solution could be to assign a position that is the natural split of the before and after positions at the target. However, perform this split enough times at that position and your decimal implementation may run out of scale quickly.
- Generally, allow for sorting of non-null values. Any null values should appear last, or a placeholder value other than null should be used to differentiate a unspecified sort record.
- Author:
- Jeff Fischer
-
Method Summary
Modifier and TypeMethodDescriptiondefault P
updateSort
(SortPositionRequest sortPositionRequest, ContextInfo context, DomainMapperManager mapper, TrackableRepository<Trackable> repository, ChangeNotifier notifier) Deprecated.updateSort
(SortPositionRequest sortPositionRequest, ContextInfo context, DomainMapperManager mapper, TrackableRepository<Trackable> repository, ChangeNotifier notifier, PropagationIntegrator propagationIntegrator, PropagationHelperUtility propagationHelperUtility) Apply a sort field value change
-
Method Details
-
updateSort
@Deprecated default P updateSort(SortPositionRequest sortPositionRequest, ContextInfo context, DomainMapperManager mapper, TrackableRepository<Trackable> repository, ChangeNotifier notifier) Deprecated.UseupdateSort(SortPositionRequest, ContextInfo, DomainMapperManager, TrackableRepository, ChangeNotifier, PropagationIntegrator, PropagationHelperUtility)
instead to allow for instant propagation handling.Apply a sort field value change- Parameters:
sortPositionRequest
- Information about the item being moved and the position to which it's movingcontext
- The current request context viewmapper
- The mapper generally used during updates to apply changes to repository domainrepository
- The repository used to manage persistence of the changing domainnotifier
- Component responsible for notifying the messaging system of the change- Returns:
- The updated business domain
-
updateSort
P updateSort(SortPositionRequest sortPositionRequest, ContextInfo context, DomainMapperManager mapper, TrackableRepository<Trackable> repository, ChangeNotifier notifier, @Nullable PropagationIntegrator propagationIntegrator, @Nullable PropagationHelperUtility propagationHelperUtility) Apply a sort field value change- Parameters:
sortPositionRequest
- Information about the item being moved and the position to which it's movingcontext
- The current request context viewmapper
- The mapper generally used during updates to apply changes to repository domainrepository
- The repository used to manage persistence of the changing domainnotifier
- Component responsible for notifying the messaging system of the changepropagationIntegrator
- Component responsible for initiating propagation, if applicablepropagationHelperUtility
- Component containing common utilities for propagation- Returns:
- The updated business domain
-
updateSort(SortPositionRequest, ContextInfo, DomainMapperManager, TrackableRepository, ChangeNotifier, PropagationIntegrator, PropagationHelperUtility)
instead to allow for instant propagation handling.