1
22
23 package com.liferay.portal.kernel.scheduler.messaging;
24
25 import com.liferay.portal.kernel.scheduler.TriggerType;
26
27 import java.io.Serializable;
28
29 import java.util.Date;
30
31
45 public class SchedulerRequest implements Serializable {
46
47 public static final String COMMAND_REGISTER = "REGISTER";
48
49 public static final String COMMAND_RETRIEVE = "RETRIEVE";
50
51 public static final String COMMAND_SHUTDOWN = "SHUTDOWN";
52
53 public static final String COMMAND_STARTUP = "STARTUP";
54
55 public static final String COMMAND_UNREGISTER = "UNREGISTER";
56
57 public static SchedulerRequest createRegisterRequest(
58 String groupName, long interval, Date startDate, Date endDate,
59 String description, String destination, String messageBody) {
60
61 return new SchedulerRequest(
62 COMMAND_REGISTER, null, groupName, interval, startDate, endDate,
63 description, destination, messageBody);
64 }
65
66 public static SchedulerRequest createRegisterRequest(
67 String groupName, String cronText, Date startDate, Date endDate,
68 String description, String destination, String messageBody) {
69
70 return new SchedulerRequest(
71 COMMAND_REGISTER, null, groupName, cronText, startDate, endDate,
72 description, destination, messageBody);
73 }
74
75 public static SchedulerRequest createRegisterRequest(
76 String jobName, String groupName, long interval, Date startDate,
77 Date endDate, String description, String destination,
78 String messageBody) {
79
80 return new SchedulerRequest(
81 COMMAND_REGISTER, jobName, groupName, interval, startDate, endDate,
82 description, destination, messageBody);
83 }
84
85 public static SchedulerRequest createRegisterRequest(
86 String jobName, String groupName, String cronText, Date startDate,
87 Date endDate, String description, String destination,
88 String messageBody) {
89
90 return new SchedulerRequest(
91 COMMAND_REGISTER, jobName, groupName, cronText, startDate, endDate,
92 description, destination, messageBody);
93 }
94
95 public static SchedulerRequest createRetrieveRequest(String groupName) {
96 return new SchedulerRequest(COMMAND_RETRIEVE, null, groupName);
97 }
98
99 public static SchedulerRequest createRetrieveResponseRequest(
100 String jobName, String groupName, long interval, Date startDate,
101 Date endDate, String description, String messageBody) {
102
103 return new SchedulerRequest(
104 null, jobName, groupName, interval, startDate, endDate, description,
105 null, messageBody);
106 }
107
108 public static SchedulerRequest createRetrieveResponseRequest(
109 String jobName, String groupName, String cronText, Date startDate,
110 Date endDate, String description, String messageBody) {
111
112 return new SchedulerRequest(
113 null, jobName, groupName, cronText, startDate, endDate, description,
114 null, messageBody);
115 }
116
117 public static SchedulerRequest createShutdownRequest() {
118 return new SchedulerRequest(COMMAND_SHUTDOWN);
119 }
120
121 public static SchedulerRequest createStartupRequest() {
122 return new SchedulerRequest(COMMAND_STARTUP);
123 }
124
125 public static SchedulerRequest createUnregisterRequest(
126 String jobName, String groupName) {
127
128 return new SchedulerRequest(COMMAND_UNREGISTER, jobName, groupName);
129 }
130
131
134 public SchedulerRequest() {
135 }
136
137
140 public SchedulerRequest(String command) {
141 _command = command;
142 }
143
144
147 public SchedulerRequest(
148 String command, String jobName, String groupName) {
149
150 _command = command;
151 _jobName = jobName;
152 _groupName = groupName;
153 }
154
155
158 public SchedulerRequest(
159 String command, String jobName, String groupName, long interval,
160 Date startDate, Date endDate, String description, String destination,
161 String messageBody) {
162
163 _command = command;
164 _jobName = jobName;
165 _groupName = groupName;
166 _triggerType = TriggerType.SIMPLE;
167 _interval = interval;
168 _startDate = startDate;
169 _endDate = endDate;
170 _description = description;
171 _destination = destination;
172 _messageBody = messageBody;
173 }
174
175
178 public SchedulerRequest(
179 String command, String jobName, String groupName, String cronText,
180 Date startDate, Date endDate, String description, String destination,
181 String messageBody) {
182
183 _command = command;
184 _jobName = jobName;
185 _groupName = groupName;
186 _triggerType = TriggerType.CRON;
187 _cronText = cronText;
188 _startDate = startDate;
189 _endDate = endDate;
190 _description = description;
191 _destination = destination;
192 _messageBody = messageBody;
193 }
194
195 public String getCommand() {
196 return _command;
197 }
198
199 public String getCronText() {
200 return _cronText;
201 }
202
203 public String getDescription() {
204 return _description;
205 }
206
207 public String getDestination() {
208 return _destination;
209 }
210
211 public Date getEndDate() {
212 return _endDate;
213 }
214
215 public String getGroupName() {
216 return _groupName;
217 }
218
219 public long getInterval() {
220 return _interval;
221 }
222
223 public String getJobName() {
224 return _jobName;
225 }
226
227 public String getMessageBody() {
228 return _messageBody;
229 }
230
231 public Date getStartDate() {
232 return _startDate;
233 }
234
235 public TriggerType getTriggerType() {
236 return _triggerType;
237 }
238
239 public void setCommand(String command) {
240 _command = command;
241 }
242
243 public void setCronText(String cronText) {
244 _cronText = cronText;
245 }
246
247 public void setDescription(String description) {
248 _description = description;
249 }
250
251 public void setDestination(String destination) {
252 _destination = destination;
253 }
254
255 public void setEndDate(Date endDate) {
256 _endDate = endDate;
257 }
258
259 public void setGroupName(String groupName) {
260 _groupName = groupName;
261 }
262
263 public void setInterval(long interval) {
264 this._interval = interval;
265 }
266
267 public void setJobName(String jobName) {
268 _jobName = jobName;
269 }
270
271 public void setMessageBody(String messageBody) {
272 _messageBody = messageBody;
273 }
274
275 public void setStartDate(Date startDate) {
276 _startDate = startDate;
277 }
278
279 public void setTriggerType(TriggerType triggerType) {
280 _triggerType = triggerType;
281 }
282
283 private String _command;
284 private String _cronText;
285 private String _description;
286 private String _destination;
287 private Date _endDate;
288 private String _groupName;
289 private long _interval;
290 private String _jobName;
291 private String _messageBody;
292 private Date _startDate;
293 private TriggerType _triggerType;
294
295 }