Package com.jk.webstack.controllers
Class JKWebControllerWithOrmSupport<T>
java.lang.Object
com.jk.web.faces.controllers.JKWebController
com.jk.webstack.controllers.JKWebAppBaseController
com.jk.webstack.controllers.JKWebControllerWithSqlDataAccess
com.jk.webstack.controllers.JKWebControllerWithOrmSupport<T>
- Type Parameters:
T
- Specifies the type of ORM entity managed by this controller.
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
JKMasterDetailWebControllerWithOrmSupport
,JKRolesWebControllers
,JKUserWebControllers
This abstract class extends the
JKWebControllerWithSqlDataAccess
and
provides support for working with Object-Relational Mapping (ORM) entities.- Version:
- 1.0
- Author:
- Dr. Jalal H. Kiswani
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ControllerMode
Represents the current controller mode.Fields inherited from class com.jk.webstack.controllers.JKWebControllerWithSqlDataAccess
sqlDataAccess
Fields inherited from class com.jk.web.faces.controllers.JKWebController
logger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd()
This method adds a new model to the database or initiates a workflow approval process based on availability.This method adds the current ORM entity to the database.protected void
This method is yet to be implemented (TBI).protected void
This method is yet to be implemented (TBI).protected void
This method is yet to be implemented (TBI).protected void
This method is yet to be implemented (TBI).approvePayload
(int id) This method approves a workflow pay-load with the specified ID.protected void
This method is yet to be implemented (TBI).protected void
This method is yet to be implemented (TBI).protected void
This method is yet to be implemented (TBI).protected void
This method is yet to be implemented (TBI).void
This method changes the controller mode to READONLY.protected T
This method creates and returns an instance of an empty model for the ORM entity associated with this controller.delete()
This method deletes the current model from the database or initiates a workflow approval process based on availability.This method deletes the currently loaded ORM entity from the database.This method duplicates the current model.edit()
This method sets the current controller mode to EDIT mode.fill()
This method fills the fields of the current model.find
(int id) This method finds and sets the ORM entity with the specified ID in the controller.findPayload
(int id) This method finds a workflow pay-load with the specified ID.protected JKObjectDataAccess
This method retrieves and returns the data access service responsible for handling database operations for the ORM entity associated with this controller.This method retrieves s list of data items based on the data list filter.This method retrieves the filter predicate for the data list.This method gets the empty model.This method retrieves the filtered list of ORM entities.This method retrieves the second filter list.This method retrieves the value of the primary key field of the currently loaded ORM entity.protected Integer
getIdValue
(T model) This method retrieves the value of the primary key field of the specified ORM entity.getMode()
This method retrieves the current controller mode.getModel()
This method retrieves the current ORM entity being managed.This method retrieves the class type of the ORM entity.This method retrieves the list of ORM entities.This method retrieves the filter predicate for the model list.This method retrieves the original ORM entity for workflow purposes.This method retrieves the pay-load model for workflow.This method retrieves the list of pay-load models for work flows.protected String
Thie method retrieves the workflow entity name.boolean
This method checks whether the controller is in the ADD mode to allow data addition.boolean
This method checks whether the current mode allows deleting.boolean
This method checks whether the current mode allows editing.boolean
This method checks whether the current mode allows filling fields.boolean
This method checks whether the current mode allows reseting.boolean
This method checks whether the current mode allows saving.boolean
This method checks whether to always refresh the list of ORM entities or not.boolean
This method checks the flag for confirming reset actions.boolean
This method checks whether the controller is currently in EDIT mode.boolean
This method checks the flag for tabular editing mode.boolean
isFieldModified
(String name) This method checks if a specific field in the model has been modified.boolean
This method checks if the input fields should be disabled based on the current controller mode.boolean
This method checks whether the controller is currently in READONLY mode.boolean
This method checks whether workflow functionality is available.protected void
This method performs post-construction initialization of the web controller.rejectPayload
(int id) This method rejects a workflow pay-load with the specified ID.reset()
This method resets the controller's state.void
This method resets the data-related state of the controller.protected void
This method resets the workflow-related state of the controller.save()
This method saves the changes made to the current model to the database or initiates a workflow approval process based on availability.saveAll()
This method saves all changes made to the current model to the database or initiates a workflow approval process based on availability.void
This method saves all the models in the current list to the database.This method saves the current ORM entity to the database.void
setAlwaysRefreshList
(boolean alwaysRefreshList) This method sets whether to always refresh the list of ORM entities or not.void
setConfirmReeset
(boolean confirmReeset) This method sets the flag for confirming reset actions to the provided value.void
setDataList
(List<T> dataList) This method sets the list of data items based on the data list filter to the provided one.void
setDataListFilter
(Predicate<? super T> dataListFilter) This method sets the filter predicate for the data list to the provided one.void
setEditTabular
(boolean editTabular) This method sets the flag for tabular editing mode to the provided value.void
setFilterList
(List<T> filterList) This method sets the filtered list of ORM entities to the provided one.void
setFilterList2
(List filterList2) This method sets the second filter list to the provided one.void
setIdValue
(Object value) This method sets the primary key value of the model to the provided value.void
This method sets the current ORM entity being managed to the provided one.void
setModelListFilter
(Predicate<? super T> modelListFilter) This method sets the filter predicate for the model list to the provided one.void
setOriginal
(T original) This method sets the original ORM entity for workflow purposes to the provided value.void
setPayload
(PayloadModel payload) This method sets the pay-load model for workflow to the provided value.void
setPayloads
(List<PayloadModel> payloads) This method sets the list of pay-load models for work flows to the provided one.viewPayload
(int id) This method displays the details of a workflow pay-load with the specified ID for viewing.Methods inherited from class com.jk.webstack.controllers.JKWebControllerWithSqlDataAccess
execute, getSqlDataAccess
Methods inherited from class com.jk.webstack.controllers.JKWebAppBaseController
getActionLogName, getActionLogService, getEmail, getEmailService, getFamilyName, getFirstName, getIdToken, getUserName, isUserLoggedIn, logAction
Methods inherited from class com.jk.web.faces.controllers.JKWebController
context, error, error, executeAsyc, getContextParam, getContextPath, getFromAppliaction, getFromRequest, getFromSession, getParam, getParamterFromRequest, getRoles, getTenantId, getViewScopedManagedBean, handleException, init, isDebug, isDevelopmentMode, redirect, request, session, showErrorDialogMessage, showInfoDialogMessage, showWarningDialogMessage, success, success, suggestName, updateUi, warning
-
Field Details
-
mode
Represents the current controller mode.
-
-
Constructor Details
-
JKWebControllerWithOrmSupport
public JKWebControllerWithOrmSupport()
-
-
Method Details
-
addToDatabase
This method adds the current ORM entity to the database.- Returns:
- null.
-
edit
This method sets the current controller mode to EDIT mode.- Returns:
- null.
-
saveToDatabase
This method saves the current ORM entity to the database.- Returns:
- null.
-
beforeInsert
protected void beforeInsert()This method is yet to be implemented (TBI). -
beforeFind
protected void beforeFind()This method is yet to be implemented (TBI). -
afterFind
protected void afterFind()This method is yet to be implemented (TBI). -
afterInsert
protected void afterInsert()This method is yet to be implemented (TBI). -
beforeUpdate
protected void beforeUpdate()This method is yet to be implemented (TBI). -
afterUpdate
protected void afterUpdate()This method is yet to be implemented (TBI). -
beforeDelete
protected void beforeDelete()This method is yet to be implemented (TBI). -
find
This method finds and sets the ORM entity with the specified ID in the controller.- Parameters:
id
- Specifies the ID of the entity to find.- Returns:
- null.
-
getModelClass
This method retrieves the class type of the ORM entity.- Returns:
- the class type of the ORM entity.
-
getModelList
This method retrieves the list of ORM entities.- Returns:
- the list of ORM entities.
-
deleteFromDatabase
This method deletes the currently loaded ORM entity from the database.- Returns:
- null.
-
afterDelete
protected void afterDelete()This method is yet to be implemented (TBI). -
getIdValue
This method retrieves the value of the primary key field of the currently loaded ORM entity.- Returns:
- the value of the primary key field of the currently loaded ORM entity.
-
getIdValue
This method retrieves the value of the primary key field of the specified ORM entity.- Parameters:
model
- Specifies the ORM entity from which to retrieve the primary key value.- Returns:
- the primary key value of the entity, typically an integer.
-
getModel
This method retrieves the current ORM entity being managed.- Returns:
- the current ORM entity being managed.
-
createEmptyModel
This method creates and returns an instance of an empty model for the ORM entity associated with this controller.- Returns:
- an empty model instance of the ORM entity.
-
setModel
This method sets the current ORM entity being managed to the provided one.- Parameters:
model
- Specifies the new current ORM entity being managed.
-
getDataAccess
This method retrieves and returns the data access service responsible for handling database operations for the ORM entity associated with this controller.- Returns:
- the data access service for the ORM entity.
-
reset
This method resets the controller's state.- Returns:
- null.
-
resetData
public void resetData()This method resets the data-related state of the controller. -
resetWorkFlow
protected void resetWorkFlow()This method resets the workflow-related state of the controller. -
isAlwaysRefreshList
public boolean isAlwaysRefreshList()This method checks whether to always refresh the list of ORM entities or not.- Returns:
- true, if it always refresh the list of ORM entities, false otherwise.
-
setAlwaysRefreshList
public void setAlwaysRefreshList(boolean alwaysRefreshList) This method sets whether to always refresh the list of ORM entities or not.- Parameters:
alwaysRefreshList
- Indicates to always refresh the list (true) or not (false).
-
setIdValue
This method sets the primary key value of the model to the provided value.- Parameters:
value
- Specifies the new primary key value of the model.
-
duplicate
This method duplicates the current model.- Returns:
- null.
-
getEmptyModel
This method gets the empty model.- Returns:
- the empty model.
-
fill
This method fills the fields of the current model.- Returns:
- null.
-
isAllowAdd
public boolean isAllowAdd()This method checks whether the controller is in the ADD mode to allow data addition.- Returns:
- true, if its allowed to add new data, false otherwise.
-
isAllowEdit
public boolean isAllowEdit()This method checks whether the current mode allows editing.- Returns:
- true, if the current mode allows editing, false otherwise.
-
isAllowSave
public boolean isAllowSave()This method checks whether the current mode allows saving.- Returns:
- true, if the current mode allows saving, false otherwise.
-
isAllowDelete
public boolean isAllowDelete()This method checks whether the current mode allows deleting.- Returns:
- true, if the current mode allows deleting, false otherwise.
-
isAllowReset
public boolean isAllowReset()This method checks whether the current mode allows reseting.- Returns:
- true, if the current mode allows reseting, false otherwise.
-
isAllowFill
public boolean isAllowFill()This method checks whether the current mode allows filling fields.- Returns:
- true, if the current mode allows filling fields, false otherwise.
-
isEditMode
public boolean isEditMode()This method checks whether the controller is currently in EDIT mode.- Returns:
- true, if it is in EDIt mode, false otherwise.
-
cancelEdit
public void cancelEdit()This method changes the controller mode to READONLY. -
isReadOnlyMode
public boolean isReadOnlyMode()This method checks whether the controller is currently in READONLY mode.- Returns:
- true, if it is in READONLY mode, false otherwise.
-
getFilterList
This method retrieves the filtered list of ORM entities.- Returns:
- the filtered list of ORM entities.
-
setFilterList2
This method sets the second filter list to the provided one.- Parameters:
filterList2
- Specifies the new second filter list.
-
setFilterList
This method sets the filtered list of ORM entities to the provided one.- Parameters:
filterList
- Specifies the new filtered list of ORM entities.
-
getFilterList2
This method retrieves the second filter list.- Returns:
- the second filter list.
-
isConfirmReeset
public boolean isConfirmReeset()This method checks the flag for confirming reset actions.- Returns:
- true, if the flag is set to true, false otherwise.
-
setConfirmReeset
public void setConfirmReeset(boolean confirmReeset) This method sets the flag for confirming reset actions to the provided value.- Parameters:
confirmReeset
- Indicates the new flag value.
-
getMode
This method retrieves the current controller mode.- Returns:
- the current controller mode.
-
isEditTabular
public boolean isEditTabular()This method checks the flag for tabular editing mode.- Returns:
- true, if the flag is set to true, false otherwise.
-
setEditTabular
public void setEditTabular(boolean editTabular) This method sets the flag for tabular editing mode to the provided value.- Parameters:
editTabular
- Indicates the new flag value.
-
saveAllToDatabase
public void saveAllToDatabase()This method saves all the models in the current list to the database. -
add
This method adds a new model to the database or initiates a workflow approval process based on availability.- Returns:
- null.
-
save
This method saves the changes made to the current model to the database or initiates a workflow approval process based on availability.- Returns:
- null.
-
saveAll
This method saves all changes made to the current model to the database or initiates a workflow approval process based on availability.- Returns:
- null.
-
delete
This method deletes the current model from the database or initiates a workflow approval process based on availability.- Returns:
- null.
-
getPayloads
This method retrieves the list of pay-load models for work flows.- Returns:
- the list of pay-load models for work flows.
-
setPayloads
This method sets the list of pay-load models for work flows to the provided one.- Parameters:
payloads
- Specifies the new list of pay-load models for work flows.
-
getWorkflowEntityName
Thie method retrieves the workflow entity name.- Returns:
- the workflow entity name.
-
isWorkflowAvialable
public boolean isWorkflowAvialable()This method checks whether workflow functionality is available.- Returns:
- true, if it is available, false otherwise.
-
getPayload
This method retrieves the pay-load model for workflow.- Returns:
- the pay-load model for workflow.
-
setPayload
This method sets the pay-load model for workflow to the provided value.- Parameters:
payload
- Specifies the new pay-load model for workflow.
-
approvePayload
This method approves a workflow pay-load with the specified ID.- Parameters:
id
- Specifies the ID of the workflow pay-load to be approved.- Returns:
- null.
-
findPayload
This method finds a workflow pay-load with the specified ID.- Parameters:
id
- Specifies the ID of the workflow pay-load to be found.- Returns:
- the found PayloadModel object or null if not found.
-
rejectPayload
This method rejects a workflow pay-load with the specified ID.- Parameters:
id
- Specifies the ID of the workflow pay-load to be rejected.- Returns:
- null.
-
viewPayload
This method displays the details of a workflow pay-load with the specified ID for viewing.- Parameters:
id
- Specifies the ID of the workflow pay-load to be viewed.- Returns:
- null.
-
isInputDisabled
public boolean isInputDisabled()This method checks if the input fields should be disabled based on the current controller mode.- Returns:
- true, if the input fields should be disabled, false otherwise.
-
getOriginal
This method retrieves the original ORM entity for workflow purposes.- Returns:
- the original ORM entity for workflow purposes.
-
setOriginal
This method sets the original ORM entity for workflow purposes to the provided value.- Parameters:
original
- Specifies the new original ORM entity for workflow purposes.
-
isFieldModified
This method checks if a specific field in the model has been modified.- Parameters:
name
- Specifies the name of the field to check for modification.- Returns:
- true, if the field has been modified, false otherwise.
-
getDataList
This method retrieves s list of data items based on the data list filter.- Returns:
- s list of data items based on the data list filter.
-
getDataListFilter
This method retrieves the filter predicate for the data list.- Returns:
- the filter predicate for the data list.
-
setDataListFilter
This method sets the filter predicate for the data list to the provided one.- Parameters:
dataListFilter
- Specifies the new filter predicate for the data list.
-
setDataList
This method sets the list of data items based on the data list filter to the provided one.- Parameters:
dataList
- Specifies the new list of data items based on the data list filter.
-
getModelListFilter
This method retrieves the filter predicate for the model list.- Returns:
- the filter predicate for the model list.
-
setModelListFilter
This method sets the filter predicate for the model list to the provided one.- Parameters:
modelListFilter
- Specifies the new filter predicate for the model list.
-
postConstruct
protected void postConstruct()This method performs post-construction initialization of the web controller.It initializes the model class, controller mode, and checks if workflow is available.
- Overrides:
postConstruct
in classJKWebController
-