org.apache.turbine.om.security.peer
Class TurbineUserPeer

java.lang.Object
  |
  +--org.apache.turbine.om.peer.BasePeer
        |
        +--org.apache.turbine.om.security.peer.TurbineUserPeer
All Implemented Interfaces:
UserPeer

public class TurbineUserPeer
extends BasePeer
implements UserPeer

This class handles all the database access for the User/User table. This table contains all the information for a given user.

Version:
$Id: TurbineUserPeer.java,v 1.1.1.1 2001/08/16 05:08:45 jvanzyl Exp $
Author:
Frank Y. Kim, John D. McNally, Brett McLaughlin

Field Summary
static java.lang.String[] columnNames
          The names of the columns.
private static com.workingdogs.village.Column[] columns
          The columns.
static java.lang.String CONFIRM_DATA
          This is the value that is stored in the database for confirmed users.
static java.lang.String CONFIRM_VALUE
          The key name for the confirm_value field.
private static java.lang.String CONFIRM_VALUE_COLUMN
          The column name for the confirm_value field.
static java.lang.String CREATED
          The key name for the created field.
private static java.lang.String CREATED_COLUMN
          The column name for the created field.
static java.lang.String[] criteriaKeys
          The keys for the criteria.
static java.lang.String EMAIL
          The key name for the email field.
private static java.lang.String EMAIL_COLUMN
          The column name for the email field.
static java.lang.String FIRST_NAME
          The key name for the first name field.
private static java.lang.String FIRST_NAME_COLUMN
          The key name for the first name field.
static java.lang.String LAST_LOGIN
          The key name for the last_login field.
private static java.lang.String LAST_LOGIN_COLUMN
          The column name for the last_login field.
static java.lang.String LAST_NAME
          The key name for the last name field.
private static java.lang.String LAST_NAME_COLUMN
          The key name for the last name field.
private static TurbineMapBuilder mapBuilder
          The mapBuilder for this Peer.
static java.lang.String MODIFIED
          The key name for the modified field.
private static java.lang.String MODIFIED_COLUMN
          The column name for the modified field.
static java.lang.String OBJECT_DATA
          The key name for the object_data field.
private static java.lang.String OBJECT_DATA_COLUMN
          The column name for the visitor id field.
static java.lang.String PASSWORD
          The key name for the password field.
private static com.workingdogs.village.Schema schema
          The schema.
private static java.lang.String SEQUENCE_NAME
          The Oracle sequence name for this peer.
private static java.lang.String TABLE_NAME
          The table name for this peer.
static java.lang.String USER_ID
          The key name for the visitor id field.
private static java.lang.String USER_ID_COLUMN
          The column name for the visitor id field.
static java.lang.String USERNAME
          The key name for the username field.
private static java.lang.String USERNAME_COLUMN
          The column name for the login name field
 
Fields inherited from class org.apache.turbine.om.peer.BasePeer
DEFAULT_MAP_BUILDER, IGNORE_CASE, mapBuilders, ORDER_BY
 
Constructor Summary
TurbineUserPeer()
           
 
Method Summary
static void addSelectColumns(Criteria criteria)
          Add all the columns needed to create a new object
static Criteria buildCriteria(User user)
          Builds a criteria object based upon an User object
static boolean checkExists(User user)
          Checks if a User is defined in the system.
static java.util.Vector doSelect(Criteria criteria)
          Issues a select based on a criteria.
static java.util.Vector doSelect(Criteria criteria, DBConnection dbConn)
          Issues a select based on a criteria.
static java.util.Vector doSelect(Criteria criteria, User current)
          Issues a select based on a criteria.
static void doUpdate(Criteria criteria)
          Issues an update based on a criteria.
static java.lang.String getColumnName(java.lang.String name)
          Returns the full name of a column.
 java.lang.String getFullColumnName(java.lang.String name)
          Returns the full name of a column.
static java.lang.Class getOMClass()
          The type of User this peer will instantiate.
