15
16
17
18
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
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_party.rb', line 15
def self.unpack(hParty, responseObj, inContext = nil)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hParty.empty?
@MessagePath.issueWarning(620, responseObj, inContext)
return nil
end
intMetadataClass = InternalMetadata.new
intParty = intMetadataClass.newParty
if hParty.has_key?('contactId')
intParty[:contactId] = hParty['contactId']
unless intParty[:contactId].nil? || intParty[:contactId] == ''
hContact = @MessagePath.findContact(hParty['contactId'])
if hContact[0].nil?
outContext = 'contact ID ' + intParty[:contactId]
outContext = inContext + ' > ' + outContext unless inContext.nil?
@MessagePath.issueError(622, responseObj, outContext)
else
intParty[:contactIndex] = hContact[0]
intParty[:contactType] = hContact[1]
intParty[:contactName] = hContact[2]
end
end
end
if intParty[:contactId].nil? || intParty[:contactId] == ''
@MessagePath.issueError(621, responseObj, inContext)
end
if intParty[:contactType] == 'organization'
if hParty.has_key?('organizationMembers')
hParty['organizationMembers'].each do |contactId|
intParty[:organizationMembers] << contactId
hContact = @MessagePath.findContact(contactId)
if hContact[0].nil?
outContext = 'contact ID ' + contactId
outContext = inContext + ' > ' + outContext unless inContext.nil?
@MessagePath.issueWarning(623, responseObj, outContext)
end
end
end
end
return intParty
end
|