Class: Hyrax::Transactions::Steps::ConditionallyDestroyChildrenFromSplit
- Inherits:
-
Object
- Object
- Hyrax::Transactions::Steps::ConditionallyDestroyChildrenFromSplit
- Defined in:
- app/transactions/hyrax/transactions/steps/conditionally_destroy_children_from_split.rb
Overview
For a FileSet that is a PDF, we need to delete any works and file_sets that are the result of splitting that PDF into constituent images of each page of the PDF. This is responsible for that work.
Instance Method Summary collapse
Instance Method Details
#call(resource, user: nil) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/transactions/hyrax/transactions/steps/conditionally_destroy_children_from_split.rb', line 13 def call(resource, user: nil) return Failure(:resource_not_persisted) unless resource.persisted? parent = IiifPrint.persistence_adapter.parent_for(resource) return Success(resource) unless parent # We do not care about the results of this call; as it is conditionally looking for things # to destroy. IiifPrint::SplitPdfs::DestroyPdfChildWorksService.conditionally_destroy_spawned_children_of( file_set: resource, work: parent, user: user ) Success(resource) end |