Class: Hyrax::Workflow::StatusListService

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

Overview

Finds a list of works that we can perform a workflow action on

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, filter_condition) ⇒ StatusListService

Returns a new instance of StatusListService.

Parameters:

  • context (#current_user, #logger)
  • filter_condition (String)

    a solr filter


8
9
10
11
# File 'app/services/hyrax/workflow/status_list_service.rb', line 8

def initialize(context, filter_condition)
  @context = context
  @filter_condition = filter_condition
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context


13
14
15
# File 'app/services/hyrax/workflow/status_list_service.rb', line 13

def context
  @context
end

Instance Method Details

#eachArray<StatusRow>

TODO: We will want to paginate this

Returns:

  • (Array<StatusRow>)

    a list of results that the given user can take action on.


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

def each
  return enum_for(:each) unless block_given?
  solr_documents.each do |doc|
    yield doc
  end
end

#userObject

TODO: Make this private for version 1.0


25
26
27
# File 'app/services/hyrax/workflow/status_list_service.rb', line 25

def user
  context.current_user
end