Class: ADIWG::Mdtranslator::Writers::Fgdc::Constraint

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

Instance Method Summary collapse

Constructor Details

#initialize(xml, hResponseObj) ⇒ Constraint

Returns a new instance of Constraint.



17
18
19
20
21
# 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

Instance Method Details

#writeXML(aConstraints) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# 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