Class TasksAddHandler
java.lang.Object
ch.autumo.beetroot.server.HTTPServer.DefaultStreamHandler
ch.autumo.beetroot.server.HTTPServer.DefaultHandler
ch.autumo.beetroot.handler.BaseHandler
ch.autumo.beetroot.handler.DefaultAddHandler
ch.autumo.beetroot.handler.tasks.TasksAddHandler
- All Implemented Interfaces:
Handler, HTTPServer.UriResponder
Tasks add handler.
-
Nested Class Summary
Nested classes/interfaces inherited from class BaseHandler
BaseHandler.IfSectionHandlerModifier and TypeClassDescriptionprotected final classState handler for role, entity and action "IFs" for the overall, the template and the template sub-resource layer. -
Field Summary
Fields inherited from class BaseHandler
action, columns, emptyBean, entity, htmlData, htmlHead, initialValues, insertServletNameInTemplateRefs, MSG_TYPE_ERR, MSG_TYPE_INFO, MSG_TYPE_WARN, PRECISION_INPUT_TYPES, serverName, servletName, TAG_PREFIX_LANG, transientFields, uniqueFieldsModifier and TypeFieldDescriptionprotected StringCurrent action to process.Column data map holding the columns.cfg-data of the current processing entity.protected EntityEmpty bean, used for creating an new entity instance.protected StringCurrent entity to process.protected StringHTML table data content.protected StringHTML head content.Column data map holding the columns.cfg-data for initial fields used by the add-template.protected booleanInsert servlet name inzo template references (links)? Necessary when oparting beetRoot within a servlet container.static final intMessage type error.static final intMessage type info.static final intMessage type warning.Precision HTML input types.protected StringServer name.protected StringServlet name.static final StringLangiage tag prefix.Column data list holding the columns.cfg-data for transient fields.protected String[]Column data array holding the columns.cfg-data for unique fields. -
Constructor Summary
ConstructorsConstructorDescriptionTasksAddHandler(String entity) Creates the handler for the given entity.TasksAddHandler(String entity, String errMsg) Creates the handler for the given entity. -
Method Summary
Modifier and TypeMethodDescriptionGet additional mandatory fields of the table that are not present and mandatory fields in the GUI.Class<?> Get bean entity class that has been generated trough PLANT, self-written or null (then null in extract calls too).Class<?> Overwrite to get the right re-route/redirect index handler after modifying data.booleanOverwrite this method, to specifically extend handler authorization, e.g.Methods inherited from class DefaultAddHandler
extractCustomSingleInputDiv, extractSingleInputDiv, extractSingleInputDiv, formatSingleValueForDB, getResource, getSelectValues, isSelect, readData, saveDataModifier and TypeMethodDescriptionextractCustomSingleInputDiv(BeetRootHTTPSession session, String val, ResultSetMetaData rsmd, String columnName, String guiColName, int idx) Overwrite this method, if you need to add a custom field (HTML 'div'); e.g.protected StringextractSingleInputDiv(BeetRootHTTPSession session, ResultSetMetaData rsmd, String columnName, String guiColName, int idx) Extract one single input div with label and input tags from result set standing at current row.protected StringextractSingleInputDiv(BeetRootHTTPSession session, Map<String, String> data, ResultSetMetaData rsmd, String columnName, String guiColName, int idx) Extract one single input div with label and input tags from result set standing at current row.formatSingleValueForDB(BeetRootHTTPSession session, String val, String columnname) Format single value before update / insert into DB.Get web resource file as it lies on the file system relatively to the started server process.protected String[]getSelectValues(String columnName) Get values for column nameprotected booleanIs this column a HTML select field?readData(BeetRootHTTPSession session, int id) Read data from DB that must be filled when the template is parsed.saveData(BeetRootHTTPSession session) Save data to DB.Methods inherited from class BaseHandler
addCheckBox, addErrorMessage, addHtmlDataLine, addHtmlHeadLine, addSuccessMessage, addWarningMessage, columns, columnsSize, deleteData, get, getColumn, getColumnsForSql, getColumnsForSql, getCurrentEntityDbId, getCurrentSession, getCustomizedExceptionInformation, getData, getEmptyBean, getEntity, getHandlerClass, getHtmlData, getHtmlHead, getInsertValues, getLayout, getMessageType, getMimeType, getNewScanner, getNewScanner, getPaginator, getSimpleManagementUserRoles, getStatus, getTableExport, getTemplateEngineErrorMessage, getTemplateEngineErrorTitle, getText, getText, getTitle, getTransientFields, getUpdateSetClause, getUpdateSetClause, hasExternalLinks, hasNoColumnsConfig, initialize, initialValue, initValuesSize, isCurrentUserUpdate, isCustomResponse, isNoContentResponse, isNoContentResponseButRoute, isPrecisionInputType, isRetryCall, loginMarker, parseAssociatedEntities, parseUnassociatedEntities, patchInputValue, readSnippetResource, redirectedMarker, refreshUserRoles, registerDisplayField, registerRoutes, render, renderAll, setCurrentEntityDbId, setMessageType, setVar, setVarAll, showLangMenu, showMenu, uniqueFields, uniqueTest, updateDataModifier and TypeMethodDescriptionprotected voidaddCheckBox(BeetRootHTTPSession session, String columnName) Add proper logic for check-boxes.voidaddErrorMessage(String message) Add an error message to show.voidaddHtmlDataLine(String line) Get HTML data.voidaddHtmlHeadLine(String line) Get HTML head if there's any.voidaddSuccessMessage(String message) Add a success message to show.voidaddWarningMessage(String message) Add a warning message to show.columns()Get columns map.intAmount of columns,deleteData(BeetRootHTTPSession session, int id) Delete data from DB.final org.nanohttpd.protocols.http.response.Responseget(HTTPServer.UriResource uriResource, Map<String, String> urlParams, org.nanohttpd.protocols.http.IHTTPSession session) MAIN method for base handler.String[]getColumn(int idx) Access column values.Get SQL fields, e.g.getColumnsForSql(boolean forModification) Get SQL fields, e.g.final intGet current DB id of entity processed, for 'index.html' pages or other pages not showing an existing entity it is '-1'.final BeetRootHTTPSessionGet current HTTP session process.protected String[]getCustomizedExceptionInformation(Session userSession) Overwrite this method, if you want to have a customized handler exception title and message.final InputStreamgetData()Get data input stream.final EntityGet an ampty bean of the entity type that is processed in this handler.Get web entity (use plural, e.g.final Class<?> getHandlerClass(String handlerName) Get a handler class by handler name.Get HTML data.Get HTML head if there's any.getInsertValues(BeetRootHTTPSession session) Get SQL insert values.Overwrite if you want to have a special layout for this handler.intGet set message type, default it is info/success type.MIME type of the streamed data.protected ScannergetNewScanner(String resource) Getting a new scanner for a web resource (HTML template) to parse.protected ScannergetNewScanner(String resource, String originalResource) Getting a new scanner for a web resource (HTML template) to parse.getPaginator(BeetRootHTTPSession session) Get HTML paginator code.String[]Retrieve user roles for simple user role management.org.nanohttpd.protocols.http.response.IStatusHTTP status of the response.getTableExport(BeetRootHTTPSession session) Get HTML table export code.protected StringgetTemplateEngineErrorMessage(Session userSession, String resource) Get message for general template engine error.protected StringgetTemplateEngineErrorTitle(Session userSession, String resource) Get title for general template engine error.final StringgetText()Text or HTML content returned by this handler.getText(BeetRootHTTPSession session, int origId) Process handlers to get the whole HTML page.Page title show left above the navigation area.Get transient fieldsgetUpdateSetClause(BeetRootHTTPSession session) Get SQL update set clause.getUpdateSetClause(BeetRootHTTPSession session, String onOffMapName) Get SQL update set clause.booleanOverwrite if this handler serves templates with external links (starting with 'http' or 'https').protected booleanOverwrite this if your handler has no columns config configuration.voidinitialize(BeetRootHTTPSession session) Every handler MUST be initialized!protected StringinitialValue(String colName) Holds initial add values from 'columns.cfg'.protected intReturn size of initial value list for add template.protected booleanisCurrentUserUpdate(BeetRootHTTPSession session) Is the current user being updated?protected booleanOverwrite this if your handler has a custom response; e.g., a JSON response without any further HTML content.protected booleanOverwrite this if your handler doesn't have an output.protected StringisNoContentResponseButRoute(Session userSession) Overwrite this if your handler doesn't have an output.protected booleanisPrecisionInputType(String inputType) Is the given HTML input type a precision input type? They are allowed to have a 'maxLength' attribute.booleanisRetryCall(BeetRootHTTPSession session) Is it a retry call?protected voidloginMarker(boolean redirectLogin) Login marker method.protected voidparseAssociatedEntities(StringBuilder snippet, List<Model> list, BeetRootHTTPSession session) Parse associated list.protected voidparseUnassociatedEntities(StringBuilder snippet, List<Model> list, BeetRootHTTPSession session) Parse un-associated list.static StringpatchInputValue(String text, String id, String newValue) This replaces a value in a HTML element with a specific ID.protected StringBuilderreadSnippetResource(String resource, Session userSession) Read snippet resource; e.g., 'web/html/:lang/users/snippets/roles.html'.protected voidredirectedMarker(boolean redirected) Mark this handler as it has been redirected from a data modifying handler.protected final voidrefreshUserRoles(int currentUserId, BeetRootHTTPSession session) Refresh user roles and permissions for current user.voidregisterDisplayField(String displayNameValue) Register a display name value to be show where defined in template.static voidregisterRoutes(List<Route> routes) Routes registration method.voidrender(BeetRootHTTPSession session) Overwrite to set your template variables.voidrenderAll(BeetRootHTTPSession session) Overwrite to set your variables for the whole HTML page.final voidsetCurrentEntityDbId(int origId) Set current DB id of entity processed, for 'index.html' pages or other pages not showing an existing entity it is '-1'.voidsetMessageType(int messageType) Set message type.final voidSet a template variable.final voidSet a global variable.booleanshowLangMenu(Session userSession) Show language menu?booleanShow template menu?String[]Get unique fields.uniqueTest(BeetRootHTTPSession session, String preSql, String operation) Check if unique fields are unique.updateData(BeetRootHTTPSession session, int id) Update data in DB.Methods inherited from class HTTPServer.DefaultStreamHandler
delete, other, post, putModifier and TypeMethodDescriptionorg.nanohttpd.protocols.http.response.Responsedelete(HTTPServer.UriResource uriResource, Map<String, String> urlParams, org.nanohttpd.protocols.http.IHTTPSession session) Handles an HTTP DELETE request.org.nanohttpd.protocols.http.response.Responseother(String method, HTTPServer.UriResource uriResource, Map<String, String> urlParams, org.nanohttpd.protocols.http.IHTTPSession session) Handles any other HTTP method.org.nanohttpd.protocols.http.response.Responsepost(HTTPServer.UriResource uriResource, Map<String, String> urlParams, org.nanohttpd.protocols.http.IHTTPSession session) Handles an HTTP POST request.org.nanohttpd.protocols.http.response.Responseput(HTTPServer.UriResource uriResource, Map<String, String> urlParams, org.nanohttpd.protocols.http.IHTTPSession session) Handles an HTTP PUT request.
-
Constructor Details
-
TasksAddHandler
Creates the handler for the given entity.- Parameters:
entity- the entity name
-
TasksAddHandler
-
-
Method Details
-
getRedirectHandler
Description copied from class:BaseHandlerOverwrite to get the right re-route/redirect index handler after modifying data. It must be of the same entity as the last executing handler!- Overrides:
getRedirectHandlerin classBaseHandler- Returns:
- redirect index handler
-
getAddMandatoryFields
Description copied from class:DefaultAddHandlerGet additional mandatory fields of the table that are not present and mandatory fields in the GUI. They are usually the DB NOT NULL fields. Return the column/value pair within a map. The value must be an object that is representable as a string!- Specified by:
getAddMandatoryFieldsin classDefaultAddHandler- Returns:
- column/value pair map
-
getBeanClass
Description copied from class:DefaultAddHandlerGet bean entity class that has been generated trough PLANT, self-written or null (then null in extract calls too).- Overrides:
getBeanClassin classDefaultAddHandler- Returns:
- bean entity class
-
hasAccess
Description copied from class:BaseHandlerOverwrite this method, to specifically extend handler authorization, e.g. with more app user roles.- Overrides:
hasAccessin classBaseHandler- Parameters:
userSession- user session- Returns:
- true if access is allowed, otherwise false
-