KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > turbine > om > security > peer > RolePermissionPeer


1 package org.apache.turbine.om.security.peer;
2
3 /*
4  * Copyright 2001-2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License")
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
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,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 JavaDoc TABLE_NAME = MAP_BUILDER.getTableRolePermission();
42
43     /** The column name for the permission id field. */
44     public static final String JavaDoc PERMISSION_ID
45             = MAP_BUILDER.getRolePermission_PermissionId();
46
47     /** The column name for the role id field. */
48     public static final String JavaDoc 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 JavaDoc
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 JavaDoc
71     {
72         Criteria criteria = new Criteria();
73         criteria.add(PERMISSION_ID, permission_id);
74         doDelete(criteria);
75     }
76 }
77
Popular Tags