Sha256: 11ddf904788e0010722a91786fe380003d13d943ba4c11c95f05ff6e0318f287

Contents?: true

Size: 1021 Bytes

Versions: 126

Compression:

Stored size: 1021 Bytes

Contents

require "rdf/vocab"

module Ddr
  module Events
    module PreservationEventBehavior
      extend ActiveSupport::Concern

      included do
        class_attribute :preservation_event_type
      end

      def preservation_event_type
        self.class.preservation_event_type
      end

      EVENT_ID_TYPE = "Duke Digital Repository Event ID"
      LINKING_OBJECT_ID_TYPE = "Duke Digital Repository PID"

      def as_premis
        Ddr::Metadata::PremisEvent.new.tap do |doc|
          doc.event_type = RDF::Vocab::PremisEventType.label_for(preservation_event_type)
          doc.event_id_type = EVENT_ID_TYPE
          doc.event_id_value = id
          doc.event_detail = summary
          doc.linking_object_id_type = LINKING_OBJECT_ID_TYPE
          doc.linking_object_id_value = pid
          doc.event_outcome = outcome
          doc.event_outcome_detail_note = detail
          doc.event_date_time = event_date_time_s
        end
      end

      def to_xml
        as_premis.to_xml
      end

    end
  end
end

Version data entries

126 entries across 126 versions & 1 rubygems

Version Path
ddr-models-3.0.0.beta.17 lib/ddr/events/preservation_event_behavior.rb
ddr-models-3.0.0.beta.16 lib/ddr/events/preservation_event_behavior.rb
ddr-models-3.0.0.beta.15 lib/ddr/events/preservation_event_behavior.rb
ddr-models-3.0.0.beta.14 lib/ddr/events/preservation_event_behavior.rb
ddr-models-3.0.0.beta.13 lib/ddr/events/preservation_event_behavior.rb
ddr-models-3.0.0.beta.12 lib/ddr/events/preservation_event_behavior.rb
ddr-models-3.0.0.beta.11 lib/ddr/events/preservation_event_behavior.rb
ddr-models-2.4.7 lib/ddr/events/preservation_event_behavior.rb
ddr-models-2.4.6 lib/ddr/events/preservation_event_behavior.rb
ddr-models-2.4.5 lib/ddr/events/preservation_event_behavior.rb
ddr-models-3.0.0.beta.10 lib/ddr/events/preservation_event_behavior.rb
ddr-models-3.0.0.beta.9 lib/ddr/events/preservation_event_behavior.rb
ddr-models-3.0.0.beta.8 lib/ddr/events/preservation_event_behavior.rb
ddr-models-3.0.0.beta.7 lib/ddr/events/preservation_event_behavior.rb
ddr-models-2.4.4 lib/ddr/events/preservation_event_behavior.rb
ddr-models-3.0.0.beta.6 lib/ddr/events/preservation_event_behavior.rb
ddr-models-2.4.3 lib/ddr/events/preservation_event_behavior.rb
ddr-models-2.4.2 lib/ddr/events/preservation_event_behavior.rb
ddr-models-3.0.0.beta.4 lib/ddr/events/preservation_event_behavior.rb
ddr-models-2.4.1 lib/ddr/events/preservation_event_behavior.rb