Class: Hyrax::Workflow::WorkflowFactory

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

Overview

Responsible for:

  • Creating a workflow entity

  • Assigning specific roles to the entity (but not the workflow)

  • Running the deposit_action

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(work, attributes, user) ⇒ WorkflowFactory

Returns a new instance of WorkflowFactory.

Parameters:

  • work (#to_global_id, #active_workflow)
  • user (User)
  • attributes (Hash)


28
29
30
31
32
# File 'app/services/hyrax/workflow/workflow_factory.rb', line 28

def initialize(work, attributes, user)
  @work = work
  @attributes = attributes
  @user = user
end

Class Method Details

.create(work, attributes, user) ⇒ TrueClass

Parameters:

  • work (#to_global_id)
  • attributes (Hash)
  • user (User)

Returns:

  • (TrueClass)


21
22
23
# File 'app/services/hyrax/workflow/workflow_factory.rb', line 21

def self.create(work, attributes, user)
  new(work, attributes, user).create
end

Instance Method Details

#createTrueClass

Creates a Sipity::Entity for the work. The Sipity::Entity acts as a proxy to a work within a workflow

Returns:

  • (TrueClass)


40
41
42
43
44
45
# File 'app/services/hyrax/workflow/workflow_factory.rb', line 40

def create
  entity = create_workflow_entity!
  assign_specific_roles_to(entity: entity)
  run_workflow_action!
  true
end