Module: Ddr::Events::PreservationEventBehavior

Extended by:
ActiveSupport::Concern
Included in:
CreationEvent, FixityCheckEvent, IngestionEvent, ValidationEvent, VirusCheckEvent
Defined in:
lib/ddr/events/preservation_event_behavior.rb

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#as_premisObject



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ddr/events/preservation_event_behavior.rb', line 17

def as_premis
  Ddr::Metadata::PremisEvent.new.tap do |doc|
    doc.event_type = PreservationEventType.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

#preservation_event_typeObject



10
11
12
# File 'lib/ddr/events/preservation_event_behavior.rb', line 10

def preservation_event_type
  self.class.preservation_event_type
end

#to_xmlObject



31
32
33
# File 'lib/ddr/events/preservation_event_behavior.rb', line 31

def to_xml
  as_premis.to_xml
end