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
59
60
61
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_date.rb', line 15
def self.unpack(hDate, responseObj, inContext = nil)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hDate.empty?
@MessagePath.issueWarning(150, responseObj, inContext)
return nil
end
intMetadataClass = InternalMetadata.new
intDate = intMetadataClass.newDate
if hDate.has_key?('date') && hDate['date'] != ''
aDateTimeReturn = AdiwgDateTimeFun.dateTimeFromString(hDate['date'])
if aDateTimeReturn[1] == 'ERROR'
@MessagePath.issueError(151, responseObj, inContext)
else
intDate[:date] = aDateTimeReturn[0]
intDate[:dateResolution] = aDateTimeReturn[1]
end
else
@MessagePath.issueError(152, responseObj, inContext)
end
if hDate.has_key?('dateType')
intDate[:dateType] = hDate['dateType']
end
if intDate[:dateType].nil? || intDate[:dateType] == ''
@MessagePath.issueError(153, responseObj, inContext)
end
if hDate.has_key?('description')
s = hDate['description']
unless s == ''
intDate[:description] = s
end
end
return intDate
end
|