lib/adiwg/mdtranslator/writers/iso/classes/class_securityConstraints.rb in adiwg-mdtranslator-0.10.2 vs lib/adiwg/mdtranslator/writers/iso/classes/class_securityConstraints.rb in adiwg-mdtranslator-0.12.0

- old
+ new

@@ -2,67 +2,78 @@ # writer output in XML # History: # Stan Smith 2013-11-01 original script # Stan Smith 2014-07-08 modify require statements to function in RubyGem structure +# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers require 'code_classification' -class MD_SecurityConstraints +module ADIWG + module Mdtranslator + module Writers + module Iso - def initialize(xml) - @xml = xml - end + class MD_SecurityConstraints - def writeXML(hSecurityCons) + def initialize(xml) + @xml = xml + end - # classes used - classCode = MD_ClassificationCode.new(@xml) + def writeXML(hSecurityCons) - @xml.tag!('gmd:MD_SecurityConstraints') do + # classes used + classCode = $WriterNS::MD_ClassificationCode.new(@xml) - # security constraints - classification code - required - s = hSecurityCons[:classCode] - if s.nil? - @xml.tag!('gmd:classification',{'gco:nilReason'=>'missing'}) - else - @xml.tag!('gmd:classification') do - classCode.writeXML(s) - end - end + @xml.tag!('gmd:MD_SecurityConstraints') do - # security constraints - user note - s = hSecurityCons[:userNote] - if !s.nil? - @xml.tag!('gmd:userNote') do - @xml.tag!('gco:CharacterString',s) - end - elsif $showAllTags - @xml.tag!('gmd:userNote') - end + # security constraints - classification code - required + s = hSecurityCons[:classCode] + if s.nil? + @xml.tag!('gmd:classification', {'gco:nilReason' => 'missing'}) + else + @xml.tag!('gmd:classification') do + classCode.writeXML(s) + end + end - # security constraints - classification system - s = hSecurityCons[:classSystem] + # security constraints - user note + s = hSecurityCons[:userNote] + if !s.nil? + @xml.tag!('gmd:userNote') do + @xml.tag!('gco:CharacterString', s) + end + elsif $showAllTags + @xml.tag!('gmd:userNote') + end - if !s.nil? - @xml.tag!('gmd:classificationSystem') do - @xml.tag!('gco:CharacterString',s) - end - elsif $showAllTags - @xml.tag!('gmd:classificationSystem') - end + # security constraints - classification system + s = hSecurityCons[:classSystem] - # security constraints - handling description - s = hSecurityCons[:handlingDesc] - if !s.nil? - @xml.tag!('gmd:handlingDescription') do - @xml.tag!('gco:CharacterString',s) - end - elsif $showAllTags - @xml.tag!('gmd:handlingDescription') - end + if !s.nil? + @xml.tag!('gmd:classificationSystem') do + @xml.tag!('gco:CharacterString', s) + end + elsif $showAllTags + @xml.tag!('gmd:classificationSystem') + end - end + # security constraints - handling description + s = hSecurityCons[:handlingDesc] + if !s.nil? + @xml.tag!('gmd:handlingDescription') do + @xml.tag!('gco:CharacterString', s) + end + elsif $showAllTags + @xml.tag!('gmd:handlingDescription') + end - end + end -end \ No newline at end of file + end + + end + + end + end + end +end