Class: Dor::CreateWorkflowService
- Inherits:
-
Object
- Object
- Dor::CreateWorkflowService
- Defined in:
- lib/dor/services/create_workflow_service.rb
Class Method Summary collapse
-
.create_workflow(item, name:, create_ds: true, priority: 0) ⇒ Object
Initilizes workflow for the object in the workflow service It will set the priorty of the new workflow to the current_priority if it is > 0 It will set lane_id from the item’s APO default workflow lane.
Instance Method Summary collapse
- #create_workflow(name:, create_ds: true, priority: 0) ⇒ Object
-
#initialize(item) ⇒ CreateWorkflowService
constructor
A new instance of CreateWorkflowService.
Constructor Details
#initialize(item) ⇒ CreateWorkflowService
Returns a new instance of CreateWorkflowService.
15 16 17 |
# File 'lib/dor/services/create_workflow_service.rb', line 15 def initialize(item) @item = item end |
Class Method Details
.create_workflow(item, name:, create_ds: true, priority: 0) ⇒ Object
Initilizes workflow for the object in the workflow service
It will set the priorty of the new workflow to the current_priority if it is > 0
It will set lane_id from the item's APO default workflow lane
11 12 13 |
# File 'lib/dor/services/create_workflow_service.rb', line 11 def self.create_workflow(item, name:, create_ds: true, priority: 0) new(item).create_workflow(name: name, create_ds: create_ds, priority: priority) end |
Instance Method Details
#create_workflow(name:, create_ds: true, priority: 0) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/dor/services/create_workflow_service.rb', line 19 def create_workflow(name:, create_ds: true, priority: 0) priority = item.workflows.current_priority if priority == 0 opts = { create_ds: create_ds, lane_id: default_workflow_lane } opts[:priority] = priority if priority > 0 Dor::Config.workflow.client.create_workflow(Dor::WorkflowObject.initial_repo(name), item.pid, name, Dor::WorkflowObject.initial_workflow(name), opts) item.workflows.content(true) # refresh the copy of the workflows datastream end |