Class WorkflowInstance.Builder

  • Enclosing class:
    WorkflowInstance

    public static class WorkflowInstance.Builder
    extends Object
    Builder for workflow instance.
    • Constructor Detail

      • Builder

        public Builder()
        Create a workflow instance builder.
      • Builder

        public Builder​(ObjectStringMapper objectMapper)
        Create a workflow instance builder with an object mapper.
        Parameters:
        objectMapper - The object mapper.
      • Builder

        public Builder​(WorkflowInstance copy)
        Create a workflow instance builder based on an existing workflow instance.
        Parameters:
        copy - The instance to be used as a basis for the new instance.
    • Method Detail

      • setId

        public WorkflowInstance.Builder setId​(long id)
        Set the workflow instance identifier.
        Parameters:
        id - The identifier.
        Returns:
        this.
      • setExecutorId

        public WorkflowInstance.Builder setExecutorId​(Integer executorId)
        Set the executor instance identifier.
        Parameters:
        executorId - The identifier.
        Returns:
        this.
      • setParentWorkflowId

        public WorkflowInstance.Builder setParentWorkflowId​(Long parentWorkflowId)
        Set the parent workflow identifier.
        Parameters:
        parentWorkflowId - The identifier.
        Returns:
        this.
      • setParentActionId

        public WorkflowInstance.Builder setParentActionId​(Long parentActionId)
        Set the parent workflow identifier.
        Parameters:
        parentActionId - The identifier.
        Returns:
        this.
      • setType

        public WorkflowInstance.Builder setType​(String type)
        Set the type of the workflow definition.
        Parameters:
        type - The type.
        Returns:
        this.
      • setPriority

        public WorkflowInstance.Builder setPriority​(Short priority)
        Set the priority of the workflow instance. When an executor chooses from many available scheduled workflow instances it primarily (unfairly) schedules the workflow instance with the larger priority value, and for workflows with the same priority, the one scheduled first. Priority defaults to 0 and can also be negative.
        Parameters:
        priority - The priority.
        Returns:
        this.
      • setBusinessKey

        public WorkflowInstance.Builder setBusinessKey​(String businessKey)
        Set the business key.
        Parameters:
        businessKey - The business key.
        Returns:
        this.
      • setExternalId

        public WorkflowInstance.Builder setExternalId​(String externalId)
        Set the external identifier.
        Parameters:
        externalId - The external identifier.
        Returns:
        this.
      • setStateText

        public WorkflowInstance.Builder setStateText​(String stateText)
        Set the state text.
        Parameters:
        stateText - The state text.
        Returns:
        this.
      • setNextActivation

        public WorkflowInstance.Builder setNextActivation​(org.joda.time.DateTime nextActivation)
        Set the next activation time.
        Parameters:
        nextActivation - The next activation time.
        Returns:
        this.
      • setOriginalStateVariables

        public WorkflowInstance.Builder setOriginalStateVariables​(Map<String,​String> originalStateVariables)
        Set the original state variables.
        Parameters:
        originalStateVariables - The original state variables.
        Returns:
        this.
      • setStateVariables

        public WorkflowInstance.Builder setStateVariables​(Map<String,​String> stateVariables)
        Set the state variables.
        Parameters:
        stateVariables - The state variables.
        Returns:
        this.
      • putStateVariable

        public WorkflowInstance.Builder putStateVariable​(String key,
                                                         String value)
        Put a state variable to the state variables map.
        Parameters:
        key - The name of the variable.
        value - The string value of the variable.
        Returns:
        this.
      • putStateVariable

        public WorkflowInstance.Builder putStateVariable​(String key,
                                                         Object value)
        Put a state variable to the state variables map.
        Parameters:
        key - The name of the variable.
        value - The value of the variable, serialized by object mapper.
        Returns:
        this.
      • putStateVariable

        public WorkflowInstance.Builder putStateVariable​(String key,
                                                         Optional<?> optionalValue)
        Put a state variable to the state variables map if the optional value is present. If the optionalValue is empty, existing state variable value is not changed.
        Parameters:
        key - The name of the variable.
        optionalValue - The optional value of the variable, serialized by object mapper.
        Returns:
        this.
      • setRetries

        public WorkflowInstance.Builder setRetries​(int retries)
        Set the number of retries.
        Parameters:
        retries - The number of retries.
        Returns:
        this.
      • setCreated

        public WorkflowInstance.Builder setCreated​(org.joda.time.DateTime created)
        Set the creation timestamp.
        Parameters:
        created - Creation time.
        Returns:
        this.
      • setModified

        public WorkflowInstance.Builder setModified​(org.joda.time.DateTime modified)
        Set the modification timestamp.
        Parameters:
        modified - Modification time.
        Returns:
        this.
      • setStartedIfNotSet

        public WorkflowInstance.Builder setStartedIfNotSet​(org.joda.time.DateTime started)
        Set the started timestamp if it has not already been set.
        Parameters:
        started - Start time.
        Returns:
        this.
      • setExecutorGroup

        public WorkflowInstance.Builder setExecutorGroup​(String executorGroup)
        Set the executor group name.
        Parameters:
        executorGroup - The executor group name.
        Returns:
        this.
      • setArchived

        public WorkflowInstance.Builder setArchived​(boolean isArchived)
        Set whether the workflow instance is stored in archive or main tables.
        Parameters:
        isArchived - True if this workflow is stored in archive tables.
        Returns:
        this.
      • build

        public WorkflowInstance build()
        Create the workflow instance object.
        Returns:
        The workflow instance.