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 27 28 29 37 public abstract class BaseInboxEvent extends BaseObject 38 implements org.apache.turbine.om.Retrievable 39 { 40 41 private static final InboxEventPeer peer = 42 new InboxEventPeer(); 43 44 45 46 private int inboxEventId; 47 48 49 private String inboxEventCode = "AUTO"; 50 51 52 private int status = 30; 53 54 55 private int priority = 30; 56 57 58 private Date issuedDate; 59 60 61 private Date closedDate; 62 63 64 private int eventChannel = 20; 65 66 67 private int eventType = 30; 68 69 70 private int emailFormat = 10; 71 72 73 private int customerId = 1000; 74 75 76 private int projectId = 1000; 77 78 79 private int productId = 1000; 80 81 82 private String senderName; 83 84 85 private String senderEmail; 86 87 88 private String senderReplyTo; 89 90 91 private Date sentTime; 92 93 94 private String senderTo; 95 96 97 private String senderCc; 98 99 100 private String subject; 101 102 103 private String body; 104 105 106 private String notes; 107 108 109 private Date created; 110 111 112 private Date modified; 113 114 115 private String createdBy; 116 117 118 private String modifiedBy; 119 120 121 126 public int getInboxEventId() 127 { 128 return inboxEventId; 129 } 130 131 132 137 public void setInboxEventId(int v) throws TorqueException 138 { 139 140 if (this.inboxEventId != v) 141 { 142 this.inboxEventId = v; 143 setModified(true); 144 } 145 146 147 148 if (collInboxAttachments != null) 150 { 151 for (int i = 0; i < collInboxAttachments.size(); i++) 152 { 153 ((InboxAttachment) collInboxAttachments.get(i)) 154 .setInboxEventId(v); 155 } 156 } 157 } 158 159 164 public String getInboxEventCode() 165 { 166 return inboxEventCode; 167 } 168 169 170 175 public void setInboxEventCode(String v) 176 { 177 178 if (!ObjectUtils.equals(this.inboxEventCode, v)) 179 { 180 this.inboxEventCode = v; 181 setModified(true); 182 } 183 184 185 } 186 187 192 public int getStatus() 193 { 194 return status; 195 } 196 197 198 203 public void setStatus(int v) 204 { 205 206 if (this.status != v) 207 { 208 this.status = v; 209 setModified(true); 210 } 211 212 213 } 214 215 220 public int getPriority() 221 { 222 return priority; 223 } 224 225 226 231 public void setPriority(int v) 232 { 233 234 if (this.priority != v) 235 { 236 this.priority = v; 237 setModified(true); 238 } 239 240 241 } 242 243 248 public Date getIssuedDate() 249 { 250 return issuedDate; 251 } 252 253 254 259 public void setIssuedDate(Date v) 260 { 261 262 if (!ObjectUtils.equals(this.issuedDate, v)) 263 { 264 this.issuedDate = v; 265 setModified(true); 266 } 267 268 269 } 270 271 276 public Date getClosedDate() 277 { 278 return closedDate; 279 } 280 281 282 287 public void setClosedDate(Date v) 288 { 289 290 if (!ObjectUtils.equals(this.closedDate, v)) 291 { 292 this.closedDate = v; 293 setModified(true); 294 } 295 296 297 } 298 299 304 public int getEventChannel() 305 { 306 return eventChannel; 307 } 308 309 310 315 public void setEventChannel(int v) 316 { 317 318 if (this.eventChannel != v) 319 { 320 this.eventChannel = v; 321 setModified(true); 322 } 323 324 325 } 326 327 332 public int getEventType() 333 { 334 return eventType; 335 } 336 337 338 343 public void setEventType(int v) 344 { 345 346 if (this.eventType != v) 347 { 348 this.eventType = v; 349 setModified(true); 350 } 351 352 353 } 354 355 360 public int getEmailFormat() 361 { 362 return emailFormat; 363 } 364 365 366 371 public void setEmailFormat(int v) 372 { 373 374 if (this.emailFormat != v) 375 { 376 this.emailFormat = v; 377 setModified(true); 378 } 379 380 381 } 382 383 388 public int getCustomerId() 389 { 390 return customerId; 391 } 392 393 394 399 public void setCustomerId(int v) throws TorqueException 400 { 401 402 if (this.customerId != v) 403 { 404 this.customerId = v; 405 setModified(true); 406 } 407 408 409 if (aCustomer != null && !(aCustomer.getCustomerId() == v)) 410 { 411 aCustomer = null; 412 } 413 414 } 415 416 421 public int getProjectId() 422 { 423 return projectId; 424 } 425 426 427 432 public void setProjectId(int v) throws TorqueException 433 { 434 435 if (this.projectId != v) 436 { 437 this.projectId = v; 438 setModified(true); 439 } 440 441 442 if (aProject != null && !(aProject.getProjectId() == v)) 443 { 444 aProject = null; 445 } 446 447 } 448 449 454 public int getProductId() 455 { 456 return productId; 457 } 458 459 460 465 public void setProductId(int v) throws TorqueException 466 { 467 468 if (this.productId != v) 469 { 470 this.productId = v; 471 setModified(true); 472 } 473 474 475 if (aProduct != null && !(aProduct.getProductId() == v)) 476 { 477 aProduct = null; 478 } 479 480 } 481 482 487 public String getSenderName() 488 { 489 return senderName; 490 } 491 492 493 498 public void setSenderName(String v) 499 { 500 501 if (!ObjectUtils.equals(this.senderName, v)) 502 { 503 this.senderName = v; 504 setModified(true); 505 } 506 507 508 } 509 510 515 public String getSenderEmail() 516 { 517 return senderEmail; 518 } 519 520 521 526 public void setSenderEmail(String v) 527 { 528 529 if (!ObjectUtils.equals(this.senderEmail, v)) 530 { 531 this.senderEmail = v; 532 setModified(true); 533 } 534 535 536 } 537 538 543 public String getSenderReplyTo() 544 { 545 return senderReplyTo; 546 } 547 548 549 554 public void setSenderReplyTo(String v) 555 { 556 557 if (!ObjectUtils.equals(this.senderReplyTo, v)) 558 { 559 this.senderReplyTo = v; 560 setModified(true); 561 } 562 563 564 } 565 566 571 public Date getSentTime() 572 { 573 return sentTime; 574 } 575 576 577 582 public void setSentTime(Date v) 583 { 584 585 if (!ObjectUtils.equals(this.sentTime, v)) 586 { 587 this.sentTime = v; 588 setModified(true); 589 } 590 591 592 } 593 594 599 public String getSenderTo() 600 { 601 return senderTo; 602 } 603 604 605 610 public void setSenderTo(String v) 611 { 612 613 if (!ObjectUtils.equals(this.senderTo, v)) 614 { 615 this.senderTo = v; 616 setModified(true); 617 } 618 619 620 } 621 622 627 public String getSenderCc() 628 { 629 return senderCc; 630 } 631 632 633 638 public void setSenderCc(String v) 639 { 640 641 if (!ObjectUtils.equals(this.senderCc, v)) 642 { 643 this.senderCc = v; 644 setModified(true); 645 } 646 647 648 } 649 650 655 public String getSubject() 656 { 657 return subject; 658 } 659 660 661 666 public void setSubject(String v) 667 { 668 669 if (!ObjectUtils.equals(this.subject, v)) 670 { 671 this.subject = v; 672 setModified(true); 673 } 674 675 676 } 677 678 683 public String getBody() 684 { 685 return body; 686 } 687 688 689 694 public void setBody(String v) 695 { 696 697 if (!ObjectUtils.equals(this.body, v)) 698 { 699 this.body = v; 700 setModified(true); 701 } 702 703 704 } 705 706 711 public String getNotes() 712 { 713 return notes; 714 } 715 716 717 722 public void setNotes(String v) 723 { 724 725 if (!ObjectUtils.equals(this.notes, v)) 726 { 727 this.notes = v; 728 setModified(true); 729 } 730 731 732 } 733 734 739 public Date getCreated() 740 { 741 return created; 742 } 743 744 745 750 public void setCreated(Date v) 751 { 752 753 if (!ObjectUtils.equals(this.created, v)) 754 { 755 this.created = v; 756 setModified(true); 757 } 758 759 760 } 761 762 767 public Date getModified() 768 { 769 return modified; 770 } 771 772 773 778 public void setModified(Date v) 779 { 780 781 if (!ObjectUtils.equals(this.modified, v)) 782 { 783 this.modified = v; 784 setModified(true); 785 } 786 787 788 } 789 790 795 public String getCreatedBy() 796 { 797 return createdBy; 798 } 799 800 801 806 public void setCreatedBy(String v) 807 { 808 809 if (!ObjectUtils.equals(this.createdBy, v)) 810 { 811 this.createdBy = v; 812 setModified(true); 813 } 814 815 816 } 817 818 823 public String getModifiedBy() 824 { 825 return modifiedBy; 826 } 827 828 829 834 public void setModifiedBy(String v) 835 { 836 837 if (!ObjectUtils.equals(this.modifiedBy, v)) 838 { 839 this.modifiedBy = v; 840 setModified(true); 841 } 842 843 844 } 845 846 847 848 849 850 private Customer aCustomer; 851 852 858 public void setCustomer(Customer v) throws TorqueException 859 { 860 if (v == null) 861 { 862 setCustomerId( 1000); 863 } 864 else 865 { 866 setCustomerId(v.getCustomerId()); 867 } 868 aCustomer = v; 869 } 870 871 872 878 public Customer getCustomer() throws TorqueException 879 { 880 if (aCustomer == null && (this.customerId != 0)) 881 { 882 aCustomer = CustomerPeer.retrieveByPK(SimpleKey.keyFor(this.customerId)); 883 884 893 } 894 return aCustomer; 895 } 896 897 903 public void setCustomerKey(ObjectKey key) throws TorqueException 904 { 905 906 setCustomerId(((NumberKey) key).intValue()); 907 } 908 909 910 911 912 private Project aProject; 913 914 920 public void setProject(Project v) throws TorqueException 921 { 922 if (v == null) 923 { 924 setProjectId( 1000); 925 } 926 else 927 { 928 setProjectId(v.getProjectId()); 929 } 930 aProject = v; 931 } 932 933 934 940 public Project getProject() throws TorqueException 941 { 942 if (aProject == null && (this.projectId != 0)) 943 { 944 aProject = ProjectPeer.retrieveByPK(SimpleKey.keyFor(this.projectId)); 945 946 955 } 956 return aProject; 957 } 958 959 965 public void setProjectKey(ObjectKey key) throws TorqueException 966 { 967 968 setProjectId(((NumberKey) key).intValue()); 969 } 970 971 972 973 974 private Product aProduct; 975 976 982 public void setProduct(Product v) throws TorqueException 983 { 984 if (v == null) 985 { 986 setProductId( 1000); 987 } 988 else 989 { 990 setProductId(v.getProductId()); 991 } 992 aProduct = v; 993 } 994 995 996 1002 public Product getProduct() throws TorqueException 1003 { 1004 if (aProduct == null && (this.productId != 0)) 1005 { 1006 aProduct = ProductPeer.retrieveByPK(SimpleKey.keyFor(this.productId)); 1007 1008 1017 } 1018 return aProduct; 1019 } 1020 1021 1027 public void setProductKey(ObjectKey key) throws TorqueException 1028 { 1029 1030 setProductId(((NumberKey) key).intValue()); 1031 } 1032 1033 1034 1035 1038 protected List collInboxAttachments; 1039 1040 1045 protected void initInboxAttachments() 1046 { 1047 if (collInboxAttachments == null) 1048 { 1049 collInboxAttachments = new ArrayList (); 1050 } 1051 } 1052 1053 1060 public void addInboxAttachment(InboxAttachment l) throws TorqueException 1061 { 1062 getInboxAttachments().add(l); 1063 l.setInboxEvent((InboxEvent) this); 1064 } 1065 1066 1069 private Criteria lastInboxAttachmentsCriteria = null; 1070 1071 1078 public List getInboxAttachments() throws TorqueException 1079 { 1080 if (collInboxAttachments == null) 1081 { 1082 collInboxAttachments = getInboxAttachments(new Criteria(10)); 1083 } 1084 return collInboxAttachments; 1085 } 1086 1087 1098 public List getInboxAttachments(Criteria criteria) throws TorqueException 1099 { 1100 if (collInboxAttachments == null) 1101 { 1102 if (isNew()) 1103 { 1104 collInboxAttachments = new ArrayList (); 1105 } 1106 else 1107 { 1108 criteria.add(InboxAttachmentPeer.INBOX_EVENT_ID, getInboxEventId() ); 1109 collInboxAttachments = InboxAttachmentPeer.doSelect(criteria); 1110 } 1111 } 1112 else 1113 { 1114 if (!isNew()) 1116 { 1117 criteria.add(InboxAttachmentPeer.INBOX_EVENT_ID, getInboxEventId()); 1121 if (!lastInboxAttachmentsCriteria.equals(criteria)) 1122 { 1123 collInboxAttachments = InboxAttachmentPeer.doSelect(criteria); 1124 } 1125 } 1126 } 1127 lastInboxAttachmentsCriteria = criteria; 1128 1129 return collInboxAttachments; 1130 } 1131 1132 1140 public List getInboxAttachments(Connection con) throws TorqueException 1141 { 1142 if (collInboxAttachments == null) 1143 { 1144 collInboxAttachments = getInboxAttachments(new Criteria(10), con); 1145 } 1146 return collInboxAttachments; 1147 } 1148 1149 1161 public List getInboxAttachments(Criteria criteria, Connection con) 1162 throws TorqueException 1163 { 1164 if (collInboxAttachments == null) 1165 { 1166 if (isNew()) 1167 { 1168 collInboxAttachments = new ArrayList (); 1169 } 1170 else 1171 { 1172 criteria.add(InboxAttachmentPeer.INBOX_EVENT_ID, getInboxEventId()); 1173 collInboxAttachments = InboxAttachmentPeer.doSelect(criteria, con); 1174 } 1175 } 1176 else 1177 { 1178 if (!isNew()) 1180 { 1181 criteria.add(InboxAttachmentPeer.INBOX_EVENT_ID, getInboxEventId()); 1185 if (!lastInboxAttachmentsCriteria.equals(criteria)) 1186 { 1187 collInboxAttachments = InboxAttachmentPeer.doSelect(criteria, con); 1188 } 1189 } 1190 } 1191 lastInboxAttachmentsCriteria = criteria; 1192 1193 return collInboxAttachments; 1194 } 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1217 protected List getInboxAttachmentsJoinInboxEvent(Criteria criteria) 1218 throws TorqueException 1219 { 1220 if (collInboxAttachments == null) 1221 { 1222 if (isNew()) 1223 { 1224 collInboxAttachments = new ArrayList (); 1225 } 1226 else 1227 { 1228 criteria.add(InboxAttachmentPeer.INBOX_EVENT_ID, getInboxEventId()); 1229 collInboxAttachments = InboxAttachmentPeer.doSelectJoinInboxEvent(criteria); 1230 } 1231 } 1232 else 1233 { 1234 1238 criteria.add(InboxAttachmentPeer.INBOX_EVENT_ID, getInboxEventId()); 1239 if (!lastInboxAttachmentsCriteria.equals(criteria)) 1240 { 1241 collInboxAttachments = InboxAttachmentPeer.doSelectJoinInboxEvent(criteria); 1242 } 1243 } 1244 lastInboxAttachmentsCriteria = criteria; 1245 1246 return collInboxAttachments; 1247 } 1248 1249 1250 1251 1252 private static List fieldNames = null; 1253 1254 1259 public static synchronized List getFieldNames() 1260 { 1261 if (fieldNames == null) 1262 { 1263 fieldNames = new ArrayList (); 1264 fieldNames.add("InboxEventId"); 1265 fieldNames.add("InboxEventCode"); 1266 fieldNames.add("Status"); 1267 fieldNames.add("Priority"); 1268 fieldNames.add("IssuedDate"); 1269 fieldNames.add("ClosedDate"); 1270 fieldNames.add("EventChannel"); 1271 fieldNames.add("EventType"); 1272 fieldNames.add("EmailFormat"); 1273 fieldNames.add("CustomerId"); 1274 fieldNames.add("ProjectId"); 1275 fieldNames.add("ProductId"); 1276 fieldNames.add("SenderName"); 1277 fieldNames.add("SenderEmail"); 1278 fieldNames.add("SenderReplyTo"); 1279 fieldNames.add("SentTime"); 1280 fieldNames.add("SenderTo"); 1281 fieldNames.add("SenderCc"); 1282 fieldNames.add("Subject"); 1283 fieldNames.add("Body"); 1284 fieldNames.add("Notes"); 1285 fieldNames.add("Created"); 1286 fieldNames.add("Modified"); 1287 fieldNames.add("CreatedBy"); 1288 fieldNames.add("ModifiedBy"); 1289 fieldNames = Collections.unmodifiableList(fieldNames); 1290 } 1291 return fieldNames; 1292 } 1293 1294 1300 public Object getByName(String name) 1301 { 1302 if (name.equals("InboxEventId")) 1303 { 1304 return new Integer (getInboxEventId()); 1305 } 1306 if (name.equals("InboxEventCode")) 1307 { 1308 return getInboxEventCode(); 1309 } 1310 if (name.equals("Status")) 1311 { 1312 return new Integer (getStatus()); 1313 } 1314 if (name.equals("Priority")) 1315 { 1316 return new Integer (getPriority()); 1317 } 1318 if (name.equals("IssuedDate")) 1319 { 1320 return getIssuedDate(); 1321 } 1322 if (name.equals("ClosedDate")) 1323 { 1324 return getClosedDate(); 1325 } 1326 if (name.equals("EventChannel")) 1327 { 1328 return new Integer (getEventChannel()); 1329 } 1330 if (name.equals("EventType")) 1331 { 1332 return new Integer (getEventType()); 1333 } 1334 if (name.equals("EmailFormat")) 1335 { 1336 return new Integer (getEmailFormat()); 1337 } 1338 if (name.equals("CustomerId")) 1339 { 1340 return new Integer (getCustomerId()); 1341 } 1342 if (name.equals("ProjectId")) 1343 { 1344 return new Integer (getProjectId()); 1345 } 1346 if (name.equals("ProductId")) 1347 { 1348 return new Integer (getProductId()); 1349 } 1350 if (name.equals("SenderName")) 1351 { 1352 return getSenderName(); 1353 } 1354 if (name.equals("SenderEmail")) 1355 { 1356 return getSenderEmail(); 1357 } 1358 if (name.equals("SenderReplyTo")) 1359 { 1360 return getSenderReplyTo(); 1361 } 1362 if (name.equals("SentTime")) 1363 { 1364 return getSentTime(); 1365 } 1366 if (name.equals("SenderTo")) 1367 { 1368 return getSenderTo(); 1369 } 1370 if (name.equals("SenderCc")) 1371 { 1372 return getSenderCc(); 1373 } 1374 if (name.equals("Subject")) 1375 { 1376 return getSubject(); 1377 } 1378 if (name.equals("Body")) 1379 { 1380 return getBody(); 1381 } 1382 if (name.equals("Notes")) 1383 { 1384 return getNotes(); 1385 } 1386 if (name.equals("Created")) 1387 { 1388 return getCreated(); 1389 } 1390 if (name.equals("Modified")) 1391 { 1392 return getModified(); 1393 } 1394 if (name.equals("CreatedBy")) 1395 { 1396 return getCreatedBy(); 1397 } 1398 if (name.equals("ModifiedBy")) 1399 { 1400 return getModifiedBy(); 1401 } 1402 return null; 1403 } 1404 1405 1413 public Object getByPeerName(String name) 1414 { 1415 if (name.equals(InboxEventPeer.INBOX_EVENT_ID)) 1416 { 1417 return new Integer (getInboxEventId()); 1418 } 1419 if (name.equals(InboxEventPeer.INBOX_EVENT_CODE)) 1420 { 1421 return getInboxEventCode(); 1422 } 1423 if (name.equals(InboxEventPeer.STATUS)) 1424 { 1425 return new Integer (getStatus()); 1426 } 1427 if (name.equals(InboxEventPeer.PRIORITY)) 1428 { 1429 return new Integer (getPriority()); 1430 } 1431 if (name.equals(InboxEventPeer.ISSUED_DATE)) 1432 { 1433 return getIssuedDate(); 1434 } 1435 if (name.equals(InboxEventPeer.CLOSED_DATE)) 1436 { 1437 return getClosedDate(); 1438 } 1439 if (name.equals(InboxEventPeer.EVENT_CHANNEL)) 1440 { 1441 return new Integer (getEventChannel()); 1442 } 1443 if (name.equals(InboxEventPeer.EVENT_TYPE)) 1444 { 1445 return new Integer (getEventType()); 1446 } 1447 if (name.equals(InboxEventPeer.EMAIL_FORMAT)) 1448 { 1449 return new Integer (getEmailFormat()); 1450 } 1451 if (name.equals(InboxEventPeer.CUSTOMER_ID)) 1452 { 1453 return new Integer (getCustomerId()); 1454 } 1455 if (name.equals(InboxEventPeer.PROJECT_ID)) 1456 { 1457 return new Integer (getProjectId()); 1458 } 1459 if (name.equals(InboxEventPeer.PRODUCT_ID)) 1460 { 1461 return new Integer (getProductId()); 1462 } 1463 if (name.equals(InboxEventPeer.SENDER_NAME)) 1464 { 1465 return getSenderName(); 1466 } 1467 if (name.equals(InboxEventPeer.SENDER_EMAIL)) 1468 { 1469 return getSenderEmail(); 1470 } 1471 if (name.equals(InboxEventPeer.SENDER_REPLY_TO)) 1472 { 1473 return getSenderReplyTo(); 1474 } 1475 if (name.equals(InboxEventPeer.SENT_TIME)) 1476 { 1477 return getSentTime(); 1478 } 1479 if (name.equals(InboxEventPeer.SENDER_TO)) 1480 { 1481 return getSenderTo(); 1482 } 1483 if (name.equals(InboxEventPeer.SENDER_CC)) 1484 { 1485 return getSenderCc(); 1486 } 1487 if (name.equals(InboxEventPeer.SUBJECT)) 1488 { 1489 return getSubject(); 1490 } 1491 if (name.equals(InboxEventPeer.BODY)) 1492 { 1493 return getBody(); 1494 } 1495 if (name.equals(InboxEventPeer.NOTES)) 1496 { 1497 return getNotes(); 1498 } 1499 if (name.equals(InboxEventPeer.CREATED)) 1500 { 1501 return getCreated(); 1502 } 1503 if (name.equals(InboxEventPeer.MODIFIED)) 1504 { 1505 return getModified(); 1506 } 1507 if (name.equals(InboxEventPeer.CREATED_BY)) 1508 { 1509 return getCreatedBy(); 1510 } 1511 if (name.equals(InboxEventPeer.MODIFIED_BY)) 1512 { 1513 return getModifiedBy(); 1514 } 1515 return null; 1516 } 1517 1518 1525 public Object getByPosition(int pos) 1526 { 1527 if (pos == 0) 1528 { 1529 return new Integer (getInboxEventId()); 1530 } 1531 if (pos == 1) 1532 { 1533 return getInboxEventCode(); 1534 } 1535 if (pos == 2) 1536 { 1537 return new Integer (getStatus()); 1538 } 1539 if (pos == 3) 1540 { 1541 return new Integer (getPriority()); 1542 } 1543 if (pos == 4) 1544 { 1545 return getIssuedDate(); 1546 } 1547 if (pos == 5) 1548 { 1549 return getClosedDate(); 1550 } 1551 if (pos == 6) 1552 { 1553 return new Integer (getEventChannel()); 1554 } 1555 if (pos == 7) 1556 { 1557 return new Integer (getEventType()); 1558 } 1559 if (pos == 8) 1560 { 1561 return new Integer (getEmailFormat()); 1562 } 1563 if (pos == 9) 1564 { 1565 return new Integer (getCustomerId()); 1566 } 1567 if (pos == 10) 1568 { 1569 return new Integer (getProjectId()); 1570 } 1571 if (pos == 11) 1572 { 1573 return new Integer (getProductId()); 1574 } 1575 if (pos == 12) 1576 { 1577 return getSenderName(); 1578 } 1579 if (pos == 13) 1580 { 1581 return getSenderEmail(); 1582 } 1583 if (pos == 14) 1584 { 1585 return getSenderReplyTo(); 1586 } 1587 if (pos == 15) 1588 { 1589 return getSentTime(); 1590 } 1591 if (pos == 16) 1592 { 1593 return getSenderTo(); 1594 } 1595 if (pos == 17) 1596 { 1597 return getSenderCc(); 1598 } 1599 if (pos == 18) 1600 { 1601 return getSubject(); 1602 } 1603 if (pos == 19) 1604 { 1605 return getBody(); 1606 } 1607 if (pos == 20) 1608 { 1609 return getNotes(); 1610 } 1611 if (pos == 21) 1612 { 1613 return getCreated(); 1614 } 1615 if (pos == 22) 1616 { 1617 return getModified(); 1618 } 1619 if (pos == 23) 1620 { 1621 return getCreatedBy(); 1622 } 1623 if (pos == 24) 1624 { 1625 return getModifiedBy(); 1626 } 1627 return null; 1628 } 1629 1630 1636 public void save() throws Exception  1637 { 1638 save(InboxEventPeer.getMapBuilder() 1639 .getDatabaseMap().getName()); 1640 } 1641 1642 1652 public void save(String dbName) throws TorqueException 1653 { 1654 Connection con = null; 1655 try 1656 { 1657 con = Transaction.begin(dbName); 1658 save(con); 1659 Transaction.commit(con); 1660 } 1661 catch(TorqueException e) 1662 { 1663 Transaction.safeRollback(con); 1664 throw e; 1665 } 1666 } 1667 1668 1670 private boolean alreadyInSave = false; 1671 1681 public void save(Connection con) throws TorqueException 1682 { 1683 if (!alreadyInSave) 1684 { 1685 alreadyInSave = true; 1686 1687 1688 1689 if (isModified()) 1691 { 1692 if (isNew()) 1693 { 1694 InboxEventPeer.doInsert((InboxEvent) this, con); 1695 setNew(false); 1696 } 1697 else 1698 { 1699 InboxEventPeer.doUpdate((InboxEvent) this, con); 1700 } 1701 } 1702 1703 1704 1705 if (collInboxAttachments != null) 1706 { 1707 for (int i = 0; i < collInboxAttachments.size(); i++) 1708 { 1709 ((InboxAttachment) collInboxAttachments.get(i)).save(con); 1710 } 1711 } 1712 alreadyInSave = false; 1713 } 1714 } 1715 1716 1717 1722 public void setPrimaryKey(ObjectKey key) 1723 throws TorqueException 1724 { 1725 setInboxEventId(((NumberKey) key).intValue()); 1726 } 1727 1728 1733 public void setPrimaryKey(String key) throws TorqueException 1734 { 1735 setInboxEventId(Integer.parseInt(key)); 1736 } 1737 1738 1739 1743 public ObjectKey getPrimaryKey() 1744 { 1745 return SimpleKey.keyFor(getInboxEventId()); 1746 } 1747 1748 1752 public String getQueryKey() 1753 { 1754 if (getPrimaryKey() == null) 1755 { 1756 return ""; 1757 } 1758 else 1759 { 1760 return getPrimaryKey().toString(); 1761 } 1762 } 1763 1764 1768 public void setQueryKey(String key) 1769 throws TorqueException 1770 { 1771 setPrimaryKey(key); 1772 } 1773 1774 1780 public InboxEvent copy() throws TorqueException 1781 { 1782 return copyInto(new InboxEvent()); 1783 } 1784 1785 protected InboxEvent copyInto(InboxEvent copyObj) throws TorqueException 1786 { 1787 copyObj.setInboxEventId(inboxEventId); 1788 copyObj.setInboxEventCode(inboxEventCode); 1789 copyObj.setStatus(status); 1790 copyObj.setPriority(priority); 1791 copyObj.setIssuedDate(issuedDate); 1792 copyObj.setClosedDate(closedDate); 1793 copyObj.setEventChannel(eventChannel); 1794 copyObj.setEventType(eventType); 1795 copyObj.setEmailFormat(emailFormat); 1796 copyObj.setCustomerId(customerId); 1797 copyObj.setProjectId(projectId); 1798 copyObj.setProductId(productId); 1799 copyObj.setSenderName(senderName); 1800 copyObj.setSenderEmail(senderEmail); 1801 copyObj.setSenderReplyTo(senderReplyTo); 1802 copyObj.setSentTime(sentTime); 1803 copyObj.setSenderTo(senderTo); 1804 copyObj.setSenderCc(senderCc); 1805 copyObj.setSubject(subject); 1806 copyObj.setBody(body); 1807 copyObj.setNotes(notes); 1808 copyObj.setCreated(created); 1809 copyObj.setModified(modified); 1810 copyObj.setCreatedBy(createdBy); 1811 copyObj.setModifiedBy(modifiedBy); 1812 1813 copyObj.setInboxEventId( 0); 1814 1815 1816 1817 List v = getInboxAttachments(); 1818 for (int i = 0; i < v.size(); i++) 1819 { 1820 InboxAttachment obj = (InboxAttachment) v.get(i); 1821 copyObj.addInboxAttachment(obj.copy()); 1822 } 1823 return copyObj; 1824 } 1825 1826 1832 public InboxEventPeer getPeer() 1833 { 1834 return peer; 1835 } 1836 1837 public String toString() 1838 { 1839 StringBuffer str = new StringBuffer (); 1840 str.append("InboxEvent:\n"); 1841 str.append("InboxEventId = ") 1842 .append(getInboxEventId()) 1843 .append("\n"); 1844 str.append("InboxEventCode = ") 1845 .append(getInboxEventCode()) 1846 .append("\n"); 1847 str.append("Status = ") 1848 .append(getStatus()) 1849 .append("\n"); 1850 str.append("Priority = ") 1851 .append(getPriority()) 1852 .append("\n"); 1853 str.append("IssuedDate = ") 1854 .append(getIssuedDate()) 1855 .append("\n"); 1856 str.append("ClosedDate = ") 1857 .append(getClosedDate()) 1858 .append("\n"); 1859 str.append("EventChannel = ") 1860 .append(getEventChannel()) 1861 .append("\n"); 1862 str.append("EventType = ") 1863 .append(getEventType()) 1864 .append("\n"); 1865 str.append("EmailFormat = ") 1866 .append(getEmailFormat()) 1867 .append("\n"); 1868 str.append("CustomerId = ") 1869 .append(getCustomerId()) 1870 .append("\n"); 1871 str.append("ProjectId = ") 1872 .append(getProjectId()) 1873 .append("\n"); 1874 str.append("ProductId = ") 1875 .append(getProductId()) 1876 .append("\n"); 1877 str.append("SenderName = ") 1878 .append(getSenderName()) 1879 .append("\n"); 1880 str.append("SenderEmail = ") 1881 .append(getSenderEmail()) 1882 .append("\n"); 1883 str.append("SenderReplyTo = ") 1884 .append(getSenderReplyTo()) 1885 .append("\n"); 1886 str.append("SentTime = ") 1887 .append(getSentTime()) 1888 .append("\n"); 1889 str.append("SenderTo = ") 1890 .append(getSenderTo()) 1891 .append("\n"); 1892 str.append("SenderCc = ") 1893 .append(getSenderCc()) 1894 .append("\n"); 1895 str.append("Subject = ") 1896 .append(getSubject()) 1897 .append("\n"); 1898 str.append("Body = ") 1899 .append(getBody()) 1900 .append("\n"); 1901 str.append("Notes = ") 1902 .append(getNotes()) 1903 .append("\n"); 1904 str.append("Created = ") 1905 .append(getCreated()) 1906 .append("\n"); 1907 str.append("Modified = ") 1908 .append(getModified()) 1909 .append("\n"); 1910 str.append("CreatedBy = ") 1911 .append(getCreatedBy()) 1912 .append("\n"); 1913 str.append("ModifiedBy = ") 1914 .append(getModifiedBy()) 1915 .append("\n"); 1916 return(str.toString()); 1917 } 1918} 1919
| Popular Tags
|