Sha256: 23d9621053484426d167340273e85f0689fce6b721e1079c9fbd8b16e6f7b156

Contents?: true

Size: 1.06 KB

Versions: 46

Compression:

Stored size: 1.06 KB

Contents

module Hyrax
  module Actors
    # Responsible for removing FileSets related to the given curation concern.
    class CleanupFileSetsActor < Hyrax::Actors::AbstractActor
      # @param [Hyrax::Actors::Environment] env
      # @return [Boolean] true if destroy was successful
      def destroy(env)
        cleanup_file_sets(env.curation_concern)
        next_actor.destroy(env)
      end

      private

        def cleanup_file_sets(curation_concern)
          # Destroy the list source first.  This prevents each file_set from attemping to
          # remove itself individually from the work. If hundreds of files are attached,
          # this would take too long.

          # Get list of member file_sets from Solr
          fs = curation_concern.file_sets
          curation_concern.list_source.destroy
          # Remove Work from Solr after it was removed from Fedora so that the
          # in_objects lookup does not break when FileSets are destroyed.
          ActiveFedora::SolrService.delete(curation_concern.id)
          fs.each(&:destroy)
        end
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
hyrax-2.9.6 app/actors/hyrax/actors/cleanup_file_sets_actor.rb
hyrax-2.9.5 app/actors/hyrax/actors/cleanup_file_sets_actor.rb
hyrax-2.9.4 app/actors/hyrax/actors/cleanup_file_sets_actor.rb
hyrax-2.9.3 app/actors/hyrax/actors/cleanup_file_sets_actor.rb
hyrax-2.9.2 app/actors/hyrax/actors/cleanup_file_sets_actor.rb
hyrax-2.9.1 app/actors/hyrax/actors/cleanup_file_sets_actor.rb
hyrax-2.9.0 app/actors/hyrax/actors/cleanup_file_sets_actor.rb
hyrax-2.8.0 app/actors/hyrax/actors/cleanup_file_sets_actor.rb
hyrax-2.7.2 app/actors/hyrax/actors/cleanup_file_sets_actor.rb
hyrax-2.7.1 app/actors/hyrax/actors/cleanup_file_sets_actor.rb
hyrax-2.7.0 app/actors/hyrax/actors/cleanup_file_sets_actor.rb
hyrax-2.6.0 app/actors/hyrax/actors/cleanup_file_sets_actor.rb
hyrax-2.5.1 app/actors/hyrax/actors/cleanup_file_sets_actor.rb
hyrax-2.5.0 app/actors/hyrax/actors/cleanup_file_sets_actor.rb
hyrax-3.0.0.pre.beta2 app/actors/hyrax/actors/cleanup_file_sets_actor.rb
hyrax-2.4.1 app/actors/hyrax/actors/cleanup_file_sets_actor.rb
hyrax-3.0.0.pre.beta1 app/actors/hyrax/actors/cleanup_file_sets_actor.rb
hyrax-2.4.0 app/actors/hyrax/actors/cleanup_file_sets_actor.rb
hyrax-2.3.3 app/actors/hyrax/actors/cleanup_file_sets_actor.rb
hyrax-2.3.2 app/actors/hyrax/actors/cleanup_file_sets_actor.rb