jasperserver4r 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,105 @@
1
+ require 'jasperserver4r/reportschedulerservice'
2
+ require 'jasperserver4r/reportschedulerservicemappingregistry'
3
+ require 'soap/rpc/driver'
4
+
5
+ module JasperServer
6
+ module ReportSchedulerService
7
+
8
+ class ReportSchedulerInterface < ::SOAP::RPC::Driver
9
+ DefaultEndpointUrl = "http://localhost:8080/jasperserver/services/ReportScheduler"
10
+ NsWs = "http://www.jasperforge.org/jasperserver/ws"
11
+
12
+ Methods = [
13
+ [ XSD::QName.new(NsWs, "deleteJob"),
14
+ "",
15
+ "deleteJob",
16
+ [ ["in", "id", ["::SOAP::SOAPLong"]] ],
17
+ { :request_style => :rpc, :request_use => :encoded,
18
+ :response_style => :rpc, :response_use => :encoded,
19
+ :faults => {} }
20
+ ],
21
+ [ XSD::QName.new(NsWs, "deleteJobs"),
22
+ "",
23
+ "deleteJobs",
24
+ [ ["in", "ids", ["JasperServer::ReportSchedulerService::ArrayOf_xsd_long", "http://www.jasperforge.org/jasperserver/ws", "ArrayOf_xsd_long"]] ],
25
+ { :request_style => :rpc, :request_use => :encoded,
26
+ :response_style => :rpc, :response_use => :encoded,
27
+ :faults => {} }
28
+ ],
29
+ [ XSD::QName.new(NsWs, "getJob"),
30
+ "",
31
+ "getJob",
32
+ [ ["in", "id", ["::SOAP::SOAPLong"]],
33
+ ["retval", "getJobReturn", ["JasperServer::ReportSchedulerService::Job", "http://www.jasperforge.org/jasperserver/ws", "Job"]] ],
34
+ { :request_style => :rpc, :request_use => :encoded,
35
+ :response_style => :rpc, :response_use => :encoded,
36
+ :faults => {} }
37
+ ],
38
+ [ XSD::QName.new(NsWs, "scheduleJob"),
39
+ "",
40
+ "scheduleJob",
41
+ [ ["in", "job", ["Job", "http://www.jasperforge.org/jasperserver/ws", "Job"]],
42
+ ["retval", "scheduleJobReturn", ["JasperServer::ReportSchedulerService::Job", "http://www.jasperforge.org/jasperserver/ws", "Job"]] ],
43
+ { :request_style => :rpc, :request_use => :encoded,
44
+ :response_style => :rpc, :response_use => :encoded,
45
+ :faults => {} }
46
+ ],
47
+ [ XSD::QName.new(NsWs, "updateJob"),
48
+ "",
49
+ "updateJob",
50
+ [ ["in", "job", ["Job", "http://www.jasperforge.org/jasperserver/ws", "Job"]],
51
+ ["retval", "updateJobReturn", ["JasperServer::ReportSchedulerService::Job", "http://www.jasperforge.org/jasperserver/ws", "Job"]] ],
52
+ { :request_style => :rpc, :request_use => :encoded,
53
+ :response_style => :rpc, :response_use => :encoded,
54
+ :faults => {} }
55
+ ],
56
+ [ XSD::QName.new(NsWs, "getAllJobs"),
57
+ "",
58
+ "getAllJobs",
59
+ [ ["retval", "getAllJobsReturn", ["JasperServer::ReportSchedulerService::ArrayOfJobSummary", "http://www.jasperforge.org/jasperserver/ws", "ArrayOfJobSummary"]] ],
60
+ { :request_style => :rpc, :request_use => :encoded,
61
+ :response_style => :rpc, :response_use => :encoded,
62
+ :faults => {} }
63
+ ],
64
+ [ XSD::QName.new(NsWs, "getReportJobs"),
65
+ "",
66
+ "getReportJobs",
67
+ [ ["in", "reportURI", ["::SOAP::SOAPString"]],
68
+ ["retval", "getReportJobsReturn", ["JasperServer::ReportSchedulerService::ArrayOfJobSummary", "http://www.jasperforge.org/jasperserver/ws", "ArrayOfJobSummary"]] ],
69
+ { :request_style => :rpc, :request_use => :encoded,
70
+ :response_style => :rpc, :response_use => :encoded,
71
+ :faults => {} }
72
+ ]
73
+ ]
74
+
75
+ def initialize(endpoint_url = nil)
76
+ endpoint_url ||= DefaultEndpointUrl
77
+ super(endpoint_url, nil)
78
+ self.mapping_registry = JasperServer::ReportSchedulerService::DefaultMappingRegistry::EncodedRegistry
79
+ self.literal_mapping_registry = JasperServer::ReportSchedulerService::DefaultMappingRegistry::LiteralRegistry
80
+ init_methods
81
+ end
82
+
83
+ private
84
+
85
+ def init_methods
86
+ Methods.each do |definitions|
87
+ opt = definitions.last
88
+ if opt[:request_style] == :document
89
+ add_document_operation(*definitions)
90
+ else
91
+ add_rpc_operation(*definitions)
92
+ qname = definitions[0]
93
+ name = definitions[2]
94
+ if qname.name != name and qname.name.capitalize == name.capitalize
95
+ ::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
96
+ __send__(name, *arg)
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
103
+
104
+ end
105
+ end
@@ -0,0 +1,307 @@
1
+ require 'jasperserver4r/reportschedulerservice'
2
+ require 'soap/mapping'
3
+
4
+ module JasperServer
5
+
6
+ module ReportSchedulerService
7
+
8
+ module DefaultMappingRegistry
9
+ EncodedRegistry = ::SOAP::Mapping::EncodedRegistry.new
10
+ LiteralRegistry = ::SOAP::Mapping::LiteralRegistry.new
11
+ NsWs = "http://www.jasperforge.org/jasperserver/ws"
12
+
13
+ EncodedRegistry.set(
14
+ ArrayOf_xsd_long,
15
+ ::SOAP::SOAPArray,
16
+ ::SOAP::Mapping::EncodedRegistry::TypedArrayFactory,
17
+ { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "long") }
18
+ )
19
+
20
+ EncodedRegistry.set(
21
+ ArrayOf_xsd_int,
22
+ ::SOAP::SOAPArray,
23
+ ::SOAP::Mapping::EncodedRegistry::TypedArrayFactory,
24
+ { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "int") }
25
+ )
26
+
27
+ EncodedRegistry.register(
28
+ :class => JasperServer::ReportSchedulerService::JobCalendarTrigger,
29
+ :schema_type => XSD::QName.new(NsWs, "JobCalendarTrigger"),
30
+ :schema_basetype => XSD::QName.new(NsWs, "JobTrigger"),
31
+ :schema_element => [
32
+ ["id", ["SOAP::SOAPLong", XSD::QName.new(nil, "id")]],
33
+ ["version", ["SOAP::SOAPInt", XSD::QName.new(nil, "version")]],
34
+ ["timezone", ["SOAP::SOAPString", XSD::QName.new(nil, "timezone")]],
35
+ ["startDate", ["SOAP::SOAPDateTime", XSD::QName.new(nil, "startDate")]],
36
+ ["endDate", ["SOAP::SOAPDateTime", XSD::QName.new(nil, "endDate")]],
37
+ ["minutes", ["SOAP::SOAPString", XSD::QName.new(nil, "minutes")]],
38
+ ["hours", ["SOAP::SOAPString", XSD::QName.new(nil, "hours")]],
39
+ ["daysType", ["JasperServer::ReportSchedulerService::CalendarDaysType", XSD::QName.new(nil, "daysType")]],
40
+ ["weekDays", ["JasperServer::ReportSchedulerService::ArrayOf_xsd_int", XSD::QName.new(nil, "weekDays")]],
41
+ ["monthDays", ["SOAP::SOAPString", XSD::QName.new(nil, "monthDays")]],
42
+ ["months", ["JasperServer::ReportSchedulerService::ArrayOf_xsd_int", XSD::QName.new(nil, "months")]]
43
+ ]
44
+ )
45
+
46
+ EncodedRegistry.set(
47
+ ArrayOf_xsd_string,
48
+ ::SOAP::SOAPArray,
49
+ ::SOAP::Mapping::EncodedRegistry::TypedArrayFactory,
50
+ { :type => XSD::QName.new("http://www.w3.org/2001/XMLSchema", "string") }
51
+ )
52
+
53
+ EncodedRegistry.register(
54
+ :class => JasperServer::ReportSchedulerService::JobMailNotification,
55
+ :schema_type => XSD::QName.new(NsWs, "JobMailNotification"),
56
+ :schema_element => [
57
+ ["id", ["SOAP::SOAPLong", XSD::QName.new(nil, "id")]],
58
+ ["version", ["SOAP::SOAPInt", XSD::QName.new(nil, "version")]],
59
+ ["toAddresses", ["JasperServer::ReportSchedulerService::ArrayOf_xsd_string", XSD::QName.new(nil, "toAddresses")]],
60
+ ["subject", ["SOAP::SOAPString", XSD::QName.new(nil, "subject")]],
61
+ ["messageText", ["SOAP::SOAPString", XSD::QName.new(nil, "messageText")]],
62
+ ["resultSendType", ["JasperServer::ReportSchedulerService::ResultSendType", XSD::QName.new(nil, "resultSendType")]],
63
+ ["skipEmptyReports", ["SOAP::SOAPBoolean", XSD::QName.new(nil, "skipEmptyReports")]]
64
+ ]
65
+ )
66
+
67
+ EncodedRegistry.register(
68
+ :class => JasperServer::ReportSchedulerService::JobParameter,
69
+ :schema_type => XSD::QName.new(NsWs, "JobParameter"),
70
+ :schema_element => [
71
+ ["name", ["SOAP::SOAPString", XSD::QName.new(nil, "name")]],
72
+ ["value", ["SOAP::SOAPAnySimpleType", XSD::QName.new(nil, "value")]]
73
+ ]
74
+ )
75
+
76
+ EncodedRegistry.set(
77
+ ArrayOfJobParameter,
78
+ ::SOAP::SOAPArray,
79
+ ::SOAP::Mapping::EncodedRegistry::TypedArrayFactory,
80
+ { :type => XSD::QName.new(NsWs, "JobParameter") }
81
+ )
82
+
83
+ EncodedRegistry.register(
84
+ :class => JasperServer::ReportSchedulerService::JobRepositoryDestination,
85
+ :schema_type => XSD::QName.new(NsWs, "JobRepositoryDestination"),
86
+ :schema_element => [
87
+ ["id", ["SOAP::SOAPLong", XSD::QName.new(nil, "id")]],
88
+ ["version", ["SOAP::SOAPInt", XSD::QName.new(nil, "version")]],
89
+ ["folderURI", ["SOAP::SOAPString", XSD::QName.new(nil, "folderURI")]],
90
+ ["sequentialFilenames", ["SOAP::SOAPBoolean", XSD::QName.new(nil, "sequentialFilenames")]],
91
+ ["overwriteFiles", ["SOAP::SOAPBoolean", XSD::QName.new(nil, "overwriteFiles")]],
92
+ ["outputDescription", ["SOAP::SOAPString", XSD::QName.new(nil, "outputDescription")]],
93
+ ["timestampPattern", ["SOAP::SOAPString", XSD::QName.new(nil, "timestampPattern")]]
94
+ ]
95
+ )
96
+
97
+ EncodedRegistry.register(
98
+ :class => JasperServer::ReportSchedulerService::JobSimpleTrigger,
99
+ :schema_type => XSD::QName.new(NsWs, "JobSimpleTrigger"),
100
+ :schema_basetype => XSD::QName.new(NsWs, "JobTrigger"),
101
+ :schema_element => [
102
+ ["id", ["SOAP::SOAPLong", XSD::QName.new(nil, "id")]],
103
+ ["version", ["SOAP::SOAPInt", XSD::QName.new(nil, "version")]],
104
+ ["timezone", ["SOAP::SOAPString", XSD::QName.new(nil, "timezone")]],
105
+ ["startDate", ["SOAP::SOAPDateTime", XSD::QName.new(nil, "startDate")]],
106
+ ["endDate", ["SOAP::SOAPDateTime", XSD::QName.new(nil, "endDate")]],
107
+ ["occurrenceCount", ["SOAP::SOAPInt", XSD::QName.new(nil, "occurrenceCount")]],
108
+ ["recurrenceInterval", ["SOAP::SOAPInt", XSD::QName.new(nil, "recurrenceInterval")]],
109
+ ["recurrenceIntervalUnit", ["JasperServer::ReportSchedulerService::IntervalUnit", XSD::QName.new(nil, "recurrenceIntervalUnit")]]
110
+ ]
111
+ )
112
+
113
+ EncodedRegistry.register(
114
+ :class => JasperServer::ReportSchedulerService::Job,
115
+ :schema_type => XSD::QName.new(NsWs, "Job"),
116
+ :schema_element => [
117
+ ["id", ["SOAP::SOAPLong", XSD::QName.new(nil, "id")]],
118
+ ["version", ["SOAP::SOAPInt", XSD::QName.new(nil, "version")]],
119
+ ["reportUnitURI", ["SOAP::SOAPString", XSD::QName.new(nil, "reportUnitURI")]],
120
+ ["username", ["SOAP::SOAPString", XSD::QName.new(nil, "username")]],
121
+ ["label", ["SOAP::SOAPString", XSD::QName.new(nil, "label")]],
122
+ ["description", ["SOAP::SOAPString", XSD::QName.new(nil, "description")]],
123
+ ["simpleTrigger", ["JasperServer::ReportSchedulerService::JobSimpleTrigger", XSD::QName.new(nil, "simpleTrigger")]],
124
+ ["calendarTrigger", ["JasperServer::ReportSchedulerService::JobCalendarTrigger", XSD::QName.new(nil, "calendarTrigger")]],
125
+ ["parameters", ["JasperServer::ReportSchedulerService::ArrayOfJobParameter", XSD::QName.new(nil, "parameters")]],
126
+ ["baseOutputFilename", ["SOAP::SOAPString", XSD::QName.new(nil, "baseOutputFilename")]],
127
+ ["outputFormats", ["JasperServer::ReportSchedulerService::ArrayOf_xsd_string", XSD::QName.new(nil, "outputFormats")]],
128
+ ["outputLocale", ["SOAP::SOAPString", XSD::QName.new(nil, "outputLocale")]],
129
+ ["repositoryDestination", ["JasperServer::ReportSchedulerService::JobRepositoryDestination", XSD::QName.new(nil, "repositoryDestination")]],
130
+ ["mailNotification", ["JasperServer::ReportSchedulerService::JobMailNotification", XSD::QName.new(nil, "mailNotification")]]
131
+ ]
132
+ )
133
+
134
+ EncodedRegistry.register(
135
+ :class => JasperServer::ReportSchedulerService::JobSummary,
136
+ :schema_type => XSD::QName.new(NsWs, "JobSummary"),
137
+ :schema_element => [
138
+ ["id", ["SOAP::SOAPLong", XSD::QName.new(nil, "id")]],
139
+ ["version", ["SOAP::SOAPInt", XSD::QName.new(nil, "version")]],
140
+ ["reportUnitURI", ["SOAP::SOAPString", XSD::QName.new(nil, "reportUnitURI")]],
141
+ ["username", ["SOAP::SOAPString", XSD::QName.new(nil, "username")]],
142
+ ["label", ["SOAP::SOAPString", XSD::QName.new(nil, "label")]],
143
+ ["state", ["JasperServer::ReportSchedulerService::RuntimeJobState", XSD::QName.new(nil, "state")]],
144
+ ["previousFireTime", ["SOAP::SOAPDateTime", XSD::QName.new(nil, "previousFireTime")]],
145
+ ["nextFireTime", ["SOAP::SOAPDateTime", XSD::QName.new(nil, "nextFireTime")]]
146
+ ]
147
+ )
148
+
149
+ EncodedRegistry.set(
150
+ ArrayOfJobSummary,
151
+ ::SOAP::SOAPArray,
152
+ ::SOAP::Mapping::EncodedRegistry::TypedArrayFactory,
153
+ { :type => XSD::QName.new(NsWs, "JobSummary") }
154
+ )
155
+
156
+ EncodedRegistry.register(
157
+ :class => JasperServer::ReportSchedulerService::IntervalUnit,
158
+ :schema_type => XSD::QName.new(NsWs, "IntervalUnit")
159
+ )
160
+
161
+ EncodedRegistry.register(
162
+ :class => JasperServer::ReportSchedulerService::CalendarDaysType,
163
+ :schema_type => XSD::QName.new(NsWs, "CalendarDaysType")
164
+ )
165
+
166
+ EncodedRegistry.register(
167
+ :class => JasperServer::ReportSchedulerService::ResultSendType,
168
+ :schema_type => XSD::QName.new(NsWs, "ResultSendType")
169
+ )
170
+
171
+ EncodedRegistry.register(
172
+ :class => JasperServer::ReportSchedulerService::RuntimeJobState,
173
+ :schema_type => XSD::QName.new(NsWs, "RuntimeJobState")
174
+ )
175
+
176
+ LiteralRegistry.register(
177
+ :class => JasperServer::ReportSchedulerService::JobCalendarTrigger,
178
+ :schema_type => XSD::QName.new(NsWs, "JobCalendarTrigger"),
179
+ :schema_basetype => XSD::QName.new(NsWs, "JobTrigger"),
180
+ :schema_element => [
181
+ ["id", ["SOAP::SOAPLong", XSD::QName.new(nil, "id")]],
182
+ ["version", ["SOAP::SOAPInt", XSD::QName.new(nil, "version")]],
183
+ ["timezone", ["SOAP::SOAPString", XSD::QName.new(nil, "timezone")]],
184
+ ["startDate", ["SOAP::SOAPDateTime", XSD::QName.new(nil, "startDate")]],
185
+ ["endDate", ["SOAP::SOAPDateTime", XSD::QName.new(nil, "endDate")]],
186
+ ["minutes", ["SOAP::SOAPString", XSD::QName.new(nil, "minutes")]],
187
+ ["hours", ["SOAP::SOAPString", XSD::QName.new(nil, "hours")]],
188
+ ["daysType", ["JasperServer::ReportSchedulerService::CalendarDaysType", XSD::QName.new(nil, "daysType")]],
189
+ ["weekDays", ["JasperServer::ReportSchedulerService::ArrayOf_xsd_int", XSD::QName.new(nil, "weekDays")]],
190
+ ["monthDays", ["SOAP::SOAPString", XSD::QName.new(nil, "monthDays")]],
191
+ ["months", ["JasperServer::ReportSchedulerService::ArrayOf_xsd_int", XSD::QName.new(nil, "months")]]
192
+ ]
193
+ )
194
+
195
+ LiteralRegistry.register(
196
+ :class => JasperServer::ReportSchedulerService::JobMailNotification,
197
+ :schema_type => XSD::QName.new(NsWs, "JobMailNotification"),
198
+ :schema_element => [
199
+ ["id", ["SOAP::SOAPLong", XSD::QName.new(nil, "id")]],
200
+ ["version", ["SOAP::SOAPInt", XSD::QName.new(nil, "version")]],
201
+ ["toAddresses", ["JasperServer::ReportSchedulerService::ArrayOf_xsd_string", XSD::QName.new(nil, "toAddresses")]],
202
+ ["subject", ["SOAP::SOAPString", XSD::QName.new(nil, "subject")]],
203
+ ["messageText", ["SOAP::SOAPString", XSD::QName.new(nil, "messageText")]],
204
+ ["resultSendType", ["JasperServer::ReportSchedulerService::ResultSendType", XSD::QName.new(nil, "resultSendType")]],
205
+ ["skipEmptyReports", ["SOAP::SOAPBoolean", XSD::QName.new(nil, "skipEmptyReports")]]
206
+ ]
207
+ )
208
+
209
+ LiteralRegistry.register(
210
+ :class => JasperServer::ReportSchedulerService::JobParameter,
211
+ :schema_type => XSD::QName.new(NsWs, "JobParameter"),
212
+ :schema_element => [
213
+ ["name", ["SOAP::SOAPString", XSD::QName.new(nil, "name")]],
214
+ ["value", ["SOAP::SOAPAnySimpleType", XSD::QName.new(nil, "value")]]
215
+ ]
216
+ )
217
+
218
+ LiteralRegistry.register(
219
+ :class => JasperServer::ReportSchedulerService::JobRepositoryDestination,
220
+ :schema_type => XSD::QName.new(NsWs, "JobRepositoryDestination"),
221
+ :schema_element => [
222
+ ["id", ["SOAP::SOAPLong", XSD::QName.new(nil, "id")]],
223
+ ["version", ["SOAP::SOAPInt", XSD::QName.new(nil, "version")]],
224
+ ["folderURI", ["SOAP::SOAPString", XSD::QName.new(nil, "folderURI")]],
225
+ ["sequentialFilenames", ["SOAP::SOAPBoolean", XSD::QName.new(nil, "sequentialFilenames")]],
226
+ ["overwriteFiles", ["SOAP::SOAPBoolean", XSD::QName.new(nil, "overwriteFiles")]],
227
+ ["outputDescription", ["SOAP::SOAPString", XSD::QName.new(nil, "outputDescription")]],
228
+ ["timestampPattern", ["SOAP::SOAPString", XSD::QName.new(nil, "timestampPattern")]]
229
+ ]
230
+ )
231
+
232
+ LiteralRegistry.register(
233
+ :class => JasperServer::ReportSchedulerService::JobSimpleTrigger,
234
+ :schema_type => XSD::QName.new(NsWs, "JobSimpleTrigger"),
235
+ :schema_basetype => XSD::QName.new(NsWs, "JobTrigger"),
236
+ :schema_element => [
237
+ ["id", ["SOAP::SOAPLong", XSD::QName.new(nil, "id")]],
238
+ ["version", ["SOAP::SOAPInt", XSD::QName.new(nil, "version")]],
239
+ ["timezone", ["SOAP::SOAPString", XSD::QName.new(nil, "timezone")]],
240
+ ["startDate", ["SOAP::SOAPDateTime", XSD::QName.new(nil, "startDate")]],
241
+ ["endDate", ["SOAP::SOAPDateTime", XSD::QName.new(nil, "endDate")]],
242
+ ["occurrenceCount", ["SOAP::SOAPInt", XSD::QName.new(nil, "occurrenceCount")]],
243
+ ["recurrenceInterval", ["SOAP::SOAPInt", XSD::QName.new(nil, "recurrenceInterval")]],
244
+ ["recurrenceIntervalUnit", ["JasperServer::ReportSchedulerService::IntervalUnit", XSD::QName.new(nil, "recurrenceIntervalUnit")]]
245
+ ]
246
+ )
247
+
248
+ LiteralRegistry.register(
249
+ :class => JasperServer::ReportSchedulerService::Job,
250
+ :schema_type => XSD::QName.new(NsWs, "Job"),
251
+ :schema_element => [
252
+ ["id", ["SOAP::SOAPLong", XSD::QName.new(nil, "id")]],
253
+ ["version", ["SOAP::SOAPInt", XSD::QName.new(nil, "version")]],
254
+ ["reportUnitURI", ["SOAP::SOAPString", XSD::QName.new(nil, "reportUnitURI")]],
255
+ ["username", ["SOAP::SOAPString", XSD::QName.new(nil, "username")]],
256
+ ["label", ["SOAP::SOAPString", XSD::QName.new(nil, "label")]],
257
+ ["description", ["SOAP::SOAPString", XSD::QName.new(nil, "description")]],
258
+ ["simpleTrigger", ["JasperServer::ReportSchedulerService::JobSimpleTrigger", XSD::QName.new(nil, "simpleTrigger")]],
259
+ ["calendarTrigger", ["JasperServer::ReportSchedulerService::JobCalendarTrigger", XSD::QName.new(nil, "calendarTrigger")]],
260
+ ["parameters", ["JasperServer::ReportSchedulerService::ArrayOfJobParameter", XSD::QName.new(nil, "parameters")]],
261
+ ["baseOutputFilename", ["SOAP::SOAPString", XSD::QName.new(nil, "baseOutputFilename")]],
262
+ ["outputFormats", ["JasperServer::ReportSchedulerService::ArrayOf_xsd_string", XSD::QName.new(nil, "outputFormats")]],
263
+ ["outputLocale", ["SOAP::SOAPString", XSD::QName.new(nil, "outputLocale")]],
264
+ ["repositoryDestination", ["JasperServer::ReportSchedulerService::JobRepositoryDestination", XSD::QName.new(nil, "repositoryDestination")]],
265
+ ["mailNotification", ["JasperServer::ReportSchedulerService::JobMailNotification", XSD::QName.new(nil, "mailNotification")]]
266
+ ]
267
+ )
268
+
269
+ LiteralRegistry.register(
270
+ :class => JasperServer::ReportSchedulerService::JobSummary,
271
+ :schema_type => XSD::QName.new(NsWs, "JobSummary"),
272
+ :schema_element => [
273
+ ["id", ["SOAP::SOAPLong", XSD::QName.new(nil, "id")]],
274
+ ["version", ["SOAP::SOAPInt", XSD::QName.new(nil, "version")]],
275
+ ["reportUnitURI", ["SOAP::SOAPString", XSD::QName.new(nil, "reportUnitURI")]],
276
+ ["username", ["SOAP::SOAPString", XSD::QName.new(nil, "username")]],
277
+ ["label", ["SOAP::SOAPString", XSD::QName.new(nil, "label")]],
278
+ ["state", ["JasperServer::ReportSchedulerService::RuntimeJobState", XSD::QName.new(nil, "state")]],
279
+ ["previousFireTime", ["SOAP::SOAPDateTime", XSD::QName.new(nil, "previousFireTime")]],
280
+ ["nextFireTime", ["SOAP::SOAPDateTime", XSD::QName.new(nil, "nextFireTime")]]
281
+ ]
282
+ )
283
+
284
+ LiteralRegistry.register(
285
+ :class => JasperServer::ReportSchedulerService::IntervalUnit,
286
+ :schema_type => XSD::QName.new(NsWs, "IntervalUnit")
287
+ )
288
+
289
+ LiteralRegistry.register(
290
+ :class => JasperServer::ReportSchedulerService::CalendarDaysType,
291
+ :schema_type => XSD::QName.new(NsWs, "CalendarDaysType")
292
+ )
293
+
294
+ LiteralRegistry.register(
295
+ :class => JasperServer::ReportSchedulerService::ResultSendType,
296
+ :schema_type => XSD::QName.new(NsWs, "ResultSendType")
297
+ )
298
+
299
+ LiteralRegistry.register(
300
+ :class => JasperServer::ReportSchedulerService::RuntimeJobState,
301
+ :schema_type => XSD::QName.new(NsWs, "RuntimeJobState")
302
+ )
303
+ end
304
+
305
+ end
306
+
307
+ end
@@ -0,0 +1,14 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'jasperserver4r'
4
+
5
+ module CommonUtils
6
+
7
+ def self.create_api_object(test)
8
+ client = JasperServer::API.new( "jasperadmin", "jasperadmin" )
9
+ test. assert_instance_of( JasperServer::API, client,
10
+ 'ERROR: Failed to create JasperServer::API instance' )
11
+ return client
12
+ end
13
+ end
14
+
@@ -0,0 +1,426 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'jasperserver4r'
4
+ require 'common_utils'
5
+
6
+ class TestReportScheduler < Test::Unit::TestCase
7
+
8
+ # Initialize tests
9
+ def setup
10
+ @client = CommonUtils.create_api_object(self)
11
+
12
+ # Defaults to http://localhost:8080/jasperserver/services/ReportScheduler"
13
+ @scheduler_service = @client.get_report_scheduler_service
14
+
15
+ @test_report_no_params = {'uri' => '/reports/samples/AllAccounts',
16
+ 'output_label' => 'AllAccounts',
17
+ 'output_filename' => 'AllAccounts'}
18
+
19
+ @test_report_with_params = {'uri' => '/reports/samples/EmployeeAccounts',
20
+ 'output_label' => 'EmployeeAccounts',
21
+ 'output_filename' => 'EmployeeAccounts',
22
+ 'params' => {
23
+ 'name' => 'EmployeeID',
24
+ 'value' => 'matt_id'}}
25
+
26
+ @test_jobs = []
27
+ end
28
+
29
+ # Delete all jobs created
30
+ def teardown
31
+ @scheduler_service.deleteJobs( @test_jobs ) if !@test_jobs.nil?
32
+ end
33
+
34
+ # Test creating a scheduled job with a simple trigger
35
+ def test_schedule_job_simple_trigger
36
+ # Create a trigger object with simple recurrence
37
+ trigger = JasperServer::ReportSchedulerService::JobSimpleTrigger.new
38
+ trigger.startDate = SOAP::SOAPDateTime.new( "2010-01-01T00:00:00.0000000+02:00" )
39
+ trigger.occurrenceCount = 1
40
+ trigger.recurrenceInterval = 1
41
+ trigger.recurrenceIntervalUnit = JasperServer::ReportSchedulerService::IntervalUnit::WEEK
42
+
43
+ # Create an mail notification object
44
+ email = JasperServer::ReportSchedulerService::JobMailNotification.new
45
+ email.toAddresses = "all4miller@gmail.com"
46
+ email.subject = "Schedule report execution completed successfully"
47
+ email.messageText = "Schedule report execution completed successfully"
48
+ email.resultSendType = JasperServer::ReportSchedulerService::ResultSendType::SEND_ATTACHMENT
49
+
50
+ # Create a repository destination object
51
+ repo_dest = JasperServer::ReportSchedulerService::JobRepositoryDestination.new
52
+ repo_dest.folderURI = '/ContentFiles/pdf'
53
+ repo_dest.sequentialFilenames = false
54
+ repo_dest.overwriteFiles = true
55
+
56
+ # Create a job object
57
+ job = JasperServer::ReportSchedulerService::Job.new
58
+ job.reportUnitURI = @test_report_no_params['uri']
59
+ job.label = @test_report_no_params['output_label']
60
+ job.baseOutputFilename = @test_report_no_params['output_filename']
61
+ job.outputFormats = ['PDF']
62
+ job.simpleTrigger = trigger
63
+ job.mailNotification = email
64
+ job.repositoryDestination = repo_dest
65
+
66
+ # Create the schedule on the server
67
+ job_res = @scheduler_service.scheduleJob( job )
68
+ assert_not_nil( job_res, 'Failed to create schedule with simple recurrence' )
69
+ @test_jobs << job_res.id if !job_res.nil?
70
+ end
71
+
72
+ # Test creating a scheduled job with a calendar trigger
73
+ def test_schedule_job_calendar_trigger
74
+ # Create a trigger object with calendar recurrence
75
+ trigger = JasperServer::ReportSchedulerService::JobCalendarTrigger.new
76
+ trigger.startDate = SOAP::SOAPDateTime.new("2010-01-01T08:00:00.0000000+02:00")
77
+ trigger.minutes = "0"
78
+ trigger.hours = "8"
79
+ trigger.daysType=JasperServer::ReportSchedulerService::CalendarDaysType::ALL
80
+ trigger.months = [0,1,2,3,4,5,6,7,8,9,10,11]
81
+
82
+ # Create an mail notification object
83
+ email = JasperServer::ReportSchedulerService::JobMailNotification.new
84
+ email.toAddresses = "all4miller@gmail.com"
85
+ email.subject = "Schedule report execution completed successfully"
86
+ email.messageText = "Schedule report execution completed successfully"
87
+ email.resultSendType = JasperServer::ReportSchedulerService::ResultSendType::SEND_ATTACHMENT
88
+
89
+ # Create a repository destination object
90
+ repo_dest = JasperServer::ReportSchedulerService::JobRepositoryDestination.new
91
+ repo_dest.folderURI = '/ContentFiles/pdf'
92
+ repo_dest.sequentialFilenames = false
93
+ repo_dest.overwriteFiles = true
94
+
95
+ # Create a job object
96
+ job = JasperServer::ReportSchedulerService::Job.new
97
+ job.reportUnitURI = @test_report_no_params['uri']
98
+ job.label = @test_report_no_params['output_label']
99
+ job.baseOutputFilename = @test_report_no_params['output_filename']
100
+ job.outputFormats = ['PDF']
101
+ job.calendarTrigger = trigger
102
+ job.mailNotification = email
103
+ job.repositoryDestination = repo_dest
104
+
105
+ # Create the schedule on the server
106
+ job_res = @scheduler_service.scheduleJob( job )
107
+ assert_not_nil( job_res, 'Failed to create schedule with calendar recurrence' )
108
+ @test_jobs << job_res.id if !job_res.nil?
109
+ end
110
+
111
+ # Test creating a scheduled job with a simple trigger and report params
112
+ def test_schedule_job_simple_trigger_report_params
113
+ # Create a trigger object with simple recurrence
114
+ trigger = JasperServer::ReportSchedulerService::JobSimpleTrigger.new
115
+ trigger.startDate = SOAP::SOAPDateTime.new( "2010-01-01T00:00:00.0000000+02:00" )
116
+ trigger.occurrenceCount = 1
117
+ trigger.recurrenceInterval = 1
118
+ trigger.recurrenceIntervalUnit = JasperServer::ReportSchedulerService::IntervalUnit::WEEK
119
+
120
+ # Create an mail notification object
121
+ email = JasperServer::ReportSchedulerService::JobMailNotification.new
122
+ email.toAddresses = "all4miller@gmail.com"
123
+ email.subject = "Schedule report execution completed successfully"
124
+ email.messageText = "Schedule report execution completed successfully"
125
+ email.resultSendType = JasperServer::ReportSchedulerService::ResultSendType::SEND_ATTACHMENT
126
+
127
+ # Create a repository destination object
128
+ repo_dest = JasperServer::ReportSchedulerService::JobRepositoryDestination.new
129
+ repo_dest.folderURI = '/ContentFiles/pdf'
130
+ repo_dest.sequentialFilenames = false
131
+ repo_dest.overwriteFiles = true
132
+
133
+ # Create a param array object
134
+ params = JasperServer::ReportSchedulerService::ArrayOfJobParameter.new
135
+ params << JasperServer::ReportSchedulerService::JobParameter.new( @test_report_with_params['params']['name'], @test_report_with_params['params']['value'] )
136
+
137
+ # Create a job object
138
+ job = JasperServer::ReportSchedulerService::Job.new
139
+ job.reportUnitURI = @test_report_with_params['uri']
140
+ job.label = @test_report_with_params['output_label']
141
+ job.baseOutputFilename = @test_report_with_params['output_filename']
142
+ job.outputFormats = ['PDF']
143
+ job.simpleTrigger = trigger
144
+ job.mailNotification = email
145
+ job.repositoryDestination = repo_dest
146
+ job.parameters = params
147
+
148
+ # Create the schedule on the server
149
+ job_res = @scheduler_service.scheduleJob( job )
150
+ assert_not_nil( job_res, 'Failed to create schedule with simple recurrence and report params' )
151
+ @test_jobs << job_res.id if !job_res.nil?
152
+ end
153
+
154
+
155
+ # Test getting list of scheduled jobs back
156
+ def test_get_all_jobs
157
+ # Create a trigger object with simple recurrence
158
+ trigger = JasperServer::ReportSchedulerService::JobSimpleTrigger.new
159
+ trigger.startDate = SOAP::SOAPDateTime.new( "2010-01-01T00:00:00.0000000+02:00" )
160
+ trigger.occurrenceCount = 1
161
+ trigger.recurrenceInterval = 1
162
+ trigger.recurrenceIntervalUnit = JasperServer::ReportSchedulerService::IntervalUnit::WEEK
163
+
164
+ # Create an mail notification object
165
+ email = JasperServer::ReportSchedulerService::JobMailNotification.new
166
+ email.toAddresses = "all4miller@gmail.com"
167
+ email.subject = "Schedule report execution completed successfully"
168
+ email.messageText = "Schedule report execution completed successfully"
169
+ email.resultSendType = JasperServer::ReportSchedulerService::ResultSendType::SEND_ATTACHMENT
170
+
171
+ # Create a repository destination object
172
+ repo_dest = JasperServer::ReportSchedulerService::JobRepositoryDestination.new
173
+ repo_dest.folderURI = '/ContentFiles/pdf'
174
+ repo_dest.sequentialFilenames = false
175
+ repo_dest.overwriteFiles = true
176
+
177
+ # Create a job object
178
+ job = JasperServer::ReportSchedulerService::Job.new
179
+ job.reportUnitURI = @test_report_no_params['uri']
180
+ job.label = @test_report_no_params['output_label']
181
+ job.baseOutputFilename = @test_report_no_params['output_filename']
182
+ job.outputFormats = ['PDF']
183
+ job.simpleTrigger = trigger
184
+ job.mailNotification = email
185
+ job.repositoryDestination = repo_dest
186
+
187
+ # Create the schedule on the server
188
+ job_res = @scheduler_service.scheduleJob( job )
189
+
190
+ @test_jobs << job_res.id if !job_res.nil?
191
+
192
+ array_of_jobs = @scheduler_service.getAllJobs
193
+ assert_not_nil array_of_jobs, 'Failed to retrieve list of jobs'
194
+ array_of_jobs.each do |job|
195
+ assert_not_nil job, 'Null job returned'
196
+ end
197
+ end
198
+
199
+ # Test getting list of scheduled jobs back for specific report
200
+ def test_get_report_jobs
201
+ # Create a trigger object with simple recurrence
202
+ trigger = JasperServer::ReportSchedulerService::JobSimpleTrigger.new
203
+ trigger.startDate = SOAP::SOAPDateTime.new( "2010-01-01T00:00:00.0000000+02:00" )
204
+ trigger.occurrenceCount = 1
205
+ trigger.recurrenceInterval = 1
206
+ trigger.recurrenceIntervalUnit = JasperServer::ReportSchedulerService::IntervalUnit::WEEK
207
+
208
+ # Create an mail notification object
209
+ email = JasperServer::ReportSchedulerService::JobMailNotification.new
210
+ email.toAddresses = "all4miller@gmail.com"
211
+ email.subject = "Schedule report execution completed successfully"
212
+ email.messageText = "Schedule report execution completed successfully"
213
+ email.resultSendType = JasperServer::ReportSchedulerService::ResultSendType::SEND_ATTACHMENT
214
+
215
+ # Create a repository destination object
216
+ repo_dest = JasperServer::ReportSchedulerService::JobRepositoryDestination.new
217
+ repo_dest.folderURI = '/ContentFiles/pdf'
218
+ repo_dest.sequentialFilenames = false
219
+ repo_dest.overwriteFiles = true
220
+
221
+ # Create a job object
222
+ job = JasperServer::ReportSchedulerService::Job.new
223
+ job.reportUnitURI = @test_report_no_params['uri']
224
+ job.label = @test_report_no_params['output_label']
225
+ job.baseOutputFilename = @test_report_no_params['output_filename']
226
+ job.outputFormats = ['PDF']
227
+ job.simpleTrigger = trigger
228
+ job.mailNotification = email
229
+ job.repositoryDestination = repo_dest
230
+
231
+ # Create the schedule on the server
232
+ job_res = @scheduler_service.scheduleJob( job )
233
+
234
+ @test_jobs << job_res.id if !job_res.nil?
235
+
236
+ array_of_jobs = @scheduler_service.getReportJobs( @test_report_no_params['uri'])
237
+ assert_not_nil array_of_jobs, 'Failed to retrieve report jobs'
238
+ array_of_jobs.each do |job|
239
+ assert_not_nil job, 'Null job returned'
240
+ end
241
+ end
242
+
243
+ # Test getting an existing scheduled job
244
+ def test_get_job
245
+ # Create a trigger object with simple recurrence
246
+ trigger = JasperServer::ReportSchedulerService::JobSimpleTrigger.new
247
+ trigger.startDate = SOAP::SOAPDateTime.new( "2010-01-01T00:00:00.0000000+02:00" )
248
+ trigger.occurrenceCount = 1
249
+ trigger.recurrenceInterval = 1
250
+ trigger.recurrenceIntervalUnit = JasperServer::ReportSchedulerService::IntervalUnit::WEEK
251
+
252
+ # Create an mail notification object
253
+ email = JasperServer::ReportSchedulerService::JobMailNotification.new
254
+ email.toAddresses = "all4miller@gmail.com"
255
+ email.subject = "Schedule report execution completed successfully"
256
+ email.messageText = "Schedule report execution completed successfully"
257
+ email.resultSendType = JasperServer::ReportSchedulerService::ResultSendType::SEND_ATTACHMENT
258
+
259
+ # Create a repository destination object
260
+ repo_dest = JasperServer::ReportSchedulerService::JobRepositoryDestination.new
261
+ repo_dest.folderURI = '/ContentFiles/pdf'
262
+ repo_dest.sequentialFilenames = false
263
+ repo_dest.overwriteFiles = true
264
+
265
+ # Create a job object
266
+ job = JasperServer::ReportSchedulerService::Job.new
267
+ job.reportUnitURI = @test_report_no_params['uri']
268
+ job.label = @test_report_no_params['output_label']
269
+ job.baseOutputFilename = @test_report_no_params['output_filename']
270
+ job.outputFormats = ['PDF']
271
+ job.simpleTrigger = trigger
272
+ job.mailNotification = email
273
+ job.repositoryDestination = repo_dest
274
+
275
+ # Create the schedule on the server
276
+ job_res = @scheduler_service.scheduleJob( job )
277
+
278
+ @test_jobs << job_res.id if !job_res.nil?
279
+
280
+ # Fetch job by id
281
+ job = @scheduler_service.getJob( job_res.id )
282
+
283
+ # Did we get anythign back
284
+ assert_not_nil( job, 'Failed to retrieve existing job' )
285
+ assert_instance_of( JasperServer::ReportSchedulerService::Job, job,
286
+ 'Failed to retrieve existing job' )
287
+ end
288
+
289
+ # Test updating an existing scheduled job
290
+ def test_update_job
291
+ # Create a trigger object with simple recurrence
292
+ trigger = JasperServer::ReportSchedulerService::JobSimpleTrigger.new
293
+ trigger.startDate = SOAP::SOAPDateTime.new( "2010-01-01T00:00:00.0000000+02:00" )
294
+ trigger.occurrenceCount = 1
295
+ trigger.recurrenceInterval = 1
296
+ trigger.recurrenceIntervalUnit = JasperServer::ReportSchedulerService::IntervalUnit::WEEK
297
+
298
+ # Create an mail notification object
299
+ email = JasperServer::ReportSchedulerService::JobMailNotification.new
300
+ email.toAddresses = "all4miller@gmail.com"
301
+ email.subject = "Schedule report execution completed successfully"
302
+ email.messageText = "Schedule report execution completed successfully"
303
+ email.resultSendType = JasperServer::ReportSchedulerService::ResultSendType::SEND_ATTACHMENT
304
+
305
+ # Create a repository destination object
306
+ repo_dest = JasperServer::ReportSchedulerService::JobRepositoryDestination.new
307
+ repo_dest.folderURI = '/ContentFiles/pdf'
308
+ repo_dest.sequentialFilenames = false
309
+ repo_dest.overwriteFiles = true
310
+
311
+ # Create a job object
312
+ job = JasperServer::ReportSchedulerService::Job.new
313
+ job.reportUnitURI = @test_report_no_params['uri']
314
+ job.label = @test_report_no_params['output_label']
315
+ job.baseOutputFilename = @test_report_no_params['output_filename']
316
+ job.outputFormats = ['PDF']
317
+ job.simpleTrigger = trigger
318
+ job.mailNotification = email
319
+ job.repositoryDestination = repo_dest
320
+
321
+ # Create the schedule on the server
322
+ job_res = @scheduler_service.scheduleJob( job )
323
+
324
+ @test_jobs << job_res.id if !job_res.nil?
325
+
326
+ # Update job values
327
+ job_res.label << ' updated params'
328
+ job_res.outputFormats = ['XLS']
329
+ job_res.simpleTrigger.recurrenceIntervalUnit = JasperServer::ReportSchedulerService::IntervalUnit::DAY
330
+ job_res.mailNotification.resultSendType = JasperServer::ReportSchedulerService::ResultSendType::SEND_ATTACHMENT
331
+
332
+ # Persist the updated job
333
+ updated_job = @scheduler_service.updateJob( job_res )
334
+
335
+ assert_not_nil( updated_job, 'Failed to update the existing job' )
336
+ assert_instance_of( JasperServer::ReportSchedulerService::Job, updated_job,
337
+ 'Failed to update the existing job' )
338
+ end
339
+
340
+ # Test deleting a single scheduled job
341
+ def test_delete_job
342
+ # Create a trigger object with simple recurrence
343
+ trigger = JasperServer::ReportSchedulerService::JobSimpleTrigger.new
344
+ trigger.startDate = SOAP::SOAPDateTime.new( "2010-01-01T00:00:00.0000000+02:00" )
345
+ trigger.occurrenceCount = 1
346
+ trigger.recurrenceInterval = 1
347
+ trigger.recurrenceIntervalUnit = JasperServer::ReportSchedulerService::IntervalUnit::WEEK
348
+
349
+ # Create an mail notification object
350
+ email = JasperServer::ReportSchedulerService::JobMailNotification.new
351
+ email.toAddresses = "all4miller@gmail.com"
352
+ email.subject = "Schedule report execution completed successfully"
353
+ email.messageText = "Schedule report execution completed successfully"
354
+ email.resultSendType = JasperServer::ReportSchedulerService::ResultSendType::SEND_ATTACHMENT
355
+
356
+ # Create a repository destination object
357
+ repo_dest = JasperServer::ReportSchedulerService::JobRepositoryDestination.new
358
+ repo_dest.folderURI = '/ContentFiles/pdf'
359
+ repo_dest.sequentialFilenames = false
360
+ repo_dest.overwriteFiles = true
361
+
362
+ # Create a job object
363
+ job = JasperServer::ReportSchedulerService::Job.new
364
+ job.reportUnitURI = @test_report_no_params['uri']
365
+ job.label = @test_report_no_params['output_label']
366
+ job.baseOutputFilename = @test_report_no_params['output_filename']
367
+ job.outputFormats = ['PDF']
368
+ job.simpleTrigger = trigger
369
+ job.mailNotification = email
370
+ job.repositoryDestination = repo_dest
371
+
372
+ # Create the schedule on the server
373
+ job_res = @scheduler_service.scheduleJob( job )
374
+
375
+ # Delete the schedule on the server
376
+ assert_nothing_raised do
377
+ @scheduler_service.deleteJob( job_res.id )
378
+ end
379
+ end
380
+
381
+ # Test deleting multiple jobs scheduled job
382
+ def test_delete_jobs
383
+ jobs = []
384
+ 2.times do
385
+ # Create a trigger object with simple recurrence
386
+ trigger = JasperServer::ReportSchedulerService::JobSimpleTrigger.new
387
+ trigger.startDate = SOAP::SOAPDateTime.new( "2010-01-01T00:00:00.0000000+02:00" )
388
+ trigger.occurrenceCount = 1
389
+ trigger.recurrenceInterval = 1
390
+ trigger.recurrenceIntervalUnit = JasperServer::ReportSchedulerService::IntervalUnit::WEEK
391
+
392
+ # Create an mail notification object
393
+ email = JasperServer::ReportSchedulerService::JobMailNotification.new
394
+ email.toAddresses = "all4miller@gmail.com"
395
+ email.subject = "Schedule report execution completed successfully"
396
+ email.messageText = "Schedule report execution completed successfully"
397
+ email.resultSendType = JasperServer::ReportSchedulerService::ResultSendType::SEND_ATTACHMENT
398
+
399
+ # Create a repository destination object
400
+ repo_dest = JasperServer::ReportSchedulerService::JobRepositoryDestination.new
401
+ repo_dest.folderURI = '/ContentFiles/pdf'
402
+ repo_dest.sequentialFilenames = false
403
+ repo_dest.overwriteFiles = true
404
+
405
+ # Create a job object
406
+ job = JasperServer::ReportSchedulerService::Job.new
407
+ job.reportUnitURI = @test_report_no_params['uri']
408
+ job.label = @test_report_no_params['output_label']
409
+ job.baseOutputFilename = @test_report_no_params['output_filename']
410
+ job.outputFormats = ['PDF']
411
+ job.simpleTrigger = trigger
412
+ job.mailNotification = email
413
+ job.repositoryDestination = repo_dest
414
+
415
+ # Create the schedule on the server
416
+ job_res = @scheduler_service.scheduleJob( job )
417
+ jobs << job_res.id if !job_res.nil?
418
+ end
419
+
420
+ # Delete the schedule on the server
421
+ assert_nothing_raised do
422
+ @scheduler_service.deleteJobs( jobs )
423
+ end
424
+ end
425
+
426
+ end