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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_domain.rb', line 24
def self.unpack(hDomain, responseObj)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hDomain.empty?
@MessagePath.issueWarning(200, responseObj)
return nil
end
intMetadataClass = InternalMetadata.new
intDomain = intMetadataClass.newDictionaryDomain
outContext = nil
if hDomain.has_key?('domainId')
intDomain[:domainId] = hDomain['domainId']
end
if intDomain[:domainId].nil? || intDomain[:domainId] == ''
@MessagePath.issueError(201, responseObj)
else
outContext = 'domain ID ' + hDomain['domainId']
end
if hDomain.has_key?('commonName')
if hDomain['commonName'] != ''
intDomain[:domainName] = hDomain['commonName']
end
end
if hDomain.has_key?('codeName')
intDomain[:domainCode] = hDomain['codeName']
end
if intDomain[:domainCode].nil? || intDomain[:domainCode] == ''
@MessagePath.issueError(202, responseObj, outContext)
end
if hDomain.has_key?('description')
intDomain[:domainDescription] = hDomain['description']
end
if intDomain[:domainDescription].nil? || intDomain[:domainDescription] == ''
@MessagePath.issueError(203, responseObj, outContext)
end
if hDomain.has_key?('domainReference')
hCitation = hDomain['domainReference']
unless hCitation.empty?
hReturn = Citation.unpack(hCitation, responseObj)
unless hReturn.nil?
intDomain[:domainReference] = hReturn
end
end
end
if hDomain.has_key?('domainItem')
hDomain['domainItem'].each do |item|
hDom = DomainItem.unpack(item, responseObj, outContext)
unless hDom.nil?
intDomain[:domainItems] << hDom
end
end
end
return intDomain
end
|