Package com.webmethods.portal.bizPolicy
Interface ITraits
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Enable Access operations.static final int
Enable alias operations.static final int
Enable all the states.static final int
Enable event generation operations.static final int
No states will be executed.static final int
Enable policy operations.static final int
Enable version operations.static final int
Enable workflow operations. -
Method Summary
Modifier and TypeMethodDescriptionint
Get an integer representation of theITraits
object associated with the current context.boolean
A convenience function forACCESS
.boolean
hasAlias()
A convenience function forALIAS
.boolean
A convenience function forEVENTS
.boolean
A convenience function forPOLICY
.boolean
A convenience function forVERSION
.boolean
A convenience function forWORKFLOW
.void
setTraits
(int traits) Set the traits on theITraits
object associated with the current context.void
updateTraits
(int value, boolean set) Updates current traits values by setting or unsetting specified traits
-
Field Details
-
NONE
static final int NONENo states will be executed.- See Also:
-
ACCESS
static final int ACCESSEnable Access operations.- See Also:
-
WORKFLOW
static final int WORKFLOWEnable workflow operations.- See Also:
-
VERSION
static final int VERSIONEnable version operations.- See Also:
-
POLICY
static final int POLICYEnable policy operations.- See Also:
-
ALIAS
static final int ALIASEnable alias operations.- See Also:
-
EVENTS
static final int EVENTSEnable event generation operations.- See Also:
-
ALL
static final int ALLEnable all the states.- See Also:
-
-
Method Details
-
getTraits
int getTraits()Get an integer representation of theITraits
object associated with the current context.- Returns:
- the integer representation of an ITrait
-
setTraits
void setTraits(int traits) Set the traits on theITraits
object associated with the current context. -
hasAccess
boolean hasAccess()A convenience function forACCESS
.- Returns:
- true if enabled, false otherwise
-
hasWorkflow
boolean hasWorkflow()A convenience function forWORKFLOW
.- Returns:
- true if enabled, false otherwise
-
hasVersion
boolean hasVersion()A convenience function forVERSION
.- Returns:
- true if enabled, false otherwise
-
hasPolicy
boolean hasPolicy()A convenience function forPOLICY
.- Returns:
- true if enabled, false otherwise
-
hasAlias
boolean hasAlias()A convenience function forALIAS
.- Returns:
- true if enabled, false otherwise
-
hasEvents
boolean hasEvents()A convenience function forEVENTS
.- Returns:
- true if enabled, false otherwise
-
updateTraits
void updateTraits(int value, boolean set) Updates current traits values by setting or unsetting specified traits- Parameters:
value
-set
-
-