Package net.pricefx.common.dto
Class WorkflowDTO
- Object
-
- WorkflowDTO
-
public class WorkflowDTO extends Object
This class is basically the type of object, which is exposed in the workflow logic by the binding variableworkflow
In your workflow logic you would call methods on that class instance to add approval nodes and/or watcher nodes and supply further details
The methods are designed to be used in a simple flow pattern.
Simple example:
workflow.addApprovalStep("First Approval").withApprovers("admin").withReasons("Admin needs always approve")
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WorkflowDTO.ApprovalStepDTO
static class
WorkflowDTO.StepDTO<T extends WorkflowDTO.StepDTO>
static class
WorkflowDTO.WatcherStepDTO
-
Constructor Summary
Constructors Constructor Description WorkflowDTO(WorkflowType type, String typedId)
WorkflowDTO(WorkflowType type, String typedId, String submitReason, boolean isMassUpdate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WorkflowDTO.ApprovalStepDTO
addApprovalStep(String uniqueName)
Adds a new approval step at the end of the approval workflow.void
addItemReason(String itemTypedId, String reason)
WorkflowDTO.WatcherStepDTO
addWatcherStep(String uniqueName)
Adds a watcher step to the end of the approval workflow.Map<String,Object>
getDataMap()
String
getDefaultPostApprovalStepLogicName()
List<String>
getDenialReasons()
Map<String,String>
getItemReasons()
boolean
getRunDefaultPostApprovalStepLogicOnEmptyWorkflow()
WorkflowDTO.StepDTO
getStep(String uniqueName)
Retrieves a workflow step with given name (if it exists)LinkedHashSet<WorkflowDTO.StepDTO>
getSteps()
String
getSubmitReason()
Gets reason entered by submitterWorkflowType
getType()
Returns the type of the workflow.String
getTypedId()
boolean
isAddStepRestrictedToWFAdmin()
Boolean
isAutoConvertToDeal()
boolean
isDenialReasonOptional()
boolean
isMassUpdate()
boolean
isSelectStepOnDeny()
boolean
removeStep(String uniqueName)
Removes a workflow step with given unique name (if it exists).void
setSubmitReason(String submitReason)
Overrides reason entered by submitterWorkflowDTO
withAddStepRestrictedToWFAdmin()
WorkflowDTO
withAddStepRestrictedToWFAdmin(boolean isAddStepRestrictedToWFAdmin)
WorkflowDTO
withAutoConvertToDeal(boolean autoConvertToDeal)
Iftrue
then automatically converts quote to deal when quote is approvedWorkflowDTO
withDataMap(Map<String,Object> dataMap)
Sets dataMap map, which is available then in email templatesWorkflowDTO
withDefaultPostApprovalStepLogic(String postApprovalStepLogicUniqueName)
Adds a logic that will be executed after every approval step.WorkflowDTO
withDenialReasons(List<String> denialReasons, boolean isDenialReasonOptional)
WorkflowDTO
withRunDefaultPostApprovalStepLogicOnEmptyWorkflow(boolean runDefaultPostStepLogicOnEmptyWorkflow)
Decides if default post step logic should be executed also in case the wf is empty (has no steps).WorkflowDTO
withSelectStepOnDeny(boolean isSelectStepOnDeny)
-
-
-
Method Detail
-
addApprovalStep
public WorkflowDTO.ApprovalStepDTO addApprovalStep(String uniqueName)
Adds a new approval step at the end of the approval workflow.- Parameters:
uniqueName
- Name of the step, it must be unique inside one approval workflow. If you will add again a Step with the same unique name, you will override the existing one.- Returns:
- The Approval Step itself.
-
addWatcherStep
public WorkflowDTO.WatcherStepDTO addWatcherStep(String uniqueName)
Adds a watcher step to the end of the approval workflow. A watcher step cannot approve or deny, but will receive a notification when it becomes active.- Parameters:
uniqueName
- Name of the step. It must be unique inside one approval flow. If you will add again a Step with the same unique name, you will override the existing one.- Returns:
- The Watcher Step itself.
-
getType
public WorkflowType getType()
Returns the type of the workflow. Corresponds to the underlying approvable document:- QUOTE("quote")
- PRICEGRIDITEM("pricegriditem")
- REBATEAGREEMENT("rebateagreement")
- CONTRACT("contract")
- DATACHANGEREQUEST("dcr")
- PRICELIST("pricelist")
- REBATERECORD("rebaterecord")
- MODELRECORD("modelrecord")
- CLAIM("claim")
- Returns:
- The Type of the Workflow.
-
removeStep
public boolean removeStep(String uniqueName)
Removes a workflow step with given unique name (if it exists).- Parameters:
uniqueName
- The name of the step- Returns:
-
getStep
public WorkflowDTO.StepDTO getStep(String uniqueName)
Retrieves a workflow step with given name (if it exists)- Parameters:
uniqueName
- The name of the step- Returns:
-
getSubmitReason
public String getSubmitReason()
Gets reason entered by submitter- Returns:
-
setSubmitReason
public void setSubmitReason(String submitReason)
Overrides reason entered by submitter- Parameters:
submitReason
-
-
withDenialReasons
public WorkflowDTO withDenialReasons(List<String> denialReasons, boolean isDenialReasonOptional)
-
isDenialReasonOptional
public boolean isDenialReasonOptional()
-
getTypedId
public String getTypedId()
-
getSteps
public LinkedHashSet<WorkflowDTO.StepDTO> getSteps()
-
withAddStepRestrictedToWFAdmin
public WorkflowDTO withAddStepRestrictedToWFAdmin()
-
withAddStepRestrictedToWFAdmin
public WorkflowDTO withAddStepRestrictedToWFAdmin(boolean isAddStepRestrictedToWFAdmin)
-
isAddStepRestrictedToWFAdmin
public boolean isAddStepRestrictedToWFAdmin()
-
withSelectStepOnDeny
public WorkflowDTO withSelectStepOnDeny(boolean isSelectStepOnDeny)
-
isSelectStepOnDeny
public boolean isSelectStepOnDeny()
-
withDataMap
public WorkflowDTO withDataMap(Map<String,Object> dataMap)
Sets dataMap map, which is available then in email templates- Parameters:
dataMap
- The map with additional data needed to render the template.- Returns:
-
withDefaultPostApprovalStepLogic
public WorkflowDTO withDefaultPostApprovalStepLogic(String postApprovalStepLogicUniqueName)
Adds a logic that will be executed after every approval step.- Parameters:
postApprovalStepLogicUniqueName
- Unique name of wf post step logic
-
getDefaultPostApprovalStepLogicName
public String getDefaultPostApprovalStepLogicName()
-
withRunDefaultPostApprovalStepLogicOnEmptyWorkflow
public WorkflowDTO withRunDefaultPostApprovalStepLogicOnEmptyWorkflow(boolean runDefaultPostStepLogicOnEmptyWorkflow)
Decides if default post step logic should be executed also in case the wf is empty (has no steps).- Parameters:
runDefaultPostStepLogicOnEmptyWorkflow
- Default is false.
-
getRunDefaultPostApprovalStepLogicOnEmptyWorkflow
public boolean getRunDefaultPostApprovalStepLogicOnEmptyWorkflow()
-
withAutoConvertToDeal
public WorkflowDTO withAutoConvertToDeal(boolean autoConvertToDeal)
Iftrue
then automatically converts quote to deal when quote is approved- Parameters:
autoConvertToDeal
- flag if should be automatically converted
-
isAutoConvertToDeal
public Boolean isAutoConvertToDeal()
-
isMassUpdate
public boolean isMassUpdate()
- Returns:
- true If workflow is called from mass update job
-
-