Sha256: fa7a588c6b1bea5fd901683d1122aff7f9965bd20d9031dac3d38cb0faf06044

Contents?: true

Size: 920 Bytes

Versions: 22

Compression:

Stored size: 920 Bytes

Contents

module Ddr
  module Events
    class VirusCheckEvent < Event

      include PreservationEventBehavior
      include ReindexObjectAfterSave

      self.preservation_event_type = :vir
      self.description = "Content file scanned for viruses"

      def to_solr
        { Ddr::IndexFields::LAST_VIRUS_CHECK_ON => event_date_time_s,
          Ddr::IndexFields::LAST_VIRUS_CHECK_OUTCOME => outcome }
      end

      # Message sent by ActiveSupport::Notifications
      def self.call(*args)
        notification = ActiveSupport::Notifications::Event.new(*args)
        result = notification.payload[:result] # Ddr::Antivirus::ScanResult instance
        create(pid: notification.payload[:pid],
               event_date_time: result.scanned_at,
               outcome: result.ok? ? SUCCESS : FAILURE,
               software: result.version,
               detail: result.to_s
               )
      end

    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
ddr-models-2.0.1 lib/ddr/events/virus_check_event.rb
ddr-models-2.0.0 lib/ddr/events/virus_check_event.rb
ddr-models-2.0.0.rc6 lib/ddr/events/virus_check_event.rb
ddr-models-2.0.0.rc5 lib/ddr/events/virus_check_event.rb
ddr-models-2.0.0.rc4 lib/ddr/events/virus_check_event.rb
ddr-models-2.0.0.rc3 lib/ddr/events/virus_check_event.rb
ddr-models-2.0.0.rc2 lib/ddr/events/virus_check_event.rb
ddr-models-1.17.1 lib/ddr/events/virus_check_event.rb
ddr-models-2.0.0.rc1 lib/ddr/events/virus_check_event.rb
ddr-models-2.0.0.pre.5 lib/ddr/events/virus_check_event.rb
ddr-models-1.17.0 lib/ddr/events/virus_check_event.rb
ddr-models-2.0.0.pre.4 lib/ddr/events/virus_check_event.rb
ddr-models-2.0.0.pre.3 lib/ddr/events/virus_check_event.rb
ddr-models-1.16.2 lib/ddr/events/virus_check_event.rb
ddr-models-2.0.0.pre.2 lib/ddr/events/virus_check_event.rb
ddr-models-2.0.0.pre.1 lib/ddr/events/virus_check_event.rb
ddr-models-1.16.1 lib/ddr/events/virus_check_event.rb
ddr-models-1.16.0 lib/ddr/events/virus_check_event.rb
ddr-models-1.15.0 lib/ddr/events/virus_check_event.rb
ddr-models-1.14.2 lib/ddr/events/virus_check_event.rb