Class: Hyrax::Workflow::StatusListService Deprecated

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

Overview

Deprecated.

use the Hyrax::Workflow::ActionableObjects enumerator instead. that service is designed as a more efficient and ergonomic replacement for this one, and has fewer dependencies on specific indexing behavior.

Finds a list of works that a given user can perform a workflow action on.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context_or_user, filter_condition) ⇒ StatusListService

Returns a new instance of StatusListService.

Parameters:

  • context_or_user (::User, #current_user)
  • filter_condition (String)

    a solr filter

Raises:

  • (ArgumentError)

    if th caller fails to provide a user



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/services/hyrax/workflow/status_list_service.rb', line 16

def initialize(context_or_user, filter_condition)
  Deprecation
    .warn("Use the Hyrax::Workflow::ActionableObjects enumerator instead.")

  case context_or_user
  when ::User
    @user = context_or_user
  when nil
    raise ArgumentError, "A current user MUST be provided."
  else
    Deprecation.warn('Initializing StatusListService with a controller ' \
                     '"context" is deprecated. Pass in a user instead.')
    @context = context_or_user
    @user = @context.current_user
  end
  @filter_condition = filter_condition
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



38
39
40
# File 'app/services/hyrax/workflow/status_list_service.rb', line 38

def context
  @context
end

Instance Method Details

#eachEnumerable<StatusRow>

TODO:

We will want to paginate this

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

Returns:

  • (Enumerable<StatusRow>)

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



44
45
46
47
48
49
50
# File 'app/services/hyrax/workflow/status_list_service.rb', line 44

def each
  return enum_for(:each) unless block_given?

  solr_documents.each do |doc|
    yield doc
  end
end

#userObject

Deprecated.


54
55
56
57
58
# File 'app/services/hyrax/workflow/status_list_service.rb', line 54

def user
  Deprecation.warn('This method was always intended to be private. ' \
                   'It will be removed in Hyrax 4.0')
  @user
end