flux
Interface ForEachCollectionElementAction

All Superinterfaces:
Action, java.lang.Cloneable, ForEachAction, RuntimeDataMap, java.io.Serializable

public interface ForEachCollectionElementAction
extends ForEachAction

Makes each element in a collection available for individual processing in a flow chart. The collection can be an array, List, Map, or Set.

The For Each Collection Element Action returns its result in the flow context variable "RESULT". The following table contains more information on accessing and using the result.

Flow Context Variable Java Type Description
RESULTbooleanA boolean value indicating whether there is still more data to process. If this value is true, then the action's collection element contains more elements to iterate over; if this value is false, then the end of the collection has been reached.

By default, any flow you create from the for each collection element action Action will have the condition "RESULT.result", meaning that the flow will only be followed if there is still data to iterate over.

If you create a flow with the else condition or the condition "NOT RESULT.result", then the action will only follow that flow when there is no more data in the collection. This is useful for continuing on in the workflow once you have processed the last element in the collection.

It is not appropriate to use an unconditional flow with the for each collection element action. Uncoditional flows will cause unexpected behavior in the workflow (for example, the action may repeatedly loop over the same set of data without exiting).

All other types of flows can be used with the for each collection element action.
<Loop index setting>java.lang.ObjectThe current item in the collection. The name of the variable depends on the value specified for the loop index on the action.

Author:
Copyright 2014 Flux Corporation. All rights reserved.

Nested Class Summary
 
Nested classes/interfaces inherited from interface flux.ForEachAction
ForEachAction.For_Each_Res, ForEachAction.ForEachResult
 
Method Summary
 Flow addFlow(Action action)
          The flow that is followed when collection data is still available to be processed.
 java.lang.Object getCollection()
          Returns the array, List, Map, or Set that is to be iterated over.
 java.lang.String getMapKeyIndex()
          Returns the name of the flow context variable that contains one of the map keys from the collection that is being iterated over.
 void setCollection(java.lang.Object collection)
          Sets the array, List, Map, or Set that is to be iterated over.
 void setMapKeyIndex(java.lang.String mapKeyIndex)
          Sets the name of the flow context variable that contains one of the map keys from the collection that is being iterated over.
 
Methods inherited from interface flux.ForEachAction
getLoopIndex, setExpirationFlow, setLoopIndex
 
Methods inherited from interface flux.Action
addFlow, addSignalFlow, clone, execute, getDescription, getFlows, getHiddenVariableNames, getJoinExpression, getName, getPostscript, getPostscriptLanguage, getPrescript, getPrescriptLanguage, getResultInfo, getSignalsToMonitor, getTimeoutBusinessInterval, getTimeoutBusinessIntervalNamespace, getTimeoutExpression, getVariableManager, isEndOfRun, isJoinPoint, isSkippable, isStartAction, isStartOfRun, isTransactionBreak, removeFlow, reset, setDescription, setElseFlow, setEndOfRun, setErrorFlow, setErrorFlowWithoutRollback, setErrorFlowWithRollback, setJoinExpression, setJoinPoint, setName, setPostscript, setPostscriptLanguage, setPrescript, setPrescriptLanguage, setSignalsToMonitor, setSkippable, setStartAction, setStartOfRun, setTimeoutBusinessInterval, setTimeoutBusinessIntervalNamespace, setTimeoutExpression, setTimeoutFlow, setTransactionBreak, verify, verifyOnClient
 
Methods inherited from interface flux.runtimedatamap.RuntimeDataMap
getRuntimeDataMap, setRuntimeDataMap
 

Method Detail

addFlow

Flow addFlow(Action action)
The flow that is followed when collection data is still available to be processed. Delegates to addFlow(Action, EngineHelper.useLastResult("result")).

To add a flow that is followed under different conditions, use a different flow condition by calling setElseFlow(Action action) or addFlow(Action action, String condition). For example, to follow a flow only after all the elements in the collection have been processed, call setElseFlow(action).

Note that with actions other than this action, addFlow(Action) may not delegate to addFlow(Action, EngineHelper.useLastResult("result")). Most actions do not delegate in this manner. When using these other actions, use caution to ensure the flow condition is as intended.

Specified by:
addFlow in interface Action
Parameters:
action - The flow that is followed when collection data is still available to be processed.
Returns:
The newly created flow.
See Also:
Action.setElseFlow(flux.Action), Action.addFlow(Action, String), EngineHelper.useLastResult(String)

getCollection

java.lang.Object getCollection()
Returns the array, List, Map, or Set that is to be iterated over. Returns null if the collection has not been set.

Returns:
The array, List, Map, or Set that is to be iterated over.

getMapKeyIndex

java.lang.String getMapKeyIndex()
Returns the name of the flow context variable that contains one of the map keys from the collection that is being iterated over. In other words, when a map is iterated over using this action, the name of the key of the current map element is stored in the flow context variable manager under the name specified by this method.

Defaults to "key".

Returns:
The name of the flow context variable that contains one of the map keys from the collection that is being iterated over.

setCollection

void setCollection(java.lang.Object collection)
Sets the array, List, Map, or Set that is to be iterated over. By default, the collection is null.

Parameters:
collection - The array, List, Map, or Set that is to be iterated over.
Throws:
java.lang.IllegalArgumentException - If the specified argument is not a recognized collection.

setMapKeyIndex

void setMapKeyIndex(java.lang.String mapKeyIndex)
Sets the name of the flow context variable that contains one of the map keys from the collection that is being iterated over. In other words, when a map is iterated over using this action, the name of the key of the current map element is stored in the flow context variable manager under the name specified by this method.

Defaults to "key".

Parameters:
mapKeyIndex - The name of the flow context variable that contains one of the map keys from the collection that is being iterated over.


© 2014 Flux Corporation. All rights reserved.