Package com.orchestranetworks.userservice.permission

# Interface ServicePermissionRuleContext<S extends EntitySelection>

All Superinterfaces:
  `UserServiceInvocationContext<S>`

public interface ServicePermissionRuleContext<S extends EntitySelection> extends UserServiceInvocationContext<S>
Provides the context in which a service permission rule is being evaluated. Permissions can be evaluated for display or for execution.

Since:
  5.8.0
See Also:
  - `ServicePermissionRule.getPermission(ServicePermissionRuleContext)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `S`
  `getEntitySelection()`
  Returns the current selection.
  `ServiceKey`
  `getServiceKey()`
  Returns the current service key.
  `Session`
  `getSession()`
  Returns the current session.
  `ToolbarLocation`
  `getToolbarLocation()`
  When the permission is being evaluated for displaying or hiding the service as a toolbar action (a button or a menu item), returns the toolbar location containing this action.
  `boolean`
  `isForDisplay()`
  Returns `true` when the permission is being evaluated for displaying or hiding the service as a toolbar action (a button or a menu item).
  `boolean`
  `isForDisplayInDefaultMenu()`
  Returns `true` when the permission is being evaluated for displaying or hiding the service as part of a EBX® default menu.
  `boolean`
  `isForExecution()`
  Returns `true` when the permission is being evaluated for executing the service (launched from a toolbar or accessed from a web component).

- ## Method Details

  - ### getEntitySelection

    S getEntitySelection()
    Returns the current selection. Never returns `null`.

    Note: In the context of permission evaluation, the returned selection can be affected by whether a service permission is being evaluated for display or for execution. For instance when evaluating the service permission in a table view for display, the TableViewEntitySelection.getSelectedRecords() method will always return an empty result.

    Specified by:
      `getEntitySelection` in interface `UserServiceInvocationContext<S extends EntitySelection>`

  - ### getSession

    Session getSession()
    Returns the current session. Never returns `null`.

  - ### getServiceKey

    ServiceKey getServiceKey()
    Returns the current service key.

  - ### isForDisplay

    boolean isForDisplay()
    Returns `true` when the permission is being evaluated for displaying or hiding the service as a toolbar action (a button or a menu item).
    See Also:
      - `getToolbarLocation()`

  - ### isForDisplayInDefaultMenu

    boolean isForDisplayInDefaultMenu()
    Returns `true` when the permission is being evaluated for displaying or hiding the service as part of a EBX® default menu.

  - ### isForExecution

    boolean isForExecution()
    Returns `true` when the permission is being evaluated for executing the service (launched from a toolbar or accessed from a web component).

  - ### getToolbarLocation

    ToolbarLocation getToolbarLocation()
    When the permission is being evaluated for displaying or hiding the service as a toolbar action (a button or a menu item), returns the toolbar location containing this action. Returns `null` when `isForDisplay()` is `false`.