001package org.apache.fulcrum.security.torque.om; 002 003import java.sql.Connection; 004import java.util.ArrayList; 005import java.util.Collection; 006import java.util.List; 007import java.util.Map; 008import java.util.Objects; 009import java.util.stream.Collectors; 010 011import org.apache.torque.NoRowsException; 012import org.apache.torque.TooManyRowsException; 013import org.apache.torque.TorqueException; 014import org.apache.torque.criteria.Criteria; 015import org.apache.torque.criteria.Criterion; 016import org.apache.torque.om.mapper.RecordMapper; 017import org.apache.torque.om.mapper.CompositeMapper; 018import org.apache.torque.om.ObjectKey; 019import org.apache.torque.om.SimpleKey; 020import org.apache.torque.map.TableMap; 021import org.apache.torque.util.TorqueConnection; 022import org.apache.torque.util.Transaction; 023import org.apache.torque.util.ColumnValues; 024import org.apache.torque.util.JdbcTypedValue; 025 026 027 028/** 029 * The skeleton for this class was autogenerated by Torque on: 030 * 031 * [Thu Nov 04 13:34:23 CET 2021] 032 * 033 * You should not use this class directly. It should not even be 034 * extended; all references should be to TorqueTurbineUserGroupRolePeer 035 */ 036 037@SuppressWarnings("unused") 038public abstract class BaseTorqueTurbineUserGroupRolePeerImpl 039 extends org.apache.torque.util.AbstractPeerImpl<TorqueTurbineUserGroupRole> 040{ 041 /** Serial version */ 042 private static final long serialVersionUID = 1636029263578L; 043 044 045 046 /** 047 * Constructor. 048 * The recordMapper, tableMap and databaseName fields are correctly 049 * initialized. 050 */ 051 public BaseTorqueTurbineUserGroupRolePeerImpl() 052 { 053 this(new TorqueTurbineUserGroupRoleRecordMapper(), 054 TorqueTurbineUserGroupRolePeer.TABLE, 055 TorqueTurbineUserGroupRolePeer.DATABASE_NAME); 056 } 057 058 /** 059 * Constructor providing the objects to be injected as parameters. 060 * 061 * @param recordMapper a record mapper to map JDBC result sets to objects 062 * @param tableMap the default table map 063 * @param databaseName the name of the database 064 */ 065 public BaseTorqueTurbineUserGroupRolePeerImpl( 066 RecordMapper<TorqueTurbineUserGroupRole> recordMapper, 067 TableMap tableMap, 068 String databaseName) 069 { 070 super(recordMapper, tableMap, databaseName); 071 } 072 073 074 /** 075 * Returns a new instance of the Data object class 076 */ 077 public TorqueTurbineUserGroupRole getDbObjectInstance() 078 { 079 return new TorqueTurbineUserGroupRole(); 080 } 081 082 083 /** 084 * Method to do updates. This method is to be used during a transaction, 085 * otherwise use the doUpdate(Criteria) method. 086 * 087 * @param columnValues the values to update plus the primary key 088 * identifying the row to update. 089 * @param con the connection to use, not null. 090 * 091 * @return the number of affected rows. 092 * 093 * @throws TorqueException Any exceptions caught during processing will be 094 * rethrown wrapped into a TorqueException. 095 */ 096 public int doUpdate(ColumnValues columnValues, Connection con) 097 throws TorqueException 098 { 099 Criteria selectCriteria = new Criteria(getDatabaseName()); 100 correctBooleans(columnValues); 101 102 { 103 JdbcTypedValue pkValue 104 = columnValues.remove(TorqueTurbineUserGroupRolePeer.USER_ID); 105 if (pkValue == null) 106 { 107 throw new TorqueException( 108 "The value for the primary key column " 109 + "TorqueTurbineUserGroupRolePeer.USER_ID" 110 + " must be set"); 111 } 112 if (pkValue.getSqlExpression() == null) 113 { 114 selectCriteria.where( 115 TorqueTurbineUserGroupRolePeer.USER_ID, 116 pkValue.getValue()); 117 } 118 else 119 { 120 selectCriteria.where( 121 TorqueTurbineUserGroupRolePeer.USER_ID, 122 pkValue.getSqlExpression()); 123 } 124 } 125 { 126 JdbcTypedValue pkValue 127 = columnValues.remove(TorqueTurbineUserGroupRolePeer.GROUP_ID); 128 if (pkValue == null) 129 { 130 throw new TorqueException( 131 "The value for the primary key column " 132 + "TorqueTurbineUserGroupRolePeer.GROUP_ID" 133 + " must be set"); 134 } 135 if (pkValue.getSqlExpression() == null) 136 { 137 selectCriteria.where( 138 TorqueTurbineUserGroupRolePeer.GROUP_ID, 139 pkValue.getValue()); 140 } 141 else 142 { 143 selectCriteria.where( 144 TorqueTurbineUserGroupRolePeer.GROUP_ID, 145 pkValue.getSqlExpression()); 146 } 147 } 148 { 149 JdbcTypedValue pkValue 150 = columnValues.remove(TorqueTurbineUserGroupRolePeer.ROLE_ID); 151 if (pkValue == null) 152 { 153 throw new TorqueException( 154 "The value for the primary key column " 155 + "TorqueTurbineUserGroupRolePeer.ROLE_ID" 156 + " must be set"); 157 } 158 if (pkValue.getSqlExpression() == null) 159 { 160 selectCriteria.where( 161 TorqueTurbineUserGroupRolePeer.ROLE_ID, 162 pkValue.getValue()); 163 } 164 else 165 { 166 selectCriteria.where( 167 TorqueTurbineUserGroupRolePeer.ROLE_ID, 168 pkValue.getSqlExpression()); 169 } 170 } 171 172 173 int rowCount = doUpdate(selectCriteria, columnValues, con); 174 return rowCount; 175 } 176 177 /** 178 * Deletes a data object, i.e. a row in a table, in the database. 179 * 180 * @param obj the data object to delete in the database, not null. 181 * 182 * @return the number of deleted rows. 183 * 184 * @throws TorqueException Any exceptions caught during processing will be 185 * rethrown wrapped into a TorqueException. 186 */ 187 public int doDelete(TorqueTurbineUserGroupRole obj) throws TorqueException 188 { 189 int result = doDelete(buildCriteria(obj.getPrimaryKey())); 190 obj.setDeleted(true); 191 return result; 192 } 193 194 /** 195 * Deletes a data object, i.e. a row in a table, in the database. 196 * This method is to be used during a transaction, otherwise use the 197 * doDelete(TorqueTurbineUserGroupRole) method. 198 * 199 * @param obj the data object to delete in the database, not null. 200 * @param con the connection to use, not null. 201 * 202 * @return the number of deleted rows. 203 * 204 * @throws TorqueException Any exceptions caught during processing will be 205 * rethrown wrapped into a TorqueException. 206 */ 207 public int doDelete(TorqueTurbineUserGroupRole obj, Connection con) 208 throws TorqueException 209 { 210 int result = doDelete(buildCriteria(obj.getPrimaryKey()), con); 211 obj.setDeleted(true); 212 return result; 213 } 214 215 /** 216 * Deletes data objects, i.e. rows in a table, in the database. 217 * 218 * @param objects the data object to delete in the database, not null, 219 * may not contain null. 220 * 221 * @return the number of deleted rows. 222 * 223 * @throws TorqueException Any exceptions caught during processing will be 224 * rethrown wrapped into a TorqueException. 225 */ 226 public int doDelete(Collection<TorqueTurbineUserGroupRole> objects) 227 throws TorqueException 228 { 229 int result = doDelete(buildPkCriteria(objects)); 230 objects.forEach(object -> object.setDeleted(true)); 231 return result; 232 } 233 234 /** 235 * Deletes data objects, i.e. rows in a table, in the database. 236 * This method uses the passed connection to delete the rows; 237 * if a transaction is open in the connection, the deletion happens inside 238 * this transaction. 239 * 240 * @param objects the data objects to delete in the database, not null, 241 * may not contain null. 242 * @param con the connection to use for deleting, not null. 243 * 244 * @return the number of deleted rows. 245 * 246 * @throws TorqueException Any exceptions caught during processing will be 247 * rethrown wrapped into a TorqueException. 248 */ 249 public int doDelete( 250 Collection<TorqueTurbineUserGroupRole> objects, 251 Connection con) 252 throws TorqueException 253 { 254 int result = doDelete(buildPkCriteria(objects), con); 255 objects.forEach(object -> object.setDeleted(true)); 256 return result; 257 } 258 259 /** 260 * Build a Criteria object which selects all objects which have a given 261 * primary key. 262 * 263 * @param pk the primary key value to build the criteria from, not null. 264 */ 265 public Criteria buildCriteria(ObjectKey<?> pk) 266 { 267 Criteria criteria = new Criteria(); 268 SimpleKey<?>[] keys = (SimpleKey[])pk.getValue(); 269 criteria.and(TorqueTurbineUserGroupRolePeer.USER_ID, keys[0]); 270 criteria.and(TorqueTurbineUserGroupRolePeer.GROUP_ID, keys[1]); 271 criteria.and(TorqueTurbineUserGroupRolePeer.ROLE_ID, keys[2]); 272 return criteria; 273 } 274 275 /** 276 * Build a Criteria object which selects all objects which primary keys 277 * are contained in the passed collection. 278 * 279 * @param pks the primary key values to build the criteria from, not null, 280 * may not contain null. 281 */ 282 public Criteria buildCriteria(Collection<ObjectKey<?>> pks) 283 { 284 Criteria criteria = new Criteria(); 285 for (ObjectKey<?> pk : pks) 286 { 287 SimpleKey<?>[] keys = (SimpleKey[])pk.getValue(); 288 Criterion c0 = new Criterion( 289 TorqueTurbineUserGroupRolePeer.USER_ID, keys[0], Criteria.EQUAL); 290 Criterion c1 = new Criterion( 291 TorqueTurbineUserGroupRolePeer.GROUP_ID, keys[1], Criteria.EQUAL); 292 c0.and(c1); 293 Criterion c2 = new Criterion( 294 TorqueTurbineUserGroupRolePeer.ROLE_ID, keys[2], Criteria.EQUAL); 295 c1.and(c2); 296 criteria.or(c0); 297 } 298 return criteria; 299 } 300 301 302 /** 303 * Build a Criteria object which selects all passed objects using their 304 * primary key. Objects which do not yet have a primary key are ignored. 305 * 306 * @param objects the objects to build the criteria from, not null, 307 * may not contain null. 308 */ 309 public Criteria buildPkCriteria( 310 Collection<TorqueTurbineUserGroupRole> objects) 311 { 312 return buildCriteria(objects.stream() 313 .map(object -> object.getPrimaryKey()) 314 .collect(Collectors.toList())); 315 } 316 317 /** 318 * Build a Criteria object from the data object for this peer. 319 * 320 * @param obj the object to build the criteria from, not null. 321 */ 322 public Criteria buildCriteria(TorqueTurbineUserGroupRole obj) 323 { 324 Criteria criteria = new Criteria(getDatabaseName()); 325 criteria.and(TorqueTurbineUserGroupRolePeer.USER_ID, obj.getUserId()); 326 criteria.and(TorqueTurbineUserGroupRolePeer.GROUP_ID, obj.getGroupId()); 327 criteria.and(TorqueTurbineUserGroupRolePeer.ROLE_ID, obj.getRoleId()); 328 return criteria; 329 } 330 331 /** 332 * Build a Criteria object from the data object for this peer, 333 * skipping all binary columns. 334 * 335 * @param obj the object to build the criteria from, not null. 336 */ 337 public Criteria buildSelectCriteria(TorqueTurbineUserGroupRole obj) 338 { 339 Criteria criteria = new Criteria(getDatabaseName()); 340 criteria.and(TorqueTurbineUserGroupRolePeer.USER_ID, obj.getUserId()); 341 criteria.and(TorqueTurbineUserGroupRolePeer.GROUP_ID, obj.getGroupId()); 342 criteria.and(TorqueTurbineUserGroupRolePeer.ROLE_ID, obj.getRoleId()); 343 return criteria; 344 } 345 346 /** 347 * Returns the contents of the object as ColumnValues object. 348 * Primary key columns which are generated on insertion are not 349 * added to the returned object if they still have their initial 350 * value. Also, columns which have the useDatabaseDefaultValue 351 * flag set to true are also not added to the returned object 352 * if they still have their initial value. 353 * 354 * @throws TorqueException if the table map cannot be retrieved 355 * (should not happen). 356 */ 357 public ColumnValues buildColumnValues(TorqueTurbineUserGroupRole torqueTurbineUserGroupRole) 358 throws TorqueException 359 { 360 ColumnValues columnValues = new ColumnValues(); 361 columnValues.put( 362 TorqueTurbineUserGroupRolePeer.USER_ID, 363 new JdbcTypedValue( 364 torqueTurbineUserGroupRole.getUserId(), 365 4)); 366 columnValues.put( 367 TorqueTurbineUserGroupRolePeer.GROUP_ID, 368 new JdbcTypedValue( 369 torqueTurbineUserGroupRole.getGroupId(), 370 4)); 371 columnValues.put( 372 TorqueTurbineUserGroupRolePeer.ROLE_ID, 373 new JdbcTypedValue( 374 torqueTurbineUserGroupRole.getRoleId(), 375 4)); 376 return columnValues; 377 } 378 379 /** 380 * retrieve object using using pk values. 381 * 382 * @param userId Integer 383 * @param groupId Integer 384 * @param roleId Integer 385 */ 386 public TorqueTurbineUserGroupRole retrieveByPK( 387 Integer userId, 388 Integer groupId, 389 Integer roleId) 390 throws TorqueException 391 { 392 try (TorqueConnection connection = Transaction.begin(getDatabaseName())) 393 { 394 TorqueTurbineUserGroupRole result = retrieveByPK( 395 userId, 396 groupId, 397 roleId, 398 connection); 399 Transaction.commit(connection); 400 return result; 401 } 402 } 403 404 /** 405 * retrieve object using using pk values. 406 * 407 * @param userId Integer 408 * @param groupId Integer 409 * @param roleId Integer 410 * @param con Connection 411 */ 412 public TorqueTurbineUserGroupRole retrieveByPK( 413 Integer userId, 414 Integer groupId, 415 Integer roleId, 416 Connection con) throws TorqueException 417 { 418 419 Criteria criteria = new Criteria(); 420 criteria.and(TorqueTurbineUserGroupRolePeer.USER_ID, userId); 421 criteria.and(TorqueTurbineUserGroupRolePeer.GROUP_ID, groupId); 422 criteria.and(TorqueTurbineUserGroupRolePeer.ROLE_ID, roleId); 423 TorqueTurbineUserGroupRole v = doSelectSingleRecord(criteria, con); 424 if (v == null) 425 { 426 throw new NoRowsException("Failed to select a row."); 427 } 428 429 return v; 430 } 431 432 /** 433 * Retrieve a single object by pk 434 * 435 * @param pk the primary key 436 * @throws TorqueException Any exceptions caught during processing will be 437 * rethrown wrapped into a TorqueException. 438 * @throws NoRowsException Primary key was not found in database. 439 * @throws TooManyRowsException Primary key was not found in database. 440 */ 441 public TorqueTurbineUserGroupRole retrieveByPK(ObjectKey<?> pk) 442 throws TorqueException, NoRowsException, TooManyRowsException 443 { 444 try (TorqueConnection connection = Transaction.begin(getDatabaseName())) 445 { 446 TorqueTurbineUserGroupRole result = retrieveByPK(pk, connection); 447 Transaction.commit(connection); 448 return result; 449 } 450 } 451 452 /** 453 * Retrieve a single object by pk 454 * 455 * @param pk the primary key 456 * @param con the connection to use 457 * @throws TorqueException Any exceptions caught during processing will be 458 * rethrown wrapped into a TorqueException. 459 * @throws NoRowsException Primary key was not found in database. 460 * @throws TooManyRowsException Primary key was not found in database. 461 */ 462 public TorqueTurbineUserGroupRole retrieveByPK(ObjectKey<?> pk, Connection con) 463 throws TorqueException, NoRowsException, TooManyRowsException 464 { 465 Criteria criteria = buildCriteria(pk); 466 TorqueTurbineUserGroupRole v = doSelectSingleRecord(criteria, con); 467 if (v == null) 468 { 469 throw new NoRowsException("Failed to select a row."); 470 } 471 472 return v; 473 } 474 475 476 /** 477 * Retrieve multiple objects by pk. 478 * 479 * @param pks List of primary keys. 480 * Entries in pks which do not match entries in the database are ignored. 481 * 482 * @return the list of matching objects, not null. 483 * 484 * @throws TorqueException Any exceptions caught during processing will be 485 * rethrown wrapped into a TorqueException. 486 */ 487 public List<TorqueTurbineUserGroupRole> retrieveByObjectKeys(Collection<ObjectKey<?>> pks) 488 throws TorqueException 489 { 490 try (TorqueConnection connection = Transaction.begin(getDatabaseName())) 491 { 492 List<TorqueTurbineUserGroupRole> result = retrieveByObjectKeys(pks, connection); 493 Transaction.commit(connection); 494 return result; 495 } 496 } 497 498 /** 499 * Retrieve multiple objects by pk. 500 * 501 * @param pks List of primary keys. 502 * Entries in pks which do not match entries in the database are ignored. 503 * @param dbcon the connection to use 504 * 505 * @return the list of matching objects, not null. 506 * 507 * @throws TorqueException Any exceptions caught during processing will be 508 * rethrown wrapped into a TorqueException. 509 */ 510 public List<TorqueTurbineUserGroupRole> retrieveByObjectKeys( 511 Collection<ObjectKey<?>> pks, 512 Connection dbcon) 513 throws TorqueException 514 { 515 if (pks == null || pks.size() == 0) 516 { 517 return new ArrayList<TorqueTurbineUserGroupRole>(); 518 } 519 Criteria criteria = buildCriteria(pks); 520 List<TorqueTurbineUserGroupRole> result = doSelect(criteria, dbcon); 521 return result; 522 } 523 524 525 /** 526 * Selects a collection of dbObjectClassName objects pre-filled with their 527 * TorqueTurbineUser objects. 528 * 529 * @throws TorqueException Any exceptions caught during processing will be 530 * rethrown wrapped into a TorqueException. 531 */ 532 public List<TorqueTurbineUserGroupRole> doSelectJoinTorqueTurbineUser(Criteria criteria) 533 throws TorqueException 534 { 535 try (TorqueConnection connection = Transaction.begin(getDatabaseName())) 536 { 537 List<TorqueTurbineUserGroupRole> result 538 = TorqueTurbineUserGroupRolePeer.doSelectJoinTorqueTurbineUser(criteria, connection); 539 Transaction.commit(connection); 540 return result; 541 } 542 } 543 544 /** 545 * Selects a collection of TorqueTurbineUserGroupRole objects pre-filled with their 546 * TorqueTurbineUser objects. 547 * 548 * @throws TorqueException Any exceptions caught during processing will be 549 * rethrown wrapped into a TorqueException. 550 */ 551 public List<TorqueTurbineUserGroupRole> doSelectJoinTorqueTurbineUser( 552 Criteria criteria, Connection conn) 553 throws TorqueException 554 { 555 setDbName(criteria); 556 557 addSelectColumns(criteria); 558 org.apache.fulcrum.security.torque.om.TorqueTurbineUserPeer.addSelectColumns(criteria); 559 560 CompositeMapper compositeMapper = new CompositeMapper(); 561 compositeMapper.addMapper( 562 new TorqueTurbineUserGroupRoleRecordMapper(), 563 0); 564 compositeMapper.addMapper( 565 new TorqueTurbineUserRecordMapper(), 566 TorqueTurbineUserGroupRolePeer.numColumns); 567 criteria.addJoin(TorqueTurbineUserGroupRolePeer.USER_ID, 568 org.apache.fulcrum.security.torque.om.TorqueTurbineUserPeer.USER_ID); 569 570 correctBooleans(criteria); 571 572 List<TorqueTurbineUserGroupRole> result = new ArrayList<TorqueTurbineUserGroupRole>(); 573 List<List<Object>> rawResult = doSelect( 574 criteria, compositeMapper, conn); 575 for (List<Object> rawResultRow : rawResult) 576 { 577 TorqueTurbineUserGroupRole obj1 = (TorqueTurbineUserGroupRole) rawResultRow.get(0); 578 TorqueTurbineUser obj2 = (TorqueTurbineUser) rawResultRow.get(1); 579 580 boolean newObject = true; 581 for (int j = 0; j < result.size(); j++) 582 { 583 TorqueTurbineUserGroupRole temp_obj1 = result.get(j); 584 org.apache.fulcrum.security.torque.om.TorqueTurbineUser temp_obj2 = temp_obj1.getTorqueTurbineUser(); 585 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 586 { 587 newObject = false; 588 temp_obj2.addTorqueTurbineUserGroupRole(obj1); 589 break; 590 } 591 } 592 if (newObject) 593 { 594 obj2.initTorqueTurbineUserGroupRoles(); 595 obj2.addTorqueTurbineUserGroupRole(obj1); 596 } 597 result.add(obj1); 598 } 599 return result; 600 } 601 /** 602 * Selects a collection of dbObjectClassName objects pre-filled with their 603 * TorqueTurbineGroup objects. 604 * 605 * @throws TorqueException Any exceptions caught during processing will be 606 * rethrown wrapped into a TorqueException. 607 */ 608 public List<TorqueTurbineUserGroupRole> doSelectJoinTorqueTurbineGroup(Criteria criteria) 609 throws TorqueException 610 { 611 try (TorqueConnection connection = Transaction.begin(getDatabaseName())) 612 { 613 List<TorqueTurbineUserGroupRole> result 614 = TorqueTurbineUserGroupRolePeer.doSelectJoinTorqueTurbineGroup(criteria, connection); 615 Transaction.commit(connection); 616 return result; 617 } 618 } 619 620 /** 621 * Selects a collection of TorqueTurbineUserGroupRole objects pre-filled with their 622 * TorqueTurbineGroup objects. 623 * 624 * @throws TorqueException Any exceptions caught during processing will be 625 * rethrown wrapped into a TorqueException. 626 */ 627 public List<TorqueTurbineUserGroupRole> doSelectJoinTorqueTurbineGroup( 628 Criteria criteria, Connection conn) 629 throws TorqueException 630 { 631 setDbName(criteria); 632 633 addSelectColumns(criteria); 634 org.apache.fulcrum.security.torque.om.TorqueTurbineGroupPeer.addSelectColumns(criteria); 635 636 CompositeMapper compositeMapper = new CompositeMapper(); 637 compositeMapper.addMapper( 638 new TorqueTurbineUserGroupRoleRecordMapper(), 639 0); 640 compositeMapper.addMapper( 641 new TorqueTurbineGroupRecordMapper(), 642 TorqueTurbineUserGroupRolePeer.numColumns); 643 criteria.addJoin(TorqueTurbineUserGroupRolePeer.GROUP_ID, 644 org.apache.fulcrum.security.torque.om.TorqueTurbineGroupPeer.GROUP_ID); 645 646 correctBooleans(criteria); 647 648 List<TorqueTurbineUserGroupRole> result = new ArrayList<TorqueTurbineUserGroupRole>(); 649 List<List<Object>> rawResult = doSelect( 650 criteria, compositeMapper, conn); 651 for (List<Object> rawResultRow : rawResult) 652 { 653 TorqueTurbineUserGroupRole obj1 = (TorqueTurbineUserGroupRole) rawResultRow.get(0); 654 TorqueTurbineGroup obj2 = (TorqueTurbineGroup) rawResultRow.get(1); 655 656 boolean newObject = true; 657 for (int j = 0; j < result.size(); j++) 658 { 659 TorqueTurbineUserGroupRole temp_obj1 = result.get(j); 660 org.apache.fulcrum.security.torque.om.TorqueTurbineGroup temp_obj2 = temp_obj1.getTorqueTurbineGroup(); 661 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 662 { 663 newObject = false; 664 temp_obj2.addTorqueTurbineUserGroupRole(obj1); 665 break; 666 } 667 } 668 if (newObject) 669 { 670 obj2.initTorqueTurbineUserGroupRoles(); 671 obj2.addTorqueTurbineUserGroupRole(obj1); 672 } 673 result.add(obj1); 674 } 675 return result; 676 } 677 /** 678 * Selects a collection of dbObjectClassName objects pre-filled with their 679 * TorqueTurbineRole objects. 680 * 681 * @throws TorqueException Any exceptions caught during processing will be 682 * rethrown wrapped into a TorqueException. 683 */ 684 public List<TorqueTurbineUserGroupRole> doSelectJoinTorqueTurbineRole(Criteria criteria) 685 throws TorqueException 686 { 687 try (TorqueConnection connection = Transaction.begin(getDatabaseName())) 688 { 689 List<TorqueTurbineUserGroupRole> result 690 = TorqueTurbineUserGroupRolePeer.doSelectJoinTorqueTurbineRole(criteria, connection); 691 Transaction.commit(connection); 692 return result; 693 } 694 } 695 696 /** 697 * Selects a collection of TorqueTurbineUserGroupRole objects pre-filled with their 698 * TorqueTurbineRole objects. 699 * 700 * @throws TorqueException Any exceptions caught during processing will be 701 * rethrown wrapped into a TorqueException. 702 */ 703 public List<TorqueTurbineUserGroupRole> doSelectJoinTorqueTurbineRole( 704 Criteria criteria, Connection conn) 705 throws TorqueException 706 { 707 setDbName(criteria); 708 709 addSelectColumns(criteria); 710 org.apache.fulcrum.security.torque.om.TorqueTurbineRolePeer.addSelectColumns(criteria); 711 712 CompositeMapper compositeMapper = new CompositeMapper(); 713 compositeMapper.addMapper( 714 new TorqueTurbineUserGroupRoleRecordMapper(), 715 0); 716 compositeMapper.addMapper( 717 new TorqueTurbineRoleRecordMapper(), 718 TorqueTurbineUserGroupRolePeer.numColumns); 719 criteria.addJoin(TorqueTurbineUserGroupRolePeer.ROLE_ID, 720 org.apache.fulcrum.security.torque.om.TorqueTurbineRolePeer.ROLE_ID); 721 722 correctBooleans(criteria); 723 724 List<TorqueTurbineUserGroupRole> result = new ArrayList<TorqueTurbineUserGroupRole>(); 725 List<List<Object>> rawResult = doSelect( 726 criteria, compositeMapper, conn); 727 for (List<Object> rawResultRow : rawResult) 728 { 729 TorqueTurbineUserGroupRole obj1 = (TorqueTurbineUserGroupRole) rawResultRow.get(0); 730 TorqueTurbineRole obj2 = (TorqueTurbineRole) rawResultRow.get(1); 731 732 boolean newObject = true; 733 for (int j = 0; j < result.size(); j++) 734 { 735 TorqueTurbineUserGroupRole temp_obj1 = result.get(j); 736 org.apache.fulcrum.security.torque.om.TorqueTurbineRole temp_obj2 = temp_obj1.getTorqueTurbineRole(); 737 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 738 { 739 newObject = false; 740 temp_obj2.addTorqueTurbineUserGroupRole(obj1); 741 break; 742 } 743 } 744 if (newObject) 745 { 746 obj2.initTorqueTurbineUserGroupRoles(); 747 obj2.addTorqueTurbineUserGroupRole(obj1); 748 } 749 result.add(obj1); 750 } 751 return result; 752 } 753 754 /** 755 * selects a collection of TorqueTurbineUserGroupRole objects pre-filled with 756 * all related objects. 757 * 758 * This method is protected by default in order to keep the public 759 * api reasonable. You can provide public methods for those you 760 * actually need in TorqueTurbineUserGroupRolePeerImpl. 761 * 762 * @throws TorqueException Any exceptions caught during processing will be 763 * rethrown wrapped into a TorqueException. 764 */ 765 protected List<TorqueTurbineUserGroupRole> doSelectJoinAllExceptTorqueTurbineUser(Criteria criteria) 766 throws TorqueException 767 { 768 try (TorqueConnection connection = Transaction.begin(getDatabaseName())) 769 { 770 List<TorqueTurbineUserGroupRole> result 771 = TorqueTurbineUserGroupRolePeer.doSelectJoinAllExceptTorqueTurbineUser(criteria, connection); 772 Transaction.commit(connection); 773 return result; 774 } 775 } 776 777 /** 778 * selects a collection of TorqueTurbineUserGroupRole objects pre-filled with 779 * related objects. 780 * 781 * This method is protected by default in order to keep the public 782 * api reasonable. You can provide public methods for those you 783 * actually need in TorqueTurbineUserGroupRolePeerImpl. 784 * 785 * @throws TorqueException Any exceptions caught during processing will be 786 * rethrown wrapped into a TorqueException. 787 */ 788 protected List<TorqueTurbineUserGroupRole> doSelectJoinAllExceptTorqueTurbineUser(Criteria criteria, Connection conn) 789 throws TorqueException 790 { 791 setDbName(criteria); 792 793 CompositeMapper compositeMapper = new CompositeMapper(); 794 compositeMapper.addMapper(new TorqueTurbineUserGroupRoleRecordMapper(), 0); 795 TorqueTurbineUserGroupRolePeer.addSelectColumns(criteria); 796 int offset = TorqueTurbineUserGroupRolePeer.numColumns; 797 798 org.apache.fulcrum.security.torque.om.TorqueTurbineGroupPeer.addSelectColumns(criteria); 799 criteria.addJoin(TorqueTurbineUserGroupRolePeer.GROUP_ID, org.apache.fulcrum.security.torque.om.TorqueTurbineGroupPeer.GROUP_ID); 800 compositeMapper.addMapper(new TorqueTurbineGroupRecordMapper(), offset); 801 offset = offset + org.apache.fulcrum.security.torque.om.TorqueTurbineGroupPeer.numColumns; 802 803 org.apache.fulcrum.security.torque.om.TorqueTurbineRolePeer.addSelectColumns(criteria); 804 criteria.addJoin(TorqueTurbineUserGroupRolePeer.ROLE_ID, org.apache.fulcrum.security.torque.om.TorqueTurbineRolePeer.ROLE_ID); 805 compositeMapper.addMapper(new TorqueTurbineRoleRecordMapper(), offset); 806 offset = offset + org.apache.fulcrum.security.torque.om.TorqueTurbineRolePeer.numColumns; 807 808 correctBooleans(criteria); 809 810 List<TorqueTurbineUserGroupRole> result = new ArrayList<TorqueTurbineUserGroupRole>(); 811 List<List<Object>> rawResult = doSelect( 812 criteria, compositeMapper, conn); 813 for (List<Object> rawResultRow : rawResult) 814 { 815 TorqueTurbineUserGroupRole torqueTurbineUserGroupRole = (TorqueTurbineUserGroupRole) rawResultRow.get(0); 816 817 org.apache.fulcrum.security.torque.om.TorqueTurbineGroup obj1 = (org.apache.fulcrum.security.torque.om.TorqueTurbineGroup) rawResultRow.get(1); 818 boolean newObject = true; 819 for (int j = 0; j < result.size(); j++) 820 { 821 org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRole temp_torqueTurbineUserGroupRole = result.get(j); 822 org.apache.fulcrum.security.torque.om.TorqueTurbineGroup temp_obj1 = temp_torqueTurbineUserGroupRole.getTorqueTurbineGroup(); 823 if (temp_obj1.getPrimaryKey().equals(obj1.getPrimaryKey())) 824 { 825 newObject = false; 826 temp_obj1.addTorqueTurbineUserGroupRole(torqueTurbineUserGroupRole); 827 break; 828 } 829 } 830 if (newObject) 831 { 832 obj1.initTorqueTurbineUserGroupRoles(); 833 obj1.addTorqueTurbineUserGroupRole(torqueTurbineUserGroupRole); 834 } 835 836 org.apache.fulcrum.security.torque.om.TorqueTurbineRole obj2 = (org.apache.fulcrum.security.torque.om.TorqueTurbineRole) rawResultRow.get(2); 837 newObject = true; 838 for (int j = 0; j < result.size(); j++) 839 { 840 org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRole temp_torqueTurbineUserGroupRole = result.get(j); 841 org.apache.fulcrum.security.torque.om.TorqueTurbineRole temp_obj2 = temp_torqueTurbineUserGroupRole.getTorqueTurbineRole(); 842 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 843 { 844 newObject = false; 845 temp_obj2.addTorqueTurbineUserGroupRole(torqueTurbineUserGroupRole); 846 break; 847 } 848 } 849 if (newObject) 850 { 851 obj2.initTorqueTurbineUserGroupRoles(); 852 obj2.addTorqueTurbineUserGroupRole(torqueTurbineUserGroupRole); 853 } 854 result.add(torqueTurbineUserGroupRole); 855 } 856 return result; 857 } 858 /** 859 * selects a collection of TorqueTurbineUserGroupRole objects pre-filled with 860 * all related objects. 861 * 862 * This method is protected by default in order to keep the public 863 * api reasonable. You can provide public methods for those you 864 * actually need in TorqueTurbineUserGroupRolePeerImpl. 865 * 866 * @throws TorqueException Any exceptions caught during processing will be 867 * rethrown wrapped into a TorqueException. 868 */ 869 protected List<TorqueTurbineUserGroupRole> doSelectJoinAllExceptTorqueTurbineGroup(Criteria criteria) 870 throws TorqueException 871 { 872 try (TorqueConnection connection = Transaction.begin(getDatabaseName())) 873 { 874 List<TorqueTurbineUserGroupRole> result 875 = TorqueTurbineUserGroupRolePeer.doSelectJoinAllExceptTorqueTurbineGroup(criteria, connection); 876 Transaction.commit(connection); 877 return result; 878 } 879 } 880 881 /** 882 * selects a collection of TorqueTurbineUserGroupRole objects pre-filled with 883 * related objects. 884 * 885 * This method is protected by default in order to keep the public 886 * api reasonable. You can provide public methods for those you 887 * actually need in TorqueTurbineUserGroupRolePeerImpl. 888 * 889 * @throws TorqueException Any exceptions caught during processing will be 890 * rethrown wrapped into a TorqueException. 891 */ 892 protected List<TorqueTurbineUserGroupRole> doSelectJoinAllExceptTorqueTurbineGroup(Criteria criteria, Connection conn) 893 throws TorqueException 894 { 895 setDbName(criteria); 896 897 CompositeMapper compositeMapper = new CompositeMapper(); 898 compositeMapper.addMapper(new TorqueTurbineUserGroupRoleRecordMapper(), 0); 899 TorqueTurbineUserGroupRolePeer.addSelectColumns(criteria); 900 int offset = TorqueTurbineUserGroupRolePeer.numColumns; 901 902 org.apache.fulcrum.security.torque.om.TorqueTurbineUserPeer.addSelectColumns(criteria); 903 criteria.addJoin(TorqueTurbineUserGroupRolePeer.USER_ID, org.apache.fulcrum.security.torque.om.TorqueTurbineUserPeer.USER_ID); 904 compositeMapper.addMapper(new TorqueTurbineUserRecordMapper(), offset); 905 offset = offset + org.apache.fulcrum.security.torque.om.TorqueTurbineUserPeer.numColumns; 906 907 org.apache.fulcrum.security.torque.om.TorqueTurbineRolePeer.addSelectColumns(criteria); 908 criteria.addJoin(TorqueTurbineUserGroupRolePeer.ROLE_ID, org.apache.fulcrum.security.torque.om.TorqueTurbineRolePeer.ROLE_ID); 909 compositeMapper.addMapper(new TorqueTurbineRoleRecordMapper(), offset); 910 offset = offset + org.apache.fulcrum.security.torque.om.TorqueTurbineRolePeer.numColumns; 911 912 correctBooleans(criteria); 913 914 List<TorqueTurbineUserGroupRole> result = new ArrayList<TorqueTurbineUserGroupRole>(); 915 List<List<Object>> rawResult = doSelect( 916 criteria, compositeMapper, conn); 917 for (List<Object> rawResultRow : rawResult) 918 { 919 TorqueTurbineUserGroupRole torqueTurbineUserGroupRole = (TorqueTurbineUserGroupRole) rawResultRow.get(0); 920 921 org.apache.fulcrum.security.torque.om.TorqueTurbineUser obj1 = (org.apache.fulcrum.security.torque.om.TorqueTurbineUser) rawResultRow.get(1); 922 boolean newObject = true; 923 for (int j = 0; j < result.size(); j++) 924 { 925 org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRole temp_torqueTurbineUserGroupRole = result.get(j); 926 org.apache.fulcrum.security.torque.om.TorqueTurbineUser temp_obj1 = temp_torqueTurbineUserGroupRole.getTorqueTurbineUser(); 927 if (temp_obj1.getPrimaryKey().equals(obj1.getPrimaryKey())) 928 { 929 newObject = false; 930 temp_obj1.addTorqueTurbineUserGroupRole(torqueTurbineUserGroupRole); 931 break; 932 } 933 } 934 if (newObject) 935 { 936 obj1.initTorqueTurbineUserGroupRoles(); 937 obj1.addTorqueTurbineUserGroupRole(torqueTurbineUserGroupRole); 938 } 939 940 org.apache.fulcrum.security.torque.om.TorqueTurbineRole obj2 = (org.apache.fulcrum.security.torque.om.TorqueTurbineRole) rawResultRow.get(2); 941 newObject = true; 942 for (int j = 0; j < result.size(); j++) 943 { 944 org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRole temp_torqueTurbineUserGroupRole = result.get(j); 945 org.apache.fulcrum.security.torque.om.TorqueTurbineRole temp_obj2 = temp_torqueTurbineUserGroupRole.getTorqueTurbineRole(); 946 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 947 { 948 newObject = false; 949 temp_obj2.addTorqueTurbineUserGroupRole(torqueTurbineUserGroupRole); 950 break; 951 } 952 } 953 if (newObject) 954 { 955 obj2.initTorqueTurbineUserGroupRoles(); 956 obj2.addTorqueTurbineUserGroupRole(torqueTurbineUserGroupRole); 957 } 958 result.add(torqueTurbineUserGroupRole); 959 } 960 return result; 961 } 962 /** 963 * selects a collection of TorqueTurbineUserGroupRole objects pre-filled with 964 * all related objects. 965 * 966 * This method is protected by default in order to keep the public 967 * api reasonable. You can provide public methods for those you 968 * actually need in TorqueTurbineUserGroupRolePeerImpl. 969 * 970 * @throws TorqueException Any exceptions caught during processing will be 971 * rethrown wrapped into a TorqueException. 972 */ 973 protected List<TorqueTurbineUserGroupRole> doSelectJoinAllExceptTorqueTurbineRole(Criteria criteria) 974 throws TorqueException 975 { 976 try (TorqueConnection connection = Transaction.begin(getDatabaseName())) 977 { 978 List<TorqueTurbineUserGroupRole> result 979 = TorqueTurbineUserGroupRolePeer.doSelectJoinAllExceptTorqueTurbineRole(criteria, connection); 980 Transaction.commit(connection); 981 return result; 982 } 983 } 984 985 /** 986 * selects a collection of TorqueTurbineUserGroupRole objects pre-filled with 987 * related objects. 988 * 989 * This method is protected by default in order to keep the public 990 * api reasonable. You can provide public methods for those you 991 * actually need in TorqueTurbineUserGroupRolePeerImpl. 992 * 993 * @throws TorqueException Any exceptions caught during processing will be 994 * rethrown wrapped into a TorqueException. 995 */ 996 protected List<TorqueTurbineUserGroupRole> doSelectJoinAllExceptTorqueTurbineRole(Criteria criteria, Connection conn) 997 throws TorqueException 998 { 999 setDbName(criteria); 1000 1001 CompositeMapper compositeMapper = new CompositeMapper(); 1002 compositeMapper.addMapper(new TorqueTurbineUserGroupRoleRecordMapper(), 0); 1003 TorqueTurbineUserGroupRolePeer.addSelectColumns(criteria); 1004 int offset = TorqueTurbineUserGroupRolePeer.numColumns; 1005 1006 org.apache.fulcrum.security.torque.om.TorqueTurbineUserPeer.addSelectColumns(criteria); 1007 criteria.addJoin(TorqueTurbineUserGroupRolePeer.USER_ID, org.apache.fulcrum.security.torque.om.TorqueTurbineUserPeer.USER_ID); 1008 compositeMapper.addMapper(new TorqueTurbineUserRecordMapper(), offset); 1009 offset = offset + org.apache.fulcrum.security.torque.om.TorqueTurbineUserPeer.numColumns; 1010 1011 org.apache.fulcrum.security.torque.om.TorqueTurbineGroupPeer.addSelectColumns(criteria); 1012 criteria.addJoin(TorqueTurbineUserGroupRolePeer.GROUP_ID, org.apache.fulcrum.security.torque.om.TorqueTurbineGroupPeer.GROUP_ID); 1013 compositeMapper.addMapper(new TorqueTurbineGroupRecordMapper(), offset); 1014 offset = offset + org.apache.fulcrum.security.torque.om.TorqueTurbineGroupPeer.numColumns; 1015 1016 correctBooleans(criteria); 1017 1018 List<TorqueTurbineUserGroupRole> result = new ArrayList<TorqueTurbineUserGroupRole>(); 1019 List<List<Object>> rawResult = doSelect( 1020 criteria, compositeMapper, conn); 1021 for (List<Object> rawResultRow : rawResult) 1022 { 1023 TorqueTurbineUserGroupRole torqueTurbineUserGroupRole = (TorqueTurbineUserGroupRole) rawResultRow.get(0); 1024 1025 org.apache.fulcrum.security.torque.om.TorqueTurbineUser obj1 = (org.apache.fulcrum.security.torque.om.TorqueTurbineUser) rawResultRow.get(1); 1026 boolean newObject = true; 1027 for (int j = 0; j < result.size(); j++) 1028 { 1029 org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRole temp_torqueTurbineUserGroupRole = result.get(j); 1030 org.apache.fulcrum.security.torque.om.TorqueTurbineUser temp_obj1 = temp_torqueTurbineUserGroupRole.getTorqueTurbineUser(); 1031 if (temp_obj1.getPrimaryKey().equals(obj1.getPrimaryKey())) 1032 { 1033 newObject = false; 1034 temp_obj1.addTorqueTurbineUserGroupRole(torqueTurbineUserGroupRole); 1035 break; 1036 } 1037 } 1038 if (newObject) 1039 { 1040 obj1.initTorqueTurbineUserGroupRoles(); 1041 obj1.addTorqueTurbineUserGroupRole(torqueTurbineUserGroupRole); 1042 } 1043 1044 org.apache.fulcrum.security.torque.om.TorqueTurbineGroup obj2 = (org.apache.fulcrum.security.torque.om.TorqueTurbineGroup) rawResultRow.get(2); 1045 newObject = true; 1046 for (int j = 0; j < result.size(); j++) 1047 { 1048 org.apache.fulcrum.security.torque.om.TorqueTurbineUserGroupRole temp_torqueTurbineUserGroupRole = result.get(j); 1049 org.apache.fulcrum.security.torque.om.TorqueTurbineGroup temp_obj2 = temp_torqueTurbineUserGroupRole.getTorqueTurbineGroup(); 1050 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 1051 { 1052 newObject = false; 1053 temp_obj2.addTorqueTurbineUserGroupRole(torqueTurbineUserGroupRole); 1054 break; 1055 } 1056 } 1057 if (newObject) 1058 { 1059 obj2.initTorqueTurbineUserGroupRoles(); 1060 obj2.addTorqueTurbineUserGroupRole(torqueTurbineUserGroupRole); 1061 } 1062 result.add(torqueTurbineUserGroupRole); 1063 } 1064 return result; 1065 } 1066 1067 1068 1069}