Sha256: db5840a20bd0e6d44088b6f9ee715a620e1204f101e86e959bb73d60b4aa2e7a
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
class IngestFileJob < ActiveJob::Base queue_as CurationConcerns.config.ingest_queue_name # @param [FileSet] file_set # @param [String] filename # @param [String,NilClass] mime_type # @param [User] user # @param [String] relation ('original_file') def perform(file_set, filename, mime_type, user, relation = 'original_file') file = File.open(filename, "rb") # If mime-type is known, wrap in an IO decorator # Otherwise allow Hydra::Works service to determine mime_type if mime_type file = Hydra::Derivatives::IoDecorator.new(file) file.mime_type = mime_type file.original_name = File.basename(filename) end # Tell AddFileToFileSet service to skip versioning because versions will be minted by VersionCommitter (called by save_characterize_and_record_committer) when necessary Hydra::Works::AddFileToFileSet.call(file_set, file, relation.to_sym, versioning: false) # Persist changes to the file_set file_set.save! # Do post file ingest actions CurationConcerns::VersioningService.create(file_set.send(relation.to_sym), user) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
curation_concerns-1.0.0.beta2 | app/jobs/ingest_file_job.rb |