Class: Hyrax::Workflow::WorkflowActionService

Inherits:
Object
  • Object
show all
Defined in:
app/services/hyrax/workflow/workflow_action_service.rb

Overview

Responsible for coordinating the behavior of an action taken within a workflow

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subject:, action:, comment:) ⇒ WorkflowActionService

Returns a new instance of WorkflowActionService.



9
10
11
12
13
# File 'app/services/hyrax/workflow/workflow_action_service.rb', line 9

def initialize(subject:, action:, comment:)
  @subject = subject
  @action = action
  @comment_text = comment
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



15
16
17
# File 'app/services/hyrax/workflow/workflow_action_service.rb', line 15

def action
  @action
end

#comment_textObject (readonly)

Returns the value of attribute comment_text.



15
16
17
# File 'app/services/hyrax/workflow/workflow_action_service.rb', line 15

def comment_text
  @comment_text
end

#subjectObject (readonly)

Returns the value of attribute subject.



15
16
17
# File 'app/services/hyrax/workflow/workflow_action_service.rb', line 15

def subject
  @subject
end

Class Method Details

.run(subject:, action:, comment: nil) ⇒ Object



5
6
7
# File 'app/services/hyrax/workflow/workflow_action_service.rb', line 5

def self.run(subject:, action:, comment: nil)
  new(subject: subject, action: action, comment: comment).run
end

Instance Method Details

#runObject



17
18
19
20
21
22
23
# File 'app/services/hyrax/workflow/workflow_action_service.rb', line 17

def run
  update_sipity_workflow_state
  comment = create_sipity_comment
  handle_sipity_notifications(comment: comment)
  handle_additional_sipity_workflow_action_processing(comment: comment)
  subject.work.update_index # So that the new actions and state are written into solr.
end