public interface ITraits
Traits control the behavior of Commands.
When using IBizPolicy
and
ICommand
, they are always invoked with an IContext
object.
The IContext
object contains information about the user on whose
behalf the command is invoked, as well as access, event, and workflow states.
These states, which can be toggled on and off, are known as traits,
and are encapsulated by the ITraits
object.
By default, all policy commands will check access, fire events, and initiate workflow
as appropriate for the command.
By modifying the ITraits of an IContext
object, you can control which states are available
when executing various Commands and BizPolicies.
By default, all IContext
s are initialized with all of the ITrait states enabled.
Modifier and Type | Field and Description |
---|---|
static int |
ACCESS
Enable Access operations.
|
static int |
ALIAS
Enable alias operations.
|
static int |
ALL
Enable all the states.
|
static int |
EVENTS
Enable event generation operations.
|
static int |
NONE
No states will be executed.
|
static int |
POLICY
Enable policy operations.
|
static int |
VERSION
Enable version operations.
|
static int |
WORKFLOW
Enable workflow operations.
|
Modifier and Type | Method and Description |
---|---|
int |
getTraits()
Get an integer representation of the
ITraits object associated with the current context. |
boolean |
hasAccess()
A convenience function for
ACCESS . |
boolean |
hasAlias()
A convenience function for
ALIAS . |
boolean |
hasEvents()
A convenience function for
EVENTS . |
boolean |
hasPolicy()
A convenience function for
POLICY . |
boolean |
hasVersion()
A convenience function for
VERSION . |
boolean |
hasWorkflow()
A convenience function for
WORKFLOW . |
void |
setTraits(int traits)
Set the traits on the
ITraits object associated with the current context. |
void |
updateTraits(int value,
boolean set)
Updates current traits values by setting or unsetting
specified traits
|
static final int NONE
static final int ACCESS
static final int WORKFLOW
static final int VERSION
static final int POLICY
static final int ALIAS
static final int EVENTS
static final int ALL
int getTraits()
ITraits
object associated with the current context.void setTraits(int traits)
ITraits
object associated with the current context.boolean hasAccess()
ACCESS
.boolean hasWorkflow()
WORKFLOW
.boolean hasVersion()
VERSION
.boolean hasPolicy()
POLICY
.boolean hasAlias()
ALIAS
.boolean hasEvents()
EVENTS
.void updateTraits(int value, boolean set)
value
- set
-