Module: Dor::Preservable

Extended by:
ActiveSupport::Concern
Included in:
BasicItem
Defined in:
lib/dor/models/preservable.rb

Instance Method Summary collapse

Instance Method Details

#build_provenanceMetadata_datastream(workflow_id, event_text) ⇒ Object


12
13
14
15
16
17
18
19
20
21
22
# File 'lib/dor/models/preservable.rb', line 12

def (workflow_id, event_text)
  workflow_provenance = create_workflow_provenance(workflow_id, event_text)
  dsname = 'provenanceMetadata'
  ds = datastreams[dsname]
  unless datastreams.keys.include?(dsname)
    ds.label = 'Provenance Metadata'
  end
  ds.ng_xml = workflow_provenance
      ds.content=ds.ng_xml.to_s
  ds.save
end

#build_technicalMetadata_datastream(ds = nil) ⇒ Object


24
25
26
# File 'lib/dor/models/preservable.rb', line 24

def (ds=nil)
  TechnicalMetadataService.(self)
end

#create_workflow_provenance(workflow_id, event_text) ⇒ Nokogiri::Document


34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/dor/models/preservable.rb', line 34

def create_workflow_provenance(workflow_id, event_text)
  builder = Nokogiri::XML::Builder.new do |xml|
    xml.(:objectId => self.pid) {
      xml.agent(:name => 'DOR') {
        xml.what(:object => self.pid) {
          xml.event(:who => "DOR-#{workflow_id}", :when => Time.new.iso8601) {
            xml.text(event_text)
          }
        }
      }
    }
  end
  builder.doc
end

#sdr_ingest_transfer(agreement_id) ⇒ Object


28
29
30
# File 'lib/dor/models/preservable.rb', line 28

def sdr_ingest_transfer(agreement_id)
  SdrIngestService.transfer(self,agreement_id)
end