Class PlanItemInstanceContainerUtil


  • public class PlanItemInstanceContainerUtil
    extends Object
    Utility methods around a plan item container (most likely a stage or case plan model).
    Author:
    Micha Kiener, Joram Barrez
    • Constructor Detail

      • PlanItemInstanceContainerUtil

        public PlanItemInstanceContainerUtil()
    • Method Detail

      • shouldPlanItemContainerComplete

        public static CompletionEvaluationResult shouldPlanItemContainerComplete​(CommandContext commandContext,
                                                                                 PlanItemInstanceContainer planItemInstanceContainer,
                                                                                 Collection<String> planItemInstanceIdsToIgnore,
                                                                                 boolean containerIsAutocomplete)
        Method to check a plan item container (most likely a stage or case plan model) if it should be completed according its child plan item states and their combined behavior rules (e.g. repetition, if-part, manual activation, required, etc). The method returns two results: whether the plan item itself is completable, which is the case when there is no more active or required work to be done, but it might still have optional work to do and a second one which represents whether the plan item should in fact be completed (the difference being the state of the autocomplete mode, where if turned off, only returns true, if there is no more work to be done and no more further options to activate some optional work).
        Parameters:
        commandContext - the command context in which the method is to be executed
        planItemInstanceContainer - the plan item container to evaluate is completable state (most likely a stage or case plan model)
        planItemInstanceIdsToIgnore - an optional list of plan item ids to be ignored for evaluating the parent completing state, might be null or empty
        containerIsAutocomplete - true, if the plan item container is in autocomplete mode, false, if not
        Returns:
        two flags representing whether the plan item might be completable and whether it should actually be completed
      • shouldIgnorePlanItemForCompletion

        public static boolean shouldIgnorePlanItemForCompletion​(CommandContext commandContext,
                                                                PlanItemInstanceEntity planItemInstance,
                                                                boolean alreadyCompleted)
        Evaluates the plan item for being ignored for completion, if it was at least completed once before.
        Parameters:
        commandContext - the command context under which this method is invoked
        planItemInstance - the plan item to evaluate its completed state
        alreadyCompleted - true, if the plan item has been completed before already
        Returns:
        true, if the plan item should be ignored for completion according the parent completion rule and if it was completed before
      • isPlanItemAlreadyCompleted

        public static boolean isPlanItemAlreadyCompleted​(CommandContext commandContext,
                                                         PlanItemInstanceEntity planItemInstance)
        Searches for completed plan items with the same plan item id as the given one.
        Parameters:
        commandContext - the command context under which this method is invoked
        planItemInstance - the plan item instance to search for already completed instances
        Returns:
        true, if there is at least one completed instance found, false otherwise
      • isParentCompletionRuleForPlanItemEqualToType

        public static boolean isParentCompletionRuleForPlanItemEqualToType​(PlanItemInstanceEntity planItemInstance,
                                                                           String parentCompletionRuleType)
        Checks the plan items parent completion mode to be equal to a given type and returns true if so.
        Parameters:
        planItemInstance - the plan item to check for a parent completion mode
        parentCompletionRuleType - the parent completion type to check against
        Returns:
        true, if there is a parent completion mode set on the plan item equal to the given one