Module: Bulkrax

Extended by:
Bulkrax, Forwardable
Included in:
Bulkrax
Defined in:
lib/bulkrax.rb,
lib/bulkrax/engine.rb,
lib/bulkrax/version.rb,
app/models/bulkrax/entry.rb,
app/models/bulkrax/status.rb,
app/jobs/bulkrax/delete_job.rb,
app/models/bulkrax/exporter.rb,
app/models/bulkrax/importer.rb,
app/models/bulkrax/csv_entry.rb,
app/models/bulkrax/oai_entry.rb,
app/models/bulkrax/rdf_entry.rb,
app/models/bulkrax/xml_entry.rb,
app/jobs/bulkrax/exporter_job.rb,
app/jobs/bulkrax/importer_job.rb,
lib/bulkrax/entry_spec_helper.rb,
app/parsers/bulkrax/csv_parser.rb,
app/parsers/bulkrax/xml_parser.rb,
app/models/bulkrax/exporter_run.rb,
app/models/bulkrax/importer_run.rb,
app/models/bulkrax/oai_dc_entry.rb,
app/jobs/bulkrax/application_job.rb,
app/jobs/bulkrax/delete_work_job.rb,
app/jobs/bulkrax/export_work_job.rb,
app/jobs/bulkrax/import_work_job.rb,
app/matchers/bulkrax/csv_matcher.rb,
app/matchers/bulkrax/oai_matcher.rb,
app/models/bulkrax/import_failed.rb,
app/models/bulkrax/oai_set_entry.rb,
app/parsers/bulkrax/bagit_parser.rb,
app/parsers/bulkrax/oai_dc_parser.rb,
app/matchers/bulkrax/bagit_matcher.rb,
app/controllers/concerns/bulkrax/api.rb,
app/factories/bulkrax/object_factory.rb,
app/helpers/bulkrax/exporters_helper.rb,
app/helpers/bulkrax/importers_helper.rb,
app/jobs/bulkrax/delete_file_set_job.rb,
app/jobs/bulkrax/import_file_set_job.rb,
app/helpers/bulkrax/validation_helper.rb,
app/models/bulkrax/application_record.rb,
app/models/bulkrax/csv_file_set_entry.rb,
app/models/bulkrax/rdf_file_set_entry.rb,
app/helpers/bulkrax/application_helper.rb,
app/jobs/bulkrax/delete_collection_job.rb,
app/jobs/bulkrax/import_collection_job.rb,
app/mailers/bulkrax/application_mailer.rb,
app/parsers/bulkrax/application_parser.rb,
app/models/bulkrax/csv_collection_entry.rb,
app/models/bulkrax/pending_relationship.rb,
app/models/bulkrax/rdf_collection_entry.rb,
app/models/concerns/bulkrax/status_info.rb,
app/jobs/bulkrax/download_cloud_file_job.rb,
app/matchers/bulkrax/application_matcher.rb,
app/models/concerns/bulkrax/file_factory.rb,
app/models/concerns/bulkrax/has_matchers.rb,
app/jobs/bulkrax/create_relationships_job.rb,
app/models/bulkrax/oai_qualified_dc_entry.rb,
app/controllers/bulkrax/entries_controller.rb,
app/jobs/bulkrax/schedule_relationships_job.rb,
app/models/concerns/bulkrax/errored_entries.rb,
app/models/concerns/bulkrax/export_behavior.rb,
app/models/concerns/bulkrax/import_behavior.rb,
app/parsers/bulkrax/oai_qualified_dc_parser.rb,
app/controllers/bulkrax/exporters_controller.rb,
app/controllers/bulkrax/importers_controller.rb,
app/parsers/bulkrax/parser_export_record_set.rb,
app/controllers/bulkrax/application_controller.rb,
app/models/concerns/bulkrax/has_local_processing.rb,
app/models/concerns/bulkrax/dynamic_record_lookup.rb,
app/controllers/concerns/bulkrax/download_behavior.rb,
app/models/concerns/bulkrax/file_set_entry_behavior.rb,
app/models/concerns/bulkrax/importer_exporter_behavior.rb,
app/services/bulkrax/remove_relationships_for_importer.rb

Overview

rubocop:disable Metrics/ModuleLength

Defined Under Namespace

Modules: API, ApplicationHelper, DownloadBehavior, DynamicRecordLookup, EntrySpecHelper, ErroredEntries, ExportBehavior, ExportersHelper, FileFactory, FileSetEntryBehavior, HasLocalProcessing, HasMatchers, ImportBehavior, ImporterExporterBehavior, ImportersHelper, ParserExportRecordSet, StatusInfo, ValidationHelper Classes: ApplicationController, ApplicationJob, ApplicationMailer, ApplicationMatcher, ApplicationParser, ApplicationRecord, BagitMatcher, BagitParser, CollectionsCreatedError, Configuration, CreateRelationshipsJob, CsvCollectionEntry, CsvEntry, CsvFileSetEntry, CsvMatcher, CsvParser, DeleteCollectionJob, DeleteFileSetJob, DeleteJob, DeleteWorkJob, DownloadCloudFileJob, Engine, EntriesController, Entry, ExportWorkJob, Exporter, ExporterJob, ExporterRun, ExportersController, ImportCollectionJob, ImportFailed, ImportFileSetJob, ImportWorkJob, Importer, ImporterJob, ImporterRun, ImportersController, InstallGenerator, MissingParentError, NormalizedJson, OAIError, OaiDcEntry, OaiDcParser, OaiEntry, OaiMatcher, OaiQualifiedDcEntry, OaiQualifiedDcParser, OaiSetEntry, ObjectFactory, PendingRelationship, RdfCollectionEntry, RdfEntry, RdfFileSetEntry, RemoveRelationshipsForImporter, ScheduleRelationshipsJob, Status, XmlEntry, XmlParser

Constant Summary collapse

DEFAULT_MULTI_VALUE_ELEMENT_JOIN_ON =
' | '
DEFAULT_MULTI_VALUE_ELEMENT_SPLIT_ON =
/\s*[:;|]\s*/.freeze
VERSION =
'5.4.0'

Instance Method Summary collapse

Instance Method Details

#api_definitionObject



229
230
231
232
233
234
235
236
237
# File 'lib/bulkrax.rb', line 229

def api_definition
  @api_definition ||= ActiveSupport::HashWithIndifferentAccess.new(
    YAML.safe_load(
      ERB.new(
        File.read(Rails.root.join('config', 'bulkrax_api.yml'))
      ).result
    )
  )
end

#config {|@config| ... } ⇒ Object Also known as: setup

Yields:



48
49
50
51
52
# File 'lib/bulkrax.rb', line 48

def config
  @config ||= Configuration.new
  yield @config if block_given?
  @config
end

#fallback_user_for_importer_exporter_processingObject



273
274
275
276
277
# File 'lib/bulkrax.rb', line 273

def fallback_user_for_importer_exporter_processing
  return User.batch_user if defined?(Hyrax) && User.respond_to?(:batch_user)

  raise "We have no fallback user available for Bulkrax.fallback_user_for_importer_exporter_processing"
end

#multi_value_element_join_onObject

Note:

the specific delimiter should likely be present in the multi_value_element_split_on expression.

Specify the delimiter for joining an attribute’s multi-value array into a string.



244
245
246
# File 'lib/bulkrax.rb', line 244

def multi_value_element_join_on
  @multi_value_element_join_on ||= DEFAULT_MULTI_VALUE_ELEMENT_JOIN_ON
end

#multi_value_element_split_onRegexClass

Note:

The “true” value is to preserve backwards compatibility.

‘true` use the DEFAULT_MULTI_VALUE_ELEMENT_JOIN_ON.

Returns:

  • (RegexClass)

    the regular express to use to “split” an attribute’s values. If set to

See Also:



254
255
256
257
258
259
260
# File 'lib/bulkrax.rb', line 254

def multi_value_element_split_on
  if @multi_value_element_join_on.is_a?(TrueClass)
    DEFAULT_MULTI_VALUE_ELEMENT_SPLIT_ON
  else
    @multi_value_element_split_on ||= DEFAULT_MULTI_VALUE_ELEMENT_SPLIT_ON
  end
end

#normalize_string(value) ⇒ String

Responsible for stripping hidden characters from the given string.

Parameters:

  • value (#to_s)

Returns:

  • (String)

    with hidden characters removed

See Also:



268
269
270
271
# File 'lib/bulkrax.rb', line 268

def normalize_string(value)
  # Removing [Byte Order Mark (BOM)](https://en.wikipedia.org/wiki/Byte_order_mark)
  value.to_s.delete("\xEF\xBB\xBF")
end