Class ActivityChecker

java.lang.Object
org.chenile.workflow.service.activities.ActivityChecker

public class ActivityChecker extends Object
Given that there are a bunch of activities that can be accomplished in a State and that all these activities are tracked by the state entity, this strategy checks if all these activities are completed. In the state machine, activities are modelled as events. They are annotated with a metadata called activity whose value is set to MANDATORY or OPTIONAL.

An event with no activity metadata is not an activity by definition.

All mandatory activities need to be completed. Optional activities will not be checked for completion.
  • Field Details

  • Constructor Details

    • ActivityChecker

      public ActivityChecker(STMFlowStore stmFlowStore)
  • Method Details

    • areAllActivitiesComplete

      public boolean areAllActivitiesComplete(ActivityEnabledStateEntity stateEntity)
      Parameters:
      stateEntity - the activity enabled state entity.
      Returns:
      false if we find even a single MANDATORY activity (in the current state) that has not been marked SUCCESSFUL.
    • areAllActivitiesComplete

      public boolean areAllActivitiesComplete(ActivityEnabledStateEntity stateEntity, State whichState)
      Parameters:
      stateEntity - the activity enabled state entity.
      whichState - the state against which all activities will be tracked.
      Returns:
      false if we find even a single MANDATORY activity that has not been marked SUCCESSFUL.
    • isActivityComplete

      private boolean isActivityComplete(String eventId, ActivityEnabledStateEntity stateEntity)
      Parameters:
      eventId - the event ID to check if it is complete
      stateEntity - the activity enabled state entity to check.
      Returns:
      true if we found at least one activity that matches the event ID and is marked successful
    • getActivityType

      private ActivityType getActivityType(Map<String,String> metadata)
    • isMandatoryActivity

      public boolean isMandatoryActivity(ActivityEnabledStateEntity stateEntity, String eventId)
    • isOptionalActivity

      public boolean isOptionalActivity(ActivityEnabledStateEntity stateEntity, String eventId)
    • isActivity

      public boolean isActivity(ActivityEnabledStateEntity stateEntity, String eventId)