class Dor::AdministrativeMetadataDS
Public Class Methods
xml_template()
click to toggle source
# File lib/dor/datastreams/administrative_metadata_ds.rb, line 92 def self.xml_template Nokogiri::XML::Builder.new do |xml| xml.administrativeMetadata {} end.doc end
Public Instance Methods
add_default_collection(val)
click to toggle source
Add a collection to the listing of collections for items governed by this apo. @param val [String] pid of the collection, ex. druid:ab123cd4567
# File lib/dor/datastreams/administrative_metadata_ds.rb, line 127 def add_default_collection(val) xml = ng_xml ng_xml_will_change! reg = xml.search('//administrativeMetadata/registration').first unless reg reg = Nokogiri::XML::Node.new('registration', xml) xml.search('/administrativeMetadata').first.add_child(reg) end node = Nokogiri::XML::Node.new('collection', xml) node['id'] = val reg.add_child(node) end
default_collections()
click to toggle source
get all collections listed for this APO, used during registration @return [Array] array of pids
# File lib/dor/datastreams/administrative_metadata_ds.rb, line 121 def default_collections term_values(:registration, :default_collection) end
default_shelving_path()
click to toggle source
# File lib/dor/datastreams/administrative_metadata_ds.rb, line 115 def default_shelving_path defaults.shelving.path.first end
default_shelving_path=(path)
click to toggle source
# File lib/dor/datastreams/administrative_metadata_ds.rb, line 111 def default_shelving_path=(path) defaults.shelving.path = path end
default_workflow=(wf_name)
click to toggle source
set a single default workflow @param wf_name [String] the name of the workflow, ex. 'digitizationWF'
# File lib/dor/datastreams/administrative_metadata_ds.rb, line 165 def default_workflow=(wf_name) raise ArgumentError, 'Must have a valid workflow for default' if wf_name.blank? xml = ng_xml ng_xml_will_change! nodes = xml.search('//registration/workflow') if nodes.first nodes.first['id'] = wf_name else nodes = xml.search('//registration') unless nodes.first reg_node = Nokogiri::XML::Node.new('registration', xml) xml.root.add_child(reg_node) end nodes = xml.search('//registration') wf_node = Nokogiri::XML::Node.new('workflow', xml) wf_node['id'] = wf_name nodes.first.add_child(wf_node) end end
default_workflow_lane()
click to toggle source
# File lib/dor/datastreams/administrative_metadata_ds.rb, line 107 def default_workflow_lane defaults.initiate_workflow.lane.first end
default_workflow_lane=(lane)
click to toggle source
Convenience methods to get and set properties Hides complexity/verbosity of OM TermOperators for simple, non-repeating values
# File lib/dor/datastreams/administrative_metadata_ds.rb, line 103 def default_workflow_lane=(lane) defaults.initiate_workflow.lane = lane end
default_workflows()
click to toggle source
List of default workflows, used to provide choices at registration @return [Array] and array of pids, ex ['druid:ab123cd4567']
# File lib/dor/datastreams/administrative_metadata_ds.rb, line 159 def default_workflows term_values(:registration, :workflow_id) end
desc_metadata_format()
click to toggle source
# File lib/dor/datastreams/administrative_metadata_ds.rb, line 186 def desc_metadata_format metadata_format.first end
desc_metadata_format=(format)
click to toggle source
# File lib/dor/datastreams/administrative_metadata_ds.rb, line 190 def desc_metadata_format=(format) # create the node if it isnt there already unless metadata_format.first ng_xml_will_change! add_child_node(ng_xml.root, :metadata_format) end update_values([:metadata_format] => format) end
desc_metadata_source()
click to toggle source
# File lib/dor/datastreams/administrative_metadata_ds.rb, line 199 def desc_metadata_source metadata_source.first end
desc_metadata_source=(_source)
click to toggle source
# File lib/dor/datastreams/administrative_metadata_ds.rb, line 203 def desc_metadata_source=(_source) # create the node if it isnt there already unless metadata_source.first ng_xml_will_change! add_child_node(administrativeMetadata.ng_xml.root, :metadata_source) end update_values([:metadata_source] => format) end
metadata_source()
click to toggle source
Calls superclass method
# File lib/dor/datastreams/administrative_metadata_ds.rb, line 145 def metadata_source super.first end
metadata_source=(val)
click to toggle source
# File lib/dor/datastreams/administrative_metadata_ds.rb, line 149 def metadata_source=(val) if descMetadata.nil? ng_xml_will_change! add_child_node(administrativeMetadata, :descMetadata) end update_values(%i[descMetadata source] => val) end
prefix()
click to toggle source
maintain AF < 8 indexing behavior
# File lib/dor/datastreams/administrative_metadata_ds.rb, line 213 def prefix '' end
remove_default_collection(val)
click to toggle source
# File lib/dor/datastreams/administrative_metadata_ds.rb, line 140 def remove_default_collection(val) ng_xml_will_change! ng_xml.search('//administrativeMetadata/registration/collection[@id=\'' + val + '\']').remove end