protected static TableMap getTableMap()
          Returns the TableMap related to this peer.
static java.lang.String getTableName()
          Get the name of this table.
static void populateObject(com.workingdogs.village.Record row, int offset, User obj)
           
static User row2Object(com.workingdogs.village.Record row, int offset, java.lang.Class cls)
          Implementss torque peers' method.
static java.util.Vector selectAllConfirmedUsers()
          Returns a vector of all confirmed User objects.
static java.util.Vector selectAllUsers()
          Returns a vector of all User objects.
 
Methods inherited from class org.apache.turbine.om.peer.BasePeer
beginTransaction, commitTransaction, createPreparedStatement, createQueryString, deleteAll, deleteAll, doDelete, doDelete, doInsert, doInsert, doPSSelect, doPSSelect, doUpdate, doUpdate, doUpdate, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeStatement, executeStatement, executeStatement, getMalformedColumnNameException, getMapBuilder, getMapBuilder, getPrimaryKey, getSelectResults, getSelectResults, getSelectResults, getSelectResults, handleMultiple, handleMultipleRecords, hashtableToByteArray, initColumnNames, initCriteriaKeys, initTableColumns, initTableSchema, initTableSchema, insertOrUpdateRecord, rollBackTransaction, setLimit
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

mapBuilder

private static final TurbineMapBuilder mapBuilder
The mapBuilder for this Peer.

USER_ID_COLUMN

private static final java.lang.String USER_ID_COLUMN
The column name for the visitor id field.

USERNAME_COLUMN

private static final java.lang.String USERNAME_COLUMN
The column name for the login name field

FIRST_NAME_COLUMN

private static final java.lang.String FIRST_NAME_COLUMN
The key name for the first name field.

LAST_NAME_COLUMN

private static final java.lang.String LAST_NAME_COLUMN
The key name for the last name field.

MODIFIED_COLUMN

private static final java.lang.String MODIFIED_COLUMN
The column name for the modified field.

CREATED_COLUMN

private static final java.lang.String CREATED_COLUMN
The column name for the created field.

LAST_LOGIN_COLUMN

private static final java.lang.String LAST_LOGIN_COLUMN
The column name for the last_login field.

EMAIL_COLUMN

private static final java.lang.String EMAIL_COLUMN
The column name for the email field.

CONFIRM_VALUE_COLUMN

private static final java.lang.String CONFIRM_VALUE_COLUMN
The column name for the confirm_value field.

CONFIRM_DATA

public static final java.lang.String CONFIRM_DATA
This is the value that is stored in the database for confirmed users.

OBJECT_DATA_COLUMN

private static final java.lang.String OBJECT_DATA_COLUMN
The column name for the visitor id field.

TABLE_NAME

private static final java.lang.String TABLE_NAME
The table name for this peer.

USER_ID

public static final java.lang.String USER_ID
The key name for the visitor id field.

USERNAME

public static final java.lang.String USERNAME
The key name for the username field.

PASSWORD

public static final java.lang.String PASSWORD
The key name for the password field.

FIRST_NAME

public static final java.lang.String FIRST_NAME
The key name for the first name field.

LAST_NAME

public static final java.lang.String LAST_NAME
The key name for the last name field.

MODIFIED

public static final java.lang.String MODIFIED
The key name for the modified field.

CREATED

public static final java.lang.String CREATED
The key name for the created field.

EMAIL

public static final java.lang.String EMAIL
The key name for the email field.

LAST_LOGIN

public static final java.lang.String LAST_LOGIN
The key name for the last_login field.

CONFIRM_VALUE

public static final java.lang.String CONFIRM_VALUE
The key name for the confirm_value field.

OBJECT_DATA

public static final java.lang.String OBJECT_DATA
The key name for the object_data field.

SEQUENCE_NAME

private static final java.lang.String SEQUENCE_NAME
The Oracle sequence name for this peer.

schema

