T
- entity that will be handled by the datatables, represent one JPA entity.ID
- the unique identifier of entity Tpublic interface DataTablesController<T,ID>
Modifier and Type | Method and Description |
---|---|
java.lang.String |
addRecord(T entity,
org.springframework.validation.BindingResult validationResult,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Validates an entity and if validation passes adds that record.
|
void |
configureTable(TableConfiguration<T,ID> tableConfig)
Takes a StandardTableConfiguration and uses is to configure the controller.
|
java.lang.String |
dashboardData(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Helper method to populate the transaction dashboard.
|
java.lang.String |
deleteRecord(ID id)
Deletes the record with unique identifier (such as primary key) id
|
java.lang.String |
editEntityUsingForm(T entity,
ID entityID,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Requests from the edit form will hit this method.
|
java.lang.String |
editRecord(ID id,
java.lang.Integer columnPosition,
java.lang.String value,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model)
Handles editing of records using the primary key, column position and new value for that column.
|
ApplicationSettings |
getAppSettings() |
java.lang.String |
getCustomUrl() |
DataTablesService<T,ID> |
getDataTablesService() |
T |
getEntity() |
org.apache.log4j.Logger |
getLog() |
java.lang.Class<T> |
getType() |
java.lang.String |
getViewName() |
java.lang.String |
init(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model)
Initializes the data table, this is the starting point when the page is hit.
|
void |
populateFormWithNewEntity(javax.servlet.http.HttpServletRequest request,
org.springframework.ui.Model model)
Adds a new instance of T to the model to be used when adding a new entity T
|
java.lang.String |
prepareFormForEditEntity(ID entityID,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model)
Validates an entity and if validation passes adds that record.
|
java.lang.String |
updateRecord(T entity,
org.springframework.validation.BindingResult validationResult,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Validates an entity and if validation passes updates that record.
|
void configureTable(TableConfiguration<T,ID> tableConfig)
tableConfig
- void populateFormWithNewEntity(javax.servlet.http.HttpServletRequest request, org.springframework.ui.Model model) throws java.lang.InstantiationException, java.lang.IllegalAccessException
model
- java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.String init(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.ui.Model model)
model
- java.lang.String dashboardData(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
request
- response
- java.io.IOException
java.lang.String editRecord(ID id, java.lang.Integer columnPosition, java.lang.String value, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.ui.Model model)
id
- the primary key of the recordcolumnPosition
- the column position in the tablevalue
- the new valuerequest
- response
- model
- java.lang.String prepareFormForEditEntity(ID entityID, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.ui.Model model)
entity
- The entity to add and validateresponse
- java.lang.String editEntityUsingForm(T entity, ID entityID, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
entity
- The entity to add and validateresponse
- java.lang.String deleteRecord(ID id)
id
- the unique identifier of the recordjava.lang.String addRecord(T entity, org.springframework.validation.BindingResult validationResult, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
entity
- The entity to add and validateresponse
- java.lang.String updateRecord(T entity, org.springframework.validation.BindingResult validationResult, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
entity
- The entity to add and validateresponse
- DataTablesService<T,ID> getDataTablesService()
org.apache.log4j.Logger getLog()
T getEntity()
java.lang.String getViewName()
java.lang.String getCustomUrl()
ApplicationSettings getAppSettings()
java.lang.Class<T> getType()