Class: Wings::CustomQueries::FindBySourceIdentifier
- Inherits:
-
Object
- Object
- Wings::CustomQueries::FindBySourceIdentifier
- Defined in:
- app/services/wings/custom_queries/find_by_source_identifier.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.
Instance Method Summary collapse
- #find_by_model_and_property_value(model:, property:, value:, use_valkyrie: Hyrax.config.use_valkyrie?) ⇒ Object
-
#initialize(query_service:) ⇒ FindBySourceIdentifier
constructor
A new instance of FindBySourceIdentifier.
Constructor Details
#initialize(query_service:) ⇒ FindBySourceIdentifier
Returns a new instance of FindBySourceIdentifier.
15 16 17 |
# File 'app/services/wings/custom_queries/find_by_source_identifier.rb', line 15 def initialize(query_service:) @query_service = query_service end |
Instance Attribute Details
#query_service ⇒ Object (readonly)
Returns the value of attribute query_service.
12 13 14 |
# File 'app/services/wings/custom_queries/find_by_source_identifier.rb', line 12 def query_service @query_service end |
Class Method Details
.queries ⇒ Object
Custom query override specific to Wings
8 9 10 |
# File 'app/services/wings/custom_queries/find_by_source_identifier.rb', line 8 def self.queries [:find_by_model_and_property_value] end |
Instance Method Details
#find_by_model_and_property_value(model:, property:, value:, use_valkyrie: Hyrax.config.use_valkyrie?) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/services/wings/custom_queries/find_by_source_identifier.rb', line 19 def find_by_model_and_property_value(model:, property:, value:, use_valkyrie: Hyrax.config.use_valkyrie?) # NOTE: This is using the Bulkrax::ObjectFactory (e.g. the one # envisioned for ActiveFedora). In doing this, we avoid the situation # where Bulkrax::ValkyrieObjectFactory calls this custom query. af_object = Bulkrax::ObjectFactory.search_by_property(value: value, klass: model, field: property) return if af_object.blank? return af_object unless use_valkyrie resource_factory.to_resource(object: af_object) end |