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
88
89
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_graphic.rb', line 26
def self.unpack(hGraphic, responseObj, inContext = nil)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hGraphic.empty?
@MessagePath.issueWarning(430, responseObj, inContext)
return nil
end
intMetadataClass = InternalMetadata.new
intGraphic = intMetadataClass.newGraphic
if hGraphic.has_key?('fileName')
intGraphic[:graphicName] = hGraphic['fileName']
end
if intGraphic[:graphicName].nil? || intGraphic[:graphicName] == ''
@MessagePath.issueError(431, responseObj, inContext)
end
if hGraphic.has_key?('fileDescription')
unless hGraphic['fileDescription'] == ''
intGraphic[:graphicDescription] = hGraphic['fileDescription']
end
end
if hGraphic.has_key?('fileType')
unless hGraphic['fileType'] == ''
intGraphic[:graphicType] = hGraphic['fileType']
end
end
if hGraphic.has_key?('fileConstraint')
aItems = hGraphic['fileConstraint']
aItems.each do |hItem|
unless hItem.empty?
hReturn = Constraint.unpack(hItem, responseObj)
unless hReturn.nil?
intGraphic[:graphicConstraints] << hReturn
end
end
end
end
if hGraphic.has_key?('fileUri')
hGraphic['fileUri'].each do |item|
unless item.empty?
uri = OnlineResource.unpack(item, responseObj)
unless uri.nil?
intGraphic[:graphicURI] << uri
end
end
end
end
return intGraphic
end
|