Package ch.autumo.beetroot.handler
Class DefaultRESTIndexHandler
java.lang.Object
org.nanohttpd.router.RouterNanoHTTPD.DefaultStreamHandler
org.nanohttpd.router.RouterNanoHTTPD.DefaultHandler
ch.autumo.beetroot.handler.BaseHandler
ch.autumo.beetroot.handler.DefaultRESTIndexHandler
- All Implemented Interfaces:
Handler,RouterNanoHTTPD.UriResponder
- Direct Known Subclasses:
TasksRESTIndexHandler
Default JSON-REST handler for listing entities.
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.autumo.beetroot.handler.BaseHandler
BaseHandler.IfSectionHandler -
Field Summary
FieldsFields 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
ConstructorsConstructorDescriptionDefaultRESTIndexHandler(String entity) New default index handler.DefaultRESTIndexHandler(String entity, String msg) New default index handler. -
Method Summary
Modifier and TypeMethodDescriptionextractSingleTableData(BeetRootHTTPSession session, ResultSet set, String columnName, String guiColumnName, 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).getPaginator(BeetRootHTTPSession session) Get whole index paginator.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 current entity bean processed in the list 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, getNewScanner, getNewScanner, 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
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG
-
-
Constructor Details
-
DefaultRESTIndexHandler
New default index handler.- Parameters:
entity- entity
-
DefaultRESTIndexHandler
New default index handler.- Parameters:
msg- messageentity- entity
-
-
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 current entity bean processed in the list if necessary. Called before allextractSingleTableData(BeetRootHTTPSession, ResultSet, String, String, int, Entity)calls.- Parameters:
session- HTTP sessionentity- entity bean
-
extractSingleTableData
public String extractSingleTableData(BeetRootHTTPSession session, ResultSet set, String columnName, String guiColumnName, 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'guiColumnName- GUI column name as configured in 'web/<entity>/columns.cfg'idx- SQL result set column indexentity- whole entity bean- Returns:
- JSON data extract <td>...</td>
- Throws:
Exception- exception
-
getPaginator
Get whole index paginator.- Overrides:
getPaginatorin classBaseHandler- Parameters:
session- HTTP session- Returns:
- HTML paginator code
-
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
-
getMimeType
- Overrides:
getMimeTypein classBaseHandler
-