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
97
98
99
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_associatedResource.rb', line 28
def self.unpack(hAssocRes, responseObj)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hAssocRes.empty?
@MessagePath.issueWarning(30, responseObj)
return nil
end
intMetadataClass = InternalMetadata.new
intAssocRes = intMetadataClass.newAssociatedResource
if hAssocRes.has_key?('resourceType')
hAssocRes['resourceType'].each do |item|
unless item.empty?
hReturn = ResourceType.unpack(item, responseObj)
unless hReturn.nil?
intAssocRes[:resourceTypes] << hReturn
end
end
end
end
if intAssocRes[:resourceTypes].empty?
@MessagePath.issueError(31, responseObj)
end
if hAssocRes.has_key?('associationType')
intAssocRes[:associationType] = hAssocRes['associationType']
end
if intAssocRes[:associationType].nil? || intAssocRes[:associationType] == ''
@MessagePath.issueError(32, responseObj)
end
if hAssocRes.has_key?('initiativeType')
if hAssocRes['initiativeType'] != ''
intAssocRes[:initiativeType] = hAssocRes['initiativeType']
end
end
if hAssocRes.has_key?('resourceCitation')
hObject = hAssocRes['resourceCitation']
unless hObject.empty?
hReturn = Citation.unpack(hObject, responseObj)
unless hReturn.nil?
intAssocRes[:resourceCitation] = hReturn
end
end
end
if intAssocRes[:resourceCitation].empty?
@MessagePath.issueError(33, responseObj)
end
if hAssocRes.has_key?('metadataCitation')
hObject = hAssocRes['metadataCitation']
unless hObject.empty?
hReturn = Citation.unpack(hObject, responseObj)
unless hReturn.nil?
intAssocRes[:metadataCitation] = hReturn
end
end
end
return intAssocRes
end
|