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
79
80
81
82
83
84
85
86
87
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_maintenance.rb', line 18
def self.unpack(hMaint, responseObj, inContext = nil)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hMaint.empty?
@MessagePath.issueWarning(520, responseObj, inContext)
return nil
end
intMetadataClass = InternalMetadata.new
intMaint = intMetadataClass.newMaintenance
outContext = 'maintenance'
outContext = inContext + ' > ' + outContext unless inContext.nil?
if hMaint.has_key?('frequency')
intMaint[:frequency] = hMaint['frequency']
end
if intMaint[:frequency].nil? || intMaint[:frequency] == ''
@MessagePath.issueError(521, responseObj, inContext)
end
if hMaint.has_key?('date')
aItems = hMaint['date']
aItems.each do |item|
hReturn = Date.unpack(item, responseObj, outContext)
unless hReturn.nil?
intMaint[:dates] << hReturn
end
end
end
if hMaint.has_key?('scope')
aItems = hMaint['scope']
aItems.each do |item|
hReturn = Scope.unpack(item, responseObj, outContext)
unless hReturn.nil?
intMaint[:scopes] << hReturn
end
end
end
if hMaint.has_key?('note')
hMaint['note'].each do |item|
if item != ''
intMaint[:notes] << item
end
end
end
if hMaint.has_key?('contact')
aItems = hMaint['contact']
aItems.each do |item|
hReturn = ResponsibleParty.unpack(item, responseObj, outContext)
unless hReturn.nil?
intMaint[:contacts] << hReturn
end
end
end
return intMaint
end
|