private static com.workingdogs.village.Schema schema
The schema.

columns

private static com.workingdogs.village.Column[] columns
The columns.

columnNames

public static java.lang.String[] columnNames
The names of the columns.

criteriaKeys

public static java.lang.String[] criteriaKeys
The keys for the criteria.
Constructor Detail

TurbineUserPeer

public TurbineUserPeer()
Method Detail

getTableName

public static java.lang.String getTableName()
Get the name of this table.
Returns:
A String with the name of the table.

getColumnName

public static java.lang.String getColumnName(java.lang.String name)
Returns the full name of a column.
Returns:
A String with the full name of the column.

getFullColumnName

public java.lang.String getFullColumnName(java.lang.String name)
Returns the full name of a column.
Specified by:
getFullColumnName in interface UserPeer
Returns:
A String with the full name of the column.

buildCriteria

public static Criteria buildCriteria(User user)
Builds a criteria object based upon an User object

addSelectColumns

public static void addSelectColumns(Criteria criteria)
                             throws java.lang.Exception
Add all the columns needed to create a new object

populateObject

public static void populateObject(com.workingdogs.village.Record row,
                                  int offset,
                                  User obj)
                           throws java.lang.Exception

doSelect

public static java.util.Vector doSelect(Criteria criteria)
                                 throws java.lang.Exception
Issues a select based on a criteria.
Parameters:
criteria - Object containing data that is used to create the SELECT statement.
Returns:
Vector containing TurbineUser objects.
Throws:
Exception, - a generic exception.

doSelect

public static java.util.Vector doSelect(Criteria criteria,
                                        User current)
                                 throws java.lang.Exception
Issues a select based on a criteria.
Parameters:
criteria - Object containing data that is used to create the SELECT statement.
current - User object that is to be used as part of the results - if not passed, then a new one is created.
Returns:
Vector containing TurbineUser objects.
Throws:
Exception, - a generic exception.

doSelect

public static java.util.Vector doSelect(Criteria criteria,
                                        DBConnection dbConn)
                                 throws java.lang.Exception
Issues a select based on a criteria.
Parameters:
criteria - Object containing data that is used to create the SELECT statement.
current - User object that is to be used as part of the results - if not passed, then a new one is created.
Returns:
Vector containing TurbineUser objects.
Throws:
Exception, - a generic exception.

row2Object

public static User row2Object(com.workingdogs.village.Record row,
                              int offset,
                              java.lang.Class cls)
                       throws java.lang.Exception
Implementss torque peers' method. Does not use the Class argument as Users need to go through TurbineSecurity

getOMClass

public static java.lang.Class getOMClass()
                                  throws java.lang.Exception
The type of User this peer will instantiate.

doUpdate

public static void doUpdate(Criteria criteria)
                     throws java.lang.Exception
Issues an update based on a criteria. The criteria only uses USER_ID.
Parameters:
criteria - Object containing data that is used to create the UPDATE statement.
Throws:
Exception, - a generic exception.

checkExists

public static boolean checkExists(User user)
                           throws DataBackendException,
                                  java.lang.Exception
Checks if a User is defined in the system. The name is used as query criteria.
Parameters:
permission - The User to be checked.
Returns:
true if given User exists in the system.
Throws:
DataBackendException - when more than one User with the same name exists.
Exception, - a generic exception.

selectAllUsers

public static java.util.Vector selectAllUsers()
                                       throws java.lang.Exception
Returns a vector of all User objects.
Returns:
A Vector with all users in the system.
Throws:
Exception, - a generic exception.

selectAllConfirmedUsers

public static java.util.Vector selectAllConfirmedUsers()
                                                throws java.lang.Exception
Returns a vector of all confirmed User objects.
Returns:
A Vector with all confirmed users in the system.
Throws:
Exception, - a generic exception.

getTableMap

protected static TableMap getTableMap()
Returns the TableMap related to this peer. This method is not needed for general use but a specific application could have a need.


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.