1 package org.apache.turbine.om.security.peer;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import org.apache.torque.util.BasePeer;
20 import org.apache.torque.util.Criteria;
21 import org.apache.turbine.util.db.map.TurbineMapBuilder;
22
23 /***
24 * This class handles all database access for the
25 * ROLE_PERMISSION table. This table contains all
26 * the permissions for a given role.
27 *
28 * @author <a href="mailto:frank.kim@clearink.com">Frank Y. Kim</a>
29 * @author <a href="mailto:bmclaugh@algx.net">Brett McLaughlin</a>
30 * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
31 * @author <a href="mailto:jon@collab.net">Jon S. Stevens</a>
32 * @version $Id: RolePermissionPeer.java,v 1.6.2.2 2004/05/20 03:05:16 seade Exp $
33 */
34 public class RolePermissionPeer extends BasePeer
35 {
36 /*** The map builder for this Peer. */
37 private static final TurbineMapBuilder MAP_BUILDER = (TurbineMapBuilder)
38 getMapBuilder(TurbineMapBuilder.class.getName());
39
40 /*** The table name for this peer. */
41 public static final String TABLE_NAME = MAP_BUILDER.getTableRolePermission();
42
43 /*** The column name for the permission id field. */
44 public static final String PERMISSION_ID
45 = MAP_BUILDER.getRolePermission_PermissionId();
46
47 /*** The column name for the role id field. */
48 public static final String ROLE_ID = MAP_BUILDER.getRolePermission_RoleId();
49
50
51 /***
52 * Deletes the mappings for a role_id.
53 *
54 * @param role_id An int with the role id.
55 * @exception Exception a generic exception.
56 */
57 public static void deleteRole(int role_id) throws Exception
58 {
59 Criteria criteria = new Criteria();
60 criteria.add(ROLE_ID, role_id);
61 doDelete(criteria);
62 }
63
64 /***
65 * Deletes the mappings for a permission_id.
66 *
67 * @param permission_id An int with the permission id.
68 * @exception Exception a generic exception.
69 */
70 public static void deletePermission(int permission_id) throws Exception
71 {
72 Criteria criteria = new Criteria();
73 criteria.add(PERMISSION_ID, permission_id);
74 doDelete(criteria);
75 }
76 }