Sha256: 97a54038fa4dcfa7e01521cbef4ef4cee5c8184a39b34b90ad7f451fa95b413b

Contents?: true

Size: 750 Bytes

Versions: 2

Compression:

Stored size: 750 Bytes

Contents

module Ddr
  module Events
    class FixityCheckEvent < Event

      include PreservationEventBehavior
      include ReindexObjectAfterSave

      self.preservation_event_type = :fix
      self.description = "Fixity check of attached files".freeze

      # Message sent by ActiveSupport::Notifications
      def self.call(*args)
        super do |payload|
          results = payload.delete(:results)
          payload[:outcome] = results.values.all? ? SUCCESS : FAILURE
          payload[:detail] = "Fixity check results:\n\n#{results}"
        end
      end

      def to_solr
        { Ddr::Index::Fields::LAST_FIXITY_CHECK_ON => event_date_time_s,
          Ddr::Index::Fields::LAST_FIXITY_CHECK_OUTCOME => outcome }
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ddr-models-3.0.0.beta.12 lib/ddr/events/fixity_check_event.rb
ddr-models-3.0.0.beta.11 lib/ddr/events/fixity_check_event.rb