lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb in adiwg-mdtranslator-2.13.0 vs lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb in adiwg-mdtranslator-2.13.1

- old
+ new

@@ -1,24 +1,28 @@ # unpack GML identifier # Reader - ADIwg JSON to internal data structure # History: -# Stan Smith 2018-02-18 refactored error and warning messaging +# 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? - responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: GML Identifier object is empty' + @MessagePath.issueWarning(420, responseObj) return nil end # instance classes needed in script intMetadataClass = InternalMetadata.new @@ -27,22 +31,18 @@ # gml identifier - identifier (required) if hIdentifier.has_key?('identifier') intIdentifier[:identifier] = hIdentifier['identifier'] end if intIdentifier[:identifier].nil? || intIdentifier[:identifier] == '' - responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: GML Identifier identifier is missing' - responseObj[:readerExecutionPass] = false - return nil + @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] == '' - responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: GML Identifier namespace is missing' - responseObj[:readerExecutionPass] = false - return nil + @MessagePath.issueError(422, responseObj) end return intIdentifier end