Interface IAquimaSession
- All Superinterfaces:
IAquimaSessionLifecycle, com.aquima.interactions.foundation.concurrent.Interruptible, Serializable
- All Known Subinterfaces:
IExternalSession
IAquimaSessions are interruptible. Interrupting a session has the following effects:
- if a flow is currently executing in this session, it will be interrupted as soon as it exits from the currently executing service call or function call
- if a flow has not yet started in this session, attempting to start a session will result in an
InterruptedException
- Since:
- 8.0
- Author:
- Danny Roest
-
Method Summary
Modifier and TypeMethodDescriptionbooleanclose()Closes this portal session.com.aquima.interactions.portal.IActionResultexecuteAction(String handlerName, Map<String, ?> parameters) This method will invoke an action handler using the current portal session context.com.aquima.interactions.portal.IActionResultexecuteInlineAction(com.aquima.interactions.portal.IActionHandler actionHandler, Map<String, ?> parameters) This method will invoke an action handler using the current portal session context.This method returns the date when this session was last accessed.Returns the current web render engine.This method returns the current CSRF token of this session.com.aquima.interactions.metamodel.ChannelThis method returns the current channel.com.aquima.interactions.foundation.text.ILanguageReturns the current selected language.com.aquima.interactions.composer.IPageReturns the current page.com.aquima.interactions.project.IUserDataThis method will return the current user.com.aquima.interactions.portal.ISessionMonitorThis method will return a session monitor object containing information about this portal session.getName()Returns the name of the session.com.aquima.interactions.portal.IPortalSessionThis methods returns the portal session of this aquima session.This method returns the details about the application started running this session.Returns the current request ward for this session.This method return the sessionId of this session.This method will return the value that has been added to the session scope for the specified attribute key.This method returns the time when this session was started/created.This method returns the testPath for the current session.getTheme()Returns the current theme.voidhandleEvent(com.aquima.interactions.portal.PortalEvent portalEvent) This method will process the event passed, and continue the flow if needed.voidThis method updates the last access date.voidThis method recomposes the current page.This method generates a new CSRF token for this session and returns the new token.Generates and returns a new request ward for this session.voidsetAquimaUi(String name) Sets the current web renderer.voidsetLanguage(String languageCode) Sets the current language.setSessionScopeAttribute(String key, Serializable attrValue) This method will set the value in the session scope under the specified key, and will return the value that might have been replaced by this action.voidSets the current theme.voidThis method will start the exposed flow with the specified name.voidstartFlow(String name, boolean allowUnexposedFlows, Map<String, Serializable> parameters) This method starts a flow.voidstopFlow(boolean commitPendingChanges) This method will stop the current flow and commit or rollback any pending changes.Methods inherited from interface IAquimaSessionLifecycle
activate, passivateMethods inherited from interface com.aquima.interactions.foundation.concurrent.Interruptible
interrupt, isInterrupted
-
Method Details
-
getName
-
handleEvent
void handleEvent(com.aquima.interactions.portal.PortalEvent portalEvent) This method will process the event passed, and continue the flow if needed. Depending on the type of event this method will either stay on the same page (refresh) or try to continue the flow to the next page (submit). The response that is returned by this method contains the page definition of the next page that should be displayed.Note: The next page to display may be the same as the page that was already shown.
- Parameters:
portalEvent- Event object containing input values from the client and the requested action.- Throws:
com.aquima.interactions.foundation.exception.AppException- This type of exception is thrown when the event could not be processed.
-
startFlow
This method will start the exposed flow with the specified name.The handleEvent method may be used to continue the flow. This method may fail for various reasons, for example when the flow name specified is unknown or not accessible. An object containing request parameters may be passed to this method. The parameters from this object will be available in the request scope, and allows services for instance to act on information passed through the URL starting the flow.
- Parameters:
name- the name of the flow- Throws:
com.aquima.interactions.foundation.exception.AppException- when the flow could not be started.
-
startFlow
This method starts a flow. SeestartFlow(String)- Parameters:
name- the name of the flowallowUnexposedFlows- indicator to specify if unexposed flows may be startedparameters- Optional object containing parameters from the 'request' that should be available in the request scope.- Throws:
com.aquima.interactions.foundation.exception.AppException- when the flow could not be started.
-
stopFlow
void stopFlow(boolean commitPendingChanges) This method will stop the current flow and commit or rollback any pending changes.- Parameters:
commitPendingChanges- Boolean indicating if pending changes should be committed.- Throws:
com.aquima.interactions.foundation.exception.AppException- This exception is thrown when there is no active flow.
-
executeInlineAction
@CheckReturnValue(explanation="Spotbugs thinks that this method doesn't have a side effect, but in the action handler, it can.") com.aquima.interactions.portal.IActionResult executeInlineAction(com.aquima.interactions.portal.IActionHandler actionHandler, Map<String, ?> parameters) This method will invoke an action handler using the current portal session context. The action handler will be executed in the same transaction context of the current page. The parameters passed to this method will be exposed via the IRequestScope in the action handler.- Parameters:
actionHandler- The action handler which should be executed.parameters- The parameters for the action handler.- Returns:
- The result object from the action handler.
- Throws:
com.aquima.interactions.portal.exception.PortalException- This exception is thrown if the action handler fails with an exception.- See Also:
-
recompose
void recompose()This method recomposes the current page. This method should be called when another process changed the portal state, i.e. after a non readonly action handler has been executed.- Throws:
com.aquima.interactions.foundation.exception.AppException- When the current portal state failed recomposing.
-
executeAction
@CheckReturnValue(explanation="Spotbugs thinks that this method doesn't have a side effect, but in the action handler, it can.") com.aquima.interactions.portal.IActionResult executeAction(String handlerName, Map<String, ?> parameters) This method will invoke an action handler using the current portal session context. The action handler will be executed in the same transaction context of the current page. The parameters passed to this method will be exposed via the IRequestScope in the action handler.- Parameters:
handlerName- The name of the action handler that should be invoked.parameters- The parameters for the action handler.- Returns:
- The result object from the action handler.
- Throws:
com.aquima.interactions.portal.exception.PortalException- This exception is thrown if the action handler fails with an exception.- See Also:
-
getTheme
-
setTheme
-
getAquimaUi
-
setAquimaUi
Sets the current web renderer.- Parameters:
name- the name of the web renderer.
-
setLanguage
Sets the current language.- Parameters:
languageCode- the code of the language to set- Throws:
com.aquima.interactions.metamodel.exception.UnknownLanguageException- when the language is unkown.
-
close
boolean close()Closes this portal session. The session may also need to be removed from the IAquimaSessionsMap.- Returns:
- whether the session could be closed.
-
getCurrentPage
com.aquima.interactions.composer.IPage getCurrentPage()Returns the current page.- Returns:
- the current page.
-
getCurrentLanguage
com.aquima.interactions.foundation.text.ILanguage getCurrentLanguage()Returns the current selected language.- Returns:
- the current selected language
-
getSessionId
String getSessionId()This method return the sessionId of this session.- Returns:
- the sessionId of this session, never null or empty.
-
getCsrfToken
String getCsrfToken()This method returns the current CSRF token of this session.- Returns:
- the CSRF token (never null)
-
renewCsrfToken
String renewCsrfToken()This method generates a new CSRF token for this session and returns the new token.- Returns:
- the new CSRF token
-
getRequestWard
String getRequestWard()Returns the current request ward for this session. The request ward is a randomly generated token which should change every request. The request ward is used to detect de-synchronization between the frontend and the backend.- Returns:
- the current request ward
-
renewRequestWard
String renewRequestWard()Generates and returns a new request ward for this session.- Returns:
- the new request ward
-
getPortalSession
com.aquima.interactions.portal.IPortalSession getPortalSession()This methods returns the portal session of this aquima session.It is recommend to only use the other methods in this class. However, for special purposes this method can be used, but using this method has a higher chance of breaking your code in the future.
- Returns:
- the portal session of this aquima session.
-
getProjectDetails
IProjectDetails getProjectDetails()This method returns the details about the application started running this session. This method should be used instead of using an IApplication (not recommended).- Returns:
- details about the project running this session.
-
getStartTime
Date getStartTime()This method returns the time when this session was started/created.- Returns:
- the time this session was started/created.
-
getMonitor
com.aquima.interactions.portal.ISessionMonitor getMonitor()This method will return a session monitor object containing information about this portal session.- Returns:
- The session monitor of this session.
-
getCurrentUser
com.aquima.interactions.project.IUserData getCurrentUser()This method will return the current user.- Returns:
- The current user, never null.
-
getCurrentChannel
com.aquima.interactions.metamodel.Channel getCurrentChannel()This method returns the current channel.- Returns:
- The current channel, or null.
-
getTestPath
String getTestPath()This method returns the testPath for the current session.- Returns:
- The testPath for the current session, or null.
-
getSessionScopeAttribute
This method will return the value that has been added to the session scope for the specified attribute key. When there is no value present for the specified key, a null value will be returned.- Parameters:
key- Name of the attribute for which the value is requested (mandatory).- Returns:
- The value for the specified key, or null when there is no value present.
- Since:
- 9.0
-
setSessionScopeAttribute
@CheckReturnValue(explanation="PG: suppress false-positive SpotBugs warning RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT") Serializable setSessionScopeAttribute(String key, Serializable attrValue) This method will set the value in the session scope under the specified key, and will return the value that might have been replaced by this action. When there was no value present for the specified key, a null value will be returned.- Parameters:
key- Name of the attribute for which the value should be set (mandatory).attrValue- The value that should be set for the specified key (mandatory).- Returns:
- The value that was replaced (previously present) by the set action.
- Since:
- 9.0
-
getAccessTime
Date getAccessTime()This method returns the date when this session was last accessed.- Returns:
- The date of the last access, never
null.
-
notifyAccess
void notifyAccess()This method updates the last access date.
-