Class: ADIWG::Mdtranslator::Writers::Iso19115_3::CI_Organization
- Inherits:
-
Object
- Object
- ADIWG::Mdtranslator::Writers::Iso19115_3::CI_Organization
- Defined in:
- lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_organization.rb
Instance Method Summary collapse
-
#initialize(xml, hResponseObj) ⇒ CI_Organization
constructor
A new instance of CI_Organization.
- #writeXML(hParty, hContact, inContext = nil) ⇒ Object
Constructor Details
#initialize(xml, hResponseObj) ⇒ CI_Organization
Returns a new instance of CI_Organization.
20 21 22 23 24 |
# File 'lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_organization.rb', line 20 def initialize(xml, hResponseObj) @xml = xml @hResponseObj = hResponseObj @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_3 end |
Instance Method Details
#writeXML(hParty, hContact, inContext = nil) ⇒ Object
26 27 28 29 30 31 32 33 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 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_organization.rb', line 26 def writeXML(hParty, hContact, inContext = nil) # classes used contactClass = CI_Contact.new(@xml, @hResponseObj) graphicClass = MD_BrowseGraphic.new(@xml, @hResponseObj) individualClass = CI_Individual.new(@xml, @hResponseObj) identifierClass = MD_PartyIdentifier.new(@xml, @hResponseObj) outContext = 'responsible party' outContext = inContext + ' responsible party' unless inContext.nil? unless hContact.empty? @xml.tag!('cit:CI_Organisation') do # organization - name unless hContact[:name].nil? @xml.tag!('cit:name') do @xml.tag!('gco:CharacterString', hContact[:name]) end end if hContact[:name].nil? && @hResponseObj[:writerShowTags] @xml.tag!('cit:name') end # organization - contact information [] (only one contact information in this implementation) 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!('cit:contactInfo') do contactClass.writeXML(hContact) end end if !haveInfo && @hResponseObj[:writerShowTags] @xml.tag!('cit:contactInfo') end # organization - party identifier if hContact[:externalIdentifier] && hContact[:externalIdentifier].length > 0 hContact[:externalIdentifier].each do |identifier| @xml.tag!('cit:partyIdentifier') do identifierClass.writeXML(identifier); end end else if hContact[:contactId] && hContact[:contactId].is_a?(Hash) @xml.tag!('cit:partyIdentifier') do identifierClass.writeXML(hContact[:contactId]); end elsif hContact[:contactId].is_a?(String) @xml.tag!('cit:partyIdentifier') do identifierClass.writeXML({ identifier: hContact[:contactId] }) end end end # organization - logo [] {MD_BrowseGraphic} aLogos = hContact[:logos] aLogos.each do |hLogo| unless hLogo.empty? @xml.tag!('cit:logo') do graphicClass.writeXML(hLogo) end end end if aLogos.empty? @xml.tag!('cit:logo') end # organization - individual [] {CI_Individual} aMembers = hContact[:memberOfOrgs] aMembers.each do |memberId| hMember = @NameSpace.getContact(memberId) unless hMember.empty? @xml.tag!('cit:individual') do individualClass.writeXML(hMember, outContext) end end end if aMembers.empty? @xml.tag!('cit:individual') end # organization - party identifier if hContact[:externalIdentifier] && hContact[:externalIdentifier].length > 0 hContact[:externalIdentifier].each do |identifier| @xml.tag!('cit:partyIdentifier') do identifierClass.writeXML(identifier); end end else if hContact[:contactId] && hContact[:contactId].is_a?(Hash) @xml.tag!('cit:partyIdentifier') do identifierClass.writeXML(hContact[:contactId]); end elsif hContact[:contactId].is_a?(String) @xml.tag!('cit:partyIdentifier') do identifierClass.writeXML({ identifier: hContact[:contactId] }) end end end end if hContact.empty? @NameSpace.issueWarning(271, nil, outContext) end end end |