View Javadoc

1   package org.apache.turbine.om.security.peer;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "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.TorqueException;
23  import org.apache.torque.util.BasePeer;
24  import org.apache.turbine.util.db.map.TurbineMapBuilder;
25  
26  /***
27   * This class handles all database access for the VISITOR_ROLE table.
28   * This table contains all the roles that a given user can play.
29   *
30   * @author <a href="mailto:frank.kim@clearink.com">Frank Y. Kim</a>
31   * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
32   * @author <a href="mailto:bmclaugh@algx.net">Brett McLaughlin</a>
33   *
34   * @deprecated Use {@link org.apache.turbine.services.security.torque.TorqueSecurityService}
35   * instead.
36   *
37   * @version $Id: UserGroupRolePeer.java 534527 2007-05-02 16:10:59Z tv $
38   */
39  public class UserGroupRolePeer extends BasePeer
40  {
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      {
61          try
62          {
63              MAP_BUILDER = (TurbineMapBuilder)/* Torque. */getMapBuilder(TurbineMapBuilder.class.getName());
64          }
65          catch (TorqueException e)
66          {
67              log.error("Could not initialize Peer", e);
68              throw new RuntimeException(e);
69          }
70  
71          TABLE_NAME = MAP_BUILDER.getTableUserGroupRole();
72          USER_ID = MAP_BUILDER.getUserGroupRole_UserId();
73          GROUP_ID = MAP_BUILDER.getUserGroupRole_GroupId();
74          ROLE_ID = MAP_BUILDER.getUserGroupRole_RoleId();
75      }
76  
77      /***
78       * Get the name of this table.
79       *
80       * @return A String with the name of the table.
81       */
82      public static String getTableName()
83      {
84          return TABLE_NAME;
85      }
86  
87      /***
88       * Returns the full name of a column.
89       *
90       * @param name name of a column
91       * @return A String with the full name of the column.
92       */
93      public static String getColumnName(String name)
94      {
95          StringBuffer sb = new StringBuffer();
96          sb.append(TABLE_NAME);
97          sb.append(".");
98          sb.append(name);
99          return sb.toString();
100     }
101 }