module ADIWG::Mdtranslator::Readers::MdJson::CoverageDescription

Public Class Methods

unpack(hContent, responseObj) click to toggle source
# 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 = InternalMetadata.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