Sha256: 31b1ba62edfc40bde7408bc3f2be94960669d3a338c6cf3a2fdc551acaa6da17

Contents?: true

Size: 1.45 KB

Versions: 7

Compression:

Stored size: 1.45 KB

Contents

# ISO <<Class>> MD_MaintenanceInformation
# writer output in XML

# History:
# 	Stan Smith 2013-10-31 original script
# 	Stan Smith 2013-12-18 added contact
#   Stan Smith 2014-07-08 modify require statements to function in RubyGem structure

require 'code_maintenanceFrequency'
require 'class_responsibleParty'

class MD_MaintenanceInformation

	def initialize(xml)
		@xml = xml
	end

	def writeXML(hMaintInfo)

		# classes used
		maintFreqCode = MD_MaintenanceFrequencyCode.new(@xml)
		rPartyClass = CI_ResponsibleParty.new(@xml)

		@xml.tag! 'gmd:MD_MaintenanceInformation' do

			# maintenance information - frequency code - required
			s = hMaintInfo[:maintFreq]
			if s.nil?
				@xml.tag!('gmd:maintenanceAndUpdateFrequency', {'gco:nilReason'=>'unknown'})
			else
				@xml.tag!('gmd:maintenanceAndUpdateFrequency') do
					maintFreqCode.writeXML(s)
				end
			end

			# maintenance information - note
			aNotes = hMaintInfo[:maintNotes]
			if !aNotes.empty?
				aNotes.each do |note|
					@xml.tag!('gmd:maintenanceNote') do
						@xml.tag!('gco:CharacterString',note)
					end
				end
			elsif $showAllTags
				@xml.tag!('gmd:maintenanceNote')
			end

			# maintenance information - contact - CI_ResponsibleParty
			aContacts = hMaintInfo[:maintContacts]
			if aContacts.empty? && $shoeEmpty
				@xml.tag!('gmd:contact')
			else
				aContacts.each do |hContact|
					@xml.tag!('gmd:contact') do
						rPartyClass.writeXML(hContact)
					end
				end
			end

		end

	end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
adiwg-mdtranslator-0.10.2 lib/adiwg/mdtranslator/writers/iso/classes/class_maintenanceInformation.rb
adiwg-mdtranslator-0.9.0 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_maintenanceInformation.rb
adiwg-mdtranslator-0.8.6 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_maintenanceInformation.rb
adiwg-mdtranslator-0.8.5 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_maintenanceInformation.rb
adiwg-mdtranslator-0.8.2 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_maintenanceInformation.rb
adiwg-mdtranslator-0.8.1 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_maintenanceInformation.rb
adiwg-mdtranslator-0.8.0 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_maintenanceInformation.rb