Sha256: a9f83f820f7907e3be1e8112c9ca4fc7af8c5577cdba32819e2a2b1166729674

Contents?: true

Size: 683 Bytes

Versions: 17

Compression:

Stored size: 683 Bytes

Contents

module Ddr::Derivatives
  class UpdateDerivatives

    def self.call(*args)
      event = ActiveSupport::Notifications::Event.new(*args)
      payload = event.payload
      return false if payload[:skip_update_derivatives]
      if event.name == "delete.repo_file" &&
         !file_ids.include?(payload[:file_id])
        return false
      end
      if event.name =~ /\.repo_object\z/ &&
         (file_ids & payload[:datastreams_changed]).empty?
        return false
      end
      obj = ActiveFedora::Base.find(payload[:pid])
      obj.derivatives.update_derivatives(:later)
    end

    def self.file_ids
      Ddr::Datastreams.update_derivatives_on_changed
    end

  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
ddr-models-2.11.0 lib/ddr/derivatives/update_derivatives.rb
ddr-models-2.10.2 lib/ddr/derivatives/update_derivatives.rb
ddr-models-2.10.1 lib/ddr/derivatives/update_derivatives.rb
ddr-models-2.10.0 lib/ddr/derivatives/update_derivatives.rb
ddr-models-2.10.0.rc2 lib/ddr/derivatives/update_derivatives.rb
ddr-models-2.10.0.rc1 lib/ddr/derivatives/update_derivatives.rb
ddr-models-2.9.2 lib/ddr/derivatives/update_derivatives.rb
ddr-models-2.9.1 lib/ddr/derivatives/update_derivatives.rb
ddr-models-2.9.0 lib/ddr/derivatives/update_derivatives.rb
ddr-models-2.9.0.rc1 lib/ddr/derivatives/update_derivatives.rb
ddr-models-2.8.0 lib/ddr/derivatives/update_derivatives.rb
ddr-models-2.8.0.rc1 lib/ddr/derivatives/update_derivatives.rb
ddr-models-2.7.6 lib/ddr/derivatives/update_derivatives.rb
ddr-models-2.7.5 lib/ddr/derivatives/update_derivatives.rb
ddr-models-2.7.4 lib/ddr/derivatives/update_derivatives.rb
ddr-models-2.7.3 lib/ddr/derivatives/update_derivatives.rb
ddr-models-2.7.2 lib/ddr/derivatives/update_derivatives.rb