summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2019-09-11 13:14:06 +0200
committerGitHub <noreply@github.com>2019-09-11 13:14:06 +0200
commit2187f856ce4eadeee88bd8b9ff47719df52ea025 (patch)
tree9df95fb0db015c0f597237c105ee7c5838396a97 /lib/public
parent0cc780ec0a94e6ea2103ee667b111cc38fe81f12 (diff)
parent228cb240bcfe18410a2ce53a35531cdba98b014d (diff)
downloadnextcloud-server-2187f856ce4eadeee88bd8b9ff47719df52ea025.tar.gz
nextcloud-server-2187f856ce4eadeee88bd8b9ff47719df52ea025.zip
Merge pull request #16682 from nextcloud/enh/12790/workflow-backend
workflow overhaul
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/WorkflowEngine/GenericEntityEvent.php79
-rw-r--r--lib/public/WorkflowEngine/ICheck.php35
-rw-r--r--lib/public/WorkflowEngine/IComplexOperation.php56
-rw-r--r--lib/public/WorkflowEngine/IEntity.php77
-rw-r--r--lib/public/WorkflowEngine/IEntityCheck.php54
-rw-r--r--lib/public/WorkflowEngine/IEntityEvent.php54
-rw-r--r--lib/public/WorkflowEngine/IFileCheck.php42
-rw-r--r--lib/public/WorkflowEngine/IManager.php43
-rw-r--r--lib/public/WorkflowEngine/IOperation.php70
-rw-r--r--lib/public/WorkflowEngine/IRuleMatcher.php39
-rw-r--r--lib/public/WorkflowEngine/ISpecificOperation.php50
11 files changed, 573 insertions, 26 deletions
diff --git a/lib/public/WorkflowEngine/GenericEntityEvent.php b/lib/public/WorkflowEngine/GenericEntityEvent.php
new file mode 100644
index 00000000000..3ea34c6fb87
--- /dev/null
+++ b/lib/public/WorkflowEngine/GenericEntityEvent.php
@@ -0,0 +1,79 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2019 Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\WorkflowEngine;
+
+/**
+ * Class GenericEntityEvent
+ *
+ * @package OCP\WorkflowEngine
+ *
+ * @since 18.0.0
+ */
+class GenericEntityEvent implements IEntityEvent {
+
+ /** @var string */
+ private $displayName;
+ /** @var string */
+ private $eventName;
+
+ /**
+ * GenericEntityEvent constructor.
+ *
+ * @since 18.0.0
+ */
+ public function __construct(string $displayName, string $eventName) {
+ if(trim($displayName) === '') {
+ throw new \InvalidArgumentException('DisplayName must not be empty');
+ }
+ if(trim($eventName) === '') {
+ throw new \InvalidArgumentException('EventName must not be empty');
+ }
+
+ $this->displayName = trim($displayName);
+ $this->eventName = trim($eventName);
+ }
+
+ /**
+ * returns a translated name to be presented in the web interface.
+ *
+ * Example: "created" (en), "kreita" (eo)
+ *
+ * @since 18.0.0
+ */
+ public function getDisplayName(): string {
+ return $this->displayName;
+ }
+
+ /**
+ * returns the event name that is emitted by the EventDispatcher, e.g.:
+ *
+ * Example: "OCA\MyApp\Factory\Cats::postCreated"
+ *
+ * @since 18.0.0
+ */
+ public function getEventName(): string {
+ return $this->eventName;
+ }
+}
diff --git a/lib/public/WorkflowEngine/ICheck.php b/lib/public/WorkflowEngine/ICheck.php
index 1d4fc966460..f5586e83d51 100644
--- a/lib/public/WorkflowEngine/ICheck.php
+++ b/lib/public/WorkflowEngine/ICheck.php
@@ -2,6 +2,7 @@
/**
* @copyright Copyright (c) 2016 Morris Jobke <hey@morrisjobke.de>
*
+ * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
* @author Morris Jobke <hey@morrisjobke.de>
*
* @license GNU AGPL version 3 or any later version
@@ -23,9 +24,6 @@
namespace OCP\WorkflowEngine;
-
-use OCP\Files\Storage\IStorage;
-
/**
* Interface ICheck
*
@@ -34,13 +32,6 @@ use OCP\Files\Storage\IStorage;
*/
interface ICheck {
/**
- * @param IStorage $storage
- * @param string $path
- * @since 9.1
- */
- public function setFileInfo(IStorage $storage, $path);
-
- /**
* @param string $operator
* @param string $value
* @return bool
@@ -55,4 +46,28 @@ interface ICheck {
* @since 9.1
*/
public function validateCheck($operator, $value);
+
+ /**
+ * returns a list of Entities the checker supports. The values must match
+ * the class name of the entity.
+ *
+ * An empty result means the check is universally available.
+ *
+ * @since 18.0.0
+ */
+ public function supportedEntities(): array;
+
+ /**
+ * returns whether the operation can be used in the requested scope.
+ *
+ * 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`.
+ *
+ * @since 18.0.0
+ */
+ public function isAvailableForScope(int $scope): bool;
}
diff --git a/lib/public/WorkflowEngine/IComplexOperation.php b/lib/public/WorkflowEngine/IComplexOperation.php
new file mode 100644
index 00000000000..63a4ca2460a
--- /dev/null
+++ b/lib/public/WorkflowEngine/IComplexOperation.php
@@ -0,0 +1,56 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2019 Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\WorkflowEngine;
+
+/**
+ * Interface IComplexOperation
+ *
+ * This interface represents an operator that is less generic and indicates
+ * that some of the tasks it does itself instead of relying on the engine.
+ * This includes:
+ *
+ * * registering listeners – the implementing app needs to ensure that the
+ * business logic registers listeners to the events it listens to. For example
+ * when direct storage access is required, adding a wrapper or listening to
+ * a specific one is required over usual file events.
+ *
+ * @package OCP\WorkflowEngine
+ *
+ * @since 18.0.0
+ */
+interface IComplexOperation extends IOperation {
+
+ /**
+ * As IComplexOperation chooses the triggering events itself, a hint has
+ * to be shown to the user so make clear when this operation is becoming
+ * active. This method returns such a translated string.
+ *
+ * Example: "When a file is accessed" (en)
+ *
+ * @since 18.0.0
+ */
+ public function getTriggerHint(): string;
+
+}
diff --git a/lib/public/WorkflowEngine/IEntity.php b/lib/public/WorkflowEngine/IEntity.php
new file mode 100644
index 00000000000..c08e9072a38
--- /dev/null
+++ b/lib/public/WorkflowEngine/IEntity.php
@@ -0,0 +1,77 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2019 Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\WorkflowEngine;
+
+use Symfony\Component\EventDispatcher\GenericEvent;
+
+/**
+ * Interface IEntity
+ *
+ * This interface represents an entity that supports events the workflow engine
+ * can listen to. For example a file with the create, update, etc. events.
+ *
+ * Ensure to listen to 'OCP/WorkflowEngine::loadEntities' for registering your
+ * entities.
+ *
+ * @package OCP\WorkflowEngine
+ * @since 18.0.0
+ */
+interface IEntity {
+
+ /**
+ * returns a translated name to be presented in the web interface.
+ *
+ * Example: "File" (en), "Dosiero" (eo)
+ *
+ * @since 18.0.0
+ */
+ public function getName(): string;
+
+ /**
+ * returns the URL to the icon of the entity for display in the web interface.
+ *
+ * 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');
+ *
+ * @since 18.0.0
+ */
+ public function getIcon(): string;
+
+ /**
+ * returns a list of supported events
+ *
+ * @return IEntityEvent[]
+ * @since 18.0.0
+ */
+ public function getEvents(): array;
+
+ /**
+ * @since 18.0.0
+ */
+ public function prepareRuleMatcher(IRuleMatcher $ruleMatcher, string $eventName, GenericEvent $event): void;
+
+}
diff --git a/lib/public/WorkflowEngine/IEntityCheck.php b/lib/public/WorkflowEngine/IEntityCheck.php
new file mode 100644
index 00000000000..7a4df0afd5f
--- /dev/null
+++ b/lib/public/WorkflowEngine/IEntityCheck.php
@@ -0,0 +1,54 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2019 Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\WorkflowEngine;
+
+
+use OCP\Files\Storage\IStorage;
+
+/**
+ * Interface IFileCheck
+ *
+ * @package OCP\WorkflowEngine
+ * @since 18.0.0
+ */
+interface IEntityCheck {
+ /**
+ * Equips the check with a subject fitting the Entity. For instance, an
+ * entity of File will receive an instance of OCP\Files\Node, or a comment
+ * entity might get an IComment.
+ *
+ * The implementing check must be aware of the incoming type.
+ *
+ * If an unsupported subject is passed the implementation MAY throw an
+ * \UnexpectedValueException.
+ *
+ * @param IEntity $entity
+ * @param mixed $subject
+ * @throws \UnexpectedValueException
+ * @since 18.0.0
+ */
+ public function setEntitySubject(IEntity $entity, $subject): void;
+
+}
diff --git a/lib/public/WorkflowEngine/IEntityEvent.php b/lib/public/WorkflowEngine/IEntityEvent.php
new file mode 100644
index 00000000000..8baa0573fa8
--- /dev/null
+++ b/lib/public/WorkflowEngine/IEntityEvent.php
@@ -0,0 +1,54 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2019 Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\WorkflowEngine;
+
+/**
+ * Interface IEntityEvent
+ *
+ * represents an entitiy event that is dispatched via EventDispatcher
+ *
+ * @package OCP\WorkflowEngine
+ *
+ * @since 18.0.0
+ */
+interface IEntityEvent {
+ /**
+ * returns a translated name to be presented in the web interface.
+ *
+ * Example: "created" (en), "kreita" (eo)
+ *
+ * @since 18.0.0
+ */
+ public function getDisplayName(): string;
+
+ /**
+ * returns the event name that is emitted by the EventDispatcher, e.g.:
+ *
+ * Example: "OCA\MyApp\Factory\Cats::postCreated"
+ *
+ * @since 18.0.0
+ */
+ public function getEventName(): string;
+}
diff --git a/lib/public/WorkflowEngine/IFileCheck.php b/lib/public/WorkflowEngine/IFileCheck.php
new file mode 100644
index 00000000000..557ba0f3c10
--- /dev/null
+++ b/lib/public/WorkflowEngine/IFileCheck.php
@@ -0,0 +1,42 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2019 Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\WorkflowEngine;
+
+
+use OCP\Files\Storage\IStorage;
+
+/**
+ * Interface IFileCheck
+ *
+ * @package OCP\WorkflowEngine
+ * @since 18.0.0
+ */
+interface IFileCheck extends IEntityCheck {
+ /**
+ * @since 18.0.0
+ */
+ public function setFileInfo(IStorage $storage, string $path);
+
+}
diff --git a/lib/public/WorkflowEngine/IManager.php b/lib/public/WorkflowEngine/IManager.php
index cd323a816f3..78fd718ec9e 100644
--- a/lib/public/WorkflowEngine/IManager.php
+++ b/lib/public/WorkflowEngine/IManager.php
@@ -23,9 +23,6 @@
namespace OCP\WorkflowEngine;
-
-use OCP\Files\Storage\IStorage;
-
/**
* Interface IManager
*
@@ -33,18 +30,40 @@ use OCP\Files\Storage\IStorage;
* @since 9.1
*/
interface IManager {
+
+ const SCOPE_ADMIN = 0;
+ const SCOPE_USER = 1;
+
+ const EVENT_NAME_REG_OPERATION = 'OCP\WorkflowEngine::registerOperations';
+ const EVENT_NAME_REG_ENTITY = 'OCP\WorkflowEngine::registerEntities';
+ const EVENT_NAME_REG_CHECK = 'OCP\WorkflowEngine::registerChecks';
+
+ /**
+ * Listen to `\OCP\WorkflowEngine::EVENT_NAME_REG_ENTITY` at the
+ * EventDispatcher for registering your entities.
+ *
+ * @since 18.0.0
+ */
+ public function registerEntity(IEntity $entity): void;
+
+ /**
+ * Listen to `\OCP\WorkflowEngine::EVENT_NAME_REG_OPERATION` at the
+ * EventDispatcher for registering your operators.
+ *
+ * @since 18.0.0
+ */
+ public function registerOperation(IOperation $operator): void;
+
/**
- * @param IStorage $storage
- * @param string $path
- * @since 9.1
+ * Listen to `\OCP\WorkflowEngine::EVENT_NAME_REG_CHECK` at the
+ * EventDispatcher for registering your operators.
+ *
+ * @since 18.0.0
*/
- public function setFileInfo(IStorage $storage, $path);
+ public function registerCheck(ICheck $check): void;
/**
- * @param string $class
- * @param bool $returnFirstMatchingOperationOnly
- * @return array
- * @since 9.1
+ * @since 18.0.0
*/
- public function getMatchingOperations($class, $returnFirstMatchingOperationOnly = true);
+ public function getRuleMatcher(): IRuleMatcher;
}
diff --git a/lib/public/WorkflowEngine/IOperation.php b/lib/public/WorkflowEngine/IOperation.php
index 491a805909c..d16fd618a84 100644
--- a/lib/public/WorkflowEngine/IOperation.php
+++ b/lib/public/WorkflowEngine/IOperation.php
@@ -23,6 +23,8 @@
namespace OCP\WorkflowEngine;
+use Symfony\Component\EventDispatcher\GenericEvent;
+
/**
* Interface IOperation
*
@@ -31,11 +33,71 @@ namespace OCP\WorkflowEngine;
*/
interface IOperation {
/**
- * @param string $name
- * @param array[] $checks
- * @param string $operation
+ * returns a translated name to be presented in the web interface
+ *
+ * Example: "Automated tagging" (en), "Aŭtomata etikedado" (eo)
+ *
+ * @since 18.0.0
+ */
+ public function getDisplayName(): string;
+
+ /**
+ * returns a translated, descriptive text to be presented in the web interface.
+ *
+ * It should be short and precise.
+ *
+ * Example: "Tag based automatic deletion of files after a given time." (en)
+ *
+ * @since 18.0.0
+ */
+ public function getDescription(): string;
+
+ /**
+ * returns the URL to the icon of the operator for display in the web interface.
+ *
+ * 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');
+ *
+ * @since 18.0.0
+ */
+ public function getIcon(): string;
+
+ /**
+ * returns whether the operation can be used in the requested scope.
+ *
+ * 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`.
+ *
+ * @since 18.0.0
+ */
+ public function isAvailableForScope(int $scope): bool;
+
+ /**
+ * Validates whether a configured workflow rule is valid. If it is not,
+ * an `\UnexpectedValueException` is supposed to be thrown.
+ *
* @throws \UnexpectedValueException
* @since 9.1
*/
- public function validateOperation($name, array $checks, $operation);
+ public function validateOperation(string $name, array $checks, string $operation): 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.
+ *
+ * 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.
+ *
+ * @since 18.0.0
+ */
+ public function onEvent(string $eventName, GenericEvent $event, IRuleMatcher $ruleMatcher): void;
}
diff --git a/lib/public/WorkflowEngine/IRuleMatcher.php b/lib/public/WorkflowEngine/IRuleMatcher.php
new file mode 100644
index 00000000000..5569800edb7
--- /dev/null
+++ b/lib/public/WorkflowEngine/IRuleMatcher.php
@@ -0,0 +1,39 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2019 Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\WorkflowEngine;
+
+/**
+ * Class IRuleMatcher
+ *
+ * @package OCP\WorkflowEngine
+ *
+ * @since 18.0.0
+ */
+interface IRuleMatcher extends IFileCheck {
+ /**
+ * @since 18.0.0
+ */
+ public function getMatchingOperations(string $class, bool $returnFirstMatchingOperationOnly = true): array;
+}
diff --git a/lib/public/WorkflowEngine/ISpecificOperation.php b/lib/public/WorkflowEngine/ISpecificOperation.php
new file mode 100644
index 00000000000..0b26770a13a
--- /dev/null
+++ b/lib/public/WorkflowEngine/ISpecificOperation.php
@@ -0,0 +1,50 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2019 Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\WorkflowEngine;
+
+/**
+ * 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.
+ *
+ * @package OCP\WorkflowEngine
+ * @since 18.0.0
+ */
+interface ISpecificOperation extends IOperation {
+
+ /**
+ * returns the id of the entity the operator is designed for
+ *
+ * Example: 'WorkflowEngine_Entity_File'
+ *
+ * @since 18.0.0
+ */
+ public function getEntityId():string;
+}