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

- old
+ new

@@ -1,24 +1,26 @@ # unpack vector object # Reader - ADIwg JSON to internal data structure # History: -# Stan Smith 2018-02-19 refactored error and warning messaging +# Stan Smith 2018-06-27 refactored error and warning messaging # Stan Smith 2016-10-19 original script module ADIWG module Mdtranslator module Readers module MdJson module VectorObject - def self.unpack(hVecObj, responseObj) + def self.unpack(hVecObj, responseObj, inContext = nil) + @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson + # return nil object if input is empty if hVecObj.empty? - responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: vector object is empty' + @MessagePath.issueWarning(900, responseObj, inContext) return nil end # instance classes needed in script intMetadataClass = InternalMetadata.new @@ -29,12 +31,10 @@ unless hVecObj['objectType'] == '' intVecObj[:objectType] = hVecObj['objectType'] end end if intVecObj[:objectType].nil? - responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: vector object type is missing' - responseObj[:readerExecutionPass] = false - return nil + @MessagePath.issueError(901, responseObj, inContext) end # vector object - object count if hVecObj.has_key?('objectCount') unless hVecObj['objectCount'] == ''