Class: ADIWG::Mdtranslator::Writers::Iso19115_2::CI_ResponsibleParty
- Inherits:
-
Object
- Object
- ADIWG::Mdtranslator::Writers::Iso19115_2::CI_ResponsibleParty
- Defined in:
- lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_responsibleParty.rb
Instance Method Summary collapse
-
#initialize(xml, hResponseObj) ⇒ CI_ResponsibleParty
constructor
A new instance of CI_ResponsibleParty.
- #writeXML(role, hParty, inContext = nil) ⇒ Object
Constructor Details
#initialize(xml, hResponseObj) ⇒ CI_ResponsibleParty
Returns a new instance of CI_ResponsibleParty.
28 29 30 31 32 |
# 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 |
Instance Method Details
#writeXML(role, hParty, inContext = nil) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# 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 |