class ADIWG::Mdtranslator::Writers::Fgdc::Constraint

Public Class Methods

new(xml, hResponseObj) click to toggle source
# File lib/adiwg/mdtranslator/writers/fgdc/classes/class_constraint.rb, line 17
def initialize(xml, hResponseObj)
   @xml = xml
   @hResponseObj = hResponseObj
   @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
end

Public Instance Methods

writeXML(aConstraints) click to toggle source
# File lib/adiwg/mdtranslator/writers/fgdc/classes/class_constraint.rb, line 23
def writeXML(aConstraints)

   # <- resourceInfo.constraints. first type = legal
   aConstraints.each do |hConstraint|
      if hConstraint[:type] == 'legal'
         hLegal = hConstraint[:legalConstraint]

         # identification information 1.7 (accconst) - access constraint (required)
         unless hLegal[:accessCodes].empty?
            @xml.tag!('accconst', hLegal[:accessCodes][0])
         end
         if hLegal[:accessCodes].empty?
            @NameSpace.issueWarning(40, 'accconst', 'identification section')
         end

         # identification information 1.8 (useconst) - use constraint (required)
         unless hLegal[:useCodes].empty?
            @xml.tag!('useconst', hLegal[:useCodes][0])
         end
         if hLegal[:useCodes].empty?
            @NameSpace.issueWarning(41,'useconst', 'identification section')
         end

      end
   end

end