01: package org.apache.turbine.om.security.peer;
02:
03: /*
04: * Licensed to the Apache Software Foundation (ASF) under one
05: * or more contributor license agreements. See the NOTICE file
06: * distributed with this work for additional information
07: * regarding copyright ownership. The ASF licenses this file
08: * to you under the Apache License, Version 2.0 (the
09: * "License"); you may not use this file except in compliance
10: * with the License. You may obtain a copy of the License at
11: *
12: * http://www.apache.org/licenses/LICENSE-2.0
13: *
14: * Unless required by applicable law or agreed to in writing,
15: * software distributed under the License is distributed on an
16: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17: * KIND, either express or implied. See the License for the
18: * specific language governing permissions and limitations
19: * under the License.
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: /** Serial Version UID */
42: private static final long serialVersionUID = -9097451661613525751L;
43:
44: /** The map builder for this Peer. */
45: private static final TurbineMapBuilder MAP_BUILDER;
46:
47: /** The table name for this peer. */
48: public static final String TABLE_NAME;
49:
50: /** The column name for the visitor id field. */
51: public static final String USER_ID;
52:
53: /** The column name for the group id field. */
54: public static final String GROUP_ID;
55:
56: /** The column name for the role id field. */
57: public static final String ROLE_ID;
58:
59: static {
60: try {
61: MAP_BUILDER = (TurbineMapBuilder) Torque
62: .getMapBuilder(TurbineMapBuilder.class.getName());
63: } catch (TorqueException e) {
64: log.error("Could not initialize Peer", e);
65: throw new RuntimeException(e);
66: }
67:
68: TABLE_NAME = MAP_BUILDER.getTableUserGroupRole();
69: USER_ID = MAP_BUILDER.getUserGroupRole_UserId();
70: GROUP_ID = MAP_BUILDER.getUserGroupRole_GroupId();
71: ROLE_ID = MAP_BUILDER.getUserGroupRole_RoleId();
72: }
73:
74: /**
75: * Get the name of this table.
76: *
77: * @return A String with the name of the table.
78: */
79: public static String getTableName() {
80: return TABLE_NAME;
81: }
82:
83: /**
84: * Returns the full name of a column.
85: *
86: * @param name name of a column
87: * @return A String with the full name of the column.
88: */
89: public static String getColumnName(String name) {
90: StringBuffer sb = new StringBuffer();
91: sb.append(TABLE_NAME);
92: sb.append(".");
93: sb.append(name);
94: return sb.toString();
95: }
96: }
|