Skip to content

Commit

Permalink
Update to handle platform without errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Oliveros committed May 3, 2024
1 parent 323b6c8 commit 6c03476
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -10,62 +10,64 @@ 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)
if hPlatform.has_key?('sponsor')
hReturn = ResponsibileParty.unpack(hPlatform['sponsor'], responseObj, inContext)
unless hReturn.nil?
intAcqPlatform[:sponsors] = hReturn
intPlatform[:sponsors] = hReturn
end
end

if hAcqPlatform.has_key('instrument')
hReturn = AcqInstrument.unpack(hAcqPlatform['instrument'], responseObj, inContext)
if hPlatform.has_key?('instrument')
hReturn = AcqInstrument.unpack(hPlatform['instrument'], responseObj, inContext)
unless hReturn.nil?
intAcqPlatform[:instruments] = hReturn
intPlatform[:instruments] = hReturn
else
@MessagePath.issueError(461, responseObj, inContext)
end
end

if hAcqPlatform.has_key('history')
hReturn = AcqInstrumentationEventList.unpack(hAcqPlatform['history'], responseObj, inContext)
if hPlatform.has_key?('history')
hReturn = AcqInstrumentationEventList.unpack(hPlatform['history'], responseObj, inContext)
unless hReturn.nil?
intAcqPlatform[:history] = hReturn
intPlatform[:history] = hReturn
end
end

intAcqPlatform
intPlatform

end
end
Expand Down

0 comments on commit 6c03476

Please sign in to comment.