Interface EntityMutationPlanContributor


@Incubating public 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:
  • Field Details

    • STANDARD

      static final EntityMutationPlanContributor 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:
      true if the update was fully represented by operations emitted to operationConsumer; false to 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:
      true if the delete was fully represented by operations emitted to operationConsumer; false to 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

      default Map<String, ? extends TableMutation<?>> 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.