1 package org.campware.cream.om; 2 3 4 import java.math.BigDecimal ; 5 import java.sql.Connection ; 6 import java.util.ArrayList ; 7 import java.util.Collections ; 8 import java.util.Date ; 9 import java.util.List ; 10 11 import org.apache.commons.lang.ObjectUtils; 12 import org.apache.turbine.om.Retrievable; 13 import org.apache.torque.TorqueException; 14 import org.apache.torque.om.BaseObject; 15 import org.apache.torque.om.ComboKey; 16 import org.apache.torque.om.DateKey; 17 import org.apache.torque.om.NumberKey; 18 import org.apache.torque.om.ObjectKey; 19 import org.apache.torque.om.SimpleKey; 20 import org.apache.torque.om.StringKey; 21 import org.apache.torque.om.Persistent; 22 import org.apache.torque.util.Criteria; 23 import org.apache.torque.util.Transaction; 24 25 26 34 public abstract class BaseTurbineScheduledJob extends BaseObject 35 implements org.apache.turbine.om.Retrievable 36 { 37 38 private static final TurbineScheduledJobPeer peer = 39 new TurbineScheduledJobPeer(); 40 41 42 43 private int jobId; 44 45 46 private int second = -1; 47 48 49 private int minute = -1; 50 51 52 private int hour = -1; 53 54 55 private int weekDay = -1; 56 57 58 private int dayOfMonth = -1; 59 60 61 private String task; 62 63 64 private String email; 65 66 67 private byte[] property; 68 69 70 75 public int getJobId() 76 { 77 return jobId; 78 } 79 80 81 86 public void setJobId(int v) 87 { 88 89 if (this.jobId != v) 90 { 91 this.jobId = v; 92 setModified(true); 93 } 94 95 96 } 97 98 103 public int getSecond() 104 { 105 return second; 106 } 107 108 109 114 public void setSecond(int v) 115 { 116 117 if (this.second != v) 118 { 119 this.second = v; 120 setModified(true); 121 } 122 123 124 } 125 126 131 public int getMinute() 132 { 133 return minute; 134 } 135 136 137 142 public void setMinute(int v) 143 { 144 145 if (this.minute != v) 146 { 147 this.minute = v; 148 setModified(true); 149 } 150 151 152 } 153 154 159 public int getHour() 160 { 161 return hour; 162 } 163 164 165 170 public void setHour(int v) 171 { 172 173 if (this.hour != v) 174 { 175 this.hour = v; 176 setModified(true); 177 } 178 179 180 } 181 182 187 public int getWeekDay() 188 { 189 return weekDay; 190 } 191 192 193 198 public void setWeekDay(int v) 199 { 200 201 if (this.weekDay != v) 202 { 203 this.weekDay = v; 204 setModified(true); 205 } 206 207 208 } 209 210 215 public int getDayOfMonth() 216 { 217 return dayOfMonth; 218 } 219 220 221 226 public void setDayOfMonth(int v) 227 { 228 229 if (this.dayOfMonth != v) 230 { 231 this.dayOfMonth = v; 232 setModified(true); 233 } 234 235 236 } 237 238 243 public String getTask() 244 { 245 return task; 246 } 247 248 249 254 public void setTask(String v) 255 { 256 257 if (!ObjectUtils.equals(this.task, v)) 258 { 259 this.task = v; 260 setModified(true); 261 } 262 263 264 } 265 266 271 public String getEmail() 272 { 273 return email; 274 } 275 276 277 282 public void setEmail(String v) 283 { 284 285 if (!ObjectUtils.equals(this.email, v)) 286 { 287 this.email = v; 288 setModified(true); 289 } 290 291 292 } 293 294 299 public byte[] getProperty() 300 { 301 return property; 302 } 303 304 305 310 public void setProperty(byte[] v) 311 { 312 313 if (!ObjectUtils.equals(this.property, v)) 314 { 315 this.property = v; 316 setModified(true); 317 } 318 319 320 } 321 322 323 324 private static List fieldNames = null; 325 326 331 public static synchronized List getFieldNames() 332 { 333 if (fieldNames == null) 334 { 335 fieldNames = new ArrayList (); 336 fieldNames.add("JobId"); 337 fieldNames.add("Second"); 338 fieldNames.add("Minute"); 339 fieldNames.add("Hour"); 340 fieldNames.add("WeekDay"); 341 fieldNames.add("DayOfMonth"); 342 fieldNames.add("Task"); 343 fieldNames.add("Email"); 344 fieldNames.add("Property"); 345 fieldNames = Collections.unmodifiableList(fieldNames); 346 } 347 return fieldNames; 348 } 349 350 356 public Object getByName(String name) 357 { 358 if (name.equals("JobId")) 359 { 360 return new Integer (getJobId()); 361 } 362 if (name.equals("Second")) 363 { 364 return new Integer (getSecond()); 365 } 366 if (name.equals("Minute")) 367 { 368 return new Integer (getMinute()); 369 } 370 if (name.equals("Hour")) 371 { 372 return new Integer (getHour()); 373 } 374 if (name.equals("WeekDay")) 375 { 376 return new Integer (getWeekDay()); 377 } 378 if (name.equals("DayOfMonth")) 379 { 380 return new Integer (getDayOfMonth()); 381 } 382 if (name.equals("Task")) 383 { 384 return getTask(); 385 } 386 if (name.equals("Email")) 387 { 388 return getEmail(); 389 } 390 if (name.equals("Property")) 391 { 392 return getProperty(); 393 } 394 return null; 395 } 396 397 405 public Object getByPeerName(String name) 406 { 407 if (name.equals(TurbineScheduledJobPeer.JOB_ID)) 408 { 409 return new Integer (getJobId()); 410 } 411 if (name.equals(TurbineScheduledJobPeer.SECOND)) 412 { 413 return new Integer (getSecond()); 414 } 415 if (name.equals(TurbineScheduledJobPeer.MINUTE)) 416 { 417 return new Integer (getMinute()); 418 } 419 if (name.equals(TurbineScheduledJobPeer.HOUR)) 420 { 421 return new Integer (getHour()); 422 } 423 if (name.equals(TurbineScheduledJobPeer.WEEK_DAY)) 424 { 425 return new Integer (getWeekDay()); 426 } 427 if (name.equals(TurbineScheduledJobPeer.DAY_OF_MONTH)) 428 { 429 return new Integer (getDayOfMonth()); 430 } 431 if (name.equals(TurbineScheduledJobPeer.TASK)) 432 { 433 return getTask(); 434 } 435 if (name.equals(TurbineScheduledJobPeer.EMAIL)) 436 { 437 return getEmail(); 438 } 439 if (name.equals(TurbineScheduledJobPeer.PROPERTY)) 440 { 441 return getProperty(); 442 } 443 return null; 444 } 445 446 453 public Object getByPosition(int pos) 454 { 455 if (pos == 0) 456 { 457 return new Integer (getJobId()); 458 } 459 if (pos == 1) 460 { 461 return new Integer (getSecond()); 462 } 463 if (pos == 2) 464 { 465 return new Integer (getMinute()); 466 } 467 if (pos == 3) 468 { 469 return new Integer (getHour()); 470 } 471 if (pos == 4) 472 { 473 return new Integer (getWeekDay()); 474 } 475 if (pos == 5) 476 { 477 return new Integer (getDayOfMonth()); 478 } 479 if (pos == 6) 480 { 481 return getTask(); 482 } 483 if (pos == 7) 484 { 485 return getEmail(); 486 } 487 if (pos == 8) 488 { 489 return getProperty(); 490 } 491 return null; 492 } 493 494 500 public void save() throws Exception  501 { 502 save(TurbineScheduledJobPeer.getMapBuilder() 503 .getDatabaseMap().getName()); 504 } 505 506 516 public void save(String dbName) throws TorqueException 517 { 518 Connection con = null; 519 try 520 { 521 con = Transaction.begin(dbName); 522 save(con); 523 Transaction.commit(con); 524 } 525 catch(TorqueException e) 526 { 527 Transaction.safeRollback(con); 528 throw e; 529 } 530 } 531 532 534 private boolean alreadyInSave = false; 535 545 public void save(Connection con) throws TorqueException 546 { 547 if (!alreadyInSave) 548 { 549 alreadyInSave = true; 550 551 552 553 if (isModified()) 555 { 556 if (isNew()) 557 { 558 TurbineScheduledJobPeer.doInsert((TurbineScheduledJob) this, con); 559 setNew(false); 560 } 561 else 562 { 563 TurbineScheduledJobPeer.doUpdate((TurbineScheduledJob) this, con); 564 } 565 } 566 567 alreadyInSave = false; 568 } 569 } 570 571 572 577 public void setPrimaryKey(ObjectKey key) 578 579 { 580 setJobId(((NumberKey) key).intValue()); 581 } 582 583 588 public void setPrimaryKey(String key) 589 { 590 setJobId(Integer.parseInt(key)); 591 } 592 593 594 598 public ObjectKey getPrimaryKey() 599 { 600 return SimpleKey.keyFor(getJobId()); 601 } 602 603 607 public String getQueryKey() 608 { 609 if (getPrimaryKey() == null) 610 { 611 return ""; 612 } 613 else 614 { 615 return getPrimaryKey().toString(); 616 } 617 } 618 619 623 public void setQueryKey(String key) 624 throws TorqueException 625 { 626 setPrimaryKey(key); 627 } 628 629 635 public TurbineScheduledJob copy() throws TorqueException 636 { 637 return copyInto(new TurbineScheduledJob()); 638 } 639 640 protected TurbineScheduledJob copyInto(TurbineScheduledJob copyObj) throws TorqueException 641 { 642 copyObj.setJobId(jobId); 643 copyObj.setSecond(second); 644 copyObj.setMinute(minute); 645 copyObj.setHour(hour); 646 copyObj.setWeekDay(weekDay); 647 copyObj.setDayOfMonth(dayOfMonth); 648 copyObj.setTask(task); 649 copyObj.setEmail(email); 650 copyObj.setProperty(property); 651 652 copyObj.setJobId( 0); 653 654 return copyObj; 655 } 656 657 663 public TurbineScheduledJobPeer getPeer() 664 { 665 return peer; 666 } 667 668 public String toString() 669 { 670 StringBuffer str = new StringBuffer (); 671 str.append("TurbineScheduledJob:\n"); 672 str.append("JobId = ") 673 .append(getJobId()) 674 .append("\n"); 675 str.append("Second = ") 676 .append(getSecond()) 677 .append("\n"); 678 str.append("Minute = ") 679 .append(getMinute()) 680 .append("\n"); 681 str.append("Hour = ") 682 .append(getHour()) 683 .append("\n"); 684 str.append("WeekDay = ") 685 .append(getWeekDay()) 686 .append("\n"); 687 str.append("DayOfMonth = ") 688 .append(getDayOfMonth()) 689 .append("\n"); 690 str.append("Task = ") 691 .append(getTask()) 692 .append("\n"); 693 str.append("Email = ") 694 .append(getEmail()) 695 .append("\n"); 696 str.append("Property = ") 697 .append("<binary>") 698 .append("\n"); 699 return(str.toString()); 700 } 701 } 702
| Popular Tags
|