Class: Dor::CreateWorkflowService
- Inherits:
-
Object
- Object
- Dor::CreateWorkflowService
- Extended by:
- Deprecation
- Defined in:
- lib/dor/services/create_workflow_service.rb
Class Method Summary collapse
-
.create_workflow(item, name:, create_ds: true, priority: 0) ⇒ Object
Initializes 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.
17 18 19 |
# File 'lib/dor/services/create_workflow_service.rb', line 17 def initialize(item) @item = item end |
Class Method Details
.create_workflow(item, name:, create_ds: true, priority: 0) ⇒ Object
Initializes 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
12 13 14 15 |
# File 'lib/dor/services/create_workflow_service.rb', line 12 def self.create_workflow(item, name:, create_ds: true, priority: 0) Deprecation.warn(self, 'CreateWorkflowService is deprecated. Use dor-workflow-service instead') 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
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/dor/services/create_workflow_service.rb', line 21 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 |