Class StateUtils
- java.lang.Object
-
- com.dtolabs.rundeck.core.execution.workflow.state.StateUtils
-
public class StateUtils extends java.lang.Object$INTERFACE is ... User: greg Date: 10/17/13 Time: 12:36 PM
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStateUtils.CtxItem
-
Constructor Summary
Constructors Constructor Description StateUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StepContextIdfirst(StepIdentifier stepIdentifier)static booleanisContainedStep(StepContextId general, StepContextId specific)static booleanisMatchedIdentifier(StepIdentifier parent, StepIdentifier child, boolean substep)static booleanisMatchedIdentifier(java.lang.String parent, java.lang.String child, boolean substep)static StepContextIdlast(StepIdentifier stepIdentifier)static java.lang.StringparameterString(StepContextId contextId)Generate string for a context id's parameter section, if presentstatic java.lang.StringparameterString(java.util.Map<java.lang.String,java.lang.String> params)static java.util.Map<java.lang.String,java.lang.String>parseParameterString(java.lang.String t)static voidsetupNodeStates(WorkflowStateImpl current)Configure the nodeStates map for the workflow, by visiting each step in the workflow, and connecting the step+node state for nodeSteps to the nodeStates mapstatic StepContextIdstepContextId(int step, boolean errorhandler)static StepContextIdstepContextId(int step, boolean errorhandler, java.util.Map<java.lang.String,java.lang.String> params)static StepContextIdstepContextIdFromString(java.lang.String s)static java.lang.StringstepContextIdToString(StepContextId context)static StepIdentifierstepIdentifier(int id)static StepIdentifierstepIdentifier(int... ids)static StepIdentifierstepIdentifier(StepContextId... context)static StepIdentifierstepIdentifier(java.util.List<StepContextId> context)static StepIdentifierstepIdentifierAppend(StepIdentifier identifier, StepIdentifier identifier2)static StepIdentifierstepIdentifierFromString(java.lang.String input)static StepIdentifierstepIdentifierTail(StepIdentifier identifier)static java.lang.StringstepIdentifierToString(StepIdentifier ident)static StepStatestepState(ExecutionState state)static StepStatestepState(ExecutionState state, java.util.Map metadata)static StepStatestepState(ExecutionState state, java.util.Map metadata, java.lang.String errorMessage)static StepStatestepState(ExecutionState state, java.util.Map metadata, java.lang.String errorMessage, java.util.Date startTime, java.util.Date updateTime, java.util.Date endTime)static StepStateChangestepStateChange(StepState state)static StepStateChangestepStateChange(StepState state, java.lang.String nodeName)static WorkflowNodeStateworkflowNodeState(java.lang.String nodeName, StepState nodeState, StepIdentifier lastIdentifier, java.util.Map<StepIdentifier,? extends StepState> stepStates)static WorkflowStateworkflowState(java.util.List<java.lang.String> nodeSet, java.util.List<java.lang.String> allNodes, long stepCount, ExecutionState executionState, java.util.Date updateTime, java.util.Date startTime, java.util.Date endTime, java.lang.String serverNode, java.util.List<WorkflowStepState> stepStates, boolean setupNodeStates)static WorkflowStateworkflowState(java.util.List<java.lang.String> nodeSet, java.util.List<java.lang.String> allNodes, long stepCount, ExecutionState executionState, java.util.Date timestamp, java.util.Date startTime, java.util.Date endTime, java.lang.String serverNode, java.util.List<WorkflowStepState> stepStates, java.util.Map<java.lang.String,WorkflowNodeState> nodeStates)static WorkflowStepStateworkflowStepState(StepState stepState, java.util.Map<java.lang.String,StepState> nodeStateMap, StepIdentifier stepIdentifier, WorkflowState subWorkflowState, java.util.List<java.lang.String> nodeStepTargets, boolean nodeStep)
-
-
-
Method Detail
-
stepState
public static StepState stepState(ExecutionState state)
-
stepState
public static StepState stepState(ExecutionState state, java.util.Map metadata)
-
stepState
public static StepState stepState(ExecutionState state, java.util.Map metadata, java.lang.String errorMessage)
-
stepState
public static StepState stepState(ExecutionState state, java.util.Map metadata, java.lang.String errorMessage, java.util.Date startTime, java.util.Date updateTime, java.util.Date endTime)
-
stepStateChange
public static StepStateChange stepStateChange(StepState state)
-
stepStateChange
public static StepStateChange stepStateChange(StepState state, java.lang.String nodeName)
-
parameterString
public static java.lang.String parameterString(StepContextId contextId)
Generate string for a context id's parameter section, if present- Parameters:
contextId- context id- Returns:
- parameter string, or blank string
-
parameterString
public static java.lang.String parameterString(java.util.Map<java.lang.String,java.lang.String> params)
- Parameters:
params- params- Returns:
- Generate the parameter string for a map of parameters
-
stepIdentifierToString
public static java.lang.String stepIdentifierToString(StepIdentifier ident)
- Parameters:
ident- ident- Returns:
- Generate a string representing the step identifier
-
stepIdentifierFromString
public static StepIdentifier stepIdentifierFromString(java.lang.String input)
- Parameters:
input- identifier string- Returns:
- Parse a step identifier from a string
-
stepContextIdToString
public static java.lang.String stepContextIdToString(StepContextId context)
-
stepContextIdFromString
public static StepContextId stepContextIdFromString(java.lang.String s)
- Parameters:
s- context id- Returns:
- Generate a step context id from a string
-
parseParameterString
public static java.util.Map<java.lang.String,java.lang.String> parseParameterString(java.lang.String t)
- Parameters:
t- parameter- Returns:
- Parse a paramter string to a parameter map
-
isMatchedIdentifier
public static boolean isMatchedIdentifier(java.lang.String parent, java.lang.String child, boolean substep)- Parameters:
parent- parent identifierchild- child identifiersubstep- if true, allow the child identifier to be longer than the parent, otherwise require exact same length- Returns:
- true if the identifier represents a subcontext context of the parent identifier, optionally allowing sub steps
-
isMatchedIdentifier
public static boolean isMatchedIdentifier(StepIdentifier parent, StepIdentifier child, boolean substep)
- Parameters:
parent- parent identifierchild- child identifiersubstep- if true, allow the child identifier to be longer than the parent, otherwise require exact same length- Returns:
- true if the identifier is a subcontext of the parent identifier, optionally allowing sub steps
-
isContainedStep
public static boolean isContainedStep(StepContextId general, StepContextId specific)
-
stepContextId
public static StepContextId stepContextId(int step, boolean errorhandler)
-
stepContextId
public static StepContextId stepContextId(int step, boolean errorhandler, java.util.Map<java.lang.String,java.lang.String> params)
-
stepIdentifier
public static StepIdentifier stepIdentifier(java.util.List<StepContextId> context)
-
stepIdentifier
public static StepIdentifier stepIdentifier(StepContextId... context)
-
stepIdentifier
public static StepIdentifier stepIdentifier(int id)
-
stepIdentifier
public static StepIdentifier stepIdentifier(int... ids)
-
last
public static StepContextId last(StepIdentifier stepIdentifier)
-
first
public static StepContextId first(StepIdentifier stepIdentifier)
-
stepIdentifierTail
public static StepIdentifier stepIdentifierTail(StepIdentifier identifier)
-
stepIdentifierAppend
public static StepIdentifier stepIdentifierAppend(StepIdentifier identifier, StepIdentifier identifier2)
-
workflowState
public static WorkflowState workflowState(java.util.List<java.lang.String> nodeSet, java.util.List<java.lang.String> allNodes, long stepCount, ExecutionState executionState, java.util.Date updateTime, java.util.Date startTime, java.util.Date endTime, java.lang.String serverNode, java.util.List<WorkflowStepState> stepStates, boolean setupNodeStates)
-
workflowState
public static WorkflowState workflowState(java.util.List<java.lang.String> nodeSet, java.util.List<java.lang.String> allNodes, long stepCount, ExecutionState executionState, java.util.Date timestamp, java.util.Date startTime, java.util.Date endTime, java.lang.String serverNode, java.util.List<WorkflowStepState> stepStates, java.util.Map<java.lang.String,WorkflowNodeState> nodeStates)
-
setupNodeStates
public static void setupNodeStates(WorkflowStateImpl current)
Configure the nodeStates map for the workflow, by visiting each step in the workflow, and connecting the step+node state for nodeSteps to the nodeStates map- Parameters:
current- workflow to visit
-
workflowStepState
public static WorkflowStepState workflowStepState(StepState stepState, java.util.Map<java.lang.String,StepState> nodeStateMap, StepIdentifier stepIdentifier, WorkflowState subWorkflowState, java.util.List<java.lang.String> nodeStepTargets, boolean nodeStep)
-
workflowNodeState
public static WorkflowNodeState workflowNodeState(java.lang.String nodeName, StepState nodeState, StepIdentifier lastIdentifier, java.util.Map<StepIdentifier,? extends StepState> stepStates)
-
-