org.sakaiproject.component.legacy.alias
Class DbAliasService.DbStorage

java.lang.Object
  extended byorg.sakaiproject.util.storage.BaseDbFlatStorage
      extended byorg.sakaiproject.component.legacy.alias.DbAliasService.DbStorage
All Implemented Interfaces:
BaseAliasService.Storage, SqlReader
Enclosing class:
DbAliasService

protected class DbAliasService.DbStorage
extends BaseDbFlatStorage
implements BaseAliasService.Storage, SqlReader

Covers for the BaseXmlFileStorage, providing User and AliasEdit parameters


Field Summary
protected  BaseAliasService.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
DbAliasService.DbStorage(StorageUser user)
          Construct.
 
Method Summary
 void cancel(AliasEdit edit)
          Cancel the changes and release the lock.
 boolean check(String id)
          Check if an alias with this id exists.
 void commit(AliasEdit edit)
          Commit the changes and release the lock.
 int count()
          Count all the aliases.
 int countSearch(String criteria)
          Count all the aliases with id or target matching criteria.
 AliasEdit edit(String id)
          Get a lock on the alias with this id, or null if a lock cannot be gotten.
protected  Object[] fields(String id, AliasEdit edit, boolean idAgain)
          Get the fields for the database from the edit for this id, and the id again at the end if needed
 AliasEdit get(String id)
          Get the alias with this id, or null if not found.
 List getAll()
          Get all the alias.
 List getAll(int first, int last)
          Get all the alias in record range.
 List getAll(String target)
          Get all the alias that point at this target.
 List getAll(String target, int first, int last)
          Get all the alias that point at this target, in record range.
 AliasEdit put(String id)
          Add a new alias with this id.
 void readProperties(AliasEdit 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(AliasEdit edit)
          Remove this alias.
 List search(String criteria, int first, int last)
          Search for aliases with id or target 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.alias.BaseAliasService.Storage
close, open
 

Field Detail

m_oldStorage

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

Constructor Detail

DbAliasService.DbStorage

public DbAliasService.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: BaseAliasService.Storage
Check if an alias with this id exists.

Specified by:
check in interface BaseAliasService.Storage
Parameters:
id - The alias id (case insensitive).
Returns:
true if an alias by this id exists, false if not.

get

public AliasEdit get(String id)
Description copied from interface: BaseAliasService.Storage
Get the alias with this id, or null if not found.

Specified by:
get in interface BaseAliasService.Storage
Parameters:
id - The alias id (case insensitive).
Returns:
The alias with this id, or null if not found.

getAll

public List getAll()
Description copied from interface: BaseAliasService.Storage
Get all the alias.

Specified by:
getAll in interface BaseAliasService.Storage
Returns:
The List (BaseAliasEdit) of all alias.

getAll

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

Specified by:
getAll in interface BaseAliasService.Storage
Parameters:
first - The first record position to return.
last - The last record position to return.
Returns:
The List (BaseAliasEdit) of all alias.

count

public int count()
Description copied from interface: BaseAliasService.Storage
Count all the aliases.

Specified by:
count in interface BaseAliasService.Storage
Returns:
The count of all aliases.

getAll

public List getAll(String target)
Description copied from interface: BaseAliasService.Storage
Get all the alias that point at this target.

Specified by:
getAll in interface BaseAliasService.Storage
Returns:
The List (BaseAliasEdit) of all alias that point at this target

getAll

public List getAll(String target,
                   int first,
                   int last)
Description copied from interface: BaseAliasService.Storage
Get all the alias that point at this target, in record range.

Specified by:
getAll in interface BaseAliasService.Storage
Parameters:
first - The first record position to return.
last - The last record position to return.
Returns:
The List (BaseAliasEdit) of all alias that point at this target, in record range.

put

public AliasEdit put(String id)
Description copied from interface: BaseAliasService.Storage
Add a new alias with this id.

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

edit

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

Specified by:
edit in interface BaseAliasService.Storage
Parameters:
id - The alias id (case insensitive).
Returns:
The locked Alias with this id, or null if this records cannot be locked.

commit

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

Specified by:
commit in interface BaseAliasService.Storage

cancel

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

Specified by:
cancel in interface BaseAliasService.Storage

remove

public void remove(AliasEdit edit)
Description copied from interface: BaseAliasService.Storage
Remove this alias.

Specified by:
remove in interface BaseAliasService.Storage

search

public List search(String criteria,
                   int first,
                   int last)
Description copied from interface: BaseAliasService.Storage
Search for aliases with id or target matching criteria, in range.

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

countSearch

public int countSearch(String criteria)
Description copied from interface: BaseAliasService.Storage
Count all the aliases with id or target matching criteria.

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

readProperties

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

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

fields

protected Object[] fields(String id,
                          AliasEdit 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.