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.


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

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

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action


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

def action
  @action
end

#comment_textObject (readonly)

Returns the value of attribute comment_text


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

def comment_text
  @comment_text
end

#subjectObject (readonly)

Returns the value of attribute subject


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

def subject
  @subject
end

Class Method Details

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


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

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

Instance Method Details

#runObject


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

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.try(:update_index) # So that the new actions and state are written into solr.
end