|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.sql.BaseRowMapper<T>
com.antelmann.sql.UserImplMapper<T>
public class UserImplMapper<T extends UserImpl>
provides a base mapper implementation for storing a User.
If accessTable is non-null, the corresponding JDBCRowStore
must set JDBCRowStore.fastDelete to false.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.antelmann.util.Converter |
|---|
Converter.Adapter<T1,T2> |
| Field Summary | |
|---|---|
protected String |
accessColumn
the column containing the name of the right in the access table |
protected String |
accessTable
the table name for the user access rights; if null, no access rights are initialized when mapping users |
protected String |
accessUserColumn
the column in the access rights table holding the foreign key for the userID |
protected String |
descriptionColumn
the column containing a user description |
protected String |
emailColumn
the column containing the email of the user |
protected String |
enabledColumn
the column that holds the boolean value for enabling a user |
protected String |
passwordColumn
the column that stores the password hash value |
| Fields inherited from class com.antelmann.sql.BaseRowMapper |
|---|
db, helper |
| Constructor Summary | |
|---|---|
UserImplMapper(Database<Connection> db,
String tableName,
String idColumn,
String displayColumn,
IDFactory idFactory,
Class<T> userType)
|
|
| Method Summary | |
|---|---|
protected T |
createUser(UserImpl user)
supports reflection-based instantiation with the user as the constructor parameter |
protected void |
deleteAccessRights(Object userID)
deletes the rights of the given userID from the database; the user object remains untouched |
Object |
generateNewID()
if no factory is given, getNextIntID is returned |
protected Map<String,Object> |
generateRowProperties(T user)
generates a map that contains all columns mapped to their values, so that the map can be used to store the object into a row. |
Class<? extends Enum<?>> |
getRightsEnumClass()
|
T |
getUserForName(String name)
for use with an AbstractUserLoginStore |
AbstractUserLoginStore |
getUserLoginStore()
|
Iterable<String> |
getUserNames()
for use with an AbstractUserLoginStore |
void |
handleAfterStore(T entry,
boolean isInsert)
does nothing unless overridden |
protected void |
initUserRights(UserImpl user)
reads the rights from the database and initializes the given user with it |
T |
instantiate(RowItem row)
instantiates the DBEntry based on the properties in the given row. |
boolean |
isMapProperties()
|
protected Object |
objectToRight(Object obj)
allows to customize the way the right for the user is derived from the object stored in the database |
protected Object |
rightToObject(Object right)
allows to customize the way the right is mapped to the object in the database |
void |
setMapProperties(boolean mapProperties)
|
void |
setRightsEnumClass(Class<? extends Enum<?>> rightsEnumClass)
|
protected void |
updateAccessRights(UserImpl user)
writes the rights of the given user in the database; the user object remains untouched |
void |
verifyBeforeDelete(Object id)
does nothing unless overridden |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected String enabledColumn
protected String passwordColumn
protected String descriptionColumn
protected String emailColumn
protected String accessTable
protected String accessUserColumn
protected String accessColumn
| Constructor Detail |
|---|
public UserImplMapper(Database<Connection> db,
String tableName,
String idColumn,
String displayColumn,
IDFactory idFactory,
Class<T> userType)
throws DatabaseException
DatabaseException| Method Detail |
|---|
public AbstractUserLoginStore getUserLoginStore()
public Class<? extends Enum<?>> getRightsEnumClass()
public void setRightsEnumClass(Class<? extends Enum<?>> rightsEnumClass)
public boolean isMapProperties()
public void setMapProperties(boolean mapProperties)
protected Map<String,Object> generateRowProperties(T user)
throws WrongDataException
BaseRowMapper
generateRowProperties in class BaseRowMapper<T extends UserImpl>WrongDataException
public Object generateNewID()
throws DatabaseException
generateNewID in interface ObjectRowMapper<T extends UserImpl>generateNewID in class BaseRowMapper<T extends UserImpl>DatabaseExceptionDBClassStore.generateNewID(),
SQLNumberGenerator,
TransactionalNumberGenerator
public T instantiate(RowItem row)
throws Exception
ObjectRowMapperObjectRowMapper.getRestrictMappedColumns().
Exception
protected T createUser(UserImpl user)
throws Exception
Exception
public void verifyBeforeDelete(Object id)
throws DatabaseException,
SQLException
BaseRowMapper
verifyBeforeDelete in interface ObjectRowMapper<T extends UserImpl>verifyBeforeDelete in class BaseRowMapper<T extends UserImpl>WrongDataException - if the deletion is not allowed for semantical reasons
DatabaseException
SQLException
public void handleAfterStore(T entry,
boolean isInsert)
throws DatabaseException,
SQLException
BaseRowMapper
handleAfterStore in interface ObjectRowMapper<T extends UserImpl>handleAfterStore in class BaseRowMapper<T extends UserImpl>isInsert - if true, the entry is about to be inserted; if false, it is an update
DatabaseException
SQLException
protected void initUserRights(UserImpl user)
throws SQLException
SQLExceptionprotected Object objectToRight(Object obj)
protected void deleteAccessRights(Object userID)
throws SQLException
SQLException
protected void updateAccessRights(UserImpl user)
throws SQLException
SQLExceptionprotected Object rightToObject(Object right)
public Iterable<String> getUserNames()
throws DatabaseException
DatabaseExceptionAbstractUserLoginStore
public T getUserForName(String name)
throws DatabaseException
DatabaseExceptionAbstractUserLoginStore
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||