Interface EntityMutationPlanContributor
Contributes state-management-specific graph mutation plans for entity actions.
The standard entity decomposers are responsible for the common action lifecycle: resolving the action state, invoking pre-event handling, coordinating cache handling, assigning operation ordinals, and applying the normal table mutation plan. A contributor is an extension point for the state-management-specific part of the mutation plan.
Replacement hooks are used when the logical action is represented by a
different complete mutation plan. For example, soft-delete replaces a
logical delete with an update which marks the row as deleted, and
single-table temporal update replaces the logical update with an update
which ends the current row followed by an insert of the new row version.
Returning true from a replacement hook means that the contributor has
emitted the complete set of flush operations needed for
that logical action, including any required pre-/post-execution callbacks
supplied through the context.
Additional hooks are used when the standard mutation plan should still run, but a state-management model needs extra operations. History-table support is the canonical example: the current table is still inserted, updated, or deleted, and history-table operations are appended to represent that same logical action in the history table.
Contributors should be kept focused on the mutation plan shape. They should not duplicate the standard decomposer lifecycle unless the alternate plan itself needs to attach callbacks or cache handling to the operations it emits.
- Since:
- 8.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordContext passed to delete contribution hooks.static final recordContext passed tocontributeAdditionalInsert(InsertContext, Consumer).static final recordContext passed to update contribution hooks. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final EntityMutationPlanContributorThe contributor used by the standard state-management model. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidcontributeAdditionalDelete(EntityMutationPlanContributor.DeleteContext context, Consumer<FlushOperation> operationConsumer) Optionally contributes operations to run after the standard entity delete operations and before delete post-execution handling.default voidcontributeAdditionalInsert(EntityMutationPlanContributor.InsertContext context, Consumer<FlushOperation> operationConsumer) Optionally contributes operations to run after the standard entity insert operations and before insert post-execution handling.default voidcontributeAdditionalUpdate(EntityMutationPlanContributor.UpdateContext context, Consumer<FlushOperation> operationConsumer) Optionally contributes operations to run after the standard entity update operations and before update post-execution handling.default booleancontributeReplacementDelete(EntityMutationPlanContributor.DeleteContext context, Consumer<FlushOperation> operationConsumer) Optionally replaces the mutation plan for a logical entity delete.default booleancontributeReplacementUpdate(EntityMutationPlanContributor.UpdateContext context, Consumer<FlushOperation> operationConsumer) Optionally replaces the mutation plan for a logical entity update.default Map<String, ? extends TableMutation<?>> Returns any static delete operations supplied by this contributor.
-
Field Details
-
STANDARD
The contributor used by the standard state-management model. It does not contribute any alternate mutation plans.
-
-
Method Details
-
contributeReplacementUpdate
default boolean contributeReplacementUpdate(EntityMutationPlanContributor.UpdateContext context, Consumer<FlushOperation> operationConsumer) Optionally replaces the mutation plan for a logical entity update.- Returns:
trueif the update was fully represented by operations emitted tooperationConsumer;falseto let the standard update decomposer emit its normal table update operations
-
contributeReplacementDelete
default boolean contributeReplacementDelete(EntityMutationPlanContributor.DeleteContext context, Consumer<FlushOperation> operationConsumer) Optionally replaces the mutation plan for a logical entity delete.- Returns:
trueif the delete was fully represented by operations emitted tooperationConsumer;falseto let the standard delete decomposer emit its normal table delete operations
-
contributeAdditionalInsert
default void contributeAdditionalInsert(EntityMutationPlanContributor.InsertContext context, Consumer<FlushOperation> operationConsumer) Optionally contributes operations to run after the standard entity insert operations and before insert post-execution handling. -
contributeAdditionalUpdate
default void contributeAdditionalUpdate(EntityMutationPlanContributor.UpdateContext context, Consumer<FlushOperation> operationConsumer) Optionally contributes operations to run after the standard entity update operations and before update post-execution handling. -
contributeAdditionalDelete
default void contributeAdditionalDelete(EntityMutationPlanContributor.DeleteContext context, Consumer<FlushOperation> operationConsumer) Optionally contributes operations to run after the standard entity delete operations and before delete post-execution handling. -
getStaticDeleteOperations
Returns any static delete operations supplied by this contributor.
Contributors which represent deletes using a static, reusable mutation plan should expose that plan here so grouping can use the same operation shape metadata as the physical delete path.
-