01: package org.apache.turbine.om.security.peer;
02:
03: /*
04: * Copyright 2001-2005 The Apache Software Foundation.
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License")
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
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 264148 2005-08-29 14:21:04Z henning $
33: */
34: public class RolePermissionPeer extends BasePeer {
35: /** Serial Version UID */
36: private static final long serialVersionUID = 4149656810524167640L;
37:
38: /** The map builder for this Peer. */
39: private static final TurbineMapBuilder MAP_BUILDER = (TurbineMapBuilder) getMapBuilder(TurbineMapBuilder.class
40: .getName());
41:
42: /** The table name for this peer. */
43: public static final String TABLE_NAME = MAP_BUILDER
44: .getTableRolePermission();
45:
46: /** The column name for the permission id field. */
47: public static final String PERMISSION_ID = MAP_BUILDER
48: .getRolePermission_PermissionId();
49:
50: /** The column name for the role id field. */
51: public static final String ROLE_ID = MAP_BUILDER
52: .getRolePermission_RoleId();
53:
54: /**
55: * Deletes the mappings for a role_id.
56: *
57: * @param role_id An int with the role id.
58: * @exception Exception a generic exception.
59: */
60: public static void deleteRole(int role_id) throws Exception {
61: Criteria criteria = new Criteria();
62: criteria.add(ROLE_ID, role_id);
63: doDelete(criteria);
64: }
65:
66: /**
67: * Deletes the mappings for a permission_id.
68: *
69: * @param permission_id An int with the permission id.
70: * @exception Exception a generic exception.
71: */
72: public static void deletePermission(int permission_id)
73: throws Exception {
74: Criteria criteria = new Criteria();
75: criteria.add(PERMISSION_ID, permission_id);
76: doDelete(criteria);
77: }
78: }
|