ISpecificOperation extends IOperation
Interface ISpecificOperation
This interface represents an operator that is designed to work with exactly one entity type.
In almost all of the cases it is not necessary to have this limitation, because the action is not connected to the event. This mechanism suits special cases.
Tags
Table of Contents
- getDescription() : string
- returns a translated, descriptive text to be presented in the web interface.
- getDisplayName() : string
- returns a translated name to be presented in the web interface
- getEntityId() : string
- returns the id of the entity the operator is designed for
- getIcon() : string
- returns the URL to the icon of the operator for display in the web interface.
- isAvailableForScope() : bool
- returns whether the operation can be used in the requested scope.
- onEvent() : void
- Is being called by the workflow engine when an event was triggered that is configured for this operation. An evaluation whether the event qualifies for this operation to run has still to be done by the implementor by calling the RuleMatchers getMatchingOperations method and evaluating the results.
- validateOperation() : void
- Validates whether a configured workflow rule is valid. If it is not, an `\UnexpectedValueException` is supposed to be thrown.
Methods
getDescription()
returns a translated, descriptive text to be presented in the web interface.
public
getDescription() : string
It should be short and precise.
Example: "Tag based automatic deletion of files after a given time." (en)
Tags
Return values
string —getDisplayName()
returns a translated name to be presented in the web interface
public
getDisplayName() : string
Example: "Automated tagging" (en), "AĆtomata etikedado" (eo)
Tags
Return values
string —getEntityId()
returns the id of the entity the operator is designed for
public
getEntityId() : string
Example: 'WorkflowEngine_Entity_File'
Tags
Return values
string —getIcon()
returns the URL to the icon of the operator for display in the web interface.
public
getIcon() : string
Usually, the implementation would utilize the imagePath()
method of the
\OCP\IURLGenerator
instance and simply return its result.
Example implementation: return $this->urlGenerator->imagePath('myApp', 'cat.svg');
Tags
Return values
string —isAvailableForScope()
returns whether the operation can be used in the requested scope.
public
isAvailableForScope(int $scope) : bool
Scope IDs are defined as constants in OCP\WorkflowEngine\IManager. At time of writing these are SCOPE_ADMIN and SCOPE_USER.
For possibly unknown future scopes the recommended behaviour is: if
user scope is permitted, the default behaviour should return true
,
otherwise false
.
Parameters
- $scope : int
Tags
Return values
bool —onEvent()
Is being called by the workflow engine when an event was triggered that is configured for this operation. An evaluation whether the event qualifies for this operation to run has still to be done by the implementor by calling the RuleMatchers getMatchingOperations method and evaluating the results.
public
onEvent(string $eventName, Event $event, IRuleMatcher $ruleMatcher) : void
If the implementor is an IComplexOperation, this method will not be called automatically. It can be used or left as no-op by the implementor.
Parameters
- $eventName : string
- $event : Event
- $ruleMatcher : IRuleMatcher
Tags
validateOperation()
Validates whether a configured workflow rule is valid. If it is not, an `\UnexpectedValueException` is supposed to be thrown.
public
validateOperation(string $name, array $checks, string $operation) : void
Parameters
- $name : string
- $checks : array
- $operation : string