public class FlowableExpressionCollectionUtils extends Object
Collection
s (List
s, Set
s etc.) as well as Map
s.Constructor and Description |
---|
FlowableExpressionCollectionUtils(CmmnRuntimeService cmmnRuntimeService,
RuntimeService runtimeService,
com.fasterxml.jackson.databind.ObjectMapper objectMapper) |
Modifier and Type | Method and Description |
---|---|
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.
|
protected com.fasterxml.jackson.databind.JsonNode |
addVariableToExecution(Execution execution,
String baseVariableName,
String variableName,
Object variableValue) |
protected com.fasterxml.jackson.databind.JsonNode |
addVariableToNode(com.fasterxml.jackson.databind.node.ObjectNode objectNode,
com.fasterxml.jackson.databind.node.ObjectNode existingVariableNode,
String nestedVariableName,
Object variableValue) |
protected com.fasterxml.jackson.databind.JsonNode |
addVariableToObjectNode(com.fasterxml.jackson.databind.node.ObjectNode objectNode,
String nestedVariableName,
Object variableValue) |
protected com.fasterxml.jackson.databind.JsonNode |
addVariableToPlanItem(PlanItemInstance planItemInstance,
String baseVariableName,
String variableName,
Object variableValue) |
protected com.fasterxml.jackson.databind.node.ObjectNode |
checkNode(Object jsonNode) |
protected com.fasterxml.jackson.databind.JsonNode |
createSubNodes(com.fasterxml.jackson.databind.node.ObjectNode objectNode,
String[] nestedVariableNames,
Object variableValue,
int index) |
protected com.fasterxml.jackson.databind.node.ObjectNode |
createTopNodeIfNotExists(Execution execution,
String baseVariableName) |
protected com.fasterxml.jackson.databind.node.ObjectNode |
createTopNodeIfNotExists(PlanItemInstance planItemInstance,
String baseVariableName) |
protected com.fasterxml.jackson.databind.JsonNode |
createVariableNode(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.
|
List |
emptyList()
Creates a new list, for instance to be used in an Initialize Variables Service Task.
|
Map |
emptyMap()
Creates a new map, for instance to be used in an Initialize Variables Service Task.
|
com.fasterxml.jackson.databind.JsonNode |
emptyNode() |
<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.ObjectNode |
getEmptyNode() |
protected boolean |
isNotExisting(com.fasterxml.jackson.databind.node.ObjectNode objectNode,
String nestedVariableName) |
<T> List<T> |
listWithElements(T... elements)
Creates a new list with as many elements as desired.
|
<T> List<T> |
mergeCollections(Collection<T>... collections)
Merges several collections into a list.
|
<K,V> Map<K,V> |
updateMap(Map<K,V> map,
K key,
V newValue)
Inserts or updates a value depending on whether it exists or not and returns the updated map.
|
public static final String REGEX_DOT
public FlowableExpressionCollectionUtils(CmmnRuntimeService cmmnRuntimeService, RuntimeService runtimeService, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
public com.fasterxml.jackson.databind.JsonNode addVariable(Object planItemOrExecution, String baseVariableName, String variableName, Object variableValue)
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 variablepublic com.fasterxml.jackson.databind.JsonNode emptyNode()
protected com.fasterxml.jackson.databind.JsonNode addVariableToExecution(Execution execution, String baseVariableName, String variableName, Object variableValue)
protected com.fasterxml.jackson.databind.JsonNode addVariableToPlanItem(PlanItemInstance planItemInstance, String baseVariableName, String variableName, Object variableValue)
protected com.fasterxml.jackson.databind.node.ObjectNode createTopNodeIfNotExists(PlanItemInstance planItemInstance, String baseVariableName)
protected com.fasterxml.jackson.databind.node.ObjectNode createTopNodeIfNotExists(Execution execution, String baseVariableName)
protected com.fasterxml.jackson.databind.JsonNode createSubNodes(com.fasterxml.jackson.databind.node.ObjectNode objectNode, String[] nestedVariableNames, Object variableValue, int index)
protected com.fasterxml.jackson.databind.JsonNode createVariableNode(com.fasterxml.jackson.databind.node.ObjectNode objectNode, String nestedVariableName, Object variableValue)
protected com.fasterxml.jackson.databind.JsonNode addVariableToNode(com.fasterxml.jackson.databind.node.ObjectNode objectNode, com.fasterxml.jackson.databind.node.ObjectNode existingVariableNode, String nestedVariableName, Object variableValue)
protected boolean isNotExisting(com.fasterxml.jackson.databind.node.ObjectNode objectNode, String nestedVariableName)
protected com.fasterxml.jackson.databind.JsonNode addVariableToObjectNode(com.fasterxml.jackson.databind.node.ObjectNode objectNode, String nestedVariableName, Object variableValue)
protected com.fasterxml.jackson.databind.node.ObjectNode getEmptyNode()
protected com.fasterxml.jackson.databind.node.ObjectNode checkNode(Object jsonNode)
public List emptyList()
List
public Map emptyMap()
Map
@SafeVarargs public final <T> List<T> listWithElements(T... elements)
T
- the type of the listelements
- the elements to add to the new collection@SafeVarargs public final <T> List<T> mergeCollections(Collection<T>... collections)
T
- type of the collectioncollections
- collections to be mergedpublic <T> List<T> distinct(Collection<T> collection)
T
- type of the listcollection
- the base collectionpublic <T> List<T> extractValues(Iterable iterable, String variableName)
T
- The type of the output variableiterable
- An iterable (JSON array, lists etc.) containing VariableContainers, ObjectNodes or MapsvariableName
- The name of the variable to extractpublic <K,V> Map<K,V> updateMap(Map<K,V> map, K key, V newValue)
K
- the type of the keyV
- the type of the valuemap
- the map to be updatedkey
- the key within the map to be updatednewValue
- the new value