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
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_funding.rb', line 19
def self.unpack(hFunding, responseObj)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hFunding.empty?
@MessagePath.issueWarning(300, responseObj)
return nil
end
intMetadataClass = InternalMetadata.new
intFunding = intMetadataClass.newFunding
outContext = 'funding'
if hFunding.has_key?('description')
unless hFunding['description'] == ''
intFunding[:description] = hFunding['description']
end
end
if hFunding.has_key?('timePeriod')
hObject = hFunding['timePeriod']
unless hObject.empty?
hReturn = TimePeriod.unpack(hObject, responseObj, outContext)
unless hReturn.nil?
intFunding[:timePeriod] = hReturn
end
end
end
if hFunding.has_key?('allocation')
aItems = hFunding['allocation']
aItems.each do |item|
hReturn = Allocation.unpack(item, responseObj)
unless hReturn.nil?
intFunding[:allocations] << hReturn
end
end
end
if intFunding[:allocations].empty? && intFunding[:timePeriod].empty?
@MessagePath.issueError(301, responseObj)
end
return intFunding
end
|