Interface GraphNode

All Known Implementing Classes:
GraphNodeImpl

public interface GraphNode
A node for a route graph. Represents operation chains, associated task and form, output transitions and their conditions, etc.
Since:
5.6
  • Field Details

  • Method Details

    • getId

      String getId()
      Get the node id.
      Returns:
      the node id
    • getGraph

      GraphRoute getGraph()
      Since:
      2023.0
    • getState

      GraphNode.State getState()
      Get the node state.
      Returns:
      the node state
    • setState

      void setState(GraphNode.State state)
      Set the node state.
      Parameters:
      state - the node state
    • isFork

      boolean isFork()
      Checks if this is a fork node.
      Since:
      11.1
    • isStart

      boolean isStart()
      Checks if this is the start node.
    • isStop

      boolean isStop()
      Checks if this is a stop node.
    • isMerge

      boolean isMerge()
      Checks if this is a merge node.
    • canMerge

      boolean canMerge()
      Checks if the merge is ready to execute (enough input transitions are present).
    • setCanceled

      void setCanceled()
      Notes that this node was canceled (increments canceled counter).
    • getCanceledCount

      long getCanceledCount()
      Gets the canceled count for this node.
    • cancelTasks

      void cancelTasks()
      Cancels the tasks not ended on this node.
    • getInputChain

      String getInputChain()
      Get input chain.
      Returns:
      the input chain
    • getOutputChain

      String getOutputChain()
      Get output chain.
      Returns:
      the output chain
    • hasTask

      boolean hasTask()
      Checks it this node has an associated user task.
    • getTaskAssignees

      List<String> getTaskAssignees()
      Gets the task assignees
      Returns:
      the task assignees
    • getTaskDueDate

      Date getTaskDueDate()
      Gets the due date
    • getTaskDirective

      String getTaskDirective()
      Gets the task directive
    • getTaskAssigneesPermission

      String getTaskAssigneesPermission()
      Gets the permission to the granted to the actors on this task on the document following the workflow
    • getTaskLayout

      String getTaskLayout()
      Gets the task layout
    • getTaskDocType

      String getTaskDocType()
      Returns:
      the taskDocType. If none is specified, the default task type is returned.
    • getTaskNotificationTemplate

      String getTaskNotificationTemplate()
    • starting

      void starting()
      Does bookkeeping at node start.
    • ending

      void ending()
      Does bookkeeping at node end.
    • executeChain

      void executeChain(String chainId) throws DocumentRouteException
      Executes an Automation chain in the context of this node.
      Parameters:
      chainId - the chain
      Throws:
      DocumentRouteException
    • initAddInputTransition

      void initAddInputTransition(GraphNode.Transition transition)
      Internal during graph init.
    • getInputTransitions

      List<GraphNode.Transition> getInputTransitions()
      Gets the input transitions.
    • getOutputTransitions

      List<GraphNode.Transition> getOutputTransitions()
      Gets the output transitions.
    • getTaskDueDateExpr

      String getTaskDueDateExpr()
    • executeTransitionChain

      void executeTransitionChain(GraphNode.Transition transition) throws DocumentRouteException
      Executes an Automation chain in the context of this node for a given transition
      Parameters:
      transition - the transition
      Throws:
      DocumentRouteException
    • evaluateTransitions

      List<GraphNode.Transition> evaluateTransitions() throws DocumentRouteException
      Evaluates transition conditions and returns the transitions that were true.

      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

      Returns:
      the true transitions
      Throws:
      DocumentRouteException
    • setAllVariables

      default void setAllVariables(Map<String,Object> map)
      Sets the graph and node variables.
      Parameters:
      map - the map of variables
    • setAllVariables

      default void setAllVariables(Map<String,Object> map, boolean allowGlobalVariablesAssignment)
      Sets the graph and node variables.
      Parameters:
      map - the map of variables
      allowGlobalVariablesAssignment - if set to false, throw a DocumentRouteException when trying to set global variables when not supposed to
      Since:
      7.2
    • setAllVariables

      void setAllVariables(Map<String,Object> map, boolean allowGlobalVariablesAssignment, boolean save)
      Sets the graph and node variables.
      Parameters:
      map - the map of variables
      allowGlobalVariablesAssignment - if set to false, throw a DocumentRouteException when trying to set global variables when not supposed to
      save - whether to save the document after setting the variables
      Since:
      2023.0
    • getTaskButtons

      List<GraphNode.Button> getTaskButtons()
      Gets the task buttons
    • hasTaskButton

      boolean hasTaskButton(String name)
      Has the node the given action.
      Since:
      7.2
    • getDocument

      DocumentModel getDocument()
      Gets the document representing this node
    • getVariables

      Map<String,Serializable> getVariables()
      Gets a map containing the variables currently defined on this node
    • getJsonVariables

      Map<String,Serializable> getJsonVariables()
      Gets a map containing the Json formatted variables currently defined on this node
      Since:
      7.2
    • setButton

      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
    • setLastActor

      void setLastActor(String actor)
      Sets the last actor on a node (user who completed the task).
      Parameters:
      actor - the user id
    • evaluateTaskAssignees

      List<String> evaluateTaskAssignees() throws DocumentRouteException
      Evaluates the task assignees from the taskAssigneesVar
      Throws:
      DocumentRouteException
    • computeTaskDueDate

      Date computeTaskDueDate() throws DocumentRouteException
      Evaluates the task due date from the taskDueDateExpr and sets it as the dueDate
      Throws:
      DocumentRouteException
    • getWorkflowContextualInfo

      Map<String,Serializable> getWorkflowContextualInfo(CoreSession session, boolean detached)
      Gets a map containing the workflow and node variables and workflow documents.
      Parameters:
      detached - The documents added into this map can be detached or not
    • executeOnlyFirstTransition

      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
      Since:
      5.7.2
    • hasSubRoute

      boolean hasSubRoute() throws DocumentRouteException
      Checks if this node has a sub-route model defined.
      Returns:
      true if there is a sub-route
      Throws:
      DocumentRouteException
      Since:
      5.7.2
    • getSubRouteModelId

      String getSubRouteModelId() throws DocumentRouteException
      Gets the sub-route model id.

      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.

      Returns:
      the sub-route id, or null if none is defined
      Throws:
      DocumentRouteException
      Since:
      5.7.2
    • startSubRoute

      DocumentRoute startSubRoute() throws DocumentRouteException
      Starts the sub-route on this node.
      Returns:
      the sub-route
      Throws:
      DocumentRouteException
      Since:
      5.7.2
    • cancelSubRoute

      void cancelSubRoute() throws DocumentRouteException
      Cancels the sub-route if there is one.
      Throws:
      DocumentRouteException
      Since:
      5.7.2
    • evaluateEscalationRules

      @Deprecated List<GraphNode.EscalationRule> evaluateEscalationRules()
      Evaluates the rules for the escalation rules and returns the ones to be executed. The rules already executed and not having the property multipleExecution = true are also ignored
      Since:
      5.7.2
    • getEscalationRules

      List<GraphNode.EscalationRule> getEscalationRules()
      Gets the list of all escalation rules for the node
      Since:
      5.7.2
    • hasMultipleTasks

      boolean hasMultipleTasks()
      Checks if this node has created multiple tasks, one for each assignees.
      Since:
      5.7.3
    • getTasksInfo

      List<GraphNode.TaskInfo> getTasksInfo()
      Gets all the tasks info for the tasks created from this node
      Since:
      5.7.3
    • addTaskInfo

      void addTaskInfo(String taskId)
      Persist the info when a new task is created from this node
      Since:
      5.7.3
    • updateTaskInfo

      void updateTaskInfo(String taskId, boolean ended, String status, String actor, String comment)
      Persist these info from the task on the node. Status is the id of the button clicked to end the task by the actor.
      Since:
      5.7.3
    • getEndedTasksInfo

      List<GraphNode.TaskInfo> getEndedTasksInfo()
      Gets all the ended tasks originating from this node. This also counts the canceled tasks.
      Since:
      5.7.3
    • getProcessedTasksInfo

      List<GraphNode.TaskInfo> getProcessedTasksInfo()
      Gets all the ended tasks originating from this node that were processed with a status. Doesn't count the canceled tasks.
      Since:
      5.7.3
    • hasOpenTasks

      boolean hasOpenTasks()
      Returns false if all tasks created from this node were ended.
      Since:
      5.7.3
    • allowTaskReassignment

      boolean allowTaskReassignment()
      Returns true if tasks created from this node can be reassigned.
      Since:
      5.7.3
    • setVariable

      void setVariable(String name, String value)
      Sets the variable on this node if it exists as a Node Variable.
      Since:
      5.8
    • setVariables

      void setVariables(Map<String,Serializable> map)
      Sets the node variables.
      Parameters:
      map - the map of variables
      Since:
      5.9.3, 5.8.0-HF11
    • setJSONVariables

      void setJSONVariables(Map<String,String> map)
      Sets the variables of the workflow based on their JSON representation (especially for scalar lists). For example:
       Map<String, String> map = new HashMap<>();
       map.put("contributors", "[\"John Doe\", \"John Smith\"]");
       map.put("title", "Test Title");
       
      Parameters:
      map - the map of variables
      Since:
      5.9.3, 5.8.0-HF11
    • removeTaskInfo

      void removeTaskInfo(String taskId)
      Since:
      7.4