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 BaseCountry extends BaseObject 35 implements org.apache.turbine.om.Retrievable 36 { 37 38 private static final CountryPeer peer = 39 new CountryPeer(); 40 41 42 43 private int countryId; 44 45 46 private String countryName; 47 48 49 private String countryCode; 50 51 52 57 public int getCountryId() 58 { 59 return countryId; 60 } 61 62 63 68 public void setCountryId(int v) throws TorqueException 69 { 70 71 if (this.countryId != v) 72 { 73 this.countryId = v; 74 setModified(true); 75 } 76 77 78 79 if (collCustomers != null) 81 { 82 for (int i = 0; i < collCustomers.size(); i++) 83 { 84 ((Customer) collCustomers.get(i)) 85 .setCountryId(v); 86 } 87 } 88 89 if (collNewsletters != null) 91 { 92 for (int i = 0; i < collNewsletters.size(); i++) 93 { 94 ((Newsletter) collNewsletters.get(i)) 95 .setCustCountryId(v); 96 } 97 } 98 } 99 100 105 public String getCountryName() 106 { 107 return countryName; 108 } 109 110 111 116 public void setCountryName(String v) 117 { 118 119 if (!ObjectUtils.equals(this.countryName, v)) 120 { 121 this.countryName = v; 122 setModified(true); 123 } 124 125 126 } 127 128 133 public String getCountryCode() 134 { 135 return countryCode; 136 } 137 138 139 144 public void setCountryCode(String v) 145 { 146 147 if (!ObjectUtils.equals(this.countryCode, v)) 148 { 149 this.countryCode = v; 150 setModified(true); 151 } 152 153 154 } 155 156 157 158 159 162 protected List collCustomers; 163 164 169 protected void initCustomers() 170 { 171 if (collCustomers == null) 172 { 173 collCustomers = new ArrayList (); 174 } 175 } 176 177 184 public void addCustomer(Customer l) throws TorqueException 185 { 186 getCustomers().add(l); 187 l.setCountry((Country) this); 188 } 189 190 193 private Criteria lastCustomersCriteria = null; 194 195 202 public List getCustomers() throws TorqueException 203 { 204 if (collCustomers == null) 205 { 206 collCustomers = getCustomers(new Criteria(10)); 207 } 208 return collCustomers; 209 } 210 211 222 public List getCustomers(Criteria criteria) throws TorqueException 223 { 224 if (collCustomers == null) 225 { 226 if (isNew()) 227 { 228 collCustomers = new ArrayList (); 229 } 230 else 231 { 232 criteria.add(CustomerPeer.COUNTRY_ID, getCountryId() ); 233 collCustomers = CustomerPeer.doSelect(criteria); 234 } 235 } 236 else 237 { 238 if (!isNew()) 240 { 241 criteria.add(CustomerPeer.COUNTRY_ID, getCountryId()); 245 if (!lastCustomersCriteria.equals(criteria)) 246 { 247 collCustomers = CustomerPeer.doSelect(criteria); 248 } 249 } 250 } 251 lastCustomersCriteria = criteria; 252 253 return collCustomers; 254 } 255 256 264 public List getCustomers(Connection con) throws TorqueException 265 { 266 if (collCustomers == null) 267 { 268 collCustomers = getCustomers(new Criteria(10), con); 269 } 270 return collCustomers; 271 } 272 273 285 public List getCustomers(Criteria criteria, Connection con) 286 throws TorqueException 287 { 288 if (collCustomers == null) 289 { 290 if (isNew()) 291 { 292 collCustomers = new ArrayList (); 293 } 294 else 295 { 296 criteria.add(CustomerPeer.COUNTRY_ID, getCountryId()); 297 collCustomers = CustomerPeer.doSelect(criteria, con); 298 } 299 } 300 else 301 { 302 if (!isNew()) 304 { 305 criteria.add(CustomerPeer.COUNTRY_ID, getCountryId()); 309 if (!lastCustomersCriteria.equals(criteria)) 310 { 311 collCustomers = CustomerPeer.doSelect(criteria, con); 312 } 313 } 314 } 315 lastCustomersCriteria = criteria; 316 317 return collCustomers; 318 } 319 320 321 322 323 324 325 326 327 328 329 330 341 protected List getCustomersJoinCustomerCategory(Criteria criteria) 342 throws TorqueException 343 { 344 if (collCustomers == null) 345 { 346 if (isNew()) 347 { 348 collCustomers = new ArrayList (); 349 } 350 else 351 { 352 criteria.add(CustomerPeer.COUNTRY_ID, getCountryId()); 353 collCustomers = CustomerPeer.doSelectJoinCustomerCategory(criteria); 354 } 355 } 356 else 357 { 358 362 criteria.add(CustomerPeer.COUNTRY_ID, getCountryId()); 363 if (!lastCustomersCriteria.equals(criteria)) 364 { 365 collCustomers = CustomerPeer.doSelectJoinCustomerCategory(criteria); 366 } 367 } 368 lastCustomersCriteria = criteria; 369 370 return collCustomers; 371 } 372 373 374 375 376 377 378 379 380 381 392 protected List getCustomersJoinCountry(Criteria criteria) 393 throws TorqueException 394 { 395 if (collCustomers == null) 396 { 397 if (isNew()) 398 { 399 collCustomers = new ArrayList (); 400 } 401 else 402 { 403 criteria.add(CustomerPeer.COUNTRY_ID, getCountryId()); 404 collCustomers = CustomerPeer.doSelectJoinCountry(criteria); 405 } 406 } 407 else 408 { 409 413 criteria.add(CustomerPeer.COUNTRY_ID, getCountryId()); 414 if (!lastCustomersCriteria.equals(criteria)) 415 { 416 collCustomers = CustomerPeer.doSelectJoinCountry(criteria); 417 } 418 } 419 lastCustomersCriteria = criteria; 420 421 return collCustomers; 422 } 423 424 425 426 427 428 429 430 431 432 443 protected List getCustomersJoinRegion(Criteria criteria) 444 throws TorqueException 445 { 446 if (collCustomers == null) 447 { 448 if (isNew()) 449 { 450 collCustomers = new ArrayList (); 451 } 452 else 453 { 454 criteria.add(CustomerPeer.COUNTRY_ID, getCountryId()); 455 collCustomers = CustomerPeer.doSelectJoinRegion(criteria); 456 } 457 } 458 else 459 { 460 464 criteria.add(CustomerPeer.COUNTRY_ID, getCountryId()); 465 if (!lastCustomersCriteria.equals(criteria)) 466 { 467 collCustomers = CustomerPeer.doSelectJoinRegion(criteria); 468 } 469 } 470 lastCustomersCriteria = criteria; 471 472 return collCustomers; 473 } 474 475 476 477 478 479 480 481 482 483 494 protected List getCustomersJoinLanguage(Criteria criteria) 495 throws TorqueException 496 { 497 if (collCustomers == null) 498 { 499 if (isNew()) 500 { 501 collCustomers = new ArrayList (); 502 } 503 else 504 { 505 criteria.add(CustomerPeer.COUNTRY_ID, getCountryId()); 506 collCustomers = CustomerPeer.doSelectJoinLanguage(criteria); 507 } 508 } 509 else 510 { 511 515 criteria.add(CustomerPeer.COUNTRY_ID, getCountryId()); 516 if (!lastCustomersCriteria.equals(criteria)) 517 { 518 collCustomers = CustomerPeer.doSelectJoinLanguage(criteria); 519 } 520 } 521 lastCustomersCriteria = criteria; 522 523 return collCustomers; 524 } 525 526 527 528 529 530 531 532 533 534 545 protected List getCustomersJoinEducationCategory(Criteria criteria) 546 throws TorqueException 547 { 548 if (collCustomers == null) 549 { 550 if (isNew()) 551 { 552 collCustomers = new ArrayList (); 553 } 554 else 555 { 556 criteria.add(CustomerPeer.COUNTRY_ID, getCountryId()); 557 collCustomers = CustomerPeer.doSelectJoinEducationCategory(criteria); 558 } 559 } 560 else 561 { 562 566 criteria.add(CustomerPeer.COUNTRY_ID, getCountryId()); 567 if (!lastCustomersCriteria.equals(criteria)) 568 { 569 collCustomers = CustomerPeer.doSelectJoinEducationCategory(criteria); 570 } 571 } 572 lastCustomersCriteria = criteria; 573 574 return collCustomers; 575 } 576 577 578 579 580 581 582 583 584 585 596 protected List getCustomersJoinHouseholdCategory(Criteria criteria) 597 throws TorqueException 598 { 599 if (collCustomers == null) 600 { 601 if (isNew()) 602 { 603 collCustomers = new ArrayList (); 604 } 605 else 606 { 607 criteria.add(CustomerPeer.COUNTRY_ID, getCountryId()); 608 collCustomers = CustomerPeer.doSelectJoinHouseholdCategory(criteria); 609 } 610 } 611 else 612 { 613 617 criteria.add(CustomerPeer.COUNTRY_ID, getCountryId()); 618 if (!lastCustomersCriteria.equals(criteria)) 619 { 620 collCustomers = CustomerPeer.doSelectJoinHouseholdCategory(criteria); 621 } 622 } 623 lastCustomersCriteria = criteria; 624 625 return collCustomers; 626 } 627 628 629 630 631 632 635 protected List collNewsletters; 636 637 642 protected void initNewsletters() 643 { 644 if (collNewsletters == null) 645 { 646 collNewsletters = new ArrayList (); 647 } 648 } 649 650 657 public void addNewsletter(Newsletter l) throws TorqueException 658 { 659 getNewsletters().add(l); 660 l.setCountry((Country) this); 661 } 662 663 666 private Criteria lastNewslettersCriteria = null; 667 668 675 public List getNewsletters() throws TorqueException 676 { 677 if (collNewsletters == null) 678 { 679 collNewsletters = getNewsletters(new Criteria(10)); 680 } 681 return collNewsletters; 682 } 683 684 695 public List getNewsletters(Criteria criteria) throws TorqueException 696 { 697 if (collNewsletters == null) 698 { 699 if (isNew()) 700 { 701 collNewsletters = new ArrayList (); 702 } 703 else 704 { 705 criteria.add(NewsletterPeer.CUST_COUNTRY_ID, getCountryId() ); 706 collNewsletters = NewsletterPeer.doSelect(criteria); 707 } 708 } 709 else 710 { 711 if (!isNew()) 713 { 714 criteria.add(NewsletterPeer.CUST_COUNTRY_ID, getCountryId()); 718 if (!lastNewslettersCriteria.equals(criteria)) 719 { 720 collNewsletters = NewsletterPeer.doSelect(criteria); 721 } 722 } 723 } 724 lastNewslettersCriteria = criteria; 725 726 return collNewsletters; 727 } 728 729 737 public List getNewsletters(Connection con) throws TorqueException 738 { 739 if (collNewsletters == null) 740 { 741 collNewsletters = getNewsletters(new Criteria(10), con); 742 } 743 return collNewsletters; 744 } 745 746 758 public List getNewsletters(Criteria criteria, Connection con) 759 throws TorqueException 760 { 761 if (collNewsletters == null) 762 { 763 if (isNew()) 764 { 765 collNewsletters = new ArrayList (); 766 } 767 else 768 { 769 criteria.add(NewsletterPeer.CUST_COUNTRY_ID, getCountryId()); 770 collNewsletters = NewsletterPeer.doSelect(criteria, con); 771 } 772 } 773 else 774 { 775 if (!isNew()) 777 { 778 criteria.add(NewsletterPeer.CUST_COUNTRY_ID, getCountryId()); 782 if (!lastNewslettersCriteria.equals(criteria)) 783 { 784 collNewsletters = NewsletterPeer.doSelect(criteria, con); 785 } 786 } 787 } 788 lastNewslettersCriteria = criteria; 789 790 return collNewsletters; 791 } 792 793 794 795 796 797 798 799 800 801 802 803 814 protected List getNewslettersJoinCustomerCategory(Criteria criteria) 815 throws TorqueException 816 { 817 if (collNewsletters == null) 818 { 819 if (isNew()) 820 { 821 collNewsletters = new ArrayList (); 822 } 823 else 824 { 825 criteria.add(NewsletterPeer.CUST_COUNTRY_ID, getCountryId()); 826 collNewsletters = NewsletterPeer.doSelectJoinCustomerCategory(criteria); 827 } 828 } 829 else 830 { 831 835 criteria.add(NewsletterPeer.CUST_COUNTRY_ID, getCountryId()); 836 if (!lastNewslettersCriteria.equals(criteria)) 837 { 838 collNewsletters = NewsletterPeer.doSelectJoinCustomerCategory(criteria); 839 } 840 } 841 lastNewslettersCriteria = criteria; 842 843 return collNewsletters; 844 } 845 846 847 848 849 850 851 852 853 854 865 protected List getNewslettersJoinProjectRelatedByProjectId(Criteria criteria) 866 throws TorqueException 867 { 868 if (collNewsletters == null) 869 { 870 if (isNew()) 871 { 872 collNewsletters = new ArrayList (); 873 } 874 else 875 { 876 criteria.add(NewsletterPeer.CUST_COUNTRY_ID, getCountryId()); 877 collNewsletters = NewsletterPeer.doSelectJoinProjectRelatedByProjectId(criteria); 878 } 879 } 880 else 881 { 882 886 criteria.add(NewsletterPeer.CUST_COUNTRY_ID, getCountryId()); 887 if (!lastNewslettersCriteria.equals(criteria)) 888 { 889 collNewsletters = NewsletterPeer.doSelectJoinProjectRelatedByProjectId(criteria); 890 } 891 } 892 lastNewslettersCriteria = criteria; 893 894 return collNewsletters; 895 } 896 897 898 899 900 901 902 903 904 905 916 protected List getNewslettersJoinProductRelatedByProductId(Criteria criteria) 917 throws TorqueException 918 { 919 if (collNewsletters == null) 920 { 921 if (isNew()) 922 { 923 collNewsletters = new ArrayList (); 924 } 925 else 926 { 927 criteria.add(NewsletterPeer.CUST_COUNTRY_ID, getCountryId()); 928 collNewsletters = NewsletterPeer.doSelectJoinProductRelatedByProductId(criteria); 929 } 930 } 931 else 932 { 933 937 criteria.add(NewsletterPeer.CUST_COUNTRY_ID, getCountryId()); 938 if (!lastNewslettersCriteria.equals(criteria)) 939 { 940 collNewsletters = NewsletterPeer.doSelectJoinProductRelatedByProductId(criteria); 941 } 942 } 943 lastNewslettersCriteria = criteria; 944 945 return collNewsletters; 946 } 947 948 949 950 951 952 953 954 955 956 967 protected List getNewslettersJoinProjectRelatedByRelProjectId(Criteria criteria) 968 throws TorqueException 969 { 970 if (collNewsletters == null) 971 { 972 if (isNew()) 973 { 974 collNewsletters = new ArrayList (); 975 } 976 else 977 { 978 criteria.add(NewsletterPeer.CUST_COUNTRY_ID, getCountryId()); 979 collNewsletters = NewsletterPeer.doSelectJoinProjectRelatedByRelProjectId(criteria); 980 } 981 } 982 else 983 { 984 988 criteria.add(NewsletterPeer.CUST_COUNTRY_ID, getCountryId()); 989 if (!lastNewslettersCriteria.equals(criteria)) 990 { 991 collNewsletters = NewsletterPeer.doSelectJoinProjectRelatedByRelProjectId(criteria); 992 } 993 } 994 lastNewslettersCriteria = criteria; 995 996 return collNewsletters; 997 } 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1018 protected List getNewslettersJoinProductRelatedByRelProductId(Criteria criteria) 1019 throws TorqueException 1020 { 1021 if (collNewsletters == null) 1022 { 1023 if (isNew()) 1024 { 1025 collNewsletters = new ArrayList (); 1026 } 1027 else 1028 { 1029 criteria.add(NewsletterPeer.CUST_COUNTRY_ID, getCountryId()); 1030 collNewsletters = NewsletterPeer.doSelectJoinProductRelatedByRelProductId(criteria); 1031 } 1032 } 1033 else 1034 { 1035 1039 criteria.add(NewsletterPeer.CUST_COUNTRY_ID, getCountryId()); 1040 if (!lastNewslettersCriteria.equals(criteria)) 1041 { 1042 collNewsletters = NewsletterPeer.doSelectJoinProductRelatedByRelProductId(criteria); 1043 } 1044 } 1045 lastNewslettersCriteria = criteria; 1046 1047 return collNewsletters; 1048 } 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1069 protected List getNewslettersJoinCountry(Criteria criteria) 1070 throws TorqueException 1071 { 1072 if (collNewsletters == null) 1073 { 1074 if (isNew()) 1075 { 1076 collNewsletters = new ArrayList (); 1077 } 1078 else 1079 { 1080 criteria.add(NewsletterPeer.CUST_COUNTRY_ID, getCountryId()); 1081 collNewsletters = NewsletterPeer.doSelectJoinCountry(criteria); 1082 } 1083 } 1084 else 1085 { 1086 1090 criteria.add(NewsletterPeer.CUST_COUNTRY_ID, getCountryId()); 1091 if (!lastNewslettersCriteria.equals(criteria)) 1092 { 1093 collNewsletters = NewsletterPeer.doSelectJoinCountry(criteria); 1094 } 1095 } 1096 lastNewslettersCriteria = criteria; 1097 1098 return collNewsletters; 1099 } 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1120 protected List getNewslettersJoinLanguageRelatedByCustLanguageId(Criteria criteria) 1121 throws TorqueException 1122 { 1123 if (collNewsletters == null) 1124 { 1125 if (isNew()) 1126 { 1127 collNewsletters = new ArrayList (); 1128 } 1129 else 1130 { 1131 criteria.add(NewsletterPeer.CUST_COUNTRY_ID, getCountryId()); 1132 collNewsletters = NewsletterPeer.doSelectJoinLanguageRelatedByCustLanguageId(criteria); 1133 } 1134 } 1135 else 1136 { 1137 1141 criteria.add(NewsletterPeer.CUST_COUNTRY_ID, getCountryId()); 1142 if (!lastNewslettersCriteria.equals(criteria)) 1143 { 1144 collNewsletters = NewsletterPeer.doSelectJoinLanguageRelatedByCustLanguageId(criteria); 1145 } 1146 } 1147 lastNewslettersCriteria = criteria; 1148 1149 return collNewsletters; 1150 } 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1171 protected List getNewslettersJoinLanguageRelatedByLanguageId(Criteria criteria) 1172 throws TorqueException 1173 { 1174 if (collNewsletters == null) 1175 { 1176 if (isNew()) 1177 { 1178 collNewsletters = new ArrayList (); 1179 } 1180 else 1181 { 1182 criteria.add(NewsletterPeer.CUST_COUNTRY_ID, getCountryId()); 1183 collNewsletters = NewsletterPeer.doSelectJoinLanguageRelatedByLanguageId(criteria); 1184 } 1185 } 1186 else 1187 { 1188 1192 criteria.add(NewsletterPeer.CUST_COUNTRY_ID, getCountryId()); 1193 if (!lastNewslettersCriteria.equals(criteria)) 1194 { 1195 collNewsletters = NewsletterPeer.doSelectJoinLanguageRelatedByLanguageId(criteria); 1196 } 1197 } 1198 lastNewslettersCriteria = criteria; 1199 1200 return collNewsletters; 1201 } 1202 1203 1204 1205 1206 private static List fieldNames = null; 1207 1208 1213 public static synchronized List getFieldNames() 1214 { 1215 if (fieldNames == null) 1216 { 1217 fieldNames = new ArrayList (); 1218 fieldNames.add("CountryId"); 1219 fieldNames.add("CountryName"); 1220 fieldNames.add("CountryCode"); 1221 fieldNames = Collections.unmodifiableList(fieldNames); 1222 } 1223 return fieldNames; 1224 } 1225 1226 1232 public Object getByName(String name) 1233 { 1234 if (name.equals("CountryId")) 1235 { 1236 return new Integer (getCountryId()); 1237 } 1238 if (name.equals("CountryName")) 1239 { 1240 return getCountryName(); 1241 } 1242 if (name.equals("CountryCode")) 1243 { 1244 return getCountryCode(); 1245 } 1246 return null; 1247 } 1248 1249 1257 public Object getByPeerName(String name) 1258 { 1259 if (name.equals(CountryPeer.COUNTRY_ID)) 1260 { 1261 return new Integer (getCountryId()); 1262 } 1263 if (name.equals(CountryPeer.COUNTRY_NAME)) 1264 { 1265 return getCountryName(); 1266 } 1267 if (name.equals(CountryPeer.COUNTRY_CODE)) 1268 { 1269 return getCountryCode(); 1270 } 1271 return null; 1272 } 1273 1274 1281 public Object getByPosition(int pos) 1282 { 1283 if (pos == 0) 1284 { 1285 return new Integer (getCountryId()); 1286 } 1287 if (pos == 1) 1288 { 1289 return getCountryName(); 1290 } 1291 if (pos == 2) 1292 { 1293 return getCountryCode(); 1294 } 1295 return null; 1296 } 1297 1298 1304 public void save() throws Exception 1305 { 1306 save(CountryPeer.getMapBuilder() 1307 .getDatabaseMap().getName()); 1308 } 1309 1310 1320 public void save(String dbName) throws TorqueException 1321 { 1322 Connection con = null; 1323 try 1324 { 1325 con = Transaction.begin(dbName); 1326 save(con); 1327 Transaction.commit(con); 1328 } 1329 catch(TorqueException e) 1330 { 1331 Transaction.safeRollback(con); 1332 throw e; 1333 } 1334 } 1335 1336 1338 private boolean alreadyInSave = false; 1339 1349 public void save(Connection con) throws TorqueException 1350 { 1351 if (!alreadyInSave) 1352 { 1353 alreadyInSave = true; 1354 1355 1356 1357 if (isModified()) 1359 { 1360 if (isNew()) 1361 { 1362 CountryPeer.doInsert((Country) this, con); 1363 setNew(false); 1364 } 1365 else 1366 { 1367 CountryPeer.doUpdate((Country) this, con); 1368 } 1369 } 1370 1371 1372 1373 if (collCustomers != null) 1374 { 1375 for (int i = 0; i < collCustomers.size(); i++) 1376 { 1377 ((Customer) collCustomers.get(i)).save(con); 1378 } 1379 } 1380 1381 1382 if (collNewsletters != null) 1383 { 1384 for (int i = 0; i < collNewsletters.size(); i++) 1385 { 1386 ((Newsletter) collNewsletters.get(i)).save(con); 1387 } 1388 } 1389 alreadyInSave = false; 1390 } 1391 } 1392 1393 1394 1399 public void setPrimaryKey(ObjectKey key) 1400 throws TorqueException 1401 { 1402 setCountryId(((NumberKey) key).intValue()); 1403 } 1404 1405 1410 public void setPrimaryKey(String key) throws TorqueException 1411 { 1412 setCountryId(Integer.parseInt(key)); 1413 } 1414 1415 1416 1420 public ObjectKey getPrimaryKey() 1421 { 1422 return SimpleKey.keyFor(getCountryId()); 1423 } 1424 1425 1429 public String getQueryKey() 1430 { 1431 if (getPrimaryKey() == null) 1432 { 1433 return ""; 1434 } 1435 else 1436 { 1437 return getPrimaryKey().toString(); 1438 } 1439 } 1440 1441 1445 public void setQueryKey(String key) 1446 throws TorqueException 1447 { 1448 setPrimaryKey(key); 1449 } 1450 1451 1457 public Country copy() throws TorqueException 1458 { 1459 return copyInto(new Country()); 1460 } 1461 1462 protected Country copyInto(Country copyObj) throws TorqueException 1463 { 1464 copyObj.setCountryId(countryId); 1465 copyObj.setCountryName(countryName); 1466 copyObj.setCountryCode(countryCode); 1467 1468 copyObj.setCountryId( 0); 1469 1470 1471 1472 List v = getCustomers(); 1473 for (int i = 0; i < v.size(); i++) 1474 { 1475 Customer obj = (Customer) v.get(i); 1476 copyObj.addCustomer(obj.copy()); 1477 } 1478 1479 1480 v = getNewsletters(); 1481 for (int i = 0; i < v.size(); i++) 1482 { 1483 Newsletter obj = (Newsletter) v.get(i); 1484 copyObj.addNewsletter(obj.copy()); 1485 } 1486 return copyObj; 1487 } 1488 1489 1495 public CountryPeer getPeer() 1496 { 1497 return peer; 1498 } 1499 1500 public String toString() 1501 { 1502 StringBuffer str = new StringBuffer (); 1503 str.append("Country:\n"); 1504 str.append("CountryId = ") 1505 .append(getCountryId()) 1506 .append("\n"); 1507 str.append("CountryName = ") 1508 .append(getCountryName()) 1509 .append("\n"); 1510 str.append("CountryCode = ") 1511 .append(getCountryCode()) 1512 .append("\n"); 1513 return(str.toString()); 1514 } 1515} 1516 | Popular Tags |