public interface SessionManager extends Remote
Modifier and Type | Method and Description |
---|---|
long |
beginTransaction()
Begins a transaction on this session.
|
void |
commitTransaction(long id)
Commits a transaction started by calling
beginTransaction() . |
Item |
getCurrentUser(AttributeRequest[] attributes)
Returns the user as an Item for the current session.
|
NamedValue[] |
getSessionProperties(String[] properties)
Returns the requested session properties.
|
void |
keepAlive()
Keeps a long running transaction that spans multiple requests alive.
|
void |
popSessionMode(int mode)
Pops the session one level, out of a privileged mode.
|
void |
pushSessionMode(int mode)
Pushes the session into a privileged mode where certain permission checks
are ignored, depending on the mode.
|
void |
rollbackTransaction(long id)
Rolls back a transaction started by calling
beginTransaction()
. |
Item |
setSessionMode(int mode,
AttributeRequest[] attributes)
Switches the current session into one of the administration modes
(currently only DOMAIN) or out of administration mode (NORMAL).
|
void |
setSessionProperties(NamedValue[] properties)
Set properties on the current session.
|
Item getCurrentUser(AttributeRequest[] attributes) throws FdkException
attributes
- Optional attributes to return. Can be null
.FdkException
NamedValue[] getSessionProperties(String[] properties) throws FdkException
WebServicesConstants
. Examples are
LOGIN_USER, SESSION_TIMEOUT, TRANSACTION_TIMEOUT
and any
properties that start with the public prefix defined by
FdkConstants.PUBLIC_SESSIONSTATE_PREFIX
.
This method only works for Web Services clients as it requires the
proper context. In-process clients have other means of getting the same
values.
FdkException
void setSessionProperties(NamedValue[] properties) throws FdkException
FdkConstants.PUBLIC_SESSIONSTATE_PREFIX
or
the session must be created by a trusted application. Properties for
various features are documented elsewhere.properties
- The properties to set. The names must start with the
public prefix defined by
FdkConstants.PUBLIC_SESSIONSTATE_PREFIX
.
To remove a property, set its value to null
.FdkException
void keepAlive() throws FdkException
FdkException
long beginTransaction() throws FdkException
commitTransaction()
or it can be rolled back by
calling rollbackTransaction()
on this session.
This method returns a transaction ID required to later reference this specific transaction.
Transactions can be nested but they need to be committed or rolled back in the proper order, most recent transaction first (stack model).
FdkException
void commitTransaction(long id) throws FdkException
beginTransaction()
.id
- The ID of the transaction (returned by
beginTransaction()
).FdkException
void rollbackTransaction(long id) throws FdkException
beginTransaction()
.
If the ID of the transaction is less than or equal to 0, then the entire transaction stack will be rolled back at once.
id
- The ID of the transaction (returned by
beginTransaction()
). If the ID is less than or
equal to 0, then the entire transaction stack will be rolled
back at once.FdkException
Item setSessionMode(int mode, AttributeRequest[] attributes) throws FdkException
pushSessionMode(int)
).Once the session is in an administration
mode, it can be further pushed into one of the privileged modes if needed.mode
- The mode to set, defined by one of the constants
FdkConstants.SESSION_MODE_SESSION_MODE_DOMAIN_ADMINISTRATION
or FdkConstants.SESSION_MODE_SESSION_MODE_NORMAL
attributes
- Optional attributes that can be returned for the user
item.FdkException
void pushSessionMode(int mode) throws FdkException
FdkConstants.SESSION_MODE_DISCOVER_ALL
- the session can
discover all objects, regardless of their permissions.
FdkConstants.SESSION_MODE_ADMIN_IGNORE_ALL
- powerfull mode
that ignores all permission checks. Use with caution.
Note that this call requires the following:
beginTransaction()
mode
- The mode to switch to.FdkException
- if the operation fails.void popSessionMode(int mode) throws FdkException
pushSessionMode(int)
, FdkConstants.SESSION_MODE_NORMAL
can be specified which will unwind the entire mode stack, regardless of the
current state (useful for cleanup purposes).mode
- The current mode to pop out of.FdkException
- if the operation fails.Copyright © 2023. All rights reserved.