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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataDictionary.rb', line 27
def self.unpack(hDictionary, responseObj)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hDictionary.empty?
@MessagePath.issueWarning(140, responseObj)
return nil
end
intMetadataClass = InternalMetadata.new
intDictionary = intMetadataClass.newDataDictionary
if hDictionary.has_key?('description')
s = hDictionary['description']
unless s == ''
intDictionary[:description] = s
end
end
if hDictionary.has_key?('citation')
hCitation = hDictionary['citation']
unless hCitation.empty?
hReturn = Citation.unpack(hCitation, responseObj)
unless hReturn.nil?
intDictionary[:citation] = hReturn
end
end
end
if intDictionary[:citation].empty?
@MessagePath.issueError(141, responseObj)
end
if hDictionary.has_key?('subject')
aSubjects = hDictionary['subject']
aSubjects.each do |item|
unless item == ''
intDictionary[:subjects] << item
end
end
end
if intDictionary[:subjects].empty?
@MessagePath.issueError(142, responseObj)
end
if hDictionary.has_key?('recommendedUse')
aUses = hDictionary['recommendedUse']
aUses.each do |item|
unless item == ''
intDictionary[:recommendedUses] << item
end
end
end
if hDictionary.has_key?('locale')
aLocales = hDictionary['locale']
aLocales.each do |hItem|
hReturn = Locale.unpack(hItem, responseObj)
unless hReturn.nil?
intDictionary[:locales] << hReturn
end
end
end
if hDictionary.has_key?('responsibleParty')
hRParty = hDictionary['responsibleParty']
unless hRParty.empty?
hReturn = ResponsibleParty.unpack(hRParty, responseObj)
unless hReturn.nil?
intDictionary[:responsibleParty] = hReturn
end
end
end
if intDictionary[:responsibleParty].empty?
@MessagePath.issueError(143, responseObj)
end
s = nil
if hDictionary.has_key?('dictionaryFunctionalLanguage')
s = hDictionary['dictionaryFunctionalLanguage']
elsif hDictionary.has_key?('dictionaryFormat')
s = hDictionary['dictionaryFormat']
@MessagePath.issueWarning(144, responseObj)
end
unless s.nil? || s == ''
intDictionary[:dictionaryFunctionalLanguage] = s
end
if hDictionary.has_key?('dictionaryIncludedWithResource')
if hDictionary['dictionaryIncludedWithResource'] === true
intDictionary[:includedWithDataset] = hDictionary['dictionaryIncludedWithResource']
end
end
if hDictionary.has_key?('domain')
aDomains = hDictionary['domain']
aDomains.each do |hItem|
hReturn = Domain.unpack(hItem, responseObj)
unless hReturn.nil?
intDictionary[:domains] << hReturn
end
end
end
if hDictionary.has_key?('entity')
aEntities = hDictionary['entity']
aEntities.each do |hItem|
hReturn = Entity.unpack(hItem, responseObj)
unless hReturn.nil?
intDictionary[:entities] << hReturn
end
end
end
return intDictionary
end
|