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
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_timeInstant.rb', line 20
def self.unpack(hInstant, responseObj, inContext = nil)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hInstant.empty?
@MessagePath.issueWarning(850, responseObj, inContext)
return nil
end
intMetadataClass = InternalMetadata.new
intInstant = intMetadataClass.newTimeInstant
outContext = 'time instant'
outContext = inContext + ' > ' + outContext unless inContext.nil?
if hInstant.has_key?('id')
unless hInstant['id'] == ''
intInstant[:timeId] = hInstant['id']
end
end
if hInstant.has_key?('description')
unless hInstant['description'] == ''
intInstant[:description] = hInstant['description']
end
end
if hInstant.has_key?('identifier')
unless hInstant['identifier'].empty?
hReturn = Identifier.unpack(hInstant['identifier'], responseObj, outContext)
unless hReturn.nil?
intInstant[:identifier] = hReturn
end
end
end
if hInstant.has_key?('instantName')
hInstant['instantName'].each do |item|
unless item == ''
intInstant[:instantNames] << item
end
end
end
if hInstant.has_key?('dateTime')
unless hInstant['dateTime'] == ''
hDate = DateTime.unpack(hInstant['dateTime'], responseObj, outContext)
unless hDate.nil?
intInstant[:timeInstant] = hDate
end
end
end
if hInstant.has_key?('geologicAge')
unless hInstant['geologicAge'].empty?
hGeoAge = GeologicAge.unpack(hInstant['geologicAge'], responseObj, outContext)
unless hGeoAge.nil?
intInstant[:geologicAge] = hGeoAge
end
end
end
if intInstant[:timeInstant].empty? && intInstant[:geologicAge].empty?
@MessagePath.issueError(851, responseObj, inContext)
end
return intInstant
end
|