1 package org.tigris.scarab.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.fulcrum.intake.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 30 public abstract class BaseScope extends BaseObject 31 implements org.apache.fulcrum.intake.Retrievable 32 { 33 34 private static final ScopePeer peer = 35 new ScopePeer(); 36 37 38 39 private Integer scopeId; 40 41 42 private String name; 43 44 45 50 public Integer getScopeId() 51 { 52 return scopeId; 53 } 54 55 56 61 public void setScopeId(Integer v) throws TorqueException 62 { 63 64 if (!ObjectUtils.equals(this.scopeId, v)) 65 { 66 this.scopeId = v; 67 setModified(true); 68 } 69 70 71 72 if (collQuerys != null) 74 { 75 for (int i = 0; i < collQuerys.size(); i++) 76 { 77 ((Query) collQuerys.get(i)) 78 .setScopeId(v); 79 } 80 } 81 82 if (collIssueTemplateInfos != null) 84 { 85 for (int i = 0; i < collIssueTemplateInfos.size(); i++) 86 { 87 ((IssueTemplateInfo) collIssueTemplateInfos.get(i)) 88 .setScopeId(v); 89 } 90 } 91 92 if (collReports != null) 94 { 95 for (int i = 0; i < collReports.size(); i++) 96 { 97 ((Report) collReports.get(i)) 98 .setScopeId(v); 99 } 100 } 101 } 102 103 108 public String getName() 109 { 110 return name; 111 } 112 113 114 119 public void setName(String v) 120 { 121 122 if (!ObjectUtils.equals(this.name, v)) 123 { 124 this.name = v; 125 setModified(true); 126 } 127 128 129 } 130 131 132 133 134 137 protected List collQuerys; 138 139 144 protected void initQuerys() 145 { 146 if (collQuerys == null) 147 { 148 collQuerys = new ArrayList (); 149 } 150 } 151 152 153 160 public void addQuery(Query l) throws TorqueException 161 { 162 getQuerys().add(l); 163 l.setScope((Scope)this); 164 } 165 166 169 private Criteria lastQuerysCriteria = null; 170 171 178 public List getQuerys() throws TorqueException 179 { 180 if (collQuerys == null) 181 { 182 collQuerys = getQuerys(new Criteria(10)); 183 } 184 return collQuerys; 185 } 186 187 198 public List getQuerys(Criteria criteria) throws TorqueException 199 { 200 if (collQuerys == null) 201 { 202 if (isNew()) 203 { 204 collQuerys = new ArrayList (); 205 } 206 else 207 { 208 criteria.add(QueryPeer.SCOPE_ID, getScopeId() ); 209 collQuerys = QueryPeer.doSelect(criteria); 210 } 211 } 212 else 213 { 214 if (!isNew()) 216 { 217 criteria.add(QueryPeer.SCOPE_ID, getScopeId() ); 221 if (!lastQuerysCriteria.equals(criteria)) 222 { 223 collQuerys = QueryPeer.doSelect(criteria); 224 } 225 } 226 } 227 lastQuerysCriteria = criteria; 228 229 return collQuerys; 230 } 231 232 240 public List getQuerys(Connection con) throws TorqueException 241 { 242 if (collQuerys == null) 243 { 244 collQuerys = getQuerys(new Criteria(10),con); 245 } 246 return collQuerys; 247 } 248 249 261 public List getQuerys(Criteria criteria,Connection con) throws TorqueException 262 { 263 if (collQuerys == null) 264 { 265 if (isNew()) 266 { 267 collQuerys = new ArrayList (); 268 } 269 else 270 { 271 criteria.add(QueryPeer.SCOPE_ID, getScopeId() ); 272 collQuerys = QueryPeer.doSelect(criteria,con); 273 } 274 } 275 else 276 { 277 if (!isNew()) 279 { 280 criteria.add(QueryPeer.SCOPE_ID, getScopeId() ); 284 if (!lastQuerysCriteria.equals(criteria)) 285 { 286 collQuerys = QueryPeer.doSelect(criteria,con); 287 } 288 } 289 } 290 lastQuerysCriteria = criteria; 291 292 return collQuerys; 293 } 294 295 296 297 298 299 300 301 302 303 304 305 316 protected List getQuerysJoinScarabUserImpl(Criteria criteria) 317 throws TorqueException 318 { 319 if (collQuerys == null) 320 { 321 if (isNew()) 322 { 323 collQuerys = new ArrayList (); 324 } 325 else 326 { 327 criteria.add(QueryPeer.SCOPE_ID, getScopeId() ); 328 collQuerys = QueryPeer.doSelectJoinScarabUserImpl(criteria); 329 } 330 } 331 else 332 { 333 337 criteria.add(QueryPeer.SCOPE_ID, getScopeId() ); 338 if (!lastQuerysCriteria.equals(criteria)) 339 { 340 collQuerys = QueryPeer.doSelectJoinScarabUserImpl(criteria); 341 } 342 } 343 lastQuerysCriteria = criteria; 344 345 return collQuerys; 346 } 347 348 349 350 351 352 353 354 355 356 367 protected List getQuerysJoinScope(Criteria criteria) 368 throws TorqueException 369 { 370 if (collQuerys == null) 371 { 372 if (isNew()) 373 { 374 collQuerys = new ArrayList (); 375 } 376 else 377 { 378 criteria.add(QueryPeer.SCOPE_ID, getScopeId() ); 379 collQuerys = QueryPeer.doSelectJoinScope(criteria); 380 } 381 } 382 else 383 { 384 388 criteria.add(QueryPeer.SCOPE_ID, getScopeId() ); 389 if (!lastQuerysCriteria.equals(criteria)) 390 { 391 collQuerys = QueryPeer.doSelectJoinScope(criteria); 392 } 393 } 394 lastQuerysCriteria = criteria; 395 396 return collQuerys; 397 } 398 399 400 401 402 403 404 405 406 407 418 protected List getQuerysJoinScarabModule(Criteria criteria) 419 throws TorqueException 420 { 421 if (collQuerys == null) 422 { 423 if (isNew()) 424 { 425 collQuerys = new ArrayList (); 426 } 427 else 428 { 429 criteria.add(QueryPeer.SCOPE_ID, getScopeId() ); 430 collQuerys = QueryPeer.doSelectJoinScarabModule(criteria); 431 } 432 } 433 else 434 { 435 439 criteria.add(QueryPeer.SCOPE_ID, getScopeId() ); 440 if (!lastQuerysCriteria.equals(criteria)) 441 { 442 collQuerys = QueryPeer.doSelectJoinScarabModule(criteria); 443 } 444 } 445 lastQuerysCriteria = criteria; 446 447 return collQuerys; 448 } 449 450 451 452 453 454 455 456 457 458 469 protected List getQuerysJoinIssueType(Criteria criteria) 470 throws TorqueException 471 { 472 if (collQuerys == null) 473 { 474 if (isNew()) 475 { 476 collQuerys = new ArrayList (); 477 } 478 else 479 { 480 criteria.add(QueryPeer.SCOPE_ID, getScopeId() ); 481 collQuerys = QueryPeer.doSelectJoinIssueType(criteria); 482 } 483 } 484 else 485 { 486 490 criteria.add(QueryPeer.SCOPE_ID, getScopeId() ); 491 if (!lastQuerysCriteria.equals(criteria)) 492 { 493 collQuerys = QueryPeer.doSelectJoinIssueType(criteria); 494 } 495 } 496 lastQuerysCriteria = criteria; 497 498 return collQuerys; 499 } 500 501 502 503 504 505 506 507 508 509 520 protected List getQuerysJoinMITList(Criteria criteria) 521 throws TorqueException 522 { 523 if (collQuerys == null) 524 { 525 if (isNew()) 526 { 527 collQuerys = new ArrayList (); 528 } 529 else 530 { 531 criteria.add(QueryPeer.SCOPE_ID, getScopeId() ); 532 collQuerys = QueryPeer.doSelectJoinMITList(criteria); 533 } 534 } 535 else 536 { 537 541 criteria.add(QueryPeer.SCOPE_ID, getScopeId() ); 542 if (!lastQuerysCriteria.equals(criteria)) 543 { 544 collQuerys = QueryPeer.doSelectJoinMITList(criteria); 545 } 546 } 547 lastQuerysCriteria = criteria; 548 549 return collQuerys; 550 } 551 552 553 554 555 556 557 558 559 560 571 protected List getQuerysJoinFrequency(Criteria criteria) 572 throws TorqueException 573 { 574 if (collQuerys == null) 575 { 576 if (isNew()) 577 { 578 collQuerys = new ArrayList (); 579 } 580 else 581 { 582 criteria.add(QueryPeer.SCOPE_ID, getScopeId() ); 583 collQuerys = QueryPeer.doSelectJoinFrequency(criteria); 584 } 585 } 586 else 587 { 588 592 criteria.add(QueryPeer.SCOPE_ID, getScopeId() ); 593 if (!lastQuerysCriteria.equals(criteria)) 594 { 595 collQuerys = QueryPeer.doSelectJoinFrequency(criteria); 596 } 597 } 598 lastQuerysCriteria = criteria; 599 600 return collQuerys; 601 } 602 603 604 605 606 607 610 protected List collIssueTemplateInfos; 611 612 617 protected void initIssueTemplateInfos() 618 { 619 if (collIssueTemplateInfos == null) 620 { 621 collIssueTemplateInfos = new ArrayList (); 622 } 623 } 624 625 626 633 public void addIssueTemplateInfo(IssueTemplateInfo l) throws TorqueException 634 { 635 getIssueTemplateInfos().add(l); 636 l.setScope((Scope)this); 637 } 638 639 642 private Criteria lastIssueTemplateInfosCriteria = null; 643 644 651 public List getIssueTemplateInfos() throws TorqueException 652 { 653 if (collIssueTemplateInfos == null) 654 { 655 collIssueTemplateInfos = getIssueTemplateInfos(new Criteria(10)); 656 } 657 return collIssueTemplateInfos; 658 } 659 660 671 public List getIssueTemplateInfos(Criteria criteria) throws TorqueException 672 { 673 if (collIssueTemplateInfos == null) 674 { 675 if (isNew()) 676 { 677 collIssueTemplateInfos = new ArrayList (); 678 } 679 else 680 { 681 criteria.add(IssueTemplateInfoPeer.SCOPE_ID, getScopeId() ); 682 collIssueTemplateInfos = IssueTemplateInfoPeer.doSelect(criteria); 683 } 684 } 685 else 686 { 687 if (!isNew()) 689 { 690 criteria.add(IssueTemplateInfoPeer.SCOPE_ID, getScopeId() ); 694 if (!lastIssueTemplateInfosCriteria.equals(criteria)) 695 { 696 collIssueTemplateInfos = IssueTemplateInfoPeer.doSelect(criteria); 697 } 698 } 699 } 700 lastIssueTemplateInfosCriteria = criteria; 701 702 return collIssueTemplateInfos; 703 } 704 705 713 public List getIssueTemplateInfos(Connection con) throws TorqueException 714 { 715 if (collIssueTemplateInfos == null) 716 { 717 collIssueTemplateInfos = getIssueTemplateInfos(new Criteria(10),con); 718 } 719 return collIssueTemplateInfos; 720 } 721 722 734 public List getIssueTemplateInfos(Criteria criteria,Connection con) throws TorqueException 735 { 736 if (collIssueTemplateInfos == null) 737 { 738 if (isNew()) 739 { 740 collIssueTemplateInfos = new ArrayList (); 741 } 742 else 743 { 744 criteria.add(IssueTemplateInfoPeer.SCOPE_ID, getScopeId() ); 745 collIssueTemplateInfos = IssueTemplateInfoPeer.doSelect(criteria,con); 746 } 747 } 748 else 749 { 750 if (!isNew()) 752 { 753 criteria.add(IssueTemplateInfoPeer.SCOPE_ID, getScopeId() ); 757 if (!lastIssueTemplateInfosCriteria.equals(criteria)) 758 { 759 collIssueTemplateInfos = IssueTemplateInfoPeer.doSelect(criteria,con); 760 } 761 } 762 } 763 lastIssueTemplateInfosCriteria = criteria; 764 765 return collIssueTemplateInfos; 766 } 767 768 769 770 771 772 773 774 775 776 777 778 789 protected List getIssueTemplateInfosJoinIssue(Criteria criteria) 790 throws TorqueException 791 { 792 if (collIssueTemplateInfos == null) 793 { 794 if (isNew()) 795 { 796 collIssueTemplateInfos = new ArrayList (); 797 } 798 else 799 { 800 criteria.add(IssueTemplateInfoPeer.SCOPE_ID, getScopeId() ); 801 collIssueTemplateInfos = IssueTemplateInfoPeer.doSelectJoinIssue(criteria); 802 } 803 } 804 else 805 { 806 810 criteria.add(IssueTemplateInfoPeer.SCOPE_ID, getScopeId() ); 811 if (!lastIssueTemplateInfosCriteria.equals(criteria)) 812 { 813 collIssueTemplateInfos = IssueTemplateInfoPeer.doSelectJoinIssue(criteria); 814 } 815 } 816 lastIssueTemplateInfosCriteria = criteria; 817 818 return collIssueTemplateInfos; 819 } 820 821 822 823 824 825 826 827 828 829 840 protected List getIssueTemplateInfosJoinScope(Criteria criteria) 841 throws TorqueException 842 { 843 if (collIssueTemplateInfos == null) 844 { 845 if (isNew()) 846 { 847 collIssueTemplateInfos = new ArrayList (); 848 } 849 else 850 { 851 criteria.add(IssueTemplateInfoPeer.SCOPE_ID, getScopeId() ); 852 collIssueTemplateInfos = IssueTemplateInfoPeer.doSelectJoinScope(criteria); 853 } 854 } 855 else 856 { 857 861 criteria.add(IssueTemplateInfoPeer.SCOPE_ID, getScopeId() ); 862 if (!lastIssueTemplateInfosCriteria.equals(criteria)) 863 { 864 collIssueTemplateInfos = IssueTemplateInfoPeer.doSelectJoinScope(criteria); 865 } 866 } 867 lastIssueTemplateInfosCriteria = criteria; 868 869 return collIssueTemplateInfos; 870 } 871 872 873 874 875 876 879 protected List collReports; 880 881 886 protected void initReports() 887 { 888 if (collReports == null) 889 { 890 collReports = new ArrayList (); 891 } 892 } 893 894 895 902 public void addReport(Report l) throws TorqueException 903 { 904 getReports().add(l); 905 l.setScope((Scope)this); 906 } 907 908 911 private Criteria lastReportsCriteria = null; 912 913 920 public List getReports() throws TorqueException 921 { 922 if (collReports == null) 923 { 924 collReports = getReports(new Criteria(10)); 925 } 926 return collReports; 927 } 928 929 940 public List getReports(Criteria criteria) throws TorqueException 941 { 942 if (collReports == null) 943 { 944 if (isNew()) 945 { 946 collReports = new ArrayList (); 947 } 948 else 949 { 950 criteria.add(ReportPeer.SCOPE_ID, getScopeId() ); 951 collReports = ReportPeer.doSelect(criteria); 952 } 953 } 954 else 955 { 956 if (!isNew()) 958 { 959 criteria.add(ReportPeer.SCOPE_ID, getScopeId() ); 963 if (!lastReportsCriteria.equals(criteria)) 964 { 965 collReports = ReportPeer.doSelect(criteria); 966 } 967 } 968 } 969 lastReportsCriteria = criteria; 970 971 return collReports; 972 } 973 974 982 public List getReports(Connection con) throws TorqueException 983 { 984 if (collReports == null) 985 { 986 collReports = getReports(new Criteria(10),con); 987 } 988 return collReports; 989 } 990 991 1003 public List getReports(Criteria criteria,Connection con) throws TorqueException 1004 { 1005 if (collReports == null) 1006 { 1007 if (isNew()) 1008 { 1009 collReports = new ArrayList (); 1010 } 1011 else 1012 { 1013 criteria.add(ReportPeer.SCOPE_ID, getScopeId() ); 1014 collReports = ReportPeer.doSelect(criteria,con); 1015 } 1016 } 1017 else 1018 { 1019 if (!isNew()) 1021 { 1022 criteria.add(ReportPeer.SCOPE_ID, getScopeId() ); 1026 if (!lastReportsCriteria.equals(criteria)) 1027 { 1028 collReports = ReportPeer.doSelect(criteria,con); 1029 } 1030 } 1031 } 1032 lastReportsCriteria = criteria; 1033 1034 return collReports; 1035 } 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1058 protected List getReportsJoinIssueType(Criteria criteria) 1059 throws TorqueException 1060 { 1061 if (collReports == null) 1062 { 1063 if (isNew()) 1064 { 1065 collReports = new ArrayList (); 1066 } 1067 else 1068 { 1069 criteria.add(ReportPeer.SCOPE_ID, getScopeId() ); 1070 collReports = ReportPeer.doSelectJoinIssueType(criteria); 1071 } 1072 } 1073 else 1074 { 1075 1079 criteria.add(ReportPeer.SCOPE_ID, getScopeId() ); 1080 if (!lastReportsCriteria.equals(criteria)) 1081 { 1082 collReports = ReportPeer.doSelectJoinIssueType(criteria); 1083 } 1084 } 1085 lastReportsCriteria = criteria; 1086 1087 return collReports; 1088 } 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1109 protected List getReportsJoinScarabUserImpl(Criteria criteria) 1110 throws TorqueException 1111 { 1112 if (collReports == null) 1113 { 1114 if (isNew()) 1115 { 1116 collReports = new ArrayList (); 1117 } 1118 else 1119 { 1120 criteria.add(ReportPeer.SCOPE_ID, getScopeId() ); 1121 collReports = ReportPeer.doSelectJoinScarabUserImpl(criteria); 1122 } 1123 } 1124 else 1125 { 1126 1130 criteria.add(ReportPeer.SCOPE_ID, getScopeId() ); 1131 if (!lastReportsCriteria.equals(criteria)) 1132 { 1133 collReports = ReportPeer.doSelectJoinScarabUserImpl(criteria); 1134 } 1135 } 1136 lastReportsCriteria = criteria; 1137 1138 return collReports; 1139 } 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1160 protected List getReportsJoinScarabModule(Criteria criteria) 1161 throws TorqueException 1162 { 1163 if (collReports == null) 1164 { 1165 if (isNew()) 1166 { 1167 collReports = new ArrayList (); 1168 } 1169 else 1170 { 1171 criteria.add(ReportPeer.SCOPE_ID, getScopeId() ); 1172 collReports = ReportPeer.doSelectJoinScarabModule(criteria); 1173 } 1174 } 1175 else 1176 { 1177 1181 criteria.add(ReportPeer.SCOPE_ID, getScopeId() ); 1182 if (!lastReportsCriteria.equals(criteria)) 1183 { 1184 collReports = ReportPeer.doSelectJoinScarabModule(criteria); 1185 } 1186 } 1187 lastReportsCriteria = criteria; 1188 1189 return collReports; 1190 } 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1211 protected List getReportsJoinScope(Criteria criteria) 1212 throws TorqueException 1213 { 1214 if (collReports == null) 1215 { 1216 if (isNew()) 1217 { 1218 collReports = new ArrayList (); 1219 } 1220 else 1221 { 1222 criteria.add(ReportPeer.SCOPE_ID, getScopeId() ); 1223 collReports = ReportPeer.doSelectJoinScope(criteria); 1224 } 1225 } 1226 else 1227 { 1228 1232 criteria.add(ReportPeer.SCOPE_ID, getScopeId() ); 1233 if (!lastReportsCriteria.equals(criteria)) 1234 { 1235 collReports = ReportPeer.doSelectJoinScope(criteria); 1236 } 1237 } 1238 lastReportsCriteria = criteria; 1239 1240 return collReports; 1241 } 1242 1243 1244 1245 1246 private static List fieldNames = null; 1247 1248 1253 public static synchronized List getFieldNames() 1254 { 1255 if (fieldNames == null) 1256 { 1257 fieldNames = new ArrayList (); 1258 fieldNames.add("ScopeId"); 1259 fieldNames.add("Name"); 1260 fieldNames = Collections.unmodifiableList(fieldNames); 1261 } 1262 return fieldNames; 1263 } 1264 1265 1271 public Object getByName(String name) 1272 { 1273 if (name.equals("ScopeId")) 1274 { 1275 return getScopeId(); 1276 } 1277 if (name.equals("Name")) 1278 { 1279 return getName(); 1280 } 1281 return null; 1282 } 1283 1284 1292 public Object getByPeerName(String name) 1293 { 1294 if (name.equals(ScopePeer.SCOPE_ID)) 1295 { 1296 return getScopeId(); 1297 } 1298 if (name.equals(ScopePeer.SCOPE_NAME)) 1299 { 1300 return getName(); 1301 } 1302 return null; 1303 } 1304 1305 1312 public Object getByPosition(int pos) 1313 { 1314 if (pos == 0) 1315 { 1316 return getScopeId(); 1317 } 1318 if (pos == 1) 1319 { 1320 return getName(); 1321 } 1322 return null; 1323 } 1324 1325 1331 public void save() throws Exception 1332 { 1333 save(ScopePeer.getMapBuilder() 1334 .getDatabaseMap().getName()); 1335 } 1336 1337 1347 public void save(String dbName) throws TorqueException 1348 { 1349 Connection con = null; 1350 try 1351 { 1352 con = Transaction.begin(dbName); 1353 save(con); 1354 Transaction.commit(con); 1355 } 1356 catch(TorqueException e) 1357 { 1358 Transaction.safeRollback(con); 1359 throw e; 1360 } 1361 } 1362 1363 1365 private boolean alreadyInSave = false; 1366 1376 public void save(Connection con) throws TorqueException 1377 { 1378 if (!alreadyInSave) 1379 { 1380 alreadyInSave = true; 1381 1382 1383 1384 if (isModified()) 1386 { 1387 if (isNew()) 1388 { 1389 ScopePeer.doInsert((Scope)this, con); 1390 setNew(false); 1391 } 1392 else 1393 { 1394 ScopePeer.doUpdate((Scope)this, con); 1395 } 1396 1397 if (isCacheOnSave()) 1398 { 1399 ScopeManager.putInstance(this); 1400 } 1401 } 1402 1403 1404 if (collQuerys != null) 1405 { 1406 for (int i = 0; i < collQuerys.size(); i++) 1407 { 1408 ((Query)collQuerys.get(i)).save(con); 1409 } 1410 } 1411 1412 if (collIssueTemplateInfos != null) 1413 { 1414 for (int i = 0; i < collIssueTemplateInfos.size(); i++) 1415 { 1416 ((IssueTemplateInfo)collIssueTemplateInfos.get(i)).save(con); 1417 } 1418 } 1419 1420 if (collReports != null) 1421 { 1422 for (int i = 0; i < collReports.size(); i++) 1423 { 1424 ((Report)collReports.get(i)).save(con); 1425 } 1426 } 1427 alreadyInSave = false; 1428 } 1429 } 1430 1431 1435 protected boolean isCacheOnSave() 1436 { 1437 return true; 1438 } 1439 1440 1441 1446 public void setPrimaryKey(ObjectKey scopeId) 1447 throws TorqueException { 1448 setScopeId(new Integer (((NumberKey)scopeId).intValue())); 1449 } 1450 1451 1456 public void setPrimaryKey(String key) throws TorqueException 1457 { 1458 setScopeId(new Integer (key)); 1459 } 1460 1461 1462 1466 public ObjectKey getPrimaryKey() 1467 { 1468 return SimpleKey.keyFor(getScopeId()); 1469 } 1470 1471 1475 public String getQueryKey() 1476 { 1477 if (getPrimaryKey() == null) 1478 { 1479 return ""; 1480 } 1481 else 1482 { 1483 return getPrimaryKey().toString(); 1484 } 1485 } 1486 1487 1491 public void setQueryKey(String key) 1492 throws TorqueException 1493 { 1494 setPrimaryKey(key); 1495 } 1496 1497 1503 public Scope copy() throws TorqueException 1504 { 1505 Scope copyObj = new Scope(); 1506 copyObj.setScopeId(scopeId); 1507 copyObj.setName(name); 1508 1509 copyObj.setScopeId((Integer )null); 1510 1511 1512 1513 List v = getQuerys(); 1514 for (int i = 0; i < v.size(); i++) 1515 { 1516 Query obj = (Query) v.get(i); 1517 copyObj.addQuery(obj.copy()); 1518 } 1519 1520 1521 v = getIssueTemplateInfos(); 1522 for (int i = 0; i < v.size(); i++) 1523 { 1524 IssueTemplateInfo obj = (IssueTemplateInfo) v.get(i); 1525 copyObj.addIssueTemplateInfo(obj.copy()); 1526 } 1527 1528 1529 v = getReports(); 1530 for (int i = 0; i < v.size(); i++) 1531 { 1532 Report obj = (Report) v.get(i); 1533 copyObj.addReport(obj.copy()); 1534 } 1535 return copyObj; 1536 } 1537 1538 1544 public ScopePeer getPeer() 1545 { 1546 return peer; 1547 } 1548 1549 public String toString() 1550 { 1551 StringBuffer str = new StringBuffer (); 1552 str.append("Scope:\n"); 1553 str.append("ScopeId = ") 1554 .append(getScopeId()) 1555 .append("\n"); 1556 str.append("Name = ") 1557 .append(getName()) 1558 .append("\n"); 1559 return(str.toString()); 1560 } 1561} 1562 | Popular Tags |