org.sakaiproject.component.legacy.user
Class DbUserService.DbStorage

java.lang.Object
  extended byorg.sakaiproject.util.storage.BaseDbFlatStorage
      extended byorg.sakaiproject.component.legacy.user.DbUserService.DbStorage
All Implemented Interfaces:
BaseUserDirectoryService.Storage, SqlReader
Enclosing class:
DbUserService

protected class DbUserService.DbStorage
extends BaseDbFlatStorage
implements BaseUserDirectoryService.Storage, SqlReader

Covers for the BaseXmlFileStorage, providing User and UserEdit parameters


Field Summary
protected  BaseUserDirectoryService.Storage m_oldStorage
          A prior version's storage model.
 
Fields inherited from class org.sakaiproject.util.storage.BaseDbFlatStorage
m_caseInsensitive, m_locking, m_locks, m_locksAreInTable, m_reader, m_resourcePropertyTableName, m_resourceTableDbidField, m_resourceTableIdField, m_resourceTableInsertFields, m_resourceTableInsertValues, m_resourceTableName, m_resourceTableReadFields, m_resourceTableSortField1, m_resourceTableSortField2, m_resourceTableUpdateFields, m_sql
 
Constructor Summary
DbUserService.DbStorage(StorageUser user)
          Construct.
 
Method Summary
 void cancel(UserEdit edit)
          Cancel the changes and release the lock.
 boolean check(String id)
          Check if a user by this id exists.
 void commit(UserEdit edit)
          Commit the changes and release the lock.
 int count()
          Count all the users.
 int countSearch(String criteria)
          Count all the users with id or email, first or last name matching criteria.
 UserEdit edit(String id)
          Get a lock on the user with this id, or null if a lock cannot be gotten.
protected  Object[] fields(String id, UserEdit edit, boolean idAgain)
          Get the fields for the database from the edit for this id, and the id again at the end if needed
 Collection findUsersByEmail(String email)
          Get the users with this email, or return empty if none found.
 UserEdit get(String id)
          Get the user with this id, or null if not found.
 List getAll()
          Get all users.
 List getAll(int first, int last)
          Get all the users in record range.
 UserEdit put(String id)
          Add a new user with this id.
 void readProperties(UserEdit edit, ResourcePropertiesEdit props)
          Read properties from storage into the edit's properties.
 Object readSqlResultRecord(ResultSet result)
          Read from the result one set of fields to create a Resource.
 void remove(UserEdit edit)
          Remove this user.
 List search(String criteria, int first, int last)
          Search for users with id or email, first or last name matching criteria, in range.
 
Methods inherited from class org.sakaiproject.util.storage.BaseDbFlatStorage
cancelResource, caseId, checkResource, close, commitResource, commitResource, countAllResources, countSelectedResources, countSelectedResources, deleteProperties, editResource, editResource, fieldList, getAllResources, getAllResources, getResource, getResource, getSelectedResources, getSelectedResources, getSelectedResources, getSelectedResources, getSelectedResources, getSelectedResources, insertResource, open, putResource, putResource, qualifyField, readProperties, readProperties, readProperties, readProperties, readProperties, readProperties, removeResource, removeResource, setCaseInsensitivity, setDbidField, setLocking, setSortField, setWriteFields, updateFields, updateSet, valuesParams, writeProperties, writeProperties, writeProperties, writeProperties, writeProperties, writeProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.sakaiproject.component.legacy.user.BaseUserDirectoryService.Storage
close, open
 

Field Detail

m_oldStorage

protected BaseUserDirectoryService.Storage m_oldStorage
A prior version's storage model.

Constructor Detail

DbUserService.DbStorage

public DbUserService.DbStorage(StorageUser user)
Construct.

Parameters:
user - The StorageUser class to call back for creation of Resource and Edit objects.
Method Detail

check

public boolean check(String id)
Description copied from interface: BaseUserDirectoryService.Storage
Check if a user by this id exists.

Specified by:
check in interface BaseUserDirectoryService.Storage
Parameters:
id - The user id.
Returns:
true if a user by this id exists, false if not.

get

