Class FlowableExpressionCollectionUtils
java.lang.Object
com.flowable.platform.expressions.FlowableExpressionCollectionUtils
Expression Bean Name: flwCollectionUtils
Offers utilities to work with
Collections (Lists, Sets etc.) as well as Maps.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFlowableExpressionCollectionUtils(CmmnRuntimeService cmmnRuntimeService, RuntimeService runtimeService, com.fasterxml.jackson.databind.ObjectMapper objectMapper) -
Method Summary
Modifier and TypeMethodDescriptioncom.fasterxml.jackson.databind.JsonNodeaddVariable(Object planItemOrExecution, String baseVariableName, String variableName, Object variableValue) adds a variable to a case (planItem) or process (execution) if the baseVariable (e.g.protected com.fasterxml.jackson.databind.JsonNodeaddVariableToExecution(Execution execution, String baseVariableName, String variableName, Object variableValue) protected com.fasterxml.jackson.databind.JsonNodeaddVariableToNode(com.fasterxml.jackson.databind.node.ObjectNode objectNode, com.fasterxml.jackson.databind.node.ObjectNode existingVariableNode, String nestedVariableName, Object variableValue) protected com.fasterxml.jackson.databind.JsonNodeaddVariableToObjectNode(com.fasterxml.jackson.databind.node.ObjectNode objectNode, String nestedVariableName, Object variableValue) protected com.fasterxml.jackson.databind.JsonNodeaddVariableToPlanItem(PlanItemInstance planItemInstance, String baseVariableName, String variableName, Object variableValue) protected com.fasterxml.jackson.databind.node.ObjectNodeprotected com.fasterxml.jackson.databind.JsonNodecreateSubNodes(com.fasterxml.jackson.databind.node.ObjectNode objectNode, String[] nestedVariableNames, Object variableValue, int index) protected com.fasterxml.jackson.databind.node.ObjectNodecreateTopNodeIfNotExists(PlanItemInstance planItemInstance, String baseVariableName) protected com.fasterxml.jackson.databind.node.ObjectNodecreateTopNodeIfNotExists(Execution execution, String baseVariableName) protected com.fasterxml.jackson.databind.JsonNodecreateVariableNode(com.fasterxml.jackson.databind.node.ObjectNode objectNode, String nestedVariableName, Object variableValue) <T> List<T>distinct(Collection<T> collection) Deletes all duplicates from a list while retaining order.Creates a new list, for instance to be used in an Initialize Variables Service Task.emptyMap()Creates a new map, for instance to be used in an Initialize Variables Service Task.com.fasterxml.jackson.databind.JsonNode<T> List<T>extractValues(Iterable iterable, String variableName) Extracts a single variable/element from a collection and stores in a flattened list.protected com.fasterxml.jackson.databind.node.ObjectNodeprotected booleanisNotExisting(com.fasterxml.jackson.databind.node.ObjectNode objectNode, String nestedVariableName) final <T> List<T>listWithElements(T... elements) Creates a new list with as many elements as desired.final <T> List<T>mergeCollections(Collection<T>... collections) Merges several collections into a list.<K,V> Map<K, V> Inserts or updates a value depending on whether it exists or not and returns the updated map.
-
Field Details
-
REGEX_DOT
- See Also:
-
-
Constructor Details
-
FlowableExpressionCollectionUtils
public FlowableExpressionCollectionUtils(CmmnRuntimeService cmmnRuntimeService, RuntimeService runtimeService, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-
Method Details
-
addVariable
public com.fasterxml.jackson.databind.JsonNode addVariable(Object planItemOrExecution, String baseVariableName, String variableName, Object variableValue) adds a variable to a case (planItem) or process (execution) if the baseVariable (e.g. root.test) does not exist, it will be created and the variable added- Parameters:
planItemOrExecution- can be the case instance (planItemInstance) or the process instance (execution)baseVariableName- base variable in within the instance (e.g. root.test would be just 'test')variableName- variable name that should be addedvariableValue- variable value of the variable- Returns:
- returns a JsonNode with the added variable
-
emptyNode
public com.fasterxml.jackson.databind.JsonNode emptyNode() -
addVariableToExecution
-
addVariableToPlanItem
protected com.fasterxml.jackson.databind.JsonNode addVariableToPlanItem(PlanItemInstance planItemInstance, String baseVariableName, String variableName, Object variableValue) -
createTopNodeIfNotExists
protected com.fasterxml.jackson.databind.node.ObjectNode createTopNodeIfNotExists(PlanItemInstance planItemInstance, String baseVariableName) -
createTopNodeIfNotExists
-
createSubNodes
-
createVariableNode
-
addVariableToNode
-
isNotExisting
protected boolean isNotExisting(com.fasterxml.jackson.databind.node.ObjectNode objectNode, String nestedVariableName) -
addVariableToObjectNode
-
getEmptyNode
protected com.fasterxml.jackson.databind.node.ObjectNode getEmptyNode() -
checkNode
-
emptyList
Creates a new list, for instance to be used in an Initialize Variables Service Task. Example: #{flwCollectionUtils.emptyList()}- Returns:
- An empty
List
-
emptyMap
Creates a new map, for instance to be used in an Initialize Variables Service Task. Example: #{flwCollectionUtils.emptyMap()}- Returns:
- An empty
Map
-
listWithElements
Creates a new list with as many elements as desired. Example: #{flwCollectionUtils.listWithElements('green', 'yellow', 'red')}- Type Parameters:
T- the type of the list- Parameters:
elements- the elements to add to the new collection- Returns:
- A new list with the given elements
-
mergeCollections
Merges several collections into a list. #{flwCollectionUtils.mergeCollections(candidateGroupIds, newGroups)}- Type Parameters:
T- type of the collection- Parameters:
collections- collections to be merged- Returns:
- The merged collections
-
distinct
Deletes all duplicates from a list while retaining order. Example: #{flwCollectionUtils.distinct(myListWithDuplicates)}- Type Parameters:
T- type of the list- Parameters:
collection- the base collection- Returns:
- List without any duplicates
-
extractValues
Extracts a single variable/element from a collection and stores in a flattened list. The following types are supported: - VariableContainer (e.g. executions, case instances, data objects) - JSON ObjectNode - Map- Type Parameters:
T- The type of the output variable- Parameters:
iterable- An iterable (JSON array, lists etc.) containing VariableContainers, ObjectNodes or MapsvariableName- The name of the variable to extract- Returns:
- A list of extracted values
-
updateMap
Inserts or updates a value depending on whether it exists or not and returns the updated map.- Type Parameters:
K- the type of the keyV- the type of the value- Parameters:
map- the map to be updatedkey- the key within the map to be updatednewValue- the new value- Returns:
- The updated map
-