Class AbstractMovePlanItemInstanceToTerminalStateOperation

All Implemented Interfaces:
Runnable
Direct Known Subclasses:
CompletePlanItemInstanceOperation, ExitPlanItemInstanceOperation, OccurPlanItemInstanceOperation, TerminatePlanItemInstanceOperation

public abstract class AbstractMovePlanItemInstanceToTerminalStateOperation extends AbstractChangePlanItemInstanceStateOperation
Operation that moves a given PlanItemInstance to a terminal state (completed, terminated or failed).
Author:
Joram Barrez, Filip Hrisafov, Micha Kiener
  • Constructor Details

    • AbstractMovePlanItemInstanceToTerminalStateOperation

      public AbstractMovePlanItemInstanceToTerminalStateOperation(CommandContext commandContext, PlanItemInstanceEntity planItemInstanceEntity)
  • Method Details

    • run

      public void run()
      Specified by:
      run in interface Runnable
      Overrides:
      run in class AbstractChangePlanItemInstanceStateOperation
    • isAsyncLeave

      protected boolean isAsyncLeave(PlanItemInstanceEntity planItemInstanceEntity, PlanItemDefinition planItemDefinition)
    • getVariableAggregations

      protected VariableAggregationDefinitions getVariableAggregations()
    • resolveEventDefinitionKey

      protected String resolveEventDefinitionKey(String eventType, PlanItemInstanceEntity planItemInstanceEntity, CmmnEngineConfiguration cmmnEngineConfiguration)
    • internalExecute

      protected abstract void internalExecute()
      Implementing classes should be aware that unlike extending from AbstractChangePlanItemInstanceStateOperation, this method will be executed just before the deleting the entity
      Specified by:
      internalExecute in class AbstractChangePlanItemInstanceStateOperation
    • isRepeatingOnDelete

      public boolean isRepeatingOnDelete(String originalState, String newState)
    • isWithoutStageOrParentIsNotTerminated

      public boolean isWithoutStageOrParentIsNotTerminated(PlanItemInstanceEntity planItemInstanceEntity)
    • hasRepetitionRuleAndNoEntryCriteria

      public boolean hasRepetitionRuleAndNoEntryCriteria(PlanItem planItem)
      Returns true, if the given plan item has a repetition rule, but no entry criteria to be satisfied and no collection based repetition. A collection based repetition is similar to entry criteria as it needs to be available in order to repeat the plan item.
      Parameters:
      planItem - the plan item to test
      Returns:
      true, if the plan item has a repetition rule without any conditions like entry criteria or a collection to be based on for repetition
    • hasRepetitionOnCollection

      public boolean hasRepetitionOnCollection(PlanItem planItem)
    • hasMaxInstanceCount

      public boolean hasMaxInstanceCount(PlanItem planItem)
    • hasRepetitionRuleEntryCriteria

      public boolean hasRepetitionRuleEntryCriteria(PlanItem planItem)
    • hasRepetitionRule

      public boolean hasRepetitionRule(PlanItem planItem)
    • isWaitingForRepetitionPlanItemInstanceExists

      public boolean isWaitingForRepetitionPlanItemInstanceExists(PlanItemInstanceEntity planItemInstanceEntity)
    • exitChildPlanItemInstances

      protected void exitChildPlanItemInstances(String parentTransition, String exitCriterionId, String exitEventType)
      Exits (terminates) all child plan items of the current one (e.g. if the current one is a stage or plan model) on a terminate or complete transition of the parent as in this case, child plan items not being in an ending state must also be terminated. Depending on the plan item behavior, it might be delegated to the behavior or the default one is to simply exit the child plan item as well.
      Parameters:
      parentTransition - the transition of the parent plan item to an ending state as it might have an impact on how to end the child plan item
      exitCriterionId - the optional exit criterion being triggered on the parent to end it, might be null
      exitEventType - the optional exit event type, if an exit sentry was triggered, as it might have an impact on the child ending as well
    • aggregateVariablesForSingleInstance

      protected void aggregateVariablesForSingleInstance(PlanItemInstanceEntity planItemInstanceEntity, VariableAggregationDefinitions aggregations)
    • aggregateVariablesForAllInstances

      protected void aggregateVariablesForAllInstances(PlanItemInstanceEntity planItemInstanceEntity, VariableAggregationDefinitions aggregations)
    • shouldAggregateForSingleInstance

      protected abstract boolean shouldAggregateForSingleInstance()
      Whether variable aggregation should be done when a single instance completes. This does not need to check whether the plan item instance has variable aggregations, that is the same for all instances. e.g. When an instance completes normally we should aggregate the data, but if it terminates we shouldn't
    • shouldAggregateForMultipleInstances

      protected abstract boolean shouldAggregateForMultipleInstances()
      Whether multi aggregation needs to be done. This does not need to check whether the plan item instance has variable aggregations, that is the same for all instances. e.g. Multi aggregation needs to be done when we do a normal completion, but not when the plan items are terminated
    • isEvaluateRepetitionRule

      public abstract boolean isEvaluateRepetitionRule()
    • getAsyncLeaveTransitionMetadata

      protected abstract Map<String,String> getAsyncLeaveTransitionMetadata()