Sha256: 50bb6c1ef3b39df018ac73d92264d327622b769e36671ad12bc2090978464e50

Contents?: true

Size: 809 Bytes

Versions: 14

Compression:

Stored size: 809 Bytes

Contents

class IngestLocalFileJob < Hyrax::ApplicationJob
  queue_as Hyrax.config.ingest_queue_name

  # @param [FileSet] file_set
  # @param [String] path
  # @param [User] user
  def perform(file_set, path, user)
    file_set.label ||= File.basename(path)

    actor = Hyrax::Actors::FileSetActor.new(file_set, user)

    if actor.create_content(File.open(path))
      Hyrax.config.callback.run(:after_import_local_file_success, file_set, user, path)
    else
      Hyrax.config.callback.run(:after_import_local_file_failure, file_set, user, path)
    end
  rescue SystemCallError
    # This is generic in order to handle Errno constants raised when accessing files
    # @see https://ruby-doc.org/core-2.5.3/Errno.html
    Hyrax.config.callback.run(:after_import_local_file_failure, file_set, user, path)
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
hyrax-2.9.6 app/jobs/ingest_local_file_job.rb
hyrax-2.9.5 app/jobs/ingest_local_file_job.rb
hyrax-2.9.4 app/jobs/ingest_local_file_job.rb
hyrax-2.9.3 app/jobs/ingest_local_file_job.rb
hyrax-2.9.2 app/jobs/ingest_local_file_job.rb
hyrax-2.9.1 app/jobs/ingest_local_file_job.rb
hyrax-2.9.0 app/jobs/ingest_local_file_job.rb
hyrax-2.8.0 app/jobs/ingest_local_file_job.rb
hyrax-2.7.2 app/jobs/ingest_local_file_job.rb
hyrax-2.7.1 app/jobs/ingest_local_file_job.rb
hyrax-2.7.0 app/jobs/ingest_local_file_job.rb
hyrax-2.6.0 app/jobs/ingest_local_file_job.rb
hyrax-3.0.0.pre.rc1 app/jobs/ingest_local_file_job.rb
hyrax-3.0.0.pre.beta3 app/jobs/ingest_local_file_job.rb