class ADIWG::Mdtranslator::Writers::Iso19115_2::CI_ResponsibleParty
Public Class Methods
new(xml, hResponseObj)
click to toggle source
# File lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_responsibleParty.rb, line 28 def initialize(xml, hResponseObj) @xml = xml @hResponseObj = hResponseObj @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2 end
Public Instance Methods
writeXML(role, hParty, inContext = nil)
click to toggle source
# File lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_responsibleParty.rb, line 34 def writeXML(role, hParty, inContext = nil) # classes used codelistClass = MD_Codelist.new(@xml, @hResponseObj) contactClass = CI_Contact.new(@xml, @hResponseObj) outContext = 'responsible party' outContext = inContext + ' responsible party' unless inContext.nil? hContact = ADIWG::Mdtranslator::Writers::Iso19115_2.getContact(hParty[:contactId]) unless hContact.empty? @xml.tag!('gmd:CI_ResponsibleParty') do name = hContact[:name] position = hContact[:positionName] # responsible party if hContact[:isOrganization] # responsible party - organization name unless name.nil? @xml.tag!('gmd:organisationName') do @xml.tag!('gco:CharacterString', name) end end if name.nil? && @hResponseObj[:writerShowTags] @xml.tag!('gmd:organisationName') end else # responsible party - individual name unless name.nil? @xml.tag!('gmd:individualName') do @xml.tag!('gco:CharacterString', name) end end if name.nil? && @hResponseObj[:writerShowTags] @xml.tag!('gmd:individualName') end # responsible party - position name unless position.nil? @xml.tag!('gmd:positionName') do @xml.tag!('gco:CharacterString', position) end end if position.nil? && @hResponseObj[:writerShowTags] @xml.tag!('gmd:positionName') end end # responsible party - contact info haveInfo = false unless hContact[:phones].empty? && hContact[:addresses].empty? && hContact[:eMailList].empty? && hContact[:onlineResources].empty? && hContact[:hoursOfService].empty? && hContact[:contactInstructions].nil? haveInfo = true end if haveInfo @xml.tag!('gmd:contactInfo') do contactClass.writeXML(hContact) end end if !haveInfo && @hResponseObj[:writerShowTags] @xml.tag!('gmd:contactInfo') end # responsible party - role (required) unless role.nil? @xml.tag!('gmd:role') do codelistClass.writeXML('gmd', 'iso_role', role) end end if role.nil? @NameSpace.issueWarning(270, 'gmd:role', outContext) end end end if hContact.empty? && @hResponseObj[:writerShowTags] @xml.tag!('gmd:CI_ResponsibleParty') end end