Module: IiifPrint::Actors::FileSetActorDecorator
- Defined in:
- app/actors/iiif_print/actors/file_set_actor_decorator.rb
Instance Method Summary collapse
-
#attach_to_work(work, file_set_params = {}) ⇒ Object
Override to add PDF splitting.
- #create_content(file, relation = :original_file, from_url: false) ⇒ Object
-
#parent_for(file_set:) ⇒ ActiveFedora::Base
Prior to Hyrax v3.1.0, this method did not exist.
- #service ⇒ Object
Instance Method Details
#attach_to_work(work, file_set_params = {}) ⇒ Object
Override to add PDF splitting
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/actors/iiif_print/actors/file_set_actor_decorator.rb', line 37 def attach_to_work(work, file_set_params = {}) # Locks to ensure that only one process is operating on the list at a time. super return if @pdf_paths.blank? return unless service.iiif_print_split?(work: work) service.queue_job( work: work, file_locations: @pdf_paths, user: @user, admin_set_id: work.admin_set_id ) end |
#create_content(file, relation = :original_file, from_url: false) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/actors/iiif_print/actors/file_set_actor_decorator.rb', line 7 def create_content(file, relation = :original_file, from_url: false) # Spawns asynchronous IngestJob unless ingesting from URL super if from_url # we have everything we need... queue the job parent = parent_for(file_set: @file_set) if service.iiif_print_split?(work: parent) && service.pdfs?(paths: [file_set.import_url]) service.queue_job( work: parent, file_locations: [file.path], user: @user, admin_set_id: parent.admin_set_id ) end else # we don't have the parent yet... save the paths for later use @pdf_paths = service.pdf_paths(files: [file.id.to_s]) end end |
#parent_for(file_set:) ⇒ ActiveFedora::Base
Prior to Hyrax v3.1.0, this method did not exist
32 33 34 |
# File 'app/actors/iiif_print/actors/file_set_actor_decorator.rb', line 32 def parent_for(file_set:) file_set.parent end |
#service ⇒ Object
51 52 53 |
# File 'app/actors/iiif_print/actors/file_set_actor_decorator.rb', line 51 def service IiifPrint::SplitPdfs::ChildWorkCreationFromPdfService end |