|
Last update: 2011-06-23 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.proteios.core.DbControl
public final class DbControl
A DbControl object is the main object used for communicating
with the database. It contains methods for saving and deleting items,
handling transactions, etc. DbControl objects are created by
the SessionControl.newDbControl() method.
| Method Summary | |
|---|---|
void |
close()
Close the connection to the database. |
void |
commit()
Commit all changes made to items and close the connection to the database. |
void |
deleteItem(BasicItem item)
Schedule an existing item to be deleted from the database. |
void |
detachItem(BasicItem item)
Detach an item from this DbControl. |
void |
disconnect()
Temporarily disconnect from the database. |
protected void |
finalize()
Clean up if a bad client application forgot to close the connection. |
SessionControl |
getSessionControl()
Get the SessionControl object that owns this
DbControl object. |
void |
initCollection(BasicItem item,
String collectionName)
Initialise a collection on an item. |
boolean |
isClosed()
Check if the connection to the database has been closed. |
boolean |
isConnected()
Checks if there is an active connection to the database or not. |
void |
reattachItem(BasicItem item)
Reattach a detached item from this DbControl. |
void |
reconnect()
Reconnects to the database after a disconnect(). |
void |
saveItem(BasicItem item)
Schedule a new item to be saved in the database. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public boolean isClosed()
DbControl object.
SessionControl.newDbControl()public SessionControl getSessionControl()
SessionControl object that owns this
DbControl object.
SessionControl object
public void disconnect()
throws BaseException
reconnect() before calling
commit(). If you have used batch items, you should call
commit() or you will lose everything that has already been
BasicBatcher.flush():ed to the database.
BaseException
public void reconnect()
throws BaseException
disconnect().
BaseExceptionpublic boolean isConnected()
public void close()
DbControl cannot be used anymore.
public void commit()
throws BaseException
BaseException - If there is an error
public void saveItem(BasicItem item)
throws PermissionDeniedException,
ItemAlreadyExistsException,
BaseException
commit() method is called.
item - The item to be saved
PermissionDeniedException - If the logged in user doesn't have
create permission
ItemAlreadyExistsException - If the item already exists in the
database
BaseException - If there is another error
public void deleteItem(BasicItem item)
throws PermissionDeniedException,
ItemNotFoundException,
BaseException
commit() method is called.
item - The item to be deleted
PermissionDeniedException - If the logged in user doesn't have
delete permission
ItemNotFoundException - If the item doesn't exist in the database
BaseException - If there is another error
public void detachItem(BasicItem item)
throws BaseException
DbControl. The detached item
will no longer be managed and changes will not be saved to the database.
For some items, certain operations are forbidden for detached items. For
example you are not allowed to upload files to File items.
item - The item to be detached
BaseException - If there is an errorreattachItem(BasicItem)
public void reattachItem(BasicItem item)
throws PermissionDeniedException,
ItemNotFoundException,
BaseException
DbControl. If the
reattached already exists in the database it will be managed and changes
will be saved to the database.
item - The item to be reattached
PermissionDeniedException - If the logged in user doesn't have read
permission
BaseException - If there is another error
ItemNotFoundExceptiondetachItem(BasicItem)
public void initCollection(BasicItem item,
String collectionName)
throws BaseException
Quota object and calls
the Quota.getQuotaValue(QuotaType, Location) method.
item - The itemcollectionName - The name of the collection
BaseException - If there is an errordetachItem(BasicItem),
reattachItem(BasicItem)
protected void finalize()
throws Throwable
finalize in class ObjectThrowable
|
Last update: 2011-06-23 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||