Package com.jk.web.faces.controllers
Class JKWebController
java.lang.Object
com.jk.web.faces.controllers.JKWebController
- All Implemented Interfaces:
 Serializable
- Direct Known Subclasses:
 JKAccountWebController,JKSecurityWebController,JKUtilWebController,JKWebAppBaseController,JKWebMessagesController,WorkflowController
This class is a controller, provides common utility methods and
 functionalities that can be used by web controllers throughout the
 application.
- Version:
 - 1.0
 - Author:
 - Dr. Jalal H. Kiswani
 - See Also:
 
- 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionprotected jakarta.faces.context.ExternalContextcontext()This method retrieves the external context associated with the current FacesContext.voidThis method display an error message to the user.voidThis method display an error message to the user.protected voidexecuteAsyc(Runnable command) This method executes a Runnable task asynchronously using a thread pool.getContextParam(String param, String defaultcValue) This method retrieves the value of a context parameter from the web application's configuration.protected StringThis method retrieves the context path of the current web application.getFromAppliaction(String name) This method retrieves an object from the application scope.getFromRequest(String name) This method retrieves an object from the current request scope.getFromSession(String name) This method retrieves an object from the current session scope.protected StringThis method retrieves the value of a request parameter by its name.getParamterFromRequest(String name) This method retrieves a request parameter value by name.getRoles()This method retrieves a list of roles associated with the current user session.This method gets the tenant identifier (ID).This method retrieves the user name associated with the current user session.<T> TgetViewScopedManagedBean(String controllerName) This method retrieves a view-scoped managed bean by its controller name.protected voidThis method handles exceptions that may occur during the execution of controller methods.voidinit()This method initializes the web controller.booleanisDebug()This method checks if the web application is running in debug mode.booleanThis method checks if the web application is running in development mode.voidThis method logs an action or event with the specified message.protected voidThis method is yet to be implemented (TBI).voidThis method redirects the current request to a specified outcome or URL.jakarta.servlet.http.HttpServletRequestrequest()This method retrieves the HttpServletRequest associated with the current FacesContext.jakarta.servlet.http.HttpSessionsession()Thie method retrieves the HttpSession associated with the current FacesContext.voidshowErrorDialogMessage(String msgText, String title) This method shows message error message in primefaces dialogvoidshowInfoDialogMessage(String msgText, String title) This method shows message info message in primefaces dialogvoidshowWarningDialogMessage(String msgText, String title) This method shows message warning message in primefaces dialogvoidThis method adds a success message to the current FacesContext.voidThis method adds a success message to the current FacesContext.protected StringsuggestName(String prefix, List<?> list) This method generates a suggested name by appending a unique number to the given prefix.voidThis method updates the user interface component identified by its component ID (compId).voidThis method adds a warning message to the current FacesContext. 
- 
Field Details
- 
logger
Represents this class logger. 
 - 
 - 
Constructor Details
- 
JKWebController
public JKWebController() 
 - 
 - 
Method Details
- 
init
@PostConstruct public void init()This method initializes the web controller. - 
error
This method display an error message to the user.- Parameters:
 message- Specifies the error message to be displayed.
 - 
error
This method display an error message to the user.- Parameters:
 message- Specifies the error message to be displayed.useLabel- Indicates whether to use a label for the message.
 - 
getFromAppliaction
This method retrieves an object from the application scope.- Parameters:
 name- Specifies the name or key associated with the object in the application scope.- Returns:
 - the object stored in the application scope under the specified name.
 
 - 
getFromRequest
This method retrieves an object from the current request scope.- Parameters:
 name- Specifies the name or key associated with the object in the request scope.- Returns:
 - the object stored in the request scope under the specified name.
 
 - 
getFromSession
This method retrieves an object from the current session scope.- Parameters:
 name- Specifies the name or key associated with the object in the session scope.- Returns:
 - the object stored in the session scope under the specified name.
 
 - 
getParamterFromRequest
This method retrieves a request parameter value by name.- Parameters:
 name- Specifies the name of the request parameter.- Returns:
 - the value of the request parameter.
 
 - 
context
protected jakarta.faces.context.ExternalContext context()This method retrieves the external context associated with the current FacesContext.- Returns:
 - the ExternalContext object for the current request.
 
 - 
request
public jakarta.servlet.http.HttpServletRequest request()This method retrieves the HttpServletRequest associated with the current FacesContext.- Returns:
 - the HttpServletRequest associated with the current FacesContext.
 
 - 
session
public jakarta.servlet.http.HttpSession session()Thie method retrieves the HttpSession associated with the current FacesContext.- Returns:
 - the HttpSession associated with the current FacesContext.
 
 - 
redirect
This method redirects the current request to a specified outcome or URL.- Parameters:
 outcome- Specifies the URL or outcome to which the request should be redirected.
 - 
success
This method adds a success message to the current FacesContext.- Parameters:
 message- Specifies the success message to be displayed.
 - 
success
This method adds a success message to the current FacesContext.- Parameters:
 message- Specifies the success message to be displayed.localize- Indicates whether the message should be localized.
 - 
warning
This method adds a warning message to the current FacesContext.- Parameters:
 message- Specifies the warning message to be displayed.
 - 
handleException
This method handles exceptions that may occur during the execution of controller methods.- Parameters:
 e- Specifies the exception to be handled.
 - 
getParam
This method retrieves the value of a request parameter by its name.- Parameters:
 paramName- Specifies the parameter name.- Returns:
 - the value of the parameter.
 
 - 
getContextPath
This method retrieves the context path of the current web application.- Returns:
 - the context path of the current web application.
 
 - 
getContextParam
This method retrieves the value of a context parameter from the web application's configuration.- Parameters:
 param- Specifies the name of the context parameter to retrieve.defaultcValue- Specifies the default value to return if the parameter is not found.- Returns:
 - the value of the context parameter or the default value if not found.
 
 - 
isDevelopmentMode
public boolean isDevelopmentMode()This method checks if the web application is running in development mode.- Returns:
 - true, if the web application is in development mode, false otherwise.
 
 - 
isDebug
public boolean isDebug()This method checks if the web application is running in debug mode.- Returns:
 - true, if the web application is in debug mode, false otherwise.
 
 - 
executeAsyc
This method executes a Runnable task asynchronously using a thread pool.- Parameters:
 command- Specifies the Runnable task to execute asynchronously.
 - 
logAction
This method logs an action or event with the specified message.- Parameters:
 log- Specifies the message describing the action or event to be logged.
 - 
getUserName
This method retrieves the user name associated with the current user session.- Returns:
 - the user name of the current user.
 
 - 
getRoles
This method retrieves a list of roles associated with the current user session.- Returns:
 - the list of role names assigned to the current user.
 
 - 
suggestName
This method generates a suggested name by appending a unique number to the given prefix.- Parameters:
 prefix- Specifies the prefix to be used in the generated name.list- Specifies the list of items to check for uniqueness when generating the name.- Returns:
 - the suggested name that combines the prefix and a unique number.
 
 - 
updateUi
This method updates the user interface component identified by its component ID (compId).- Parameters:
 compId- Specifies the component ID.
 - 
getViewScopedManagedBean
This method retrieves a view-scoped managed bean by its controller name.- Type Parameters:
 T- Specifies the type of the managed bean.- Parameters:
 controllerName- Specifies the name of the managed bean controller to retrieve.- Returns:
 - the instance of the managed bean.
 
 - 
getTenantId
This method gets the tenant identifier (ID).- Returns:
 - the tenant identifier (ID).
 
 - 
postConstruct
protected void postConstruct()This method is yet to be implemented (TBI). - 
showInfoDialogMessage
This method shows message info message in primefaces dialog- Parameters:
 msgText- Specifies the info dialog message.title- Specifies the message summary.
 - 
showErrorDialogMessage
This method shows message error message in primefaces dialog- Parameters:
 msgText- Specifies the error dialog message.title- Specifies the message summary.
 - 
showWarningDialogMessage
This method shows message warning message in primefaces dialog- Parameters:
 msgText- Specifies the warning dialog message.title- Specifies the message summary.
 
 -