Class: ADIWG::Mdtranslator::Writers::Fgdc::Lineage
- Inherits:
-
Object
- Object
- ADIWG::Mdtranslator::Writers::Fgdc::Lineage
- Defined in:
- lib/adiwg/mdtranslator/writers/fgdc/classes/class_lineage.rb
Instance Method Summary collapse
-
#initialize(xml, hResponseObj) ⇒ Lineage
constructor
A new instance of Lineage.
- #writeXML(aLineage) ⇒ Object
Constructor Details
#initialize(xml, hResponseObj) ⇒ Lineage
Returns a new instance of Lineage.
20 21 22 23 24 |
# File 'lib/adiwg/mdtranslator/writers/fgdc/classes/class_lineage.rb', line 20 def initialize(xml, hResponseObj) @xml = xml @hResponseObj = hResponseObj @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc end |
Instance Method Details
#writeXML(aLineage) ⇒ 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 |
# File 'lib/adiwg/mdtranslator/writers/fgdc/classes/class_lineage.rb', line 26 def writeXML(aLineage) # take only the first lineage description hLineage = aLineage[0] aSourceCollection = [] haveStep = false # classes used methodClass = Method.new(@xml, @hResponseObj) sourceClass = Source.new(@xml, @hResponseObj) processClass = Process.new(@xml, @hResponseObj) # lineage bio (method) - methodology methodClass.writeXML(hLineage) # lineage 2.5.1 (srcinfo) - source information [] # <- lineage.source hLineage[:dataSources].each do |hSource| sourceClass.writeXML(hSource, aSourceCollection) end # lineage 2.5.1 (srcinfo) - source information from source process steps [] # <- lineage.processSteps.stepSources/stepProducts hLineage[:processSteps].each do |hProcess| hProcess[:stepSources].each do |hStepSource| sourceClass.writeXML(hStepSource, aSourceCollection) end hProcess[:stepProducts].each do |hStepProduct| sourceClass.writeXML(hStepProduct, aSourceCollection) end end # the search for sources is circular, I'm stopping here. if aSourceCollection.empty? && @hResponseObj[:writerShowTags] @xml.tag!('srcinfo') end # lineage 2.5.2 (procstep) - process step (required) hLineage[:processSteps].each do |hStep| @xml.tag!('procstep') do processClass.writeXML(hStep) haveStep = true end end # lineage 2.5.2 (procstep) - process steps from source (required) hLineage[:dataSources].each do |hSource| hSource[:sourceSteps].each do |hStep| @xml.tag!('procstep') do processClass.writeXML(hStep) haveStep = true end end end unless haveStep @NameSpace.issueWarning(200, 'procstep') end # the search for process steps is circular, I'm stopping here. end |