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
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
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb', line 24
def self.unpack(hTaxonomy, responseObj)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hTaxonomy.empty?
@MessagePath.issueWarning(830, responseObj)
return nil
end
intMetadataClass = InternalMetadata.new
intTaxonomy = intMetadataClass.newTaxonomy
if hTaxonomy.has_key?('taxonomicSystem')
aItems = hTaxonomy['taxonomicSystem']
aItems.each do |item|
hReturn = TaxonomicSystem.unpack(item, responseObj)
unless hReturn.nil?
intTaxonomy[:taxonSystem] << hReturn
end
end
end
if intTaxonomy[:taxonSystem].empty?
@MessagePath.issueError(831, responseObj)
end
if hTaxonomy.has_key?('generalScope')
unless hTaxonomy['generalScope'] == ''
intTaxonomy[:generalScope] = hTaxonomy['generalScope']
end
end
if hTaxonomy.has_key?('identificationReference')
aItems = hTaxonomy['identificationReference']
aItems.each do |hItem|
unless hItem.empty?
if hItem.has_key?('identifier')
@MessagePath.issueNotice(835, responseObj)
if hItem.has_key?('authority')
hCitation = hItem['authority']
@MessagePath.issueNotice(836, responseObj)
if hCitation.empty?
@MessagePath.issueNotice(837, responseObj)
break
end
else
@MessagePath.issueNotice(837, responseObj)
break
end
else
hCitation = hItem
end
hReturn = Citation.unpack(hCitation, responseObj)
unless hReturn.nil?
intTaxonomy[:idReferences] << hReturn
end
end
end
end
if hTaxonomy.has_key?('observer')
aItems = hTaxonomy['observer']
aItems.each do |item|
hReturn = ResponsibleParty.unpack(item, responseObj)
unless hReturn.nil?
intTaxonomy[:observers] << hReturn
end
end
end
if hTaxonomy.has_key?('identificationProcedure')
unless hTaxonomy['identificationProcedure'] == ''
intTaxonomy[:idProcedure] = hTaxonomy['identificationProcedure']
end
end
if hTaxonomy.has_key?('identificationCompleteness')
unless hTaxonomy['identificationCompleteness'] == ''
intTaxonomy[:idCompleteness] = hTaxonomy['identificationCompleteness']
end
end
if hTaxonomy.has_key?('voucher')
aItems = hTaxonomy['voucher']
aItems.each do |item|
hReturn = Voucher.unpack(item, responseObj)
unless hReturn.nil?
intTaxonomy[:vouchers] << hReturn
end
end
end
if hTaxonomy.has_key?('taxonomicClassification')
aItems = hTaxonomy['taxonomicClassification']
if aItems.is_a?(Array)
aItems.each do |item|
hReturn = TaxonomicClassification.unpack(item, responseObj)
unless hReturn.nil?
intTaxonomy[:taxonClasses] << hReturn
end
end
else
hReturn = TaxonomicClassification.unpack(aItems, responseObj)
unless hReturn.nil?
intTaxonomy[:taxonClasses] << hReturn
end
@MessagePath.issueNotice(834, responseObj)
end
end
if intTaxonomy[:taxonClasses].empty?
@MessagePath.issueError(833, responseObj)
end
return intTaxonomy
end
|