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
88
89
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_onlineResource.rb', line 24
def self.unpack(hOnlineRes, responseObj, inContext = nil)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hOnlineRes.empty?
@MessagePath.issueWarning(600, responseObj, inContext)
return nil
end
intMetadataClass = InternalMetadata.new
intOLRes = intMetadataClass.newOnlineResource
if hOnlineRes.has_key?('uri')
intOLRes[:olResURI] = hOnlineRes['uri']
end
if intOLRes[:olResURI].nil? || intOLRes[:olResURI] == ''
@MessagePath.issueError(601, responseObj, inContext)
end
if hOnlineRes.has_key?('name')
unless hOnlineRes['name'] == ''
intOLRes[:olResName] = hOnlineRes['name']
end
end
if hOnlineRes.has_key?('description')
unless hOnlineRes['description'] == ''
intOLRes[:olResDesc] = hOnlineRes['description']
end
end
if hOnlineRes.has_key?('function')
unless hOnlineRes['function'] == ''
intOLRes[:olResFunction] = hOnlineRes['function']
end
end
if hOnlineRes.has_key?('applicationProfile')
unless hOnlineRes['applicationProfile'] == ''
intOLRes[:olResApplicationProfile] = hOnlineRes['applicationProfile']
end
end
if hOnlineRes.has_key?('protocol')
unless hOnlineRes['protocol'] == ''
intOLRes[:olResProtocol] = hOnlineRes['protocol']
end
end
if hOnlineRes.has_key?('protocolRequest')
unless hOnlineRes['protocolRequest'] == ''
intOLRes[:olResProtocolRequest] = hOnlineRes['protocolRequest']
end
end
return intOLRes
end
|