S
- Defined by the sub-interface to specify the type of entity
selection associated with the declared user service.public interface ActivationContext<S extends EntitySelection>
User service activation defines on which elements the service can be displayed and executed.
By default, the service is activated on the maximum scope allowed by the type of activation context, see the sub-interfaces documentation for more details. This activation can then be restricted:
ActivationContextOnDataspace.setActivationRule(ServiceActivationRuleForDataspace)
or
ActivationContextWithDatasetSet.setActivationRule(ServiceActivationRuleForDataset)
.
Note: when a service is not activated for a given dataspace or dataset, it will not be displayed in the associated permission UI screens.
By default, the service is automatically displayed in every toolbar location
matching the service activation scope. However, this can be refined by using
setDisplayForLocations(ActionDisplaySpec, ToolbarLocation...)
, which
allows to specify if and how the service is displayed in the
specified locations.
User service permission rules allow to further restrict the service availability, based on the context.
By default, the service is available in every context where the service is activated.
This availability can be restricted by setting a ServicePermissionRule
.
This rule is evaluated every time the service is invoked, either to be displayed
or executed.
UserServiceDeclaration.defineActivation(ActivationContext)
Modifier and Type | Method and Description |
---|---|
Set<ToolbarLocation> |
getAvailableToolbarLocations()
Returns all the possible toolbar locations where the current user service
declaration can be displayed.
|
void |
setDefaultPermission(UserServicePermission aDefaultPermission)
Defines the service's default permission (enabled by default).
|
void |
setDisplayForAllLocations(ActionDisplaySpec aSpec)
Specifies if and how the action launching the service is displayed for
all available locations.
|
void |
setDisplayForLocations(ActionDisplaySpec aSpec,
ToolbarLocation... someToolbarLocations)
Specifies if and how the action launching the service is displayed in the
specified locations.
|
void |
setPermissionRule(ServicePermissionRule<? super S> aRule)
Sets a contextual permission rule which will be evaluated at runtime,
upon service display or execution.
|
void setDefaultPermission(UserServicePermission aDefaultPermission)
This default permission is used when no permission has been explicitly set for this service to a given profile via UI permissions.
This method can only be used when declaring a new user service. It has no effect when declaring a service extension.
void setPermissionRule(ServicePermissionRule<? super S> aRule)
If it is known that a user service should always be disabled for
a given set of datasets or dataspaces, it is recommended to use
setActivationRule(ServiceActivationRuleForX)
instead. Indeed, activation rules have the added benefit to remove the user service
from the dataspace and dataset permission UI screens, when deactivated.
ServicePermissionRule.getPermission(ServicePermissionRuleContext)
is called each time the associated service is potentially displayed or executed in a user interface session.
void setDisplayForAllLocations(ActionDisplaySpec aSpec)
By default, ActionDisplaySpec.DISPLAYED
is set for all locations
available for this activation.
getAvailableToolbarLocations()
void setDisplayForLocations(ActionDisplaySpec aSpec, ToolbarLocation... someToolbarLocations)
By default, ActionDisplaySpec.DISPLAYED
is set for all locations
available for this activation.
To specify an ActionDisplaySpec
for all available locations,
use setDisplayForAllLocations(ActionDisplaySpec)
instead.
IllegalArgumentException
- if no location is specified, or if a location is not available for this
activation.getAvailableToolbarLocations()
Set<ToolbarLocation> getAvailableToolbarLocations()
null
.