1 package org.apache.jetspeed.om.dbregistry; 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.om.BaseObject; 14 import org.apache.torque.om.ComboKey; 15 import org.apache.torque.om.DateKey; 16 import org.apache.torque.om.NumberKey; 17 import org.apache.torque.om.ObjectKey; 18 import org.apache.torque.om.SimpleKey; 19 import org.apache.torque.om.StringKey; 20 import org.apache.torque.om.Persistent; 21 import org.apache.torque.util.Criteria; 22 import org.apache.torque.util.Transaction; 23 24 25 33 public abstract class BasePortletDbEntry extends BaseObject 34 { 35 36 private static final PortletDbEntryPeer peer = 37 new PortletDbEntryPeer(); 38 39 40 41 private long id; 42 43 44 private String name; 45 46 47 private boolean hidden=false; 48 49 50 private String classname; 51 52 53 private String type; 54 55 56 private boolean application=false; 57 58 59 private long parentRef; 60 61 62 private String uRL; 63 64 65 private boolean cachedonurl=true; 66 67 68 private String role; 69 70 71 private String title; 72 73 74 private String description; 75 76 77 private String image; 78 79 80 private String securityRef; 81 82 83 87 public long getId() 88 { 89 return id; 90 } 91 92 93 96 public void setId(long v ) throws TorqueException 97 { 98 99 if (this.id != v) 100 { 101 this.id = v; 102 setModified(true); 103 } 104 105 106 107 if (collPortletCategorys != null ) 109 { 110 for (int i = 0; i < collPortletCategorys.size(); i++) 111 { 112 ((PortletCategory)collPortletCategorys.get(i)) 113 .setOwner(v); 114 } 115 } 116 117 if (collPortletParameters != null ) 119 { 120 for (int i = 0; i < collPortletParameters.size(); i++) 121 { 122 ((PortletParameter)collPortletParameters.get(i)) 123 .setPortletId(v); 124 } 125 } 126 127 if (collPortletMediatypes != null ) 129 { 130 for (int i = 0; i < collPortletMediatypes.size(); i++) 131 { 132 ((PortletMediatype)collPortletMediatypes.get(i)) 133 .setId(v); 134 } 135 } 136 } 137 138 139 143 public String getName() 144 { 145 return name; 146 } 147 148 149 152 public void setName(String v ) 153 { 154 155 if (!ObjectUtils.equals(this.name, v)) 156 { 157 this.name = v; 158 setModified(true); 159 } 160 161 162 } 163 164 165 169 public boolean getHidden() 170 { 171 return hidden; 172 } 173 174 175 178 public void setHidden(boolean v ) 179 { 180 181 if (this.hidden != v) 182 { 183 this.hidden = v; 184 setModified(true); 185 } 186 187 188 } 189 190 191 195 public String getClassname() 196 { 197 return classname; 198 } 199 200 201 204 public void setClassname(String v ) 205 { 206 207 if (!ObjectUtils.equals(this.classname, v)) 208 { 209 this.classname = v; 210 setModified(true); 211 } 212 213 214 } 215 216 217 221 public String getType() 222 { 223 return type; 224 } 225 226 227 230 public void setType(String v ) 231 { 232 233 if (!ObjectUtils.equals(this.type, v)) 234 { 235 this.type = v; 236 setModified(true); 237 } 238 239 240 } 241 242 243 247 public boolean getApplication() 248 { 249 return application; 250 } 251 252 253 256 public void setApplication(boolean v ) 257 { 258 259 if (this.application != v) 260 { 261 this.application = v; 262 setModified(true); 263 } 264 265 266 } 267 268 269 273 public long getParentRef() 274 { 275 return parentRef; 276 } 277 278 279 282 public void setParentRef(long v ) 283 { 284 285 if (this.parentRef != v) 286 { 287 this.parentRef = v; 288 setModified(true); 289 } 290 291 292 } 293 294 295 299 public String getURL() 300 { 301 return uRL; 302 } 303 304 305 308 public void setURL(String v ) 309 { 310 311 if (!ObjectUtils.equals(this.uRL, v)) 312 { 313 this.uRL = v; 314 setModified(true); 315 } 316 317 318 } 319 320 321 325 public boolean getCachedonurl() 326 { 327 return cachedonurl; 328 } 329 330 331 334 public void setCachedonurl(boolean v ) 335 { 336 337 if (this.cachedonurl != v) 338 { 339 this.cachedonurl = v; 340 setModified(true); 341 } 342 343 344 } 345 346 347 351 public String getRole() 352 { 353 return role; 354 } 355 356 357 360 public void setRole(String v ) 361 { 362 363 if (!ObjectUtils.equals(this.role, v)) 364 { 365 this.role = v; 366 setModified(true); 367 } 368 369 370 } 371 372 373 377 public String getTitle() 378 { 379 return title; 380 } 381 382 383 386 public void setTitle(String v ) 387 { 388 389 if (!ObjectUtils.equals(this.title, v)) 390 { 391 this.title = v; 392 setModified(true); 393 } 394 395 396 } 397 398 399 403 public String getDescription() 404 { 405 return description; 406 } 407 408 409 412 public void setDescription(String v ) 413 { 414 415 if (!ObjectUtils.equals(this.description, v)) 416 { 417 this.description = v; 418 setModified(true); 419 } 420 421 422 } 423 424 425 429 public String getImage() 430 { 431 return image; 432 } 433 434 435 438 public void setImage(String v ) 439 { 440 441 if (!ObjectUtils.equals(this.image, v)) 442 { 443 this.image = v; 444 setModified(true); 445 } 446 447 448 } 449 450 451 455 public String getSecurityRef() 456 { 457 return securityRef; 458 } 459 460 461 464 public void setSecurityRef(String v ) 465 { 466 467 if (!ObjectUtils.equals(this.securityRef, v)) 468 { 469 this.securityRef = v; 470 setModified(true); 471 } 472 473 474 } 475 476 477 478 479 480 483 protected List collPortletCategorys; 484 485 490 protected void initPortletCategorys() 491 { 492 if (collPortletCategorys == null) 493 { 494 collPortletCategorys = new ArrayList (); 495 } 496 } 497 498 499 505 public void addPortletCategory(PortletCategory l) throws TorqueException 506 { 507 getPortletCategorys().add(l); 508 l.setPortletDbEntry((PortletDbEntry)this); 509 } 510 511 514 private Criteria lastPortletCategorysCriteria = null; 515 516 521 public List getPortletCategorys() throws TorqueException 522 { 523 if (collPortletCategorys == null) 524 { 525 collPortletCategorys = getPortletCategorys(new Criteria(10)); 526 } 527 return collPortletCategorys; 528 } 529 530 539 public List getPortletCategorys(Criteria criteria) throws TorqueException 540 { 541 if (collPortletCategorys == null) 542 { 543 if (isNew()) 544 { 545 collPortletCategorys = new ArrayList (); 546 } 547 else 548 { 549 criteria.add(PortletCategoryPeer.OWNER, getId() ); 550 collPortletCategorys = PortletCategoryPeer.doSelect(criteria); 551 } 552 } 553 else 554 { 555 if (!isNew()) 557 { 558 criteria.add(PortletCategoryPeer.OWNER, getId() ); 562 if (!lastPortletCategorysCriteria.equals(criteria)) 563 { 564 collPortletCategorys = PortletCategoryPeer.doSelect(criteria); 565 } 566 } 567 } 568 lastPortletCategorysCriteria = criteria; 569 570 return collPortletCategorys; 571 } 572 573 581 public List getPortletCategorys(Connection con) throws TorqueException 582 { 583 if (collPortletCategorys == null) 584 { 585 collPortletCategorys = getPortletCategorys(new Criteria(10),con); 586 } 587 return collPortletCategorys; 588 } 589 590 602 public List getPortletCategorys(Criteria criteria,Connection con) throws TorqueException 603 { 604 if (collPortletCategorys == null) 605 { 606 if (isNew()) 607 { 608 collPortletCategorys = new ArrayList (); 609 } 610 else 611 { 612 criteria.add(PortletCategoryPeer.OWNER, getId() ); 613 collPortletCategorys = PortletCategoryPeer.doSelect(criteria,con); 614 } 615 } 616 else 617 { 618 if (!isNew()) 620 { 621 criteria.add(PortletCategoryPeer.OWNER, getId() ); 625 if (!lastPortletCategorysCriteria.equals(criteria)) 626 { 627 collPortletCategorys = PortletCategoryPeer.doSelect(criteria,con); 628 } 629 } 630 } 631 lastPortletCategorysCriteria = criteria; 632 633 return collPortletCategorys; 634 } 635 636 637 638 639 640 641 642 643 644 645 646 647 658 protected List getPortletCategorysJoinPortletDbEntry(Criteria criteria) 659 throws TorqueException 660 { 661 if (collPortletCategorys == null) 662 { 663 if (isNew()) 664 { 665 collPortletCategorys = new ArrayList (); 666 } 667 else 668 { 669 criteria.add(PortletCategoryPeer.OWNER, getId() ); 670 collPortletCategorys = PortletCategoryPeer.doSelectJoinPortletDbEntry(criteria); 671 } 672 } 673 else 674 { 675 boolean newCriteria = true; 679 criteria.add(PortletCategoryPeer.OWNER, getId() ); 680 if (!lastPortletCategorysCriteria.equals(criteria)) 681 { 682 collPortletCategorys = PortletCategoryPeer.doSelectJoinPortletDbEntry(criteria); 683 } 684 } 685 lastPortletCategorysCriteria = criteria; 686 687 return collPortletCategorys; 688 } 689 690 691 692 693 694 697 protected List collPortletParameters; 698 699 704 protected void initPortletParameters() 705 { 706 if (collPortletParameters == null) 707 { 708 collPortletParameters = new ArrayList (); 709 } 710 } 711 712 713 719 public void addPortletParameter(PortletParameter l) throws TorqueException 720 { 721 getPortletParameters().add(l); 722 l.setPortletDbEntry((PortletDbEntry)this); 723 } 724 725 728 private Criteria lastPortletParametersCriteria = null; 729 730 735 public List getPortletParameters() throws TorqueException 736 { 737 if (collPortletParameters == null) 738 { 739 collPortletParameters = getPortletParameters(new Criteria(10)); 740 } 741 return collPortletParameters; 742 } 743 744 753 public List getPortletParameters(Criteria criteria) throws TorqueException 754 { 755 if (collPortletParameters == null) 756 { 757 if (isNew()) 758 { 759 collPortletParameters = new ArrayList (); 760 } 761 else 762 { 763 criteria.add(PortletParameterPeer.PORTLET_ID, getId() ); 764 collPortletParameters = PortletParameterPeer.doSelect(criteria); 765 } 766 } 767 else 768 { 769 if (!isNew()) 771 { 772 criteria.add(PortletParameterPeer.PORTLET_ID, getId() ); 776 if (!lastPortletParametersCriteria.equals(criteria)) 777 { 778 collPortletParameters = PortletParameterPeer.doSelect(criteria); 779 } 780 } 781 } 782 lastPortletParametersCriteria = criteria; 783 784 return collPortletParameters; 785 } 786 787 795 public List getPortletParameters(Connection con) throws TorqueException 796 { 797 if (collPortletParameters == null) 798 { 799 collPortletParameters = getPortletParameters(new Criteria(10),con); 800 } 801 return collPortletParameters; 802 } 803 804 816 public List getPortletParameters(Criteria criteria,Connection con) throws TorqueException 817 { 818 if (collPortletParameters == null) 819 { 820 if (isNew()) 821 { 822 collPortletParameters = new ArrayList (); 823 } 824 else 825 { 826 criteria.add(PortletParameterPeer.PORTLET_ID, getId() ); 827 collPortletParameters = PortletParameterPeer.doSelect(criteria,con); 828 } 829 } 830 else 831 { 832 if (!isNew()) 834 { 835 criteria.add(PortletParameterPeer.PORTLET_ID, getId() ); 839 if (!lastPortletParametersCriteria.equals(criteria)) 840 { 841 collPortletParameters = PortletParameterPeer.doSelect(criteria,con); 842 } 843 } 844 } 845 lastPortletParametersCriteria = criteria; 846 847 return collPortletParameters; 848 } 849 850 851 852 853 854 855 856 857 858 859 860 861 872 protected List getPortletParametersJoinPortletDbEntry(Criteria criteria) 873 throws TorqueException 874 { 875 if (collPortletParameters == null) 876 { 877 if (isNew()) 878 { 879 collPortletParameters = new ArrayList (); 880 } 881 else 882 { 883 criteria.add(PortletParameterPeer.PORTLET_ID, getId() ); 884 collPortletParameters = PortletParameterPeer.doSelectJoinPortletDbEntry(criteria); 885 } 886 } 887 else 888 { 889 boolean newCriteria = true; 893 criteria.add(PortletParameterPeer.PORTLET_ID, getId() ); 894 if (!lastPortletParametersCriteria.equals(criteria)) 895 { 896 collPortletParameters = PortletParameterPeer.doSelectJoinPortletDbEntry(criteria); 897 } 898 } 899 lastPortletParametersCriteria = criteria; 900 901 return collPortletParameters; 902 } 903 904 905 906 907 908 911 protected List collPortletMediatypes; 912 913 918 protected void initPortletMediatypes() 919 { 920 if (collPortletMediatypes == null) 921 { 922 collPortletMediatypes = new ArrayList (); 923 } 924 } 925 926 927 933 public void addPortletMediatype(PortletMediatype l) throws TorqueException 934 { 935 getPortletMediatypes().add(l); 936 l.setPortletDbEntry((PortletDbEntry)this); 937 } 938 939 942 private Criteria lastPortletMediatypesCriteria = null; 943 944 949 public List getPortletMediatypes() throws TorqueException 950 { 951 if (collPortletMediatypes == null) 952 { 953 collPortletMediatypes = getPortletMediatypes(new Criteria(10)); 954 } 955 return collPortletMediatypes; 956 } 957 958 967 public List getPortletMediatypes(Criteria criteria) throws TorqueException 968 { 969 if (collPortletMediatypes == null) 970 { 971 if (isNew()) 972 { 973 collPortletMediatypes = new ArrayList (); 974 } 975 else 976 { 977 criteria.add(PortletMediatypePeer.ID, getId() ); 978 collPortletMediatypes = PortletMediatypePeer.doSelect(criteria); 979 } 980 } 981 else 982 { 983 if (!isNew()) 985 { 986 criteria.add(PortletMediatypePeer.ID, getId() ); 990 if (!lastPortletMediatypesCriteria.equals(criteria)) 991 { 992 collPortletMediatypes = PortletMediatypePeer.doSelect(criteria); 993 } 994 } 995 } 996 lastPortletMediatypesCriteria = criteria; 997 998 return collPortletMediatypes; 999 } 1000 1001 1009 public List getPortletMediatypes(Connection con) throws TorqueException 1010 { 1011 if (collPortletMediatypes == null) 1012 { 1013 collPortletMediatypes = getPortletMediatypes(new Criteria(10),con); 1014 } 1015 return collPortletMediatypes; 1016 } 1017 1018 1030 public List getPortletMediatypes(Criteria criteria,Connection con) throws TorqueException 1031 { 1032 if (collPortletMediatypes == null) 1033 { 1034 if (isNew()) 1035 { 1036 collPortletMediatypes = new ArrayList (); 1037 } 1038 else 1039 { 1040 criteria.add(PortletMediatypePeer.ID, getId() ); 1041 collPortletMediatypes = PortletMediatypePeer.doSelect(criteria,con); 1042 } 1043 } 1044 else 1045 { 1046 if (!isNew()) 1048 { 1049 criteria.add(PortletMediatypePeer.ID, getId() ); 1053 if (!lastPortletMediatypesCriteria.equals(criteria)) 1054 { 1055 collPortletMediatypes = PortletMediatypePeer.doSelect(criteria,con); 1056 } 1057 } 1058 } 1059 lastPortletMediatypesCriteria = criteria; 1060 1061 return collPortletMediatypes; 1062 } 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1086 protected List getPortletMediatypesJoinPortletDbEntry(Criteria criteria) 1087 throws TorqueException 1088 { 1089 if (collPortletMediatypes == null) 1090 { 1091 if (isNew()) 1092 { 1093 collPortletMediatypes = new ArrayList (); 1094 } 1095 else 1096 { 1097 criteria.add(PortletMediatypePeer.ID, getId() ); 1098 collPortletMediatypes = PortletMediatypePeer.doSelectJoinPortletDbEntry(criteria); 1099 } 1100 } 1101 else 1102 { 1103 boolean newCriteria = true; 1107 criteria.add(PortletMediatypePeer.ID, getId() ); 1108 if (!lastPortletMediatypesCriteria.equals(criteria)) 1109 { 1110 collPortletMediatypes = PortletMediatypePeer.doSelectJoinPortletDbEntry(criteria); 1111 } 1112 } 1113 lastPortletMediatypesCriteria = criteria; 1114 1115 return collPortletMediatypes; 1116 } 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1137 protected List getPortletMediatypesJoinMediatype(Criteria criteria) 1138 throws TorqueException 1139 { 1140 if (collPortletMediatypes == null) 1141 { 1142 if (isNew()) 1143 { 1144 collPortletMediatypes = new ArrayList (); 1145 } 1146 else 1147 { 1148 criteria.add(PortletMediatypePeer.ID, getId() ); 1149 collPortletMediatypes = PortletMediatypePeer.doSelectJoinMediatype(criteria); 1150 } 1151 } 1152 else 1153 { 1154 boolean newCriteria = true; 1158 criteria.add(PortletMediatypePeer.ID, getId() ); 1159 if (!lastPortletMediatypesCriteria.equals(criteria)) 1160 { 1161 collPortletMediatypes = PortletMediatypePeer.doSelectJoinMediatype(criteria); 1162 } 1163 } 1164 lastPortletMediatypesCriteria = criteria; 1165 1166 return collPortletMediatypes; 1167 } 1168 1169 1170 1171 1172 private static List fieldNames = null; 1173 1174 1177 public static synchronized List getFieldNames() 1178 { 1179 if (fieldNames == null) 1180 { 1181 fieldNames = new ArrayList (); 1182 fieldNames.add("Id"); 1183 fieldNames.add("Name"); 1184 fieldNames.add("Hidden"); 1185 fieldNames.add("Classname"); 1186 fieldNames.add("Type"); 1187 fieldNames.add("Application"); 1188 fieldNames.add("ParentRef"); 1189 fieldNames.add("URL"); 1190 fieldNames.add("Cachedonurl"); 1191 fieldNames.add("Role"); 1192 fieldNames.add("Title"); 1193 fieldNames.add("Description"); 1194 fieldNames.add("Image"); 1195 fieldNames.add("SecurityRef"); 1196 fieldNames = Collections.unmodifiableList(fieldNames); 1197 } 1198 return fieldNames; 1199 } 1200 1201 1205 public Object getByName(String name) 1206 { 1207 if (name.equals("Id")) 1208 { 1209 return new Long (getId()); 1210 } 1211 if (name.equals("Name")) 1212 { 1213 return getName(); 1214 } 1215 if (name.equals("Hidden")) 1216 { 1217 return new Boolean (getHidden()); 1218 } 1219 if (name.equals("Classname")) 1220 { 1221 return getClassname(); 1222 } 1223 if (name.equals("Type")) 1224 { 1225 return getType(); 1226 } 1227 if (name.equals("Application")) 1228 { 1229 return new Boolean (getApplication()); 1230 } 1231 if (name.equals("ParentRef")) 1232 { 1233 return new Long (getParentRef()); 1234 } 1235 if (name.equals("URL")) 1236 { 1237 return getURL(); 1238 } 1239 if (name.equals("Cachedonurl")) 1240 { 1241 return new Boolean (getCachedonurl()); 1242 } 1243 if (name.equals("Role")) 1244 { 1245 return getRole(); 1246 } 1247 if (name.equals("Title")) 1248 { 1249 return getTitle(); 1250 } 1251 if (name.equals("Description")) 1252 { 1253 return getDescription(); 1254 } 1255 if (name.equals("Image")) 1256 { 1257 return getImage(); 1258 } 1259 if (name.equals("SecurityRef")) 1260 { 1261 return getSecurityRef(); 1262 } 1263 return null; 1264 } 1265 1266 1271 public Object getByPeerName(String name) 1272 { 1273 if (name.equals(PortletDbEntryPeer.ID )) 1274 { 1275 return new Long (getId()); 1276 } 1277 if (name.equals(PortletDbEntryPeer.NAME )) 1278 { 1279 return getName(); 1280 } 1281 if (name.equals(PortletDbEntryPeer.HIDDEN )) 1282 { 1283 return new Boolean (getHidden()); 1284 } 1285 if (name.equals(PortletDbEntryPeer.CLASSNAME )) 1286 { 1287 return getClassname(); 1288 } 1289 if (name.equals(PortletDbEntryPeer.TYPE )) 1290 { 1291 return getType(); 1292 } 1293 if (name.equals(PortletDbEntryPeer.APPLICATION )) 1294 { 1295 return new Boolean (getApplication()); 1296 } 1297 if (name.equals(PortletDbEntryPeer.PARENT )) 1298 { 1299 return new Long (getParentRef()); 1300 } 1301 if (name.equals(PortletDbEntryPeer.URL )) 1302 { 1303 return getURL(); 1304 } 1305 if (name.equals(PortletDbEntryPeer.CACHEDONURL )) 1306 { 1307 return new Boolean (getCachedonurl()); 1308 } 1309 if (name.equals(PortletDbEntryPeer.ROLE )) 1310 { 1311 return getRole(); 1312 } 1313 if (name.equals(PortletDbEntryPeer.TITLE )) 1314 { 1315 return getTitle(); 1316 } 1317 if (name.equals(PortletDbEntryPeer.DESCRIPTION )) 1318 { 1319 return getDescription(); 1320 } 1321 if (name.equals(PortletDbEntryPeer.IMAGE )) 1322 { 1323 return getImage(); 1324 } 1325 if (name.equals(PortletDbEntryPeer.SECURITY )) 1326 { 1327 return getSecurityRef(); 1328 } 1329 return null; 1330 } 1331 1332 1336 public Object getByPosition(int pos) 1337 { 1338 if ( pos == 0 ) 1339 { 1340 return new Long (getId()); 1341 } 1342 if ( pos == 1 ) 1343 { 1344 return getName(); 1345 } 1346 if ( pos == 2 ) 1347 { 1348 return new Boolean (getHidden()); 1349 } 1350 if ( pos == 3 ) 1351 { 1352 return getClassname(); 1353 } 1354 if ( pos == 4 ) 1355 { 1356 return getType(); 1357 } 1358 if ( pos == 5 ) 1359 { 1360 return new Boolean (getApplication()); 1361 } 1362 if ( pos == 6 ) 1363 { 1364 return new Long (getParentRef()); 1365 } 1366 if ( pos == 7 ) 1367 { 1368 return getURL(); 1369 } 1370 if ( pos == 8 ) 1371 { 1372 return new Boolean (getCachedonurl()); 1373 } 1374 if ( pos == 9 ) 1375 { 1376 return getRole(); 1377 } 1378 if ( pos == 10 ) 1379 { 1380 return getTitle(); 1381 } 1382 if ( pos == 11 ) 1383 { 1384 return getDescription(); 1385 } 1386 if ( pos == 12 ) 1387 { 1388 return getImage(); 1389 } 1390 if ( pos == 13 ) 1391 { 1392 return getSecurityRef(); 1393 } 1394 return null; 1395 } 1396 1397 1401 public void save() throws Exception 1402 { 1403 save(PortletDbEntryPeer.getMapBuilder() 1404 .getDatabaseMap().getName()); 1405 } 1406 1407 1414 public void save(String dbName) throws TorqueException 1415 { 1416 Connection con = null; 1417 try 1418 { 1419 con = Transaction.begin(dbName); 1420 save(con); 1421 Transaction.commit(con); 1422 } 1423 catch(TorqueException e) 1424 { 1425 Transaction.safeRollback(con); 1426 throw e; 1427 } 1428 } 1429 1430 1432 private boolean alreadyInSave = false; 1433 1440 public void save(Connection con) throws TorqueException 1441 { 1442 if (!alreadyInSave) 1443 { 1444 alreadyInSave = true; 1445 1446 1447 1448 if (isModified()) 1450 { 1451 if (isNew()) 1452 { 1453 PortletDbEntryPeer.doInsert((PortletDbEntry)this, con); 1454 setNew(false); 1455 } 1456 else 1457 { 1458 PortletDbEntryPeer.doUpdate((PortletDbEntry)this, con); 1459 } 1460 1461 if (isCacheOnSave()) 1462 { 1463 PortletDbEntryManager.putInstance(this); 1464 } 1465 } 1466 1467 1468 if (collPortletCategorys != null ) 1469 { 1470 for (int i = 0; i < collPortletCategorys.size(); i++) 1471 { 1472 ((PortletCategory)collPortletCategorys.get(i)).save(con); 1473 } 1474 } 1475 1476 if (collPortletParameters != null ) 1477 { 1478 for (int i = 0; i < collPortletParameters.size(); i++) 1479 { 1480 ((PortletParameter)collPortletParameters.get(i)).save(con); 1481 } 1482 } 1483 1484 if (collPortletMediatypes != null ) 1485 { 1486 for (int i = 0; i < collPortletMediatypes.size(); i++) 1487 { 1488 ((PortletMediatype)collPortletMediatypes.get(i)).save(con); 1489 } 1490 } 1491 alreadyInSave = false; 1492 } 1493 } 1494 1495 1499 protected boolean isCacheOnSave() 1500 { 1501 return true; 1502 } 1503 1504 1505 1510 public void setPrimaryKey(ObjectKey id) 1511 throws TorqueException { 1512 setId(((NumberKey)id).longValue()); 1513 } 1514 1515 1518 public void setPrimaryKey(String key) throws TorqueException 1519 { 1520 setId(Long.parseLong(key)); 1521 } 1522 1523 1524 1528 public ObjectKey getPrimaryKey() 1529 { 1530 return SimpleKey.keyFor(getId()); 1531 } 1532 1533 1534 1539 public PortletDbEntry copy() throws TorqueException 1540 { 1541 PortletDbEntry copyObj = new PortletDbEntry(); 1542 copyObj.setId(id); 1543 copyObj.setName(name); 1544 copyObj.setHidden(hidden); 1545 copyObj.setClassname(classname); 1546 copyObj.setType(type); 1547 copyObj.setApplication(application); 1548 copyObj.setParentRef(parentRef); 1549 copyObj.setURL(uRL); 1550 copyObj.setCachedonurl(cachedonurl); 1551 copyObj.setRole(role); 1552 copyObj.setTitle(title); 1553 copyObj.setDescription(description); 1554 copyObj.setImage(image); 1555 copyObj.setSecurityRef(securityRef); 1556 1557 copyObj.setId(0); 1558 1559 1560 1561 List v = getPortletCategorys(); 1562 for (int i = 0; i < v.size(); i++) 1563 { 1564 PortletCategory obj = (PortletCategory) v.get(i); 1565 copyObj.addPortletCategory(obj.copy()); 1566 } 1567 1568 1569 v = getPortletParameters(); 1570 for (int i = 0; i < v.size(); i++) 1571 { 1572 PortletParameter obj = (PortletParameter) v.get(i); 1573 copyObj.addPortletParameter(obj.copy()); 1574 } 1575 1576 1577 v = getPortletMediatypes(); 1578 for (int i = 0; i < v.size(); i++) 1579 { 1580 PortletMediatype obj = (PortletMediatype) v.get(i); 1581 copyObj.addPortletMediatype(obj.copy()); 1582 } 1583 return copyObj; 1584 } 1585 1586 1592 public PortletDbEntryPeer getPeer() 1593 { 1594 return peer; 1595 } 1596} 1597 | Popular Tags |