diff --git a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb index 27477ab4..9a6d7c52 100644 --- a/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb +++ b/lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb @@ -1,6 +1,6 @@ require_relative 'module_citation' require_relative 'module_identifier' -require_relative 'module_responsibileParty' +require_relative 'module_responsibleParty' require_relative 'module_acq-instrument' require_relative 'module_acq-instrumentationEventList' @@ -10,62 +10,70 @@ module Readers module MdJson module Platform - def self.unpack(hAcqPlatform, responseObj, inContext = nil) + def self.unpack(hPlatform, responseObj, inContext = nil) @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson - intAcqPlatform = intMetadataClass.newPlatform + intMetadataClass = InternalMetadata.new + intPlatform = intMetadataClass.newPlatform - if hAcqPlatform.has_key('platformId') - intAcqPlatform[:platformId] = hAcqPlatform['platformId'] + if hPlatform.has_key?('platformId') + intPlatform[:platformId] = hPlatform['platformId'] else @MessagePath.issueError(460, responseObj, inContext) end - if hAcqPlatform.has_key?('citation') - hReturn = Citation.unpack(hAcqPlatform['citation'], responseObj, inContext) + if hPlatform.has_key?('citation') + hReturn = Citation.unpack(hPlatform['citation'], responseObj, inContext) unless hReturn.nil? - intAcqPlatform[:citation] = hReturn + intPlatform[:citation] = hReturn end end - if hAcqPlatform.has_key?('identifier') - hReturn = Identifier.unpack(hAcqPlatform['identifier'], responseObj, inContext) + if hPlatform.has_key?('identifier') + hReturn = Identifier.unpack(hPlatform['identifier'], responseObj, inContext) unless hReturn.nil? - intAcqPlatform[:identifier] = hReturn + intPlatform[:identifier] = hReturn else @MessagePath.issueError(461, responseObj, inContext) end end - if hAcqPlatform.has_key('description') - intAcqPlatform[:description] = hAcqPlatform['description'] + if hPlatform.has_key?('description') + intPlatform[:description] = hPlatform['description'] else @MessagePath.issueError(460, responseObj, inContext) end - if hAcqPlatform.has_key?('sponsor') - hReturn = ResponsibileParty.unpack(hAcqPlatform['sponsor'], responseObj, inContext) - unless hReturn.nil? - intAcqPlatform[:sponsors] = hReturn + if hPlatform.has_key?('sponsor') + hPlatform['sponsor'].each do |sponsor| + hReturn = ResponsibleParty.unpack(sponsor, responseObj, inContext) + unless hReturn.nil? + intPlatform[:sponsors] = hReturn + end end end - if hAcqPlatform.has_key('instrument') - hReturn = AcqInstrument.unpack(hAcqPlatform['instrument'], responseObj, inContext) - unless hReturn.nil? - intAcqPlatform[:instruments] = hReturn - else - @MessagePath.issueError(461, responseObj, inContext) + if hPlatform.has_key?('instrument') + hPlatform['instrument'].each do |instrument| + hReturn = AcqInstrument.unpack(instrument, responseObj, inContext) + unless hReturn.nil? + intPlatform[:instruments] = hReturn + else + @MessagePath.issueError(461, responseObj, inContext) + end end end - if hAcqPlatform.has_key('history') - hReturn = AcqInstrumentationEventList.unpack(hAcqPlatform['history'], responseObj, inContext) - unless hReturn.nil? - intAcqPlatform[:history] = hReturn + if hPlatform.has_key?('history') + hPlatform['history'].each do |history| + hReturn = AcqInstrumentationEventList.unpack(history, responseObj, inContext) + unless hReturn.nil? + intPlatform[:history] = hReturn + end + end end - intAcqPlatform + intPlatform end end