|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--kiurubeans.KiuruHandler | +--kiurubeans.EntityHandler
Representation of a database entity.
Field Summary | |
static int |
DELETE_RECORD
Deletes record from database & clears attributes |
static int |
GET_RECORD
Updates attributes from database based on current ID information |
static int |
POST_RECORD
Saves current record from database, provided that attributes are ok. |
static int |
RESET_RECORD
Clears attributes. |
Fields inherited from class kiurubeans.KiuruHandler |
NO_ACTION |
Constructor Summary | |
EntityHandler()
Dummy empty constructor. |
Method Summary | |
void |
clearEmptyParameters(javax.servlet.http.HttpServletRequest request)
Ensures empty request parameters are clearer when entity is posted. |
protected void |
defaultAction()
Performs action based on actionType. |
abstract void |
deleteRecord()
Deletes current record from database. |
protected abstract boolean |
doCheckModifyRight()
Implementation of modify rights checking. |
protected void |
doClearActionState(javax.servlet.http.HttpServletRequest request)
Default implementation of clearing action state. |
abstract boolean |
getAddingNew()
Returns if entity is in a state of adding a new record. |
protected int |
getMaxState()
Returns current max state value. |
abstract void |
getRecord()
Retrieves record from database according to current Id field(s) value(s). |
boolean |
hasModifyRight()
Returns true if current user has full rights to modify current entity. |
abstract void |
postRecord()
Saves record to database. |
abstract void |
resetRecord()
Clears field values. |
Methods inherited from class kiurubeans.KiuruHandler |
addError, addNotice, doClearEmptyParameters, getEnumState, getError, getLangId, getOk, getUser, performAction, resetActionState, resetErrorState, setEnumState, setError, setOk, setUser |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int GET_RECORD
public static final int RESET_RECORD
public static final int DELETE_RECORD
public static final int POST_RECORD
Constructor Detail |
public EntityHandler()
Method Detail |
protected int getMaxState()
getMaxState
in class KiuruHandler
protected abstract boolean doCheckModifyRight()
hasModifyRight()
public boolean hasModifyRight()
Note! User must be set when calling this method.
protected void defaultAction() throws java.lang.Exception
defaultAction
in class KiuruHandler
java.lang.Exception
- If something went wrong during actual executed action.KiuruHandler.performAction()
public abstract void getRecord() throws java.lang.Exception
Id field(s) are defined in descendant classes. Method implements also user rights check, eg. if user has no right to retrieve the record, empty object is returned instead.
java.lang.Exception
- if there is a problem with DB connectionpublic abstract void resetRecord()
Result should be equivalent to constructing a new object. Nothing is saved to database.
public abstract void deleteRecord() throws java.lang.Exception
Actually applies deleted=true. Object is cleared after deletion.
java.lang.Exception
- if there is a problem with DB connectionpublic abstract void postRecord() throws java.lang.Exception
If field values are not valid, sets Ok property to false.
java.lang.Exception
- if there is a problem with DB connectionprotected void doClearActionState(javax.servlet.http.HttpServletRequest request)
doClearActionState
in class KiuruHandler
request
- The request-object of the JSP.KiuruHandler.resetActionState(HttpServletRequest)
public abstract boolean getAddingNew()
public void clearEmptyParameters(javax.servlet.http.HttpServletRequest request)
If bean is used in a JSP, this should be called in the beginning of page. If form content is "" or null it is not sent via HTTP, so those fields must be cleared manually. Method may be called from a handler or UI page.
clearEmptyParameters
in class KiuruHandler
request
- HTTP request with parametersKiuruHandler.doClearEmptyParameters(HttpServletRequest)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |