15
16
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
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInterval.rb', line 15
def self.unpack(hTimeInt, responseObj, inContext = nil)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hTimeInt.empty?
@MessagePath.issueWarning(860, responseObj, inContext)
return nil
end
intMetadataClass = InternalMetadata.new
intTime = intMetadataClass.newTimeInterval
if hTimeInt.has_key?('interval')
interval = hTimeInt['interval']
unless interval == ''
if interval.is_a?(Numeric)
intTime[:interval] = hTimeInt['interval']
else
@MessagePath.issueError(861, responseObj, inContext)
end
end
end
if intTime[:interval].nil? || intTime[:interval] == ''
@MessagePath.issueError(862, responseObj, inContext)
end
if hTimeInt.has_key?('units')
units = hTimeInt['units']
unless units.nil?
if %w{year month day hour minute second}.one? {|word| word == units}
intTime[:units] = hTimeInt['units']
end
end
end
if intTime[:units].nil? || intTime[:units] == ''
@MessagePath.issueError(863, responseObj, inContext)
end
return intTime
end
|