Class: Bulkrax::Configuration
- Inherits:
-
Object
- Object
- Bulkrax::Configuration
- Defined in:
- lib/bulkrax.rb
Instance Attribute Summary collapse
- #api_definition ⇒ Object
- #collection_model_class ⇒ Object
-
#csv_row_validators ⇒ Array<#call>
Callable validators invoked per-row during CSV validation.
- #curation_concerns ⇒ Object
- #default_field_mapping ⇒ Object
- #default_work_type ⇒ Object
- #export_path ⇒ Object
-
#factory_class_name_coercer ⇒ #call, Bulkrax::FactoryClassFinder::DefaultCoercer
A function responsible for converting the name of a factory class to the corresponding constant.
- #field_mappings ⇒ Object
- #file_model_class ⇒ Object
-
#fill_in_blank_source_identifiers ⇒ #call
With arity 2.
- #generated_metadata_mapping ⇒ Object
- #guided_import_demo_scenarios_enabled ⇒ Object
- #guided_import_enabled ⇒ Object
- #import_path ⇒ Object
- #ingest_queue_name ⇒ String, Proc
- #multi_value_element_join_on ⇒ Object
- #multi_value_element_split_on ⇒ Object
- #object_factory ⇒ Object
- #parsers ⇒ Object
- #qa_controlled_properties ⇒ Object
- #related_children_field_mapping ⇒ Object
- #related_parents_field_mapping ⇒ Object
- #relationship_job_class ⇒ Object
- #removed_image_path ⇒ Object
- #required_elements ⇒ Object
- #reserved_properties ⇒ Object
- #server_name ⇒ Object
- #solr_key_for_member_file_ids ⇒ String
- #use_locking ⇒ Object (also: #use_locking?)
Instance Method Summary collapse
- #collection_model_internal_resource ⇒ Object
- #curation_concern_internal_resources ⇒ Object
- #file_model_internal_resource ⇒ Object
- #register_csv_row_validator(callable) ⇒ Object
Instance Attribute Details
#api_definition ⇒ Object
37 38 39 |
# File 'lib/bulkrax.rb', line 37 def api_definition @api_definition end |
#collection_model_class ⇒ Object
98 99 100 |
# File 'lib/bulkrax.rb', line 98 def collection_model_class @collection_model_class ||= Collection if defined?(::Hyrax) end |
#csv_row_validators ⇒ Array<#call>
Returns callable validators invoked per-row during CSV validation. Each callable receives (record, row_number, context).
- Defaults to the four built-in CsvRow
-
validators.
182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/bulkrax.rb', line 182 def csv_row_validators @csv_row_validators ||= [ Bulkrax::CsvRow::MissingSourceIdentifier, Bulkrax::CsvRow::DuplicateIdentifier, Bulkrax::CsvRow::ParentReference, Bulkrax::CsvRow::ChildReference, Bulkrax::CsvRow::CircularReference, Bulkrax::CsvRow::RequiredValues, Bulkrax::CsvRow::ControlledVocabulary ] end |
#curation_concerns ⇒ Object
138 139 140 |
# File 'lib/bulkrax.rb', line 138 def curation_concerns @curation_concerns ||= defined?(::Hyrax) ? ::Hyrax.config.curation_concerns : [] end |
#default_field_mapping ⇒ Object
37 38 39 |
# File 'lib/bulkrax.rb', line 37 def default_field_mapping @default_field_mapping end |
#default_work_type ⇒ Object
37 38 39 |
# File 'lib/bulkrax.rb', line 37 def default_work_type @default_work_type end |
#export_path ⇒ Object
37 38 39 |
# File 'lib/bulkrax.rb', line 37 def export_path @export_path end |
#factory_class_name_coercer ⇒ #call, Bulkrax::FactoryClassFinder::DefaultCoercer
A function responsible for converting the name of a factory class to the corresponding constant.
94 95 96 |
# File 'lib/bulkrax.rb', line 94 def factory_class_name_coercer @factory_class_name_coercer || Bulkrax::FactoryClassFinder::DefaultCoercer end |
#field_mappings ⇒ Object
37 38 39 |
# File 'lib/bulkrax.rb', line 37 def field_mappings @field_mappings end |
#file_model_class ⇒ Object
118 119 120 |
# File 'lib/bulkrax.rb', line 118 def file_model_class @file_model_class ||= defined?(::Hyrax) ? ::FileSet : File end |
#fill_in_blank_source_identifiers ⇒ #call
Returns with arity 2. The first parameter is a ApplicationParser and the second parameter is an Integer for the index of the record encountered in the import.
62 63 64 |
# File 'lib/bulkrax.rb', line 62 def fill_in_blank_source_identifiers @fill_in_blank_source_identifiers end |
#generated_metadata_mapping ⇒ Object
37 38 39 |
# File 'lib/bulkrax.rb', line 37 def @generated_metadata_mapping end |
#guided_import_demo_scenarios_enabled ⇒ Object
37 38 39 |
# File 'lib/bulkrax.rb', line 37 def guided_import_demo_scenarios_enabled @guided_import_demo_scenarios_enabled end |
#guided_import_enabled ⇒ Object
37 38 39 |
# File 'lib/bulkrax.rb', line 37 def guided_import_enabled @guided_import_enabled end |
#import_path ⇒ Object
37 38 39 |
# File 'lib/bulkrax.rb', line 37 def import_path @import_path end |
#ingest_queue_name ⇒ String, Proc
163 164 165 166 167 |
# File 'lib/bulkrax.rb', line 163 def ingest_queue_name return @ingest_queue_name if @ingest_queue_name.present? return Hyrax.config.ingest_queue_name if defined?(Hyrax) :import end |
#multi_value_element_join_on ⇒ Object
37 38 39 |
# File 'lib/bulkrax.rb', line 37 def multi_value_element_join_on @multi_value_element_join_on end |
#multi_value_element_split_on ⇒ Object
37 38 39 |
# File 'lib/bulkrax.rb', line 37 def multi_value_element_split_on @multi_value_element_split_on end |
#object_factory ⇒ Object
37 38 39 |
# File 'lib/bulkrax.rb', line 37 def object_factory @object_factory end |
#parsers ⇒ Object
37 38 39 |
# File 'lib/bulkrax.rb', line 37 def parsers @parsers end |
#qa_controlled_properties ⇒ Object
37 38 39 |
# File 'lib/bulkrax.rb', line 37 def qa_controlled_properties @qa_controlled_properties end |
#related_children_field_mapping ⇒ Object
37 38 39 |
# File 'lib/bulkrax.rb', line 37 def @related_children_field_mapping end |
#related_parents_field_mapping ⇒ Object
37 38 39 |
# File 'lib/bulkrax.rb', line 37 def @related_parents_field_mapping end |
#relationship_job_class ⇒ Object
37 38 39 |
# File 'lib/bulkrax.rb', line 37 def relationship_job_class @relationship_job_class end |
#removed_image_path ⇒ Object
37 38 39 |
# File 'lib/bulkrax.rb', line 37 def removed_image_path @removed_image_path end |
#required_elements ⇒ Object
37 38 39 |
# File 'lib/bulkrax.rb', line 37 def required_elements @required_elements end |
#reserved_properties ⇒ Object
37 38 39 |
# File 'lib/bulkrax.rb', line 37 def reserved_properties @reserved_properties end |
#server_name ⇒ Object
37 38 39 |
# File 'lib/bulkrax.rb', line 37 def server_name @server_name end |
#solr_key_for_member_file_ids ⇒ String
71 72 73 74 75 76 77 |
# File 'lib/bulkrax.rb', line 71 def solr_key_for_member_file_ids return @solr_key_for_member_file_ids if @solr_key_for_member_file_ids.present? return "member_ids_ssim" if defined?(Hyrax) "#{file_model_class.name.to_s.underscore}_ids_ssim" end |
#use_locking ⇒ Object Also known as: use_locking?
171 172 173 174 175 |
# File 'lib/bulkrax.rb', line 171 def use_locking return @use_locking if defined?(@use_locking) ENV.key?("REDIS_HOST") end |
Instance Method Details
#collection_model_internal_resource ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/bulkrax.rb', line 104 def collection_model_internal_resource # WARN: Using #try on :internal_resource can yield unexpected results. # If the method is undefined, it can return a truthy value instead of # the typical nil. # # E.g. # ```ruby # Hyrax::FileSet.try(:internal_resource) || 'hi' # => #<Dry::Types::Result::Failure input=:internal_resource error=... # ``` instance = collection_model_class.new instance.respond_to?(:internal_resource) ? instance.internal_resource : collection_model_class.to_s end |
#curation_concern_internal_resources ⇒ Object
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/bulkrax.rb', line 144 def curation_concern_internal_resources curation_concerns.map do |cc| # WARN: Using #try on :internal_resource can yield unexpected results. # If the method is undefined, it can return a truthy value instead of # the typical nil. # # E.g. # ```ruby # Hyrax::FileSet.try(:internal_resource) || 'hi' # => #<Dry::Types::Result::Failure input=:internal_resource error=... # ``` instance = cc.new instance.respond_to?(:internal_resource) ? instance.internal_resource : cc.to_s end.uniq end |
#file_model_internal_resource ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/bulkrax.rb', line 124 def file_model_internal_resource # WARN: Using #try on :internal_resource can yield unexpected results. # If the method is undefined, it can return a truthy value instead of # the typical nil. # # E.g. # ```ruby # Hyrax::FileSet.try(:internal_resource) || 'hi' # => #<Dry::Types::Result::Failure input=:internal_resource error=... # ``` instance = file_model_class.new instance.respond_to?(:internal_resource) ? instance.internal_resource : file_model_class.to_s end |
#register_csv_row_validator(callable) ⇒ Object
196 197 198 |
# File 'lib/bulkrax.rb', line 196 def register_csv_row_validator(callable) csv_row_validators << callable end |