Class WorkflowDTO.StepDTO<T extends WorkflowDTO.StepDTO>

Object
StepDTO<T>
Type Parameters:
T - The concrete step type, so that chained calls keep returning the same step type
Direct Known Subclasses:
WorkflowDTO.ApprovalStepDTO, WorkflowDTO.WatcherStepDTO
Enclosing class:
WorkflowDTO

public abstract static class WorkflowDTO.StepDTO<T extends WorkflowDTO.StepDTO> extends Object
Common base of the approval and watcher steps of a workflow. You get a step from WorkflowDTO.addApprovalStep(String), WorkflowDTO.addWatcherStep(String) or WorkflowDTO.getStep(String), and configure it by chaining its with* methods.
See Also:
  • Field Details

    • workflow

      protected WorkflowDTO workflow
    • properties

      protected Map<String,Object> properties
    • uniqueName

      protected String uniqueName
    • emailAttachment

      protected Boolean emailAttachment
      Signals that approvable should be exported and attached to email in the given step
    • emailAttachmentTemplateName

      protected String emailAttachmentTemplateName
    • alreadySatisfiedComment

      protected String alreadySatisfiedComment
  • Constructor Details

  • Method Details

    • getProperties

      public Map<String,Object> getProperties()
      Returns the custom properties of the step, added by addProperty(String, Object). The properties are stored with the workflow step.
      Returns:
      The properties as a Map; empty if none were added
    • getUniqueName

      public String getUniqueName()
      Gets the name of the step
      Returns:
      The unique name of the step as a String
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • withEmailAttachment

      public T withEmailAttachment()
      Makes the step send the attachment along with the notification Same as withEmailAttachment(true)
      Returns:
      The step itself, for chaining further settings
      See Also:
    • withEmailAttachment

      public T withEmailAttachment(Boolean emailAttachment)
      Makes the step send the attachment along with the notification

      The attachment is an export of the document (for example, a Quote PDF) created with the print template set by withEmailAttachmentTemplateName(String), or with the default print template of the document type. The export contains the header and summary data of the document only, not its line items.

      Example:

      
       workflow.addApprovalStep("Finance Approval")
         .withApprovers("Mary", "Bob")
         .withEmailAttachmentTemplateName("Quote Export - Summary")
         .withEmailAttachment(true)
       
      Parameters:
      emailAttachment - Send attachment (true) or not (false)
      Returns:
      The step itself, for chaining further settings
      See Also:
    • getEmailAttachment

      public Boolean getEmailAttachment()
      Retrieves the attachment sending setting
      Returns:
      true if the attachment is sent with the notification, false otherwise
    • toMap

      public Map<String,Object> toMap()
    • fromMap

      public void fromMap(Map<String,Object> values)
    • readSingleValue

      protected List<String> readSingleValue(String name)
    • withEmailAttachmentTemplateName

      public T withEmailAttachmentTemplateName(String emailAttachmentTemplateName)
      Sets the print template used to export the document attached to the notification email. Only has an effect together with withEmailAttachment(Boolean).
      Parameters:
      emailAttachmentTemplateName - The name of the export or print template as a String; if not set, the default print template of the document type is used
      Returns:
      The step itself, for chaining further settings
      See Also:
    • getEmailAttachmentTemplateName

      public String getEmailAttachmentTemplateName()
      Returns the print template used for the email attachment.
      Returns:
      The template name as a String; null if the default print template is used
      See Also:
    • getAlreadySatisfiedComment

      public String getAlreadySatisfiedComment()
      Returns the comment set by withAlreadySatisfied(String).
      Returns:
      The comment as a String; null if the step is not marked as already satisfied
      See Also:
    • withAlreadySatisfied

      public T withAlreadySatisfied()
      Mark current step as already satisfied, workflowengine will skip its processing once marked as satisfied. Same as withAlreadySatisfied("").
      Returns:
      The step itself, for chaining further settings
      See Also:
    • withAlreadySatisfied

      public T withAlreadySatisfied(String comment)
      Mark current step as already satisfied, workflowengine will skip its processing once marked as satisfied.

      The step stays in the workflow with the Already Satisfied state. Use it to skip steps that were approved in a previous run of the workflow, for example after the document was denied and submitted again.

      Example:

      
       def previous = api.findPreviousWorkflowInfo(quote.typedId, "DENIED", "WITHDRAWN")
       def skip = previous?.steps?.size() >= 1 && previous.steps[0].approved
       workflow.addApprovalStep("ApproverWithDefault")
         .withApprovers("admin")
         .withAlreadySatisfied(skip ? "Approved in the previous workflow" : null)
       
      Parameters:
      comment - If set to non-null value, the execution of the step will skipped and its value used as the step's comment
      Returns:
      The step itself, for chaining further settings
      See Also: