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 IContexts are initialized with all of the ITrait states enabled.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static 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 Type
    Method
    Description
    int
    Get an integer representation of the ITraits object associated with the current context.
    boolean
    A convenience function for ACCESS.
    boolean
    A convenience function for ALIAS.
    boolean
    A convenience function for EVENTS.
    boolean
    A convenience function for POLICY.
    boolean
    A convenience function for VERSION.
    boolean
    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
  • Field Details

  • Method Details

    • getTraits

      int getTraits()
      Get an integer representation of the ITraits object associated with the current context.
      Returns:
      the integer representation of an ITrait
    • setTraits

      void setTraits(int traits)
      Set the traits on the ITraits object associated with the current context.
      Parameters:
      traits - the bit set taken from various ITrait constants
      See Also:
    • hasAccess

      boolean hasAccess()
      A convenience function for ACCESS.
      Returns:
      true if enabled, false otherwise
    • hasWorkflow

      boolean hasWorkflow()
      A convenience function for WORKFLOW.
      Returns:
      true if enabled, false otherwise
    • hasVersion

      boolean hasVersion()
      A convenience function for VERSION.
      Returns:
      true if enabled, false otherwise
    • hasPolicy

      boolean hasPolicy()
      A convenience function for POLICY.
      Returns:
      true if enabled, false otherwise
    • hasAlias

      boolean hasAlias()
      A convenience function for ALIAS.
      Returns:
      true if enabled, false otherwise
    • hasEvents

      boolean hasEvents()
      A convenience function for EVENTS.
      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 -