Sha256: 0888ab359d3997290fc970cfe15b534b3ac2d1bcd44fd6ef81235787d27fb4c4

Contents?: true

Size: 1.78 KB

Versions: 6

Compression:

Stored size: 1.78 KB

Contents

# FGDC <<Class>> Constraint
# FGDC CSDGM writer output in XML

# History:
#  Stan Smith 2017-12-12 original script

module ADIWG
   module Mdtranslator
      module Writers
         module Fgdc

            class Constraint

               def initialize(xml, hResponseObj)
                  @xml = xml
                  @hResponseObj = hResponseObj
               end

               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?
                           @hResponseObj[:writerPass] = false
                           @hResponseObj[:writerMessages] << 'Identification section is missing access constraint'
                        end

                        # identification information 1.8 (useconst) - use constraint (required)
                        unless hLegal[:useCodes].empty?
                           @xml.tag!('useconst', hLegal[:useCodes][0])
                        end
                        if hLegal[:useCodes].empty?
                           @hResponseObj[:writerPass] = false
                           @hResponseObj[:writerMessages] << 'Identification section is missing use constraint'
                        end

                     end
                  end

               end # writeXML
            end # Constraint

         end
      end
   end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.10.0 lib/adiwg/mdtranslator/writers/fgdc/classes/class_constraint.rb
adiwg-mdtranslator-2.9.2 lib/adiwg/mdtranslator/writers/fgdc/classes/class_constraint.rb
adiwg-mdtranslator-2.9.1 lib/adiwg/mdtranslator/writers/fgdc/classes/class_constraint.rb
adiwg-mdtranslator-2.9.0 lib/adiwg/mdtranslator/writers/fgdc/classes/class_constraint.rb
adiwg-mdtranslator-2.8.0 lib/adiwg/mdtranslator/writers/fgdc/classes/class_constraint.rb
adiwg-mdtranslator-2.7.0 lib/adiwg/mdtranslator/writers/fgdc/classes/class_constraint.rb