com.dtolabs.rundeck.core.execution.workflow.state
Class StateUtils

java.lang.Object
  extended by 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
static class StateUtils.CtxItem
           
 
Constructor Summary
StateUtils()
           
 
Method Summary
static StepContextId first(StepIdentifier stepIdentifier)
           
static boolean isContainedStep(StepContextId general, StepContextId specific)
           
static boolean isMatchedIdentifier(StepIdentifier parent, StepIdentifier child, boolean substep)
          Return true if the identifier is a subcontext of the parent identifier, optionally allowing sub steps
static boolean isMatchedIdentifier(java.lang.String parent, java.lang.String child, boolean substep)
          Return true if the identifier represents a subcontext context of the parent identifier, optionally allowing sub steps
static StepContextId last(StepIdentifier stepIdentifier)
           
static java.lang.String parameterString(java.util.Map<java.lang.String,java.lang.String> params)
          Generate the parameter string for a map of parameters
static java.lang.String parameterString(StepContextId contextId)
          Generate string for a context id's parameter section, if present
static java.util.Map<java.lang.String,java.lang.String> parseParameterString(java.lang.String t)
          Parse a paramter string to a parameter map
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
static StepContextId stepContextId(int step, boolean errorhandler)
           
static StepContextId stepContextId(int step, boolean errorhandler, java.util.Map<java.lang.String,java.lang.String> params)
           
static StepContextId stepContextIdFromString(java.lang.String s)
          Generate a step context id from a string
static StepIdentifier stepIdentifier(int... ids)
           
static StepIdentifier stepIdentifier(int id)
           
static StepIdentifier stepIdentifier(java.util.List<StepContextId> context)
           
static StepIdentifier stepIdentifier(StepContextId... context)
           
static StepIdentifier stepIdentifierAppend(StepIdentifier identifier, StepIdentifier identifier2)
           
static StepIdentifier stepIdentifierFromString(java.lang.String input)
          Parse a step identifier from a string
static StepIdentifier stepIdentifierTail(StepIdentifier identifier)
           
static java.lang.String stepIdentifierToString(StepIdentifier ident)
          Generate a string representing the step identifier
static StepState stepState(ExecutionState state)
           
static StepState stepState(ExecutionState state, java.util.Map metadata)
           
static StepState stepState(ExecutionState state, java.util.Map metadata, java.lang.String errorMessage)
           
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)
           
static StepStateChange stepStateChange(StepState state)
           
static StepStateChange stepStateChange(StepState state, java.lang.String nodeName)
           
static WorkflowNodeState workflowNodeState(java.lang.String nodeName, StepState nodeState, StepIdentifier lastIdentifier, java.util.Map<StepIdentifier,? extends StepState> stepStates)
           
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)
           
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)
           
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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateUtils

public StateUtils()
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 -
Returns:
parameter string, or blank string

parameterString

public static java.lang.String parameterString(java.util.Map<java.lang.String,java.lang.String> params)
Generate the parameter string for a map of parameters

Parameters:
params -
Returns:

stepIdentifierToString

public static java.lang.String stepIdentifierToString(StepIdentifier ident)
Generate a string representing the step identifier

Parameters:
ident -
Returns:

stepIdentifierFromString

public static StepIdentifier stepIdentifierFromString(java.lang.String input)
Parse a step identifier from a string

Parameters:
input -
Returns:

stepContextIdFromString

public static StepContextId stepContextIdFromString(java.lang.String s)
Generate a step context id from a string

Parameters:
s -
Returns:

parseParameterString

public static java.util.Map<java.lang.String,java.lang.String> parseParameterString(java.lang.String t)
Parse a paramter string to a parameter map

Parameters:
t -
Returns:

isMatchedIdentifier

public static boolean isMatchedIdentifier(java.lang.String parent,
                                          java.lang.String child,
                                          boolean substep)
Return true if the identifier represents a subcontext context of the parent identifier, optionally allowing sub steps

Parameters:
parent - parent identifier
child - child identifier
substep - if true, allow the child identifier to be longer than the parent, otherwise require exact same length
Returns:

isMatchedIdentifier

public static boolean isMatchedIdentifier(StepIdentifier parent,
                                          StepIdentifier child,
                                          boolean substep)
Return true if the identifier is a subcontext of the parent identifier, optionally allowing sub steps

Parameters:
parent - parent identifier
child - child identifier
substep - if true, allow the child identifier to be longer than the parent, otherwise require exact same length
Returns:

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)