19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_distributor.rb', line 19
def self.unpack(hDistrib, responseObj)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hDistrib.empty?
@MessagePath.issueWarning(190, responseObj)
return nil
end
intMetadataClass = InternalMetadata.new
intDistrib = intMetadataClass.newDistributor
outContext = 'distributor'
if hDistrib.has_key?('contact')
hObject = hDistrib['contact']
unless hObject.empty?
hReturn = ResponsibleParty.unpack(hObject, responseObj, outContext)
unless hReturn.nil?
intDistrib[:contact] = hReturn
contactId = hReturn[:parties][0][:contactId]
unless contactId.nil?
contactName = @MessagePath.findContact(contactId)[2]
unless contactName.nil?
outContext = outContext + ' > ' + contactName
end
end
end
end
end
if intDistrib[:contact].empty?
@MessagePath.issueError(191, responseObj)
end
if hDistrib.has_key?('orderProcess')
aItems = hDistrib['orderProcess']
aItems.each do |item|
hReturn = OrderProcess.unpack(item, responseObj, outContext)
unless hReturn.nil?
intDistrib[:orderProcess] << hReturn
end
end
end
if hDistrib.has_key?('transferOption')
aItemss = hDistrib['transferOption']
aItemss.each do |item|
hReturn = TransferOption.unpack(item, responseObj, outContext)
unless hReturn.nil?
intDistrib[:transferOptions] << hReturn
end
end
end
return intDistrib
end
|