|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.struts.action.Action com.jcorporate.expresso.core.controller.Controller com.jcorporate.expresso.core.controller.DBController com.sri.common.controller.AbstractDBController
public abstract class AbstractDBController
Superclass for all TI controllers, for common behavior like logging.
Field Summary | |
---|---|
static String |
COLUMN
Column Constant. |
static String |
COMMON_FOOTER_HANDLER
Constant for common footer handler. |
static String |
COMMON_HEADER_HANDLER
Constant for common header handler. |
static String |
DELIMIT
Delimiter constant. |
static String |
EDIT_GROUP_DISPLAY
Jsp constant. |
static String |
EMBEDDED_MODE
Parameter to indicate 'embedded mode'. |
static String |
FOOTER
Footer constant. |
static int |
MAX_CHARS_OUTPUT
Limit number of chars that appear in display for a given field. |
static int |
MAX_TEXTAREA_LENGTH
Max Text Area Length constant. |
static int |
MULTIPLE_TEXTAREA_NUM_LINES
Number of lines for multiple text area. |
static String |
REQUEST_CONTAINER
Key where the RequestContainer is stored in the session. |
static String |
ROW
Row Constant. |
static String |
ROW_BLOCK
Row Block Constant. |
static String |
SESSION_CONTAINER
Key where the session container is stored. |
static int |
SINGLE_TEXTAREA_NUM_LINES
Number of lines for a text area. |
static int |
TEXTAREA_NUM_COLS
Number of columns for a test area. |
static String |
WARNING_LIST
Constant for warning list location. |
Fields inherited from class com.jcorporate.expresso.core.controller.DBController |
---|
CACHE_NAME |
Fields inherited from class com.jcorporate.expresso.core.controller.Controller |
---|
CONTROLLER_PARAM_KEY, CTL_SUCC_CTL, CTL_SUCC_STATE, CTL_SUCC_TRAN, mLog, NEWSTATE_EXCEPTION_KEY, ORIGINAL_URL_KEY, REQUEST_KEY, RESPONSE_KEY, RETURN_TO_SENDER_TRAN, STATE_ERR_CTL, STATE_ERR_STATE, STATE_ERR_TRAN, STATE_PARAM_KEY, STATE_SUCC_CTL, STATE_SUCC_STATE, STATE_SUCC_TRAN |
Fields inherited from class org.apache.struts.action.Action |
---|
defaultLocale, servlet |
Constructor Summary | |
---|---|
AbstractDBController()
|
Method Summary | |
---|---|
static Transition |
addEmbeddedParameter(Transition transitionToModify)
Adds the 'embedded mode' parameter to a transition. |
void |
addWarning(ExpressoRequest request,
String s)
Adds warning to request scope, creating list if necessary. |
protected List |
addWarningList(ExpressoRequest request)
Add list to request scope. |
protected String |
getActionForwarding(String forward,
String state)
Look up the forward used for 'state' param, suitable for use with setStyle(). |
static Input |
getCheckbox(String name,
String label,
String defVal,
boolean isSelected)
Get a checkbox with the given name, label, default value, and optionally select it. |
Transition |
getPermsTrans(RowSecuredDBObject obj)
Retrieve the permission transition for the row secured dbobject. |
static String |
getPrettyXML(org.dom4j.Element elem)
Get nicely formatted XML. |
static Input |
getTextArea(String name,
String defVal)
Get a text area with 4 rows and 40 columns. |
static Input |
getTextArea(String name,
String defVal,
int rows,
int cols)
Get a text area with the given name and default value. |
protected List |
getWarningList(ExpressoRequest request)
Get list from request scope. |
static boolean |
isEmbeddedMode(ExpressoRequest request)
Checks the controller request for the 'embedded mode' parameter. |
boolean |
isValidAndPopulated(DBObject object,
String[] requiredFields,
String failureState,
ExpressoRequest request,
ExpressoResponse response)
Populates DBObject with any parameters which match field names. |
void |
outputXML(org.dom4j.Document document,
ExpressoRequest request)
Output XML for given document. |
static void |
populateDBObject(DBObject obj,
ExpressoRequest request)
fill in any fields found in request |
protected void |
postPerform(State nextState,
ExpressoRequest request,
ExpressoResponse response)
Template Method, allowing a subclass to into actions before any state in this controller is performed. |
protected void |
prePerform(State nextState,
ExpressoRequest request,
ExpressoResponse response)
Template Method, allowing a subclass to do an action after any state in this controller is performed. |
boolean |
stateAllowed(String newState,
ExpressoRequest myRequest)
Override to permit any logged in user. |
static String |
str(String item)
Make sure output strings are not empty for tables, and insure that anchor tags are completed. |
String |
strTrunc(String item,
int max)
Ensure a non-empty string (for <td columns), and also truncate as specified WHILE INSURING that an anchor link (<a ) is not cut in half. |
static void |
trimAllTextFields(DBObject object)
|
Methods inherited from class com.jcorporate.expresso.core.controller.DBController |
---|
getString, isAllowed |
Methods inherited from class org.apache.struts.action.Action |
---|
addErrors, addMessages, execute, generateToken, getDataSource, getDataSource, getErrors, getLocale, getMessages, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, resetToken, saveErrors, saveErrors, saveMessages, saveMessages, saveToken, setLocale, setServlet |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String FOOTER
public static final String COLUMN
public static final String ROW_BLOCK
public static final String ROW
public static final String WARNING_LIST
public static final String COMMON_FOOTER_HANDLER
public static final String COMMON_HEADER_HANDLER
public static final int MAX_CHARS_OUTPUT
public static final int SINGLE_TEXTAREA_NUM_LINES
public static final int MULTIPLE_TEXTAREA_NUM_LINES
public static final int TEXTAREA_NUM_COLS
public static final int MAX_TEXTAREA_LENGTH
public static final String DELIMIT
public static final String EDIT_GROUP_DISPLAY
public static final String EMBEDDED_MODE
public static final String REQUEST_CONTAINER
public static final String SESSION_CONTAINER
Constructor Detail |
---|
public AbstractDBController()
Method Detail |
---|
public boolean isValidAndPopulated(DBObject object, String[] requiredFields, String failureState, ExpressoRequest request, ExpressoResponse response) throws ControllerException, DBException
object
- the DBObject to checkrequiredFields
- an array of strings that are required to checkfailureState
- the state to transition to on failurerequest
- the ExpressoRequest
objectresponse
- the ExpressoResponse
object
ControllerException
- upon error.
DBException
- upon database metadata access/validation error.public static void populateDBObject(DBObject obj, ExpressoRequest request) throws DBException
DBException
public static void trimAllTextFields(DBObject object) throws DBException
DBException
public static String str(String item)
item
- the current value for the table.
public boolean stateAllowed(String newState, ExpressoRequest myRequest) throws ControllerException
stateAllowed
in class DBController
newState
- The name of the new state that is being requestedmyRequest
- the ExpressoRequest
object
ControllerException
- if another undefined error takes place while
checking security.public void outputXML(org.dom4j.Document document, ExpressoRequest request) throws IOException, ControllerException
document
- The XML Document (Dom4J)request
- The ExpressoRequest object.
IOException
- upon io error.
ControllerException
- upon error getting to the ServletResponse.public static String getPrettyXML(org.dom4j.Element elem) throws IOException
elem
- The XML Element to pretty print.
IOException
- upon printing exception.protected void postPerform(State nextState, ExpressoRequest request, ExpressoResponse response) throws ControllerException
postPerform
in class Controller
nextState
- the state to be performedrequest
- the request objectresponse
- the response object
ControllerException
- upon controller error.public static boolean isEmbeddedMode(ExpressoRequest request)
request
- ExpressoRequest the request parameters to query.
public static Transition addEmbeddedParameter(Transition transitionToModify)
transitionToModify
- Transition
protected List addWarningList(ExpressoRequest request)
request
- the ExpressoRequest object.
protected List getWarningList(ExpressoRequest request)
request
- The ExpressoRequest object.
public void addWarning(ExpressoRequest request, String s)
request
- The ExpressoRequest object.s
- the warning string.public static Input getCheckbox(String name, String label, String defVal, boolean isSelected)
name
- The input's name.label
- The Input's label.defVal
- The default value.isSelected
- true if the checkbox is selected.
public static Input getTextArea(String name, String defVal, int rows, int cols)
name
- Name for the text areadefVal
- Default value for the text arearows
- Rows for the text areacols
- Columns for the text area
public static Input getTextArea(String name, String defVal)
name
- Name for the text areadefVal
- Default value for the text area
protected String getActionForwarding(String forward, String state)
forward
- default forwarding path to use in case none is foundstate
- final state for which forward is looked up
ExpressoResponse.setStyle(java.lang.String)
public String strTrunc(String item, int max)
item
- The item to parsemax
- ?
public Transition getPermsTrans(RowSecuredDBObject obj)
obj
- RowSecuredDBObject the object to get the transition for.
protected void prePerform(State nextState, ExpressoRequest request, ExpressoResponse response) throws ControllerException
This implementation initializes any request-level services if needed.
prePerform
in class Controller
nextState
- the state to be performedrequest
- the request objectresponse
- the response object
ControllerException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |