Package com.orchestranetworks.service
Class ActionPermission
- java.lang.Object
-
- com.orchestranetworks.service.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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Nomenclature<String>
getActionPermissionNomenclature(Locale currentLocale)
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.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.UserMessage
getDisabledReason()
Only defined if this state is set to 'disabled' and a specific reason is provided.static ActionPermission
getEnabled()
Factory method that specifies that an action may be executed in the current session context.char
getFlag()
Persistent flag that identifies the permission.String
getFlagString()
Persistent flag that identifies the permission.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.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.static Nomenclature<String>
getReadOnlyActionPermissionNomenclature(Locale currentLocale)
boolean
isDisabled()
boolean
isDisabledOrHidden()
This method returns the opposite ofisEnabled()
.boolean
isEnabled()
boolean
isHidden()
boolean
isSameFlag(String aFlagString)
Returnstrue
if the flag specified is the same as the flag of this permission.ActionPermission
max(ActionPermission anotherPermission)
Returns the least restrictive permission between this instance and the instance given as an argument.ActionPermission
min(ActionPermission anotherPermission)
Returns the most restrictive permission between this instance and the instance given as an argument.static ActionPermission
parseFlag(char accessFlag)
Factory method.static ActionPermission
parseFlag(String actionFlag)
Factory method.String
toDisplayString(Locale aLocale)
String
toString()
-
-
-
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 thegetDisabled(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 thegetHidden(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()
-
isDisabled
public boolean isDisabled()
- See Also:
getDisabled()
,getDisabled(UserMessage)
-
isHidden
public boolean isHidden()
- See Also:
getHidden()
-
isDisabledOrHidden
public boolean isDisabledOrHidden()
This method returns the opposite ofisEnabled()
.
-
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(String actionFlag)
Factory method. The argument specified can be obtained by calling the methodgetFlagString()
.
-
parseFlag
public static ActionPermission parseFlag(char accessFlag)
Factory method. The argument specified can be obtained by calling the methodgetFlagString()
.
-
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)
Returnstrue
if the flag specified is the same as the flag of this permission.
-
getActionPermissionNomenclature
public static Nomenclature<String> getActionPermissionNomenclature(Locale currentLocale)
-
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
-
-