1 package org.apache.turbine.services.schedule;
2
3 import java.io.Serializable;
4 import java.sql.Connection;
5 import java.text.SimpleDateFormat;
6 import java.util.ArrayList;
7 import java.util.Collections;
8 import java.util.Date;
9 import java.util.GregorianCalendar;
10 import java.util.List;
11
12 import org.apache.torque.TorqueException;
13 import org.apache.torque.map.TableMap;
14 import org.apache.torque.om.ComboKey;
15 import org.apache.torque.om.DateKey;
16 import org.apache.torque.om.NumberKey;
17 import org.apache.torque.om.ObjectKey;
18 import org.apache.torque.om.SimpleKey;
19 import org.apache.torque.om.StringKey;
20 import org.apache.torque.om.BooleanKey;
21 import org.apache.torque.om.Persistent;
22 import org.apache.torque.criteria.Criteria;
23 import org.apache.torque.util.Transaction;
24 import org.apache.commons.lang.ObjectUtils;
25
26
27
28
29
30
31
32
33
34
35 public abstract class BaseJobEntryTorque extends org.apache.turbine.services.schedule.AbstractJobEntry
36 implements Persistent, Serializable
37 {
38
39 private static final long serialVersionUID = 1520250004930L;
40
41
42
43
44 private int jobId = 0;
45
46
47 private int second = -1;
48
49
50 private int minute = -1;
51
52
53 private int hour = -1;
54
55
56 private int weekDay = -1;
57
58
59 private int dayOfMonth = -1;
60
61
62 private String task = null;
63
64
65 private String email = null;
66
67
68 private byte[] property = null;
69
70
71 private boolean modified = true;
72
73
74
75
76
77 private boolean isNew = true;
78
79
80 private boolean saving = false;
81
82
83
84
85
86 private boolean loading = false;
87
88
89
90
91
92
93 private boolean deleted = false;
94
95
96
97
98
99
100
101
102
103
104 public int getJobId()
105 {
106
107 return jobId;
108 }
109
110
111
112
113
114
115 public void setJobId(int v)
116 {
117 if (this.jobId != v)
118 {
119 setModified(true);
120 }
121
122 this.jobId = v;
123
124
125 }
126
127
128
129
130
131
132 public int getSecond()
133 {
134
135 return second;
136 }
137
138
139
140
141
142
143 public void setSecond(int v)
144 {
145 if (this.second != v)
146 {
147 setModified(true);
148 }
149
150 this.second = v;
151
152
153 }
154
155
156
157
158
159
160 public int getMinute()
161 {
162
163 return minute;
164 }
165
166
167
168
169
170
171 public void setMinute(int v)
172 {
173 if (this.minute != v)
174 {
175 setModified(true);
176 }
177
178 this.minute = v;
179
180
181 }
182
183
184
185
186
187
188 public int getHour()
189 {
190
191 return hour;
192 }
193
194
195
196
197
198
199 public void setHour(int v)
200 {
201 if (this.hour != v)
202 {
203 setModified(true);
204 }
205
206 this.hour = v;
207
208
209 }
210
211
212
213
214
215
216 public int getWeekDay()
217 {
218
219 return weekDay;
220 }
221
222
223
224
225
226
227 public void setWeekDay(int v)
228 {
229 if (this.weekDay != v)
230 {
231 setModified(true);
232 }
233
234 this.weekDay = v;
235
236
237 }
238
239
240
241
242
243
244 public int getDayOfMonth()
245 {
246
247 return dayOfMonth;
248 }
249
250
251
252
253
254
255 public void setDayOfMonth(int v)
256 {
257 if (this.dayOfMonth != v)
258 {
259 setModified(true);
260 }
261
262 this.dayOfMonth = v;
263
264
265 }
266
267
268
269
270
271
272 public String getTask()
273 {
274
275 return task;
276 }
277
278
279
280
281
282
283 public void setTask(String v)
284 {
285 if (!ObjectUtils.equals(this.task, v))
286 {
287 setModified(true);
288 }
289
290 this.task = v;
291
292
293 }
294
295
296
297
298
299
300 public String getEmail()
301 {
302
303 return email;
304 }
305
306
307
308
309
310
311 public void setEmail(String v)
312 {
313 if (!ObjectUtils.equals(this.email, v))
314 {
315 setModified(true);
316 }
317
318 this.email = v;
319
320
321 }
322
323
324
325
326
327
328 public byte[] getProperty()
329 {
330
331 return property;
332 }
333
334
335
336
337
338
339 public void setProperty(byte[] v)
340 {
341 if (!ObjectUtils.equals(this.property, v))
342 {
343 setModified(true);
344 }
345
346 this.property = v;
347
348
349 }
350
351
352
353
354
355
356
357
358
359 public boolean isNew()
360 {
361 return isNew;
362 }
363
364
365
366
367
368
369 public void setNew(boolean isNew)
370 {
371 this.isNew = isNew;
372 }
373
374
375
376
377
378
379 public boolean isModified()
380 {
381 return modified;
382 }
383
384
385
386
387
388
389 public void setModified(boolean modified)
390 {
391 this.modified = modified;
392 }
393
394
395
396
397 public void resetModified()
398 {
399 modified = false;
400 }
401
402
403
404
405
406
407
408 public boolean isSaving()
409 {
410 return saving;
411 }
412
413
414
415
416
417
418 public void setSaving(boolean saving)
419 {
420 this.saving = saving;
421 }
422
423
424
425
426
427
428
429 public boolean isLoading()
430 {
431 return loading;
432 }
433
434
435
436
437
438
439 public void setLoading(boolean loading)
440 {
441 this.loading = loading;
442 }
443
444
445
446
447
448
449
450
451
452
453
454
455
456 public boolean isDeleted()
457 {
458 return deleted;
459 }
460
461
462
463
464
465
466 public void setDeleted(boolean deleted)
467 {
468 this.deleted = deleted;
469 }
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486 public void save() throws TorqueException
487 {
488 save(JobEntryTorquePeer.DATABASE_NAME);
489 }
490
491
492
493
494
495
496
497
498
499
500
501 public void save(String dbName)
502 throws TorqueException
503 {
504 Connection con = null;
505 try
506 {
507 con = Transaction.begin(dbName);
508 save(con);
509 Transaction.commit(con);
510 }
511 catch(TorqueException e)
512 {
513 Transaction.safeRollback(con);
514 throw e;
515 }
516 }
517
518
519
520
521
522
523
524
525
526
527
528
529
530 public void save(Connection con)
531 throws TorqueException
532 {
533 if (isSaving())
534 {
535 return;
536 }
537 try
538 {
539 setSaving(true);
540
541 if (isModified())
542 {
543 if (isNew())
544 {
545 JobEntryTorquePeer.doInsert((JobEntryTorque) this, con);
546 setNew(false);
547 }
548 else
549 {
550 JobEntryTorquePeer.doUpdate((JobEntryTorque) this, con);
551 }
552 }
553
554 }
555 finally
556 {
557 setSaving(false);
558 }
559 }
560
561
562
563
564
565
566
567
568
569 public void setPrimaryKey(ObjectKey key)
570
571 {
572 setJobId(((NumberKey) key).intValue());
573 }
574
575
576
577
578
579
580 public void setPrimaryKey(String key)
581 {
582 setJobId(Integer.parseInt(key));
583 }
584
585
586
587
588
589
590 public ObjectKey getPrimaryKey()
591 {
592 return SimpleKey.keyFor(getJobId());
593 }
594
595
596
597
598
599
600
601
602
603 public JobEntryTorque copy() throws TorqueException
604 {
605 return copy(true);
606 }
607
608
609
610
611
612
613
614
615
616 public JobEntryTorque copy(Connection con) throws TorqueException
617 {
618 return copy(true, con);
619 }
620
621
622
623
624
625
626
627
628
629
630 public JobEntryTorque copy(boolean deepcopy) throws TorqueException
631 {
632 JobEntryTorque jobEntryTorque = new JobEntryTorque();
633
634 return copyInto(jobEntryTorque, deepcopy);
635 }
636
637
638
639
640
641
642
643
644
645
646
647 public JobEntryTorque copy(boolean deepcopy, Connection con) throws TorqueException
648 {
649 JobEntryTorque jobEntryTorque = new JobEntryTorque();
650
651 return copyInto(jobEntryTorque, deepcopy, con);
652 }
653
654
655
656
657
658
659
660 public JobEntryTorque copyInto(JobEntryTorque copyObj) throws TorqueException
661 {
662 return copyInto(copyObj, true);
663 }
664
665
666
667
668
669
670
671
672 public JobEntryTorque copyInto(JobEntryTorque copyObj, Connection con) throws TorqueException
673 {
674 return copyInto(copyObj, true, con);
675 }
676
677
678
679
680
681
682
683
684
685 protected JobEntryTorque copyInto(JobEntryTorque copyObj, boolean deepcopy) throws TorqueException
686 {
687 copyObj.setJobId(0);
688 copyObj.setSecond(second);
689 copyObj.setMinute(minute);
690 copyObj.setHour(hour);
691 copyObj.setWeekDay(weekDay);
692 copyObj.setDayOfMonth(dayOfMonth);
693 copyObj.setTask(task);
694 copyObj.setEmail(email);
695 copyObj.setProperty(property);
696
697 if (deepcopy)
698 {
699 }
700 return copyObj;
701 }
702
703
704
705
706
707
708
709
710
711
712
713 public JobEntryTorque copyInto(JobEntryTorque copyObj, boolean deepcopy, Connection con) throws TorqueException
714 {
715 copyObj.setJobId(0);
716 copyObj.setSecond(second);
717 copyObj.setMinute(minute);
718 copyObj.setHour(hour);
719 copyObj.setWeekDay(weekDay);
720 copyObj.setDayOfMonth(dayOfMonth);
721 copyObj.setTask(task);
722 copyObj.setEmail(email);
723 copyObj.setProperty(property);
724
725 if (deepcopy)
726 {
727 }
728 return copyObj;
729 }
730
731
732 private static final org.apache.turbine.services.schedule.JobEntryTorquePeer peer
733 = new org.apache.turbine.services.schedule.JobEntryTorquePeer();
734
735
736
737
738
739
740
741 public org.apache.turbine.services.schedule.JobEntryTorquePeer getPeer()
742 {
743 return peer;
744 }
745
746
747
748
749
750
751
752 public TableMap getTableMap() throws TorqueException
753 {
754 return org.apache.turbine.services.schedule.JobEntryTorquePeer.getTableMap();
755 }
756
757
758
759 public String toString()
760 {
761 StringBuffer str = new StringBuffer();
762 str.append("JobEntryTorque:\n");
763 str.append("jobId = ")
764 .append(getJobId())
765 .append("\n");
766 str.append("second = ")
767 .append(getSecond())
768 .append("\n");
769 str.append("minute = ")
770 .append(getMinute())
771 .append("\n");
772 str.append("hour = ")
773 .append(getHour())
774 .append("\n");
775 str.append("weekDay = ")
776 .append(getWeekDay())
777 .append("\n");
778 str.append("dayOfMonth = ")
779 .append(getDayOfMonth())
780 .append("\n");
781 str.append("task = ")
782 .append(getTask())
783 .append("\n");
784 str.append("email = ")
785 .append(getEmail())
786 .append("\n");
787 str.append("property = ")
788 .append("<binary>")
789 .append("\n");
790 return(str.toString());
791 }
792
793
794
795
796
797
798
799
800 public boolean equals(Object toCompare)
801 {
802 if (toCompare == null)
803 {
804 return false;
805 }
806 if (this == toCompare)
807 {
808 return true;
809 }
810 if (!getClass().equals(toCompare.getClass()))
811 {
812 return false;
813 }
814 JobEntryTorque other = (JobEntryTorque) toCompare;
815 if (getPrimaryKey() == null || other.getPrimaryKey() == null)
816 {
817 return false;
818 }
819 return getPrimaryKey().equals(other.getPrimaryKey());
820 }
821
822
823
824
825
826
827
828 public int hashCode()
829 {
830 ObjectKey ok = getPrimaryKey();
831 if (ok == null)
832 {
833 return super.hashCode();
834 }
835
836 return ok.hashCode();
837 }
838
839
840
841
842
843
844
845
846
847
848 public boolean valueEquals(JobEntryTorque toCompare)
849 {
850 if (toCompare == null)
851 {
852 return false;
853 }
854 if (this == toCompare)
855 {
856 return true;
857 }
858 if (this.jobId != toCompare.getJobId())
859 {
860 return false;
861 }
862 if (this.second != toCompare.getSecond())
863 {
864 return false;
865 }
866 if (this.minute != toCompare.getMinute())
867 {
868 return false;
869 }
870 if (this.hour != toCompare.getHour())
871 {
872 return false;
873 }
874 if (this.weekDay != toCompare.getWeekDay())
875 {
876 return false;
877 }
878 if (this.dayOfMonth != toCompare.getDayOfMonth())
879 {
880 return false;
881 }
882 if (!ObjectUtils.equals(this.task, toCompare.getTask()))
883 {
884 return false;
885 }
886 if (!ObjectUtils.equals(this.email, toCompare.getEmail()))
887 {
888 return false;
889 }
890 if (!ObjectUtils.equals(this.property, toCompare.getProperty()))
891 {
892 return false;
893 }
894 return true;
895 }
896
897
898
899 }