|
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.AbstractBatcher
org.proteios.core.BasicBatcher<D>
public abstract class BasicBatcher<D extends BatchableData>
This is an abstract class for batching functionallity.
Add all objects and then call flush to
send the batch to the database. BasicBatcher can
also have a limit on the batch size, when the batch is
full BasicBatcher will automatically call
flush to send the current batch to
the database.
| Method Summary | |
|---|---|
void |
checkPermission(Permission permission)
Checks if the logged in user has the specified permission on this item. |
void |
delete(D data)
Delete a data object. |
void |
delete(int id)
Delete a data object by id. |
void |
flush()
Flush the batcher and send all remaining items in memory to the database. |
void |
flushDelete()
Flush the SQL delete command buffer. |
void |
flushInsert()
Flush the SQL insert command buffer. |
void |
flushUpdate()
Flush the SQL insert command buffer. |
int |
getTotalInsertCount()
|
abstract Item |
getType()
Get the type of item supported by the batcher. |
boolean |
hasPermission(Permission permission)
Checks if the logged in user has the specified permission on this item. |
void |
insert(D data)
Insert a data object. |
void |
update(D data)
Update a data object. |
abstract void |
validate(D data)
Validate the data, since no validation is possible in set methods of the data object. |
| Methods inherited from class org.proteios.core.AbstractBatcher |
|---|
close, getBatchSize, getDbControl, getSessionControl, isClosed, setBatchSize |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public final boolean hasPermission(Permission permission)
Subclasses that needs to check other keys, should override the initPermissions(int,int) method instead.
hasPermission in interface AccessControlledpermission - A value from the Permission class
TRUE if the user has the permission,
FALSE otherwise
public final void checkPermission(Permission permission)
throws PermissionDeniedException
PermissionDeniedException is thrown.
checkPermission in interface AccessControlledpermission - A value from the Permission class
PermissionDeniedException - If the logged in user doesn't
have the requested permission
public void flush()
throws BaseException
Batcher
flush in interface BatcherBaseException - If there is an errorBatcher.close()
public void insert(D data)
throws InvalidDataException,
PermissionDeniedException,
BaseException
data - Data object to be inserted
InvalidDataException - If the data is null or it doesn't validate
against the validate(BatchableData) method
PermissionDeniedException - If the logged in user doesn't
have create permission
BaseException - If there is another error
public void update(D data)
throws InvalidDataException,
PermissionDeniedException,
BaseException
data - Data object to be updated
InvalidDataException - If the data is null or it doesn't validate
against the validate(BatchableData) method
PermissionDeniedException - If the logged in user doesn't
have write permission
BaseException - If there is another error
public void delete(D data)
throws InvalidDataException,
PermissionDeniedException,
BaseException
data - Data object to be deleted
InvalidDataException - If the data is null
PermissionDeniedException - If the logged in user doesn't
have delete permission
BaseException - If there is another error
public void delete(int id)
throws PermissionDeniedException,
BaseException
id - Id of the object to be deleted
PermissionDeniedException - If the logged in user doesn't
have delete permission
BaseException - If there is another error
public void flushInsert()
throws DatabaseException
DatabaseException - Thrown if there is a database error.
public void flushUpdate()
throws DatabaseException
DatabaseException - Thrown if there is a database error.
public void flushDelete()
throws DatabaseException
DatabaseException - Thrown if there is a database error.
public abstract void validate(D data)
throws InvalidDataException
data - Data object to validate
InvalidDataException - If the data object is invalidpublic abstract Item getType()
Item enumeration.
Itempublic int getTotalInsertCount()
|
Last update: 2011-06-23 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||