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 createRetrieveRequest(String groupName) {
76 return new SchedulerRequest(COMMAND_RETRIEVE, null, groupName);
77 }
78
79 public static SchedulerRequest createRetrieveResponseRequest(
80 String jobName, String groupName, long interval, Date startDate,
81 Date endDate, String description, String messageBody) {
82
83 return new SchedulerRequest(
84 null, jobName, groupName, interval, startDate, endDate, description,
85 null, messageBody);
86 }
87
88 public static SchedulerRequest createRetrieveResponseRequest(
89 String jobName, String groupName, String cronText,
90 Date startDate, Date endDate, String description, String messageBody) {
91
92 return new SchedulerRequest(
93 null, jobName, groupName, cronText, startDate, endDate, description,
94 null, messageBody);
95 }
96
97 public static SchedulerRequest createShutdownRequest() {
98 return new SchedulerRequest(COMMAND_SHUTDOWN);
99 }
100
101 public static SchedulerRequest createStartupRequest() {
102 return new SchedulerRequest(COMMAND_STARTUP);
103 }
104
105 public static SchedulerRequest createUnregisterRequest(String groupName) {
106 return new SchedulerRequest(COMMAND_UNREGISTER, groupName, groupName);
107 }
108
109
112 public SchedulerRequest() {
113 }
114
115
118 public SchedulerRequest(String command) {
119 _command = command;
120 }
121
122
125 public SchedulerRequest(
126 String command, String jobName, String groupName) {
127
128 _command = command;
129 _jobName = jobName;
130 _groupName = groupName;
131 }
132
133
136 public SchedulerRequest(
137 String command, String jobName, String groupName, long interval,
138 Date startDate, Date endDate, String description, String destination,
139 String messageBody) {
140
141 _command = command;
142 _jobName = jobName;
143 _groupName = groupName;
144 _triggerType = TriggerType.SIMPLE;
145 _interval = interval;
146 _startDate = startDate;
147 _endDate = endDate;
148 _description = description;
149 _destination = destination;
150 _messageBody = messageBody;
151 }
152
153
156 public SchedulerRequest(
157 String command, String jobName, String groupName, String cronText,
158 Date startDate, Date endDate, String description, String destination,
159 String messageBody) {
160
161 _command = command;
162 _jobName = jobName;
163 _groupName = groupName;
164 _triggerType = TriggerType.CRON;
165 _cronText = cronText;
166 _startDate = startDate;
167 _endDate = endDate;
168 _description = description;
169 _destination = destination;
170 _messageBody = messageBody;
171 }
172
173 public String getCommand() {
174 return _command;
175 }
176
177 public String getCronText() {
178 return _cronText;
179 }
180
181 public String getDescription() {
182 return _description;
183 }
184
185 public String getDestination() {
186 return _destination;
187 }
188
189 public Date getEndDate() {
190 return _endDate;
191 }
192
193 public String getGroupName() {
194 return _groupName;
195 }
196
197 public long getInterval() {
198 return _interval;
199 }
200
201 public String getJobName() {
202 return _jobName;
203 }
204
205 public String getMessageBody() {
206 return _messageBody;
207 }
208
209 public Date getStartDate() {
210 return _startDate;
211 }
212
213 public TriggerType getTriggerType() {
214 return _triggerType;
215 }
216
217 public void setCommand(String command) {
218 _command = command;
219 }
220
221 public void setCronText(String cronText) {
222 _cronText = cronText;
223 }
224
225 public void setDescription(String description) {
226 _description = description;
227 }
228
229 public void setDestination(String destination) {
230 _destination = destination;
231 }
232
233 public void setEndDate(Date endDate) {
234 _endDate = endDate;
235 }
236
237 public void setGroupName(String groupName) {
238 _groupName = groupName;
239 }
240
241 public void setInterval(long interval) {
242 this._interval = interval;
243 }
244
245 public void setJobName(String jobName) {
246 _jobName = jobName;
247 }
248
249 public void setMessageBody(String messageBody) {
250 _messageBody = messageBody;
251 }
252
253 public void setStartDate(Date startDate) {
254 _startDate = startDate;
255 }
256
257 public void setTriggerType(TriggerType triggerType) {
258 _triggerType = triggerType;
259 }
260
261 private String _command;
262 private String _cronText;
263 private String _description;
264 private String _destination;
265 private Date _endDate;
266 private String _groupName;
267 private long _interval;
268 private String _jobName;
269 private String _messageBody;
270 private Date _startDate;
271 private TriggerType _triggerType;
272
273 }