Class: Wings::CustomQueries::FindManyByAlternateIds
- Inherits:
-
Object
- Object
- Wings::CustomQueries::FindManyByAlternateIds
- Defined in:
- lib/wings/services/custom_queries/find_many_by_alternate_ids.rb
Instance Attribute Summary collapse
-
#query_service ⇒ Object
readonly
Returns the value of attribute query_service.
Class Method Summary collapse
-
.queries ⇒ Object
Custom query override specific to Wings Use: Hyrax.custom_queries.find_many_by_alternate_ids(alternate_ids: ids, use_valkyrie: true).
Instance Method Summary collapse
-
#find_many_by_alternate_ids(alternate_ids:, use_valkyrie: true) ⇒ Array<Valkyrie::Resource>, Array<ActiveFedora::Base>
implements a combination of two Valkyrie queries: => find_many_by_ids & find_by_alternate_identifier.
-
#initialize(query_service:) ⇒ FindManyByAlternateIds
constructor
A new instance of FindManyByAlternateIds.
Constructor Details
#initialize(query_service:) ⇒ FindManyByAlternateIds
Returns a new instance of FindManyByAlternateIds.
16 17 18 |
# File 'lib/wings/services/custom_queries/find_many_by_alternate_ids.rb', line 16 def initialize(query_service:) @query_service = query_service end |
Instance Attribute Details
#query_service ⇒ Object (readonly)
Returns the value of attribute query_service.
13 14 15 |
# File 'lib/wings/services/custom_queries/find_many_by_alternate_ids.rb', line 13 def query_service @query_service end |
Class Method Details
.queries ⇒ Object
Custom query override specific to Wings Use:
Hyrax.custom_queries.find_many_by_alternate_ids(alternate_ids: ids, use_valkyrie: true)
9 10 11 |
# File 'lib/wings/services/custom_queries/find_many_by_alternate_ids.rb', line 9 def self.queries [:find_many_by_alternate_ids] end |
Instance Method Details
#find_many_by_alternate_ids(alternate_ids:, use_valkyrie: true) ⇒ Array<Valkyrie::Resource>, Array<ActiveFedora::Base>
implements a combination of two Valkyrie queries:
> find_many_by_ids & find_by_alternate_identifier
25 26 27 28 29 30 31 32 |
# File 'lib/wings/services/custom_queries/find_many_by_alternate_ids.rb', line 25 def find_many_by_alternate_ids(alternate_ids:, use_valkyrie: true) af_objects = ActiveFedora::Base.find(alternate_ids.map(&:to_s)) return af_objects unless use_valkyrie == true af_objects.map do |af_object| resource_factory.to_resource(object: af_object) end end |