Class ExpressionUtil
java.lang.Object
org.flowable.cmmn.engine.impl.util.ExpressionUtil
- Author:
- Joram Barrez, Micha Kiener
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
evaluateAutoComplete
(CommandContext commandContext, VariableContainer variableContainer, Stage stage) Returns true, if the given stage has an auto-complete condition which evaluates to true or if not, is in auto-complete mode permanently.static boolean
evaluateBooleanExpression
(CommandContext commandContext, VariableContainer variableContainer, String condition) static Object
evaluateExpression
(CommandContext commandContext, VariableContainer variableContainer, String expression) evaluateRepetitionCollectionVariableValue
(CommandContext commandContext, PlanItemInstanceEntity planItemInstanceEntity) Evaluates the collection variable name or expression given by the plan items repetition rule and returns its evaluated collection as a list.static boolean
evaluateRepetitionRule
(CommandContext commandContext, PlanItemInstanceEntity planItemInstanceEntity, PlanItemInstanceContainer planItemInstanceContainer) Returns true, if: the given plan item instance has a repetition rule at all and if so, if it has a condition witch is satisfied and all in combination with the optional max instance count attribute.static boolean
evaluateRepetitionRule
(CommandContext commandContext, VariableContainer variableContainer, String repetitionCondition) static RepetitionRule
getRepetitionRule
(PlanItemInstanceEntity planItemInstanceEntity) Returns the repetition rule, if the given plan item instance has one, null otherwise.static boolean
hasOnParts
(PlanItem planItem) Checks the given plan item to have at least one on-part.static boolean
hasRepetitionOnCollection
(PlanItemInstanceEntity planItemInstanceEntity) Returns true, if the given plan item instance has a repetition rule which is based on a collection variable, false, if there is no repetition rule at all or if it is not based on a collection variable.static boolean
hasRepetitionOnCollection
(PlanItem planItem) Returns true, if the given plan item instance has a repetition rule which is based on a collection variable, false, if there is no repetition rule at all or if it is not based on a collection variable.static boolean
hasRepetitionRule
(PlanItemInstanceEntity planItemInstanceEntity) static boolean
hasRepetitionRule
(PlanItem planItem) static boolean
isCompletionNeutralPlanItemInstance
(PlanItemInstanceEntity planItemInstanceEntity) static boolean
isCompletionNeutralPlanItemInstance
(CommandContext commandContext, PlanItemInstanceEntity planItemInstanceEntity) static boolean
isRequiredPlanItemInstance
(CommandContext commandContext, PlanItemInstanceEntity planItemInstanceEntity) static List<PlanItemInstance>
searchNonFinishedEqualPlanItemInstances
(PlanItemInstanceEntity planItemInstanceEntity, PlanItemInstanceContainer planItemInstanceContainer) Searches for non-finished plan item instances within the given container to be of the same plan item as the given instance.
-
Constructor Details
-
ExpressionUtil
public ExpressionUtil()
-
-
Method Details
-
evaluateBooleanExpression
public static boolean evaluateBooleanExpression(CommandContext commandContext, VariableContainer variableContainer, String condition) -
evaluateExpression
public static Object evaluateExpression(CommandContext commandContext, VariableContainer variableContainer, String expression) -
isRequiredPlanItemInstance
public static boolean isRequiredPlanItemInstance(CommandContext commandContext, PlanItemInstanceEntity planItemInstanceEntity) -
hasOnParts
Checks the given plan item to have at least one on-part.- Parameters:
planItem
- the plan item to check for an on-part- Returns:
- true, if there is at least one on-part, false otherwise
-
hasRepetitionRule
-
hasRepetitionRule
-
getRepetitionRule
Returns the repetition rule, if the given plan item instance has one, null otherwise.- Parameters:
planItemInstanceEntity
- the plan item instance to check for a repetition rule- Returns:
- the repetition rule of the plan item, if available, null otherwise
-
hasRepetitionOnCollection
Returns true, if the given plan item instance has a repetition rule which is based on a collection variable, false, if there is no repetition rule at all or if it is not based on a collection variable.- Parameters:
planItemInstanceEntity
- the plan item instance to check for a repetition rule based on a collection- Returns:
- true, if the plan item has a repetition rule based on a collection variable
-
hasRepetitionOnCollection
Returns true, if the given plan item instance has a repetition rule which is based on a collection variable, false, if there is no repetition rule at all or if it is not based on a collection variable.- Parameters:
planItem
- the plan item to check for a repetition rule based on a collection- Returns:
- true, if the plan item has a repetition rule based on a collection variable
-
evaluateRepetitionCollectionVariableValue
public static Iterable<Object> evaluateRepetitionCollectionVariableValue(CommandContext commandContext, PlanItemInstanceEntity planItemInstanceEntity) Evaluates the collection variable name or expression given by the plan items repetition rule and returns its evaluated collection as a list.- Parameters:
commandContext
- the command context to be used for evaluating the expressionplanItemInstanceEntity
- the plan item instance to evaluate the collection variable given by its repetition rule- Returns:
- the collection variable value as a list of objects, might be null, if there is no repetition rule or no collection or the variable or expression evaluates to null
-
evaluateRepetitionRule
public static boolean evaluateRepetitionRule(CommandContext commandContext, PlanItemInstanceEntity planItemInstanceEntity, PlanItemInstanceContainer planItemInstanceContainer) Returns true, if: the given plan item instance has a repetition rule at all and if so, if it has a condition witch is satisfied and all in combination with the optional max instance count attribute. If the repetition rule evaluates to true, this normally means that there should be an additional instance of the plan item created.- Parameters:
commandContext
- the command context in which this evaluation is taking placeplanItemInstanceEntity
- the plan item instance entity to test for a repetition rule to evaluate to trueplanItemInstanceContainer
- the container (usually the parent stage of the plan item instance) to get access to child plan items- Returns:
- true, if there is a repetition rule of the plan item instance currently evaluating to true with all of its conditions and attributes
-
searchNonFinishedEqualPlanItemInstances
public static List<PlanItemInstance> searchNonFinishedEqualPlanItemInstances(PlanItemInstanceEntity planItemInstanceEntity, PlanItemInstanceContainer planItemInstanceContainer) Searches for non-finished plan item instances within the given container to be of the same plan item as the given instance.- Parameters:
planItemInstanceEntity
- the plan item instance to search for instances of the same plan item within the containerplanItemInstanceContainer
- the container to search for child plan item instances of the same plan item- Returns:
- the list of equal plan item instances, might be empty, but never null
-
evaluateRepetitionRule
public static boolean evaluateRepetitionRule(CommandContext commandContext, VariableContainer variableContainer, String repetitionCondition) -
isCompletionNeutralPlanItemInstance
public static boolean isCompletionNeutralPlanItemInstance(PlanItemInstanceEntity planItemInstanceEntity) -
isCompletionNeutralPlanItemInstance
public static boolean isCompletionNeutralPlanItemInstance(CommandContext commandContext, PlanItemInstanceEntity planItemInstanceEntity) -
evaluateAutoComplete
public static boolean evaluateAutoComplete(CommandContext commandContext, VariableContainer variableContainer, Stage stage) Returns true, if the given stage has an auto-complete condition which evaluates to true or if not, is in auto-complete mode permanently.- Parameters:
commandContext
- the command context in which the method is invokedvariableContainer
- the variable container (most likely the plan item representing the stage or case plan model) used to evaluate the condition againststage
- the stage model object to get its auto-complete condition from- Returns:
- true, if the stage is in auto-complete, either statically or if the condition evaluates to true
-