17
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
# File 'lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_distributionInfo.rb', line 17
def self.unpack(hDistributor)
intMetadataClass = InternalMetadata.new
intDistributor = intMetadataClass.newDistributor
if hDistributor.has_key?('distributorContact')
hContact = hDistributor['distributorContact']
unless hContact.empty?
intDistributor[:distContact] = Adiwg_ResponsibleParty.unpack(hContact)
end
end
if hDistributor.has_key?('distributionOrderProcess')
aDistOrder = hDistributor['distributionOrderProcess']
unless aDistOrder.empty?
aDistOrder.each do |distOrderProcess|
intDistOrder = intMetadataClass.newDistOrder
if distOrderProcess.has_key?('fees')
s = distOrderProcess['fees']
if s != ''
intDistOrder[:fees] = s
end
end
if distOrderProcess.has_key?('plannedAvailabilityDateTime')
s = distOrderProcess['plannedAvailabilityDateTime']
if s != ''
intDistOrder[:plannedDateTime] = Adiwg_DateTime.unpack(s)
end
end
if distOrderProcess.has_key?('orderingInstructions')
s = distOrderProcess['orderingInstructions']
if s != ''
intDistOrder[:orderInstructions] = s
end
end
if distOrderProcess.has_key?('turnaround')
s = distOrderProcess['turnaround']
if s != ''
intDistOrder[:turnaround] = s
end
end
intDistributor[:distOrderProc] << intDistOrder
end
end
end
if hDistributor.has_key?('distributorFormat')
aDistFormat = hDistributor['distributorFormat']
unless aDistFormat.empty?
aDistFormat.each do |distFormat|
intResFormat = intMetadataClass.newResourceFormat
if distFormat.has_key?('formatName')
s = distFormat['formatName']
if s != ''
intResFormat[:formatName] = s
end
end
if distFormat.has_key?('version')
s = distFormat['version']
if s != ''
intResFormat[:formatVersion] = s
end
end
intDistributor[:distFormat] << intResFormat
end
end
end
if hDistributor.has_key?('distributorTransferOptions')
aDistTransOpt = hDistributor['distributorTransferOptions']
unless aDistTransOpt.empty?
aDistTransOpt.each do |distTransOpt|
intTransOpt = intMetadataClass.newDigitalTransOption
if distTransOpt.has_key?('online')
aOnlineOption = distTransOpt['online']
aOnlineOption.each do |hOlOption|
intTransOpt[:online] << Adiwg_OnlineResource.unpack(hOlOption)
end
end
if distTransOpt.has_key?('offline')
intOfflineOpt = intMetadataClass.newMedium
distOfflineOpt = distTransOpt['offline']
if distOfflineOpt.has_key?('name')
s = distOfflineOpt['name']
if s != ''
intOfflineOpt[:mediumName] = s
end
end
if distOfflineOpt.has_key?('mediumFormat')
s = distOfflineOpt['mediumFormat']
if s != ''
intOfflineOpt[:mediumFormat] = s
end
end
if distOfflineOpt.has_key?('mediumNote')
s = distOfflineOpt['mediumNote']
if s != ''
intOfflineOpt[:mediumNote] = s
end
end
intTransOpt[:offline] = intOfflineOpt
end
intDistributor[:distTransOption] << intTransOpt
end
end
end
return intDistributor
end
|