Package ch.autumo.beetroot.handler
Class DefaultViewHandler
java.lang.Object
org.nanohttpd.router.RouterNanoHTTPD.DefaultStreamHandler
org.nanohttpd.router.RouterNanoHTTPD.DefaultHandler
ch.autumo.beetroot.handler.BaseHandler
ch.autumo.beetroot.handler.DefaultViewHandler
- All Implemented Interfaces:
Handler,RouterNanoHTTPD.UriResponder
- Direct Known Subclasses:
PropertiesViewHandler,RolesViewHandler,TasksViewHandler,UsersViewHandler
Default handler for 'web/html/<entity>/view.html' templates.
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.autumo.beetroot.handler.BaseHandler
BaseHandler.IfSectionHandler -
Field Summary
Fields inherited from class ch.autumo.beetroot.handler.BaseHandler
action, columns, emptyBean, entity, htmlData, htmlHead, initialValues, insertServletNameInTemplateRefs, MSG_TYPE_ERR, MSG_TYPE_INFO, MSG_TYPE_WARN, PRECISION_INPUT_TYPES, servletName, TAG_PREFIX_LANG, transientFields, uniqueFields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionextractCustomSingleTableData(BeetRootHTTPSession session, ResultSet rsmd, String columnName, int idx, Entity entity) Overwrite this method, if you need to add a custom data; e.g. when multiple user roles are used; in this case it is more likely that you combine more values that just one field value or use it for any custom value.extractSingleTableData(BeetRootHTTPSession session, ResultSet set, String columnName, int idx, Entity entity) Extract one single table data field from result set standing at current row.Class<?>Get bean entity class that has been generated trough PLANT, self-written or null (then null in extract calls too).Get web resource file as it lies on the file system relatively to the started server process.voidprepare(BeetRootHTTPSession session, Entity entity) Prepare call to to something with the entity bean if necessary.readData(BeetRootHTTPSession session, int id) Read data from DB that must be filled when the template is parsed.Methods inherited from class ch.autumo.beetroot.handler.BaseHandler
addCheckBox, addErrorMessage, addHtmlDataLine, addHtmlHeadLine, addSuccessMessage, addWarningMessage, columns, columnsSize, deleteData, formatSingleValueForDB, get, getColumn, getColumnsForSql, getColumnsForSql, getCurrentEntityDbId, getCurrentSession, getCustomizedExceptionInformation, getData, getEmptyBean, getEntity, getHandlerClass, getHtmlData, getHtmlHead, getInsertValues, getLayout, getMessageType, getMimeType, getNewScanner, getNewScanner, getPaginator, getRedirectHandler, getSimpleManagementUserRoles, getStatus, getTableExport, getTemplateEngineErrorMessage, getTemplateEngineErrorTitle, getText, getText, getTitle, getTransientFields, getUpdateSetClause, getUpdateSetClause, hasAccess, hasExternalLinks, hasNoColumnsConfig, initialize, initialValue, initValuesSize, isCurrentUserUpdate, isCustomResponse, isNoContentResponse, isNoContentResponseButRoute, isPrecisionInputType, isRetryCall, loginMarker, parseAssociatedEntities, parseUnassociatedEntities, patchInputValue, readSnippetResource, redirectedMarker, refreshUserRoles, registerDisplayField, registerRoutes, render, renderAll, saveData, setCurrentEntityDbId, setMessageType, setVar, setVarAll, showLangMenu, showMenu, uniqueFields, uniqueTest, updateDataMethods inherited from class org.nanohttpd.router.RouterNanoHTTPD.DefaultStreamHandler
delete, other, post, put
-
Constructor Details
-
DefaultViewHandler
-
-
Method Details
-
readData
Description copied from class:BaseHandlerRead data from DB that must be filled when the template is parsed. Used by index and view handlers.- Overrides:
readDatain classBaseHandler- Parameters:
session- HTTP sessionid- db record id > 0 if a single record should be read otherwise < 0;- Returns:
- response or null, null means success, response's status must be checked!
- Throws:
Exception- exception
-
prepare
Prepare call to to something with the entity bean if necessary.- Parameters:
session- HTTP sessionentity- entity bean
-
extractSingleTableData
public String extractSingleTableData(BeetRootHTTPSession session, ResultSet set, String columnName, int idx, Entity entity) throws Exception Extract one single table data field from result set standing at current row. NOTE: Never call "set.next()" !- Parameters:
session- HTTP sessionset- database result set pointing to current recordcolumnName- column name as configured in 'web/<entity>/columns.cfg'idx- SQL result set column indexentity- whole entity bean- Returns:
- html data extract <td>...</td>
- Throws:
Exception- exception
-
extractCustomSingleTableData
public String extractCustomSingleTableData(BeetRootHTTPSession session, ResultSet rsmd, String columnName, int idx, Entity entity) throws Exception Overwrite this method, if you need to add a custom data; e.g. when multiple user roles are used; in this case it is more likely that you combine more values that just one field value or use it for any custom value. The value is guaranteed to be inserted in the column-order as defined in the 'columns.cfg'.- Parameters:
session- HTTP sessionrsmd- result set meta datacolumnName- column name as configured in 'web/<entity>/columns.cfg'idx- SQL result set column indexentity- whole entity bean- Returns:
- html data extract <td>...</td>
- Throws:
Exception- exception
-
getResource
Description copied from class:BaseHandlerGet web resource file as it lies on the file system relatively to the started server process.- Specified by:
getResourcein interfaceHandler- Specified by:
getResourcein classBaseHandler- Returns:
- web resource
-
getBeanClass
Get bean entity class that has been generated trough PLANT, self-written or null (then null in extract calls too).- Overrides:
getBeanClassin classBaseHandler- Returns:
- bean entity class
-