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
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_voucher.rb', line 17
def self.unpack(hVoucher, responseObj)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hVoucher.empty?
@MessagePath.issueWarning(940, responseObj)
return nil
end
intMetadataClass = InternalMetadata.new
intVoucher = intMetadataClass.newTaxonVoucher
outContext = 'taxon voucher'
if hVoucher.has_key?('specimen')
intVoucher[:specimen] = hVoucher['specimen']
end
if intVoucher[:specimen].nil? || intVoucher[:specimen] == ''
@MessagePath.issueError(941, responseObj)
end
if hVoucher.has_key?('repository')
hObject = hVoucher['repository']
unless hObject.empty?
hReturn = ResponsibleParty.unpack(hObject, responseObj, outContext)
unless hReturn.nil?
intVoucher[:repository] = hReturn
end
end
end
if intVoucher[:repository].empty?
@MessagePath.issueError(942, responseObj)
end
return intVoucher
end
|