public UserEdit get(String id)
Description copied from interface: BaseUserDirectoryService.Storage
Get the user with this id, or null if not found.

Specified by:
get in interface BaseUserDirectoryService.Storage
Parameters:
id - The user id.
Returns:
The user with this id, or null if not found.

getAll

public List getAll()
Description copied from interface: BaseUserDirectoryService.Storage
Get all users.

Specified by:
getAll in interface BaseUserDirectoryService.Storage
Returns:
The List (UserEdit) of all users.

getAll

public List getAll(int first,
                   int last)
Description copied from interface: BaseUserDirectoryService.Storage
Get all the users in record range.

Specified by:
getAll in interface BaseUserDirectoryService.Storage
Parameters:
first - The first record position to return.
last - The last record position to return.
Returns:
The List (BaseUserEdit) of all users.

count

public int count()
Description copied from interface: BaseUserDirectoryService.Storage
Count all the users.

Specified by:
count in interface BaseUserDirectoryService.Storage
Returns:
The count of all users.

put

public UserEdit put(String id)
Description copied from interface: BaseUserDirectoryService.Storage
Add a new user with this id.

Specified by:
put in interface BaseUserDirectoryService.Storage
Parameters:
id - The user id.
Returns:
The locked User object with this id, or null if the id is in use.

edit

public UserEdit edit(String id)
Description copied from interface: BaseUserDirectoryService.Storage
Get a lock on the user with this id, or null if a lock cannot be gotten.

Specified by:
edit in interface BaseUserDirectoryService.Storage
Parameters:
id - The user id.
Returns:
The locked User with this id, or null if this records cannot be locked.

commit

public void commit(UserEdit edit)
Description copied from interface: BaseUserDirectoryService.Storage
Commit the changes and release the lock.

Specified by:
commit in interface BaseUserDirectoryService.Storage
Parameters:
edit - The user to commit.

cancel

public void cancel(UserEdit edit)
Description copied from interface: BaseUserDirectoryService.Storage
Cancel the changes and release the lock.

Specified by:
cancel in interface BaseUserDirectoryService.Storage
Parameters:
edit - The user to commit.

remove

public void remove(UserEdit edit)
Description copied from interface: BaseUserDirectoryService.Storage
Remove this user.

Specified by:
remove in interface BaseUserDirectoryService.Storage
Parameters:
edit - The user to remove.

search

public List search(String criteria,
                   int first,
                   int last)
Description copied from interface: BaseUserDirectoryService.Storage
Search for users with id or email, first or last name matching criteria, in range.

Specified by:
search in interface BaseUserDirectoryService.Storage
Parameters:
criteria - The search criteria.
first - The first record position to return.
last - The last record position to return.
Returns:
The List (BaseUserEdit) of all alias.

countSearch

public int countSearch(String criteria)
Description copied from interface: BaseUserDirectoryService.Storage
Count all the users with id or email, first or last name matching criteria.

Specified by:
countSearch in interface BaseUserDirectoryService.Storage
Parameters:
criteria - The search criteria.
Returns:
The count of all aliases with id or target matching criteria.

findUsersByEmail

public Collection findUsersByEmail(String email)
Get the users with this email, or return empty if none found.

Specified by:
findUsersByEmail in interface BaseUserDirectoryService.Storage
Returns:
The Collection (User) of users with this email, or an empty collection if none found.

readProperties

public void readProperties(UserEdit edit,
                           ResourcePropertiesEdit props)
Read properties from storage into the edit's properties.

Specified by:
readProperties in interface BaseUserDirectoryService.Storage
Parameters:
edit - The user to read properties for.

fields

protected Object[] fields(String id,
                          UserEdit edit,
                          boolean idAgain)
Get the fields for the database from the edit for this id, and the id again at the end if needed

Parameters:
id - The resource id
edit - The edit (may be null in a new)
idAgain - If true, include the id field again at the end, else don't.
Returns:
The fields for the database.

readSqlResultRecord

public Object readSqlResultRecord(ResultSet result)
Read from the result one set of fields to create a Resource.

Specified by:
readSqlResultRecord in interface SqlReader
Parameters:
result - The Sql query result.
Returns:
The Resource object.