Class ProcessEnabledSession
java.lang.Object
com.aquima.interactions.portal.model.process.ProcessEnabledSession
- All Implemented Interfaces:
Interruptible
,IPortalSession
,ISessionLifecycle
- Direct Known Subclasses:
Dcm1ProcessEnabledSession
,Dcm2ProcessEnabledSession
Portal session wrapper implementation that handles process engine task execution.
- Since:
- 7.1
- Author:
- Jon van Leuven, O. Kerpershoek
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
Internal class which bridges two event buses.protected static class
Internal class which bridges two event buses. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IActiveProcessTask
protected final IPortalEventBus
protected final ProcessEnabledSession.PortalEventBusBridge
protected final IProcessEngine
protected final ProcessMapping
protected final PortalSession
protected final ISolution
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ProcessEnabledSession
(ISolution solution, PortalSession session, ProcessMapping processMapping, IPortalEventBus eventBus) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract String
void
activate
(ISessionActivationContext sessionActivationContext) This method may be used for activating the objects after deserialization.boolean
close()
This method will close the session, releasing resources if needed.protected abstract PortalResponse
completeTask
(IProcessScope processScope) protected PortalEvent
createEventFor
(String buttonPostfix, IPage executeTaskPage) protected IPortalSession
createSession
(IModule taskModule, Channel channel, IUserData user) protected void
executeAction
(String handlerName, Map<String, ?> parameters) This method will invoke an action handler using the current portal session context.void
executeCallback
(IPortalSessionCallback callback) Executes a callback.executeInlineAction
(IActionHandler handler, Map<String, ?> parameters) This method will invoke an action handler using the current portal session context.This method returns the ID of the application/project for which the session was created.Returns the AuditEngineReturns the optional CaseEngineClientThis method returns an object containing the project wide configuration and definitions.Returns the current channel.Returns the current flowReturns the current flowState.Returns the current language active within the portal-engine.Returns the last generated page for rendering to the client.protected IUserData
Returns the event bus used by this session.Returns the messagebus.This method returns an object containing the static definitions of the various components as defined by the current module.This method will return a session monitor object containing information about this portal session.Returns the optional ID of this session.getState()
Returns the state of the session (for serialization)protected long
handleEvent
(PortalEvent portalEvent) This method will process the event passed, and continue the flow if needed.protected PortalResponse
handleResponse
(PortalResponse originalResponse) protected boolean
void
Sets the interrupted flag, indicating that this object should interrupt the computation it is currently performing (typically on another thread) as soon as possible, and exit by throwing anInterruptedException
.boolean
Indicates whether the interrupted flag has been set.void
This method may be used for preparing the objects for serialization.void
reset()
Resets the portal session.void
restore
(IPortalSessionState state) Clears the current state and overrides it with the provided state.void
setCurrentLanguage
(String languageCode) Changes the current language for this portal session.void
setSessionId
(String id) Sets the optional ID of this session.protected boolean
startFlow
(String flowName, Map<String, Serializable> parameters, boolean allowUnExposedFlows) This method will start the flow with the specified name.protected abstract PortalResponse
startTask
(long taskId, IProcessScope processScope) void
stopFlow
(boolean commitPendingChanges) This method will stop the current flow and commit or rollback any pending changes.
-
Field Details
-
Constructor Details
-
ProcessEnabledSession
protected ProcessEnabledSession(ISolution solution, PortalSession session, ProcessMapping processMapping, IPortalEventBus eventBus)
-
-
Method Details
-
getSessionId
Description copied from interface:IPortalSession
Returns the optional ID of this session.- Specified by:
getSessionId
in interfaceIPortalSession
- Returns:
- the id if available, otherwise null.
-
setSessionId
Description copied from interface:IPortalSession
Sets the optional ID of this session.- Specified by:
setSessionId
in interfaceIPortalSession
- Parameters:
id
- the id of the session, may be null.
-
handleEvent
Description copied from interface:IPortalSession
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.- Specified by:
handleEvent
in interfaceIPortalSession
- Parameters:
portalEvent
- Event object containing input values from the client and the requested action.- Returns:
- The response of the flow action containing the page definition of the page where the flow stopped.
-
startFlow
public PortalResponse startFlow(String flowName, Map<String, Serializable> parameters, boolean allowUnExposedFlows) Description copied from interface:IPortalSession
This method will start the flow with the specified name. If another flow was active when this method is invoked, that flow will be aborted, and it's transaction will be rolled back.NOTE: As of version 7.0 an active flow must be stopped by using the stopFlow method before a new flow may be started.
When the flow has been successfully started, the method will return a response containing the page definition of the first page encountered during the flow. 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. The parameters object is optional, and if no additional parameters need to be passed to the flow, a null value may be supplied.- Specified by:
startFlow
in interfaceIPortalSession
- Parameters:
flowName
- The name of the flow that should be started.parameters
- Optional object containing parameters from the 'request' that should be available in the request scope.allowUnExposedFlows
- indicator to specify if unexposed flows may be started- Returns:
- The response of the flow action containing the page definition of the page where the flow stopped.
-
close
public boolean close()Description copied from interface:IPortalSession
This method will close the session, releasing resources if needed. Once the close method has been invoked, the session has become invalid and cannot be used anymore to handle requests.- Specified by:
close
in interfaceIPortalSession
- Returns:
- Boolean indicating if the session was successfully closed.
-
executeAction
Description copied from interface:IPortalSession
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.- Specified by:
executeAction
in interfaceIPortalSession
- 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.
- See Also:
-
executeInlineAction
Description copied from interface:IPortalSession
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.- Specified by:
executeInlineAction
in interfaceIPortalSession
- Parameters:
handler
- The action handler which should be executed.parameters
- The parameters for the action handler.- Returns:
- The result object from the action handler.
- See Also:
-
executeCallback
Description copied from interface:IPortalSession
Executes a callback. It is up to the IPortalSession implementation to decide which IPortalSession is passed as parameter to the callback. In the general case, the IPortalSession parameter is the same instance as the IPortalSession which is executing the callback, but this is not a requirement and some IPortalSession implementations may deviate from the general case.- Specified by:
executeCallback
in interfaceIPortalSession
- Parameters:
callback
- the callback which should be executed (may not be null)
-
getCurrentFlowState
Description copied from interface:IPortalSession
Returns the current flowState.- Specified by:
getCurrentFlowState
in interfaceIPortalSession
- Returns:
- Object containing information about the current flow path.
-
getCurrentLanguage
Description copied from interface:IPortalSession
Returns the current language active within the portal-engine.- Specified by:
getCurrentLanguage
in interfaceIPortalSession
- Returns:
- The current language object.
-
setCurrentLanguage
Description copied from interface:IPortalSession
Changes the current language for this portal session.- Specified by:
setCurrentLanguage
in interfaceIPortalSession
- Parameters:
languageCode
- The code of the language
-
getCurrentPage
Description copied from interface:IPortalSession
Returns the last generated page for rendering to the client. If there is no page generated yet this function returns null- Specified by:
getCurrentPage
in interfaceIPortalSession
- Returns:
- IPage the current page model.
-
getMonitor
Description copied from interface:IPortalSession
This method will return a session monitor object containing information about this portal session.- Specified by:
getMonitor
in interfaceIPortalSession
- Returns:
- The session monitor of this session.
-
stopFlow
public void stopFlow(boolean commitPendingChanges) Description copied from interface:IPortalSession
This method will stop the current flow and commit or rollback any pending changes.- Specified by:
stopFlow
in interfaceIPortalSession
- Parameters:
commitPendingChanges
- Boolean indicating if pending changes should be committed.
-
getApplicationId
Description copied from interface:IPortalSession
This method returns the ID of the application/project for which the session was created. NOTE: The ID of the application may differ from the ID returned by the getModule().getId() method.- Specified by:
getApplicationId
in interfaceIPortalSession
- Returns:
- The ID of the application/project for which the session was created.
-
getModule
Description copied from interface:IPortalSession
This method returns an object containing the static definitions of the various components as defined by the current module.- Specified by:
getModule
in interfaceIPortalSession
- Returns:
- Object containing the static definitions of the various components as defined by the current module.
-
getConfiguration
Description copied from interface:IPortalSession
This method returns an object containing the project wide configuration and definitions.- Specified by:
getConfiguration
in interfaceIPortalSession
- Returns:
- an object containing the project wide configuration and definitions.
-
getState
Description copied from interface:IPortalSession
Returns the state of the session (for serialization)- Specified by:
getState
in interfaceIPortalSession
- Returns:
- returns the current state of the session.
-
restore
Description copied from interface:IPortalSession
Clears the current state and overrides it with the provided state.- Specified by:
restore
in interfaceIPortalSession
- Parameters:
state
- The new state for this session.
-
reset
public void reset()Description copied from interface:IPortalSession
Resets the portal session. Current page, profile and scopes will all be cleared. The message bus will not be cleared explicitly.- Specified by:
reset
in interfaceIPortalSession
-
activate
Description copied from interface:ISessionLifecycle
This method may be used for activating the objects after deserialization.- Specified by:
activate
in interfaceISessionLifecycle
- Parameters:
sessionActivationContext
- the current session activation context.
-
passivate
public void passivate()Description copied from interface:ISessionLifecycle
This method may be used for preparing the objects for serialization.- Specified by:
passivate
in interfaceISessionLifecycle
-
interrupt
public void interrupt()Description copied from interface:Interruptible
Sets the interrupted flag, indicating that this object should interrupt the computation it is currently performing (typically on another thread) as soon as possible, and exit by throwing anInterruptedException
.- Specified by:
interrupt
in interfaceInterruptible
-
isInterrupted
public boolean isInterrupted()Description copied from interface:Interruptible
Indicates whether the interrupted flag has been set.- Specified by:
isInterrupted
in interfaceInterruptible
- Returns:
- true if the interrupted flag is set, false otherwise.
-
startTask
-
completeTask
-
abortCurrentTask
-
handlingTask
protected boolean handlingTask() -
handleResponse
-
shouldHandleResponse
protected boolean shouldHandleResponse() -
getTaskId
protected long getTaskId() -
getCurrentUser
-
createSession
-
createEventFor
-
disposeCurrentTask
protected void disposeCurrentTask() -
getCurrentChannel
Description copied from interface:IPortalSession
Returns the current channel.- Specified by:
getCurrentChannel
in interfaceIPortalSession
- Returns:
- The channel.
-
getMessageBus
Description copied from interface:IPortalSession
Returns the messagebus.- Specified by:
getMessageBus
in interfaceIPortalSession
- Returns:
- The messagebus, not null.
-
getEventBus
Description copied from interface:IPortalSession
Returns the event bus used by this session.- Specified by:
getEventBus
in interfaceIPortalSession
- Returns:
- the event bus, not null.
-
getCurrentFlow
Description copied from interface:IPortalSession
Returns the current flow- Specified by:
getCurrentFlow
in interfaceIPortalSession
- Returns:
- The current flow
-
getCaseEngineClient
Description copied from interface:IPortalSession
Returns the optional CaseEngineClient- Specified by:
getCaseEngineClient
in interfaceIPortalSession
- Returns:
- The CaseEngineClient
-
getAuditEngine
Description copied from interface:IPortalSession
Returns the AuditEngine- Specified by:
getAuditEngine
in interfaceIPortalSession
- Returns:
- The AuditEngine
-