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
70
71
72
73
74
75
76
77
78
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_geologicAge.rb', line 17
def self.unpack(hGeoAge, responseObj, inContext = nil)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hGeoAge.empty?
@MessagePath.issueWarning(350, responseObj, inContext)
return nil
end
intMetadataClass = InternalMetadata.new
intGeoAge = intMetadataClass.newGeologicAge
outContext = 'geologic age'
outContext = inContext + ' > ' + outContext unless inContext.nil?
if hGeoAge.has_key?('ageTimeScale')
intGeoAge[:ageTimeScale] = hGeoAge['ageTimeScale']
end
if intGeoAge[:ageTimeScale].nil? || intGeoAge[:ageTimeScale] == ''
@MessagePath.issueError(351, responseObj, inContext)
end
if hGeoAge.has_key?('ageEstimate')
intGeoAge[:ageEstimate] = hGeoAge['ageEstimate']
end
if intGeoAge[:ageEstimate].nil? || intGeoAge[:ageEstimate] == ''
@MessagePath.issueError(352, responseObj, inContext)
end
if hGeoAge.has_key?('ageUncertainty')
unless hGeoAge['ageUncertainty'] == ''
intGeoAge[:ageUncertainty] = hGeoAge['ageUncertainty']
end
end
if hGeoAge.has_key?('ageExplanation')
unless hGeoAge['ageExplanation'] == ''
intGeoAge[:ageExplanation] = hGeoAge['ageExplanation']
end
end
if hGeoAge.has_key?('ageReference')
hGeoAge['ageReference'].each do |hCitation|
unless hCitation.empty?
hReturn = Citation.unpack(hCitation, responseObj, outContext)
unless hReturn.nil?
intGeoAge[:ageReferences] << hReturn
end
end
end
end
return intGeoAge
end
|