Class ActionPermission


  • public final class ActionPermission
    extends Object
    Defines the permissions for whether or not a user can execute an action.

    The possible states are:

    • hidden – the action is not displayed to the user;
    • disabled – the action is not displayed to the user (same as hidden). In a future release, this state could be used to display the action to the user, but greyed out so that it cannot be executed;
    • enabled – the action is displayed and can be executed;

    • Method Detail

      • getEnabled

        public static ActionPermission getEnabled()
        Factory method that specifies that an action may be executed in the current session context.
      • getDisabled

        public static ActionPermission getDisabled()
        Factory method that specifies that an action is neither displayed to the user nor can be executed by the user in the current session context. This method does not provide a reason for this restriction. To specify a reason, use the getDisabled(UserMessage) method.

        In a future release, this state could be used to display the action to the user, but greyed out so that it cannot be executed.

      • getDisabled

        public static ActionPermission getDisabled​(UserMessage aReason)
        Factory method that specifies that an action is neither displayed to the user nor can be executed by the user in the current session context. This method allows to provide a reason for this restriction.

        In a future release, this state could be used to display the action to the user, but greyed out so that it cannot be executed.

      • getHidden

        public static ActionPermission getHidden()
        Factory method that specifies that an action is neither displayed to the user nor can be executed by the user in the current session context. This method does not provide a reason for this restriction. To specify a reason, use the getHidden(UserMessage) method.
      • getHidden

        public static ActionPermission getHidden​(UserMessage aReason)
        Factory method that specifies that an action is neither displayed to the user nor can be executed by the user in the current session context. This method allows to provide a reason for this restriction.
      • isEnabled

        public boolean isEnabled()
        See Also:
        getEnabled()
      • isHidden

        public boolean isHidden()
        See Also:
        getHidden()
      • isDisabledOrHidden

        public boolean isDisabledOrHidden()
        This method returns the opposite of isEnabled().
      • getDisabledReason

        public UserMessage getDisabledReason()
        Only defined if this state is set to 'disabled' and a specific reason is provided.
        See Also:
        getDisabled(UserMessage)
      • parseFlag

        public static ActionPermission parseFlag​(char accessFlag)
        Factory method. The argument specified can be obtained by calling the method getFlagString().
      • getFlag

        public char getFlag()
        Persistent flag that identifies the permission.
      • getFlagString

        public String getFlagString()
        Persistent flag that identifies the permission.

        It returns the same content as getFlag().

      • isSameFlag

        public boolean isSameFlag​(String aFlagString)
        Returns true if the flag specified is the same as the flag of this permission.
      • getActionPermissionNomenclature

        public static Nomenclature<String> getActionPermissionNomenclature​(Locale currentLocale)
      • toDisplayString

        public String toDisplayString​(Locale aLocale)
      • getReadOnlyActionPermissionNomenclature

        public static Nomenclature<String> getReadOnlyActionPermissionNomenclature​(Locale currentLocale)
      • min

        public ActionPermission min​(ActionPermission anotherPermission)
        Returns the most restrictive permission between this instance and the instance given as an argument. When two permissions has the same value, priority is given to the one having a more severe reason if specified.
        Since:
        5.7.0
      • max

        public ActionPermission max​(ActionPermission anotherPermission)
        Returns the least restrictive permission between this instance and the instance given as an argument. When two permissions has the same value, priority is given to the one having a more severe reason if specified.
        Since:
        5.7.0