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
20
21
22 import org.apache.torque.Torque;
23 import org.apache.torque.TorqueException;
24 import org.apache.torque.util.BasePeer;
25 import org.apache.turbine.util.db.map.TurbineMapBuilder;
26
27 /***
28 * This class handles all database access for the VISITOR_ROLE table.
29 * This table contains all the roles that a given user can play.
30 *
31 * @author <a href="mailto:frank.kim@clearink.com">Frank Y. Kim</a>
32 * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
33 * @author <a href="mailto:bmclaugh@algx.net">Brett McLaughlin</a>
34 *
35 * @deprecated Use {@link org.apache.turbine.services.security.torque.TorqueSecurityService}
36 * instead.
37 *
38 * @version $Id: UserGroupRolePeer.java 571795 2007-09-01 13:09:35Z tv $
39 */
40 public class UserGroupRolePeer extends BasePeer
41 {
42 /*** Serial Version UID */
43 private static final long serialVersionUID = -9097451661613525751L;
44
45 /*** The map builder for this Peer. */
46 private static final TurbineMapBuilder MAP_BUILDER;
47
48 /*** The table name for this peer. */
49 public static final String TABLE_NAME;
50
51 /*** The column name for the visitor id field. */
52 public static final String USER_ID;
53
54 /*** The column name for the group id field. */
55 public static final String GROUP_ID;
56
57 /*** The column name for the role id field. */
58 public static final String ROLE_ID;
59
60 static
61 {
62 try
63 {
64 MAP_BUILDER = (TurbineMapBuilder) Torque.getMapBuilder(TurbineMapBuilder.class.getName());
65 }
66 catch (TorqueException e)
67 {
68 log.error("Could not initialize Peer", e);
69 throw new RuntimeException(e);
70 }
71
72 TABLE_NAME = MAP_BUILDER.getTableUserGroupRole();
73 USER_ID = MAP_BUILDER.getUserGroupRole_UserId();
74 GROUP_ID = MAP_BUILDER.getUserGroupRole_GroupId();
75 ROLE_ID = MAP_BUILDER.getUserGroupRole_RoleId();
76 }
77
78 /***
79 * Get the name of this table.
80 *
81 * @return A String with the name of the table.
82 */
83 public static String getTableName()
84 {
85 return TABLE_NAME;
86 }
87
88 /***
89 * Returns the full name of a column.
90 *
91 * @param name name of a column
92 * @return A String with the full name of the column.
93 */
94 public static String getColumnName(String name)
95 {
96 StringBuffer sb = new StringBuffer();
97 sb.append(TABLE_NAME);
98 sb.append(".");
99 sb.append(name);
100 return sb.toString();
101 }
102 }