public class GraphNodeImpl extends DocumentRouteElementImpl implements GraphNode
DocumentRouteElementImpl.GetIsParentRunningUnrestricted, DocumentRouteElementImpl.SetDocumentOnReadOnlyUnrestrictedSessionRunner
GraphNode.Button, GraphNode.EscalationRule, GraphNode.Point, GraphNode.State, GraphNode.TaskInfo, GraphNode.Transition
DocumentRouteElement.ElementLifeCycleState, DocumentRouteElement.ElementLifeCycleTransistion
Modifier and Type | Field and Description |
---|---|
protected List<GraphNode.EscalationRule> |
escalationRules |
protected GraphRouteImpl |
graph |
protected List<GraphNode.Transition> |
inputTransitions
To be used through getter.
|
protected GraphNode.State |
localState |
protected List<GraphNode.Transition> |
outputTransitions
To be used through getter.
|
protected List<GraphNode.Button> |
taskButtons
To be used through getter.
|
protected List<GraphNode.TaskInfo> |
tasksInfo |
document, runner
MERGE_ALL, MERGE_ONE, NODE_VARIABLE_COMMENT, PROP_ALLOW_TASK_REASSIGNMENT, PROP_BTN_FILTER, PROP_BTN_LABEL, PROP_BTN_NAME, PROP_CANCELED, PROP_COUNT, PROP_ESCALATION_RULE_CHAIN, PROP_ESCALATION_RULE_CONDITION, PROP_ESCALATION_RULE_EXECUTED, PROP_ESCALATION_RULE_ID, PROP_ESCALATION_RULE_LABEL, PROP_ESCALATION_RULE_MULTIPLE_EXECUTION, PROP_ESCALATION_RULES, PROP_EXECUTE_ONLY_FIRST_TRANSITION, PROP_HAS_MULTIPLE_TASKS, PROP_HAS_TASK, PROP_INPUT_CHAIN, PROP_KEYVALUE_KEY, PROP_KEYVALUE_VALUE, PROP_LAST_EXECUTION_TIME, PROP_MERGE, PROP_NODE_BUTTON, PROP_NODE_END_DATE, PROP_NODE_ID, PROP_NODE_LAST_ACTOR, PROP_NODE_START_DATE, PROP_NODE_X_COORDINATE, PROP_NODE_Y_COORDINATE, PROP_OUTPUT_CHAIN, PROP_START, PROP_STOP, PROP_SUB_ROUTE_INSTANCE_ID, PROP_SUB_ROUTE_MODEL_EXPR, PROP_SUB_ROUTE_VARS, PROP_TASK_ASSIGNEES, PROP_TASK_ASSIGNEES_PERMISSION, PROP_TASK_ASSIGNEES_VAR, PROP_TASK_BUTTONS, PROP_TASK_DIRECTIVE, PROP_TASK_DOC_TYPE, PROP_TASK_DUE_DATE, PROP_TASK_DUE_DATE_EXPR, PROP_TASK_INFO_ACTOR, PROP_TASK_INFO_COMMENT, PROP_TASK_INFO_ENDED, PROP_TASK_INFO_STATUS, PROP_TASK_INFO_TASK_DOC_ID, PROP_TASK_LAYOUT, PROP_TASK_NOTIFICATION_TEMPLATE, PROP_TASKS_INFO, PROP_TITLE, PROP_TRANS_CHAIN, PROP_TRANS_CONDITION, PROP_TRANS_LABEL, PROP_TRANS_NAME, PROP_TRANS_PATH, PROP_TRANS_RESULT, PROP_TRANS_TARGET, PROP_TRANSITIONS, PROP_VARIABLES_FACET
Constructor and Description |
---|
GraphNodeImpl(DocumentModel doc) |
GraphNodeImpl(DocumentModel doc,
GraphRouteImpl graph) |
Modifier and Type | Method and Description |
---|---|
protected void |
addTaskAssignees(List<String> taskAssignees) |
void |
addTaskInfo(String taskId)
Persist the info when a new task is created from this node
|
boolean |
allowTaskReassignment()
Returns true if tasks created from this node can be reassigned.
|
void |
cancelSubRoute()
Cancels the sub-route if there is one.
|
protected void |
cancelTask(CoreSession session,
String taskId) |
void |
cancelTasks()
Cancels the tasks not ended on this node.
|
boolean |
canMerge()
Checks if the merge is ready to execute (enough input transitions are present).
|
protected List<GraphNode.EscalationRule> |
computeEscalationRules() |
protected List<GraphNode.Transition> |
computeOutputTransitions() |
protected List<GraphNode.Button> |
computeTaskButtons() |
Date |
computeTaskDueDate()
Evaluates the task due date from the taskDueDateExpr and sets it as the dueDate
|
protected List<GraphNode.TaskInfo> |
computeTasksInfo() |
void |
ending()
Does bookkeeping at node end.
|
static boolean |
equality(Object o1,
Object o2) |
protected Date |
evaluateDueDate() |
List<GraphNode.EscalationRule> |
evaluateEscalationRules()
Evaluates the rules for the escalation rules and returns the ones to be executed.
|
List<String> |
evaluateTaskAssignees()
Evaluates the task assignees from the taskAssigneesVar
|
List<GraphNode.Transition> |
evaluateTransitions()
Evaluates transition conditions and returns the transitions that were true.
|
void |
executeChain(String chainId)
Executes an Automation chain in the context of this node.
|
void |
executeChain(String chainId,
String transitionId) |
boolean |
executeOnlyFirstTransition()
When workflow engine runs an exclusive node, it evaluates the transition one by one and stops a soon as one of
the transition is evaluated to true
|
void |
executeTransitionChain(GraphNode.Transition transition)
Executes an Automation chain in the context of this node for a given transition
|
protected boolean |
getBoolean(String propertyName) |
long |
getCanceledCount()
Gets the canceled count for this node.
|
List<GraphNode.TaskInfo> |
getEndedTasksInfo()
Gets all the ended tasks originating from this node.
|
List<GraphNode.EscalationRule> |
getEscalationRules()
Gets the list of all escalation rules for the node
|
protected OperationContext |
getExecutionContext(CoreSession session) |
String |
getId()
Get the node id.
|
String |
getInputChain()
Get input chain.
|
List<GraphNode.Transition> |
getInputTransitions()
Gets the input transitions.
|
Map<String,Serializable> |
getJsonVariables()
Gets a map containing the Json formatted variables currently defined on this node
|
protected Calendar |
getNodeEndTime() |
protected String |
getNodeLastActor() |
protected Calendar |
getNodeStartTime() |
String |
getOutputChain()
Get output chain.
|
List<GraphNode.Transition> |
getOutputTransitions()
Gets the output transitions.
|
List<GraphNode.TaskInfo> |
getProcessedTasksInfo()
Gets all the ended tasks originating from this node that were processed with a status.
|
protected CoreSession |
getSession() |
GraphNode.State |
getState()
Get the node state.
|
protected Map<String,Serializable> |
getSubRouteInitialVariables() |
protected String |
getSubRouteInstanceId() |
String |
getSubRouteModelId()
Gets the sub-route model id.
|
List<String> |
getTaskAssignees()
Gets the task assignees
|
String |
getTaskAssigneesPermission()
Gets the permission to the granted to the actors on this task on the document following the workflow
|
String |
getTaskAssigneesVar() |
List<GraphNode.Button> |
getTaskButtons()
Gets the task buttons
|
String |
getTaskDirective()
Gets the task directive
|
String |
getTaskDocType() |
Date |
getTaskDueDate()
Gets the due date
|
String |
getTaskDueDateExpr() |
String |
getTaskLayout()
Gets the task layout
|
String |
getTaskNotificationTemplate() |
List<GraphNode.TaskInfo> |
getTasksInfo()
Gets all the tasks info for the tasks created from this node
|
Map<String,Serializable> |
getVariables()
Gets a map containing the variables currently defined on this node
|
Map<String,Serializable> |
getWorkflowContextualInfo(CoreSession session,
boolean detached)
Gets a map containing the workflow and node variables and workflow documents.
|
protected String |
getWorkflowInitiator() |
protected String |
getWorkflowParentNodeId() |
protected String |
getWorkflowParentRouteId() |
protected Calendar |
getWorkflowStartTime() |
boolean |
hasMultipleTasks()
Checks if this node has created multiple tasks, one for each assignees.
|
boolean |
hasOpenTasks()
Returns false if all tasks created from this node were ended.
|
boolean |
hasSubRoute()
Checks if this node has a sub-route model defined.
|
boolean |
hasTask()
Checks it this node has an associated user task.
|
boolean |
hasTaskButton(String name)
Has the node the given action.
|
protected void |
incrementProp(String prop) |
void |
initAddInputTransition(GraphNode.Transition transition)
Internal during graph init.
|
boolean |
isMerge()
Checks if this is a merge node.
|
boolean |
isStart()
Checks if this is the start node.
|
boolean |
isStop()
Checks if this is a stop node.
|
void |
removeTaskInfo(String taskId) |
protected void |
saveDocument() |
void |
setAllVariables(Map<String,Object> map)
Sets the graph and node variables.
|
void |
setAllVariables(Map<String,Object> map,
boolean allowGlobalVariablesAssignement)
Sets the graph and node variables.
|
void |
setButton(String status)
Sets the property button on the node, keeping the id of the last action executed by the user on the associated
task if any
|
void |
setCanceled()
Notes that this node was canceled (increments canceled counter).
|
void |
setJSONVariables(Map<String,String> map)
Sets the variables of the workflow based on their JSON representation (especially for scalar lists).
|
void |
setLastActor(String actor)
Sets the last actor on a node (user who completed the task).
|
void |
setState(GraphNode.State state)
Set the node state.
|
void |
setVariable(String name,
String value)
Sets the variable on this node if it exists as a Node Variable.
|
void |
setVariables(Map<String,Serializable> map)
Sets the node variables.
|
void |
starting()
Does bookkeeping at node start.
|
DocumentRoute |
startSubRoute()
Starts the sub-route on this node.
|
String |
toString() |
void |
updateTaskInfo(String taskId,
boolean ended,
String status,
String actor,
String comment)
Persist these info from the task on the node.
|
protected <T> T |
valueOrExpression(Class<T> klass,
String v,
OperationContext context,
String kind) |
backToReady, cancel, canDeleteStep, canUndoStep, canUpdateStep, canValidateStep, checkLifeCycleState, followTransition, getAttachedDocuments, getDescription, getDocument, getDocumentRoute, getName, getProperty, getTitle, hasPermissionOnDocument, isCanceled, isDone, isDraft, isModifiable, isReady, isRunning, isValidated, resume, run, run, save, setCanceled, setCanDeleteStep, setCanReadStep, setCanUpdateStep, setCanValidateStep, setDone, setPermissionOnDocument, setReadOnly, setReady, setRunning, setValidated, undo, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDocument
protected final GraphRouteImpl graph
protected GraphNode.State localState
protected List<GraphNode.Transition> inputTransitions
protected List<GraphNode.Transition> outputTransitions
protected List<GraphNode.Button> taskButtons
protected List<GraphNode.EscalationRule> escalationRules
protected List<GraphNode.TaskInfo> tasksInfo
public GraphNodeImpl(DocumentModel doc, GraphRouteImpl graph)
public GraphNodeImpl(DocumentModel doc)
protected boolean getBoolean(String propertyName)
protected void incrementProp(String prop)
protected CoreSession getSession()
protected void saveDocument()
public GraphNode.State getState()
GraphNode
public void setState(GraphNode.State state)
GraphNode
public boolean isStart()
GraphNode
public boolean isStop()
GraphNode
public void setCanceled()
GraphNode
setCanceled
in interface GraphNode
public long getCanceledCount()
GraphNode
getCanceledCount
in interface GraphNode
public boolean isMerge()
GraphNode
public String getInputChain()
GraphNode
getInputChain
in interface GraphNode
public String getOutputChain()
GraphNode
getOutputChain
in interface GraphNode
public boolean hasTask()
GraphNode
public List<String> getTaskAssignees()
GraphNode
getTaskAssignees
in interface GraphNode
public String getTaskAssigneesVar()
public Date getTaskDueDate()
GraphNode
getTaskDueDate
in interface GraphNode
public String getTaskDirective()
GraphNode
getTaskDirective
in interface GraphNode
public String getTaskAssigneesPermission()
GraphNode
getTaskAssigneesPermission
in interface GraphNode
public String getTaskLayout()
GraphNode
getTaskLayout
in interface GraphNode
public String getTaskNotificationTemplate()
getTaskNotificationTemplate
in interface GraphNode
public String getTaskDueDateExpr()
getTaskDueDateExpr
in interface GraphNode
public void starting()
GraphNode
public void ending()
GraphNode
public Map<String,Serializable> getVariables()
GraphNode
getVariables
in interface GraphNode
public Map<String,Serializable> getJsonVariables()
GraphNode
getJsonVariables
in interface GraphNode
public void setVariables(Map<String,Serializable> map)
GraphNode
setVariables
in interface GraphNode
map
- the map of variablespublic void setJSONVariables(Map<String,String> map)
GraphNode
setJSONVariables
in interface GraphNode
map
- the map of variablespublic void setAllVariables(Map<String,Object> map)
GraphNode
setAllVariables
in interface GraphNode
map
- the map of variablespublic void setAllVariables(Map<String,Object> map, boolean allowGlobalVariablesAssignement)
GraphNode
setAllVariables
in interface GraphNode
map
- the map of variablesallowGlobalVariablesAssignement
- if set to false, throw a DocumentRouteException when trying to set global
variables when not supposed toprotected OperationContext getExecutionContext(CoreSession session)
public Map<String,Serializable> getWorkflowContextualInfo(CoreSession session, boolean detached)
GraphNode
getWorkflowContextualInfo
in interface GraphNode
detached
- The documents added into this map can be detached or notprotected String getWorkflowInitiator()
protected Calendar getWorkflowStartTime()
protected String getWorkflowParentRouteId()
protected String getWorkflowParentNodeId()
protected Calendar getNodeStartTime()
protected Calendar getNodeEndTime()
protected String getNodeLastActor()
public void executeChain(String chainId) throws DocumentRouteException
GraphNode
executeChain
in interface GraphNode
chainId
- the chainDocumentRouteException
public void executeTransitionChain(GraphNode.Transition transition) throws DocumentRouteException
GraphNode
executeTransitionChain
in interface GraphNode
transition
- the transitionDocumentRouteException
public void executeChain(String chainId, String transitionId) throws DocumentRouteException
DocumentRouteException
public void initAddInputTransition(GraphNode.Transition transition)
GraphNode
initAddInputTransition
in interface GraphNode
protected List<GraphNode.Transition> computeOutputTransitions()
public List<GraphNode.Transition> getOutputTransitions()
GraphNode
getOutputTransitions
in interface GraphNode
public List<GraphNode.Transition> evaluateTransitions() throws DocumentRouteException
GraphNode
Transitions are evaluated in the order set on the node when the workflow was designed. Since @5.7.2 if the node has the property "executeOnlyFirstTransition" set to true, only the first transition evaluated to true is returned
evaluateTransitions
in interface GraphNode
DocumentRouteException
public List<String> evaluateTaskAssignees() throws DocumentRouteException
GraphNode
evaluateTaskAssignees
in interface GraphNode
DocumentRouteException
public boolean canMerge()
GraphNode
public List<GraphNode.Transition> getInputTransitions()
GraphNode
getInputTransitions
in interface GraphNode
public void cancelTasks()
GraphNode
cancelTasks
in interface GraphNode
public List<GraphNode.Button> getTaskButtons()
GraphNode
getTaskButtons
in interface GraphNode
protected List<GraphNode.Button> computeTaskButtons()
public void setButton(String status)
GraphNode
public void setLastActor(String actor)
GraphNode
setLastActor
in interface GraphNode
actor
- the user idprotected void addTaskAssignees(List<String> taskAssignees)
public String getTaskDocType()
getTaskDocType
in interface GraphNode
protected Date evaluateDueDate() throws DocumentRouteException
DocumentRouteException
public Date computeTaskDueDate() throws DocumentRouteException
GraphNode
computeTaskDueDate
in interface GraphNode
DocumentRouteException
public boolean executeOnlyFirstTransition()
GraphNode
executeOnlyFirstTransition
in interface GraphNode
public boolean hasSubRoute() throws DocumentRouteException
GraphNode
hasSubRoute
in interface GraphNode
true
if there is a sub-routeDocumentRouteException
public String getSubRouteModelId() throws DocumentRouteException
GraphNode
If this is present, then this node will be suspended while the sub-route is run. When the sub-route ends, this node will resume.
getSubRouteModelId
in interface GraphNode
null
if none is definedDocumentRouteException
protected String getSubRouteInstanceId()
public DocumentRoute startSubRoute() throws DocumentRouteException
GraphNode
startSubRoute
in interface GraphNode
DocumentRouteException
protected Map<String,Serializable> getSubRouteInitialVariables()
protected <T> T valueOrExpression(Class<T> klass, String v, OperationContext context, String kind) throws DocumentRouteException
DocumentRouteException
public void cancelSubRoute() throws DocumentRouteException
GraphNode
cancelSubRoute
in interface GraphNode
DocumentRouteException
protected List<GraphNode.EscalationRule> computeEscalationRules()
public List<GraphNode.EscalationRule> getEscalationRules()
GraphNode
getEscalationRules
in interface GraphNode
public List<GraphNode.EscalationRule> evaluateEscalationRules()
GraphNode
evaluateEscalationRules
in interface GraphNode
public boolean hasMultipleTasks()
GraphNode
hasMultipleTasks
in interface GraphNode
protected List<GraphNode.TaskInfo> computeTasksInfo()
public List<GraphNode.TaskInfo> getTasksInfo()
GraphNode
getTasksInfo
in interface GraphNode
public void addTaskInfo(String taskId)
GraphNode
addTaskInfo
in interface GraphNode
public void removeTaskInfo(String taskId)
removeTaskInfo
in interface GraphNode
public void updateTaskInfo(String taskId, boolean ended, String status, String actor, String comment)
GraphNode
updateTaskInfo
in interface GraphNode
public List<GraphNode.TaskInfo> getEndedTasksInfo()
GraphNode
getEndedTasksInfo
in interface GraphNode
public boolean hasOpenTasks()
GraphNode
hasOpenTasks
in interface GraphNode
public List<GraphNode.TaskInfo> getProcessedTasksInfo()
GraphNode
getProcessedTasksInfo
in interface GraphNode
public boolean allowTaskReassignment()
GraphNode
allowTaskReassignment
in interface GraphNode
protected void cancelTask(CoreSession session, String taskId) throws DocumentRouteException
DocumentRouteException
public void setVariable(String name, String value)
GraphNode
setVariable
in interface GraphNode
public boolean hasTaskButton(String name)
GraphNode
hasTaskButton
in interface GraphNode
Copyright © 2018 Nuxeo. All rights reserved.