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