Module: ADIWG::Mdtranslator::Readers::MdJson::CoverageDescription

Defined in:
lib/adiwg/mdtranslator/readers/mdJson/modules/module_coverageDescription.rb

Class Method Summary collapse

Class Method Details

.unpack(hContent, responseObj) ⇒ Object



19
20
21
22
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
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/readers/mdJson/modules/module_coverageDescription.rb', line 19

def self.unpack(hContent, responseObj)

   @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson

   # return nil object if input is empty
   if hContent.empty?
      @MessagePath.issueWarning(130, responseObj)
      return nil
   end

   # instance classes needed in script
   intMetadataClass = .new
   intContent = intMetadataClass.newCoverageDescription

   # content information - coverage name (required)
   if hContent.has_key?('coverageName')
      unless hContent['coverageName'] == ''
         intContent[:coverageName] = hContent['coverageName']
      end
   end
   if intContent[:coverageName].nil?
      @MessagePath.issueError(131, responseObj)
   end

   # content information - coverage description (required)
   if hContent.has_key?('coverageDescription')
      unless hContent['coverageDescription'] == ''
         intContent[:coverageDescription] = hContent['coverageDescription']
      end
   end
   if intContent[:coverageDescription].nil?
      @MessagePath.issueError(132, responseObj)
   end

   # content information - processing level code
   if hContent.has_key?('processingLevelCode')
      hObject = hContent['processingLevelCode']
      unless hObject.empty?
         hReturn = Identifier.unpack(hObject, responseObj)
         unless hReturn.nil?
            intContent[:processingLevelCode] = hReturn
         end
      end
   end

   # content information - attribute group []
   if hContent.has_key?('attributeGroup')
      hContent['attributeGroup'].each do |item|
         hAttGrp = AttributeGroup.unpack(item, responseObj)
         unless hAttGrp.nil?
            intContent[:attributeGroups] << hAttGrp
         end
      end
   end

   # content information - image description
   if hContent.has_key?('imageDescription')
      hObject = hContent['imageDescription']
      unless hObject.empty?
         hReturn = ImageDescription.unpack(hObject, responseObj)
         unless hReturn.nil?
            intContent[:imageDescription] = hReturn
         end
      end
   end

   return intContent

end