Package io.serverlessworkflow.api.states
Class ForEachState
- java.lang.Object
-
- io.serverlessworkflow.api.states.DefaultState
-
- io.serverlessworkflow.api.states.ForEachState
-
- All Implemented Interfaces:
State,Serializable
public class ForEachState extends DefaultState implements Serializable, State
Execute a set of defined actions or workflows for each element of a data array- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classForEachState.Mode-
Nested classes/interfaces inherited from class io.serverlessworkflow.api.states.DefaultState
DefaultState.Type
-
-
Constructor Summary
Constructors Constructor Description ForEachState()No args constructor for use in serializationForEachState(String name, DefaultState.Type type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Action>getActions()Actions to be executed for each of the elements of inputCollectionintgetBatchSize()Specifies how many iterations may run in parallel at the same time.StringgetInputCollection()Workflow expression selecting an array element of the states dataStringgetIterationParam()Name of the iteration parameter that can be referenced in actions/workflow.ForEachState.ModegetMode()Specifies how iterations are to be performed (sequentially or in parallel)StringgetOutputCollection()Workflow expression specifying an array element of the states data to add the results of each iterationbooleanisUsedForCompensation()If true, this state is used to compensate another state.voidsetActions(List<Action> actions)Actions to be executed for each of the elements of inputCollectionvoidsetBatchSize(int batchSize)Specifies how many iterations may run in parallel at the same time.voidsetInputCollection(String inputCollection)Workflow expression selecting an array element of the states datavoidsetIterationParam(String iterationParam)Name of the iteration parameter that can be referenced in actions/workflow.voidsetMode(ForEachState.Mode mode)Specifies how iterations are to be performed (sequentially or in parallel)voidsetOutputCollection(String outputCollection)Workflow expression specifying an array element of the states data to add the results of each iterationvoidsetUsedForCompensation(boolean usedForCompensation)If true, this state is used to compensate another state.ForEachStatewithActions(List<Action> actions)ForEachStatewithBatchSize(int batchSize)ForEachStatewithCompensatedBy(String compensatedBy)ForEachStatewithEnd(End end)ForEachStatewithId(String id)ForEachStatewithInputCollection(String inputCollection)ForEachStatewithIterationParam(String iterationParam)ForEachStatewithMetadata(Map<String,String> metadata)ForEachStatewithMode(ForEachState.Mode mode)ForEachStatewithName(String name)ForEachStatewithOnErrors(List<Error> onErrors)ForEachStatewithOutputCollection(String outputCollection)ForEachStatewithStateDataFilter(StateDataFilter stateDataFilter)ForEachStatewithTimeouts(TimeoutsDefinition timeouts)ForEachStatewithTransition(Transition transition)ForEachStatewithType(DefaultState.Type type)ForEachStatewithUsedForCompensation(boolean usedForCompensation)-
Methods inherited from class io.serverlessworkflow.api.states.DefaultState
getCompensatedBy, getEnd, getId, getMetadata, getName, getOnErrors, getStateDataFilter, getTimeouts, getTransition, getType, setCompensatedBy, setEnd, setId, setMetadata, setName, setOnErrors, setStateDataFilter, setTimeouts, setTransition, setType
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.serverlessworkflow.api.interfaces.State
getCompensatedBy, getEnd, getId, getMetadata, getName, getOnErrors, getStateDataFilter, getTimeouts, getTransition, getType
-
-
-
-
Constructor Detail
-
ForEachState
public ForEachState()
No args constructor for use in serialization
-
ForEachState
public ForEachState(String name, DefaultState.Type type)
- Parameters:
name-type-
-
-
Method Detail
-
getInputCollection
public String getInputCollection()
Workflow expression selecting an array element of the states data
-
setInputCollection
public void setInputCollection(String inputCollection)
Workflow expression selecting an array element of the states data
-
withInputCollection
public ForEachState withInputCollection(String inputCollection)
-
getOutputCollection
public String getOutputCollection()
Workflow expression specifying an array element of the states data to add the results of each iteration
-
setOutputCollection
public void setOutputCollection(String outputCollection)
Workflow expression specifying an array element of the states data to add the results of each iteration
-
withOutputCollection
public ForEachState withOutputCollection(String outputCollection)
-
getIterationParam
public String getIterationParam()
Name of the iteration parameter that can be referenced in actions/workflow. For each parallel iteration, this param should contain an unique element of the inputCollection array
-
setIterationParam
public void setIterationParam(String iterationParam)
Name of the iteration parameter that can be referenced in actions/workflow. For each parallel iteration, this param should contain an unique element of the inputCollection array
-
withIterationParam
public ForEachState withIterationParam(String iterationParam)
-
getBatchSize
public int getBatchSize()
Specifies how many iterations may run in parallel at the same time. Used if 'mode' property is set to 'parallel' (default)
-
setBatchSize
public void setBatchSize(int batchSize)
Specifies how many iterations may run in parallel at the same time. Used if 'mode' property is set to 'parallel' (default)
-
withBatchSize
public ForEachState withBatchSize(int batchSize)
-
getActions
public List<Action> getActions()
Actions to be executed for each of the elements of inputCollection
-
setActions
public void setActions(List<Action> actions)
Actions to be executed for each of the elements of inputCollection
-
withActions
public ForEachState withActions(List<Action> actions)
-
isUsedForCompensation
public boolean isUsedForCompensation()
If true, this state is used to compensate another state. Default is false
-
setUsedForCompensation
public void setUsedForCompensation(boolean usedForCompensation)
If true, this state is used to compensate another state. Default is false
-
withUsedForCompensation
public ForEachState withUsedForCompensation(boolean usedForCompensation)
-
getMode
public ForEachState.Mode getMode()
Specifies how iterations are to be performed (sequentially or in parallel)
-
setMode
public void setMode(ForEachState.Mode mode)
Specifies how iterations are to be performed (sequentially or in parallel)
-
withMode
public ForEachState withMode(ForEachState.Mode mode)
-
withId
public ForEachState withId(String id)
- Overrides:
withIdin classDefaultState
-
withName
public ForEachState withName(String name)
- Overrides:
withNamein classDefaultState
-
withType
public ForEachState withType(DefaultState.Type type)
- Overrides:
withTypein classDefaultState
-
withEnd
public ForEachState withEnd(End end)
- Overrides:
withEndin classDefaultState
-
withStateDataFilter
public ForEachState withStateDataFilter(StateDataFilter stateDataFilter)
- Overrides:
withStateDataFilterin classDefaultState
-
withMetadata
public ForEachState withMetadata(Map<String,String> metadata)
- Overrides:
withMetadatain classDefaultState
-
withTransition
public ForEachState withTransition(Transition transition)
- Overrides:
withTransitionin classDefaultState
-
withOnErrors
public ForEachState withOnErrors(List<Error> onErrors)
- Overrides:
withOnErrorsin classDefaultState
-
withCompensatedBy
public ForEachState withCompensatedBy(String compensatedBy)
- Overrides:
withCompensatedByin classDefaultState
-
withTimeouts
public ForEachState withTimeouts(TimeoutsDefinition timeouts)
- Overrides:
withTimeoutsin classDefaultState
-
-