Sha256: 4830a0d550dfa9e0cbb1555969295ff9fd422e67b1040d3b23c70520879cd2b2

Contents?: true

Size: 1.71 KB

Versions: 6

Compression:

Stored size: 1.71 KB

Contents

# unpack GML identifier
# Reader - ADIwg JSON to internal data structure

# History:
#  Stan Smith 2018-06-20 refactored error and warning messaging
# 	Stan Smith 2016-11-30 original script

# TODO verify this method is not used

module ADIWG
   module Mdtranslator
      module Readers
         module MdJson

            module GMLIdentifier

               def self.unpack(hIdentifier, responseObj)

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

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

                  # instance classes needed in script
                  intMetadataClass = InternalMetadata.new
                  intIdentifier = intMetadataClass.newIdentifier

                  # gml identifier - identifier (required)
                  if hIdentifier.has_key?('identifier')
                     intIdentifier[:identifier] = hIdentifier['identifier']
                  end
                  if intIdentifier[:identifier].nil? || intIdentifier[:identifier] == ''
                     @MessagePath.issueError(421, responseObj)
                  end

                  # gml identifier - namespace (required)
                  if hIdentifier.has_key?('namespace')
                     intIdentifier[:namespace] = hIdentifier['namespace']
                  end
                  if intIdentifier[:namespace].nil? || intIdentifier[:namespace] == ''
                     @MessagePath.issueError(422, responseObj)
                  end

                  return intIdentifier

               end
            end

         end
      end
   end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.14.2 lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb
adiwg-mdtranslator-2.14.1 lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb
adiwg-mdtranslator-2.14.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb
adiwg-mdtranslator-2.13.3 lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb
adiwg-mdtranslator-2.13.2 lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb
adiwg-mdtranslator-2.13.1 lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb