Class: ADIWG::Mdtranslator::Writers::Iso19115_2::MD_AggregateInformation

Inherits:
Object
  • Object
show all
Defined in:
lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_aggregateInformation.rb

Instance Method Summary collapse

Constructor Details

#initialize(xml, hResponseObj) ⇒ MD_AggregateInformation

Returns a new instance of MD_AggregateInformation.



28
29
30
31
32
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_aggregateInformation.rb', line 28

def initialize(xml, hResponseObj)
   @xml = xml
   @hResponseObj = hResponseObj
   @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
end

Instance Method Details

#writeXML(hAssocRes) ⇒ 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
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_aggregateInformation.rb', line 34

def writeXML(hAssocRes)

   # classes used
   codelistClass = MD_Codelist.new(@xml, @hResponseObj)
   citationClass = CI_Citation.new(@xml, @hResponseObj)

   @xml.tag!('gmd:MD_AggregateInformation') do

      # aggregate information - aggregate data set name {citation}
      hAssocCit = hAssocRes[:resourceCitation]
      unless hAssocCit.empty?
         @xml.tag!('gmd:aggregateDataSetName') do
            citationClass.writeXML(hAssocCit, 'associated resource')
         end
      end
      if hAssocCit.empty? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:aggregateDataSetName')
      end

      # aggregate information - aggregate data set identifier (use citation > identifier)
      # data set identifier was dropped from 19115-1 and not carried in mdJson

      # aggregate information - association type (required)
      s = hAssocRes[:associationType]
      unless s.nil?
         @xml.tag!('gmd:associationType') do
            codelistClass.writeXML('gmd', 'iso_associationType', s)
         end
      end
      if s.nil?
         @NameSpace.issueWarning(1, 'gmd:associationType')
      end

      # aggregate information - initiative type
      s = hAssocRes[:initiativeType]
      unless s.nil?
         @xml.tag!('gmd:initiativeType') do
            codelistClass.writeXML('gmd', 'iso_initiativeType', s)
         end
      end
      if s.nil? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:initiativeType')
      end

   end # MD_AggregateInformation tag
end