Class: AttachFilesToWorkJob

Inherits:
Hyrax::ApplicationJob show all
Defined in:
app/jobs/attach_files_to_work_job.rb

Overview

Converts UploadedFiles into FileSets and attaches them to works.

Direct Known Subclasses

AttachFilesToWorkWithOrderedMembersJob

Instance Method Summary collapse

Instance Method Details

#perform(work, uploaded_files, **work_attributes) ⇒ Object

Parameters:


8
9
10
11
12
13
14
15
16
# File 'app/jobs/attach_files_to_work_job.rb', line 8

def perform(work, uploaded_files, **work_attributes)
  case work
  when ActiveFedora::Base
    perform_af(work, uploaded_files, work_attributes)
  else
    Hyrax::WorkUploadsHandler.new(work: work).add(files: uploaded_files).attach ||
      raise("Could not complete AttachFilesToWorkJob. Some of these are probably in an undesirable state: #{uploaded_files}")
  end
end