Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2019-09-09 17:53:59 +0300
committerArthur Schiwon <blizzz@arthur-schiwon.de>2019-09-09 23:56:05 +0300
commit849d025d093d1c80d3820901d20bf6a664c6af02 (patch)
tree5abb7efdee81ac197dac61dd860f6b4c8becaf51 /lib
parent4cd931fcc6bb7f794fd14ddb75c7867823449e79 (diff)
let a dedicate service serve a stateful process
* includes making ICheck not requiring any context setter * and IFileCheck extending the IEntityCheck as entity data can be handed in via Dispatcher Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/composer/composer/autoload_classmap.php3
-rw-r--r--lib/composer/composer/autoload_static.php3
-rw-r--r--lib/public/WorkflowEngine/ICheck.php20
-rw-r--r--lib/public/WorkflowEngine/IEntityCheck.php53
-rw-r--r--lib/public/WorkflowEngine/IFileCheck.php6
-rw-r--r--lib/public/WorkflowEngine/IManager.php23
-rw-r--r--lib/public/WorkflowEngine/IRuleMatcher.php (renamed from lib/public/WorkflowEngine/IEntityAware.php)7
7 files changed, 67 insertions, 48 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index 4078193b18a..b51b689b629 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -442,11 +442,12 @@ return array(
'OCP\\WorkflowEngine\\ICheck' => $baseDir . '/lib/public/WorkflowEngine/ICheck.php',
'OCP\\WorkflowEngine\\IComplexOperation' => $baseDir . '/lib/public/WorkflowEngine/IComplexOperation.php',
'OCP\\WorkflowEngine\\IEntity' => $baseDir . '/lib/public/WorkflowEngine/IEntity.php',
- 'OCP\\WorkflowEngine\\IEntityAware' => $baseDir . '/lib/public/WorkflowEngine/IEntityAware.php',
+ 'OCP\\WorkflowEngine\\IEntityCheck' => $baseDir . '/lib/public/WorkflowEngine/IEntityCheck.php',
'OCP\\WorkflowEngine\\IEntityEvent' => $baseDir . '/lib/public/WorkflowEngine/IEntityEvent.php',
'OCP\\WorkflowEngine\\IFileCheck' => $baseDir . '/lib/public/WorkflowEngine/IFileCheck.php',
'OCP\\WorkflowEngine\\IManager' => $baseDir . '/lib/public/WorkflowEngine/IManager.php',
'OCP\\WorkflowEngine\\IOperation' => $baseDir . '/lib/public/WorkflowEngine/IOperation.php',
+ 'OCP\\WorkflowEngine\\IRuleMatcher' => $baseDir . '/lib/public/WorkflowEngine/IRuleMatcher.php',
'OCP\\WorkflowEngine\\ISpecificOperation' => $baseDir . '/lib/public/WorkflowEngine/ISpecificOperation.php',
'OC\\Accounts\\Account' => $baseDir . '/lib/private/Accounts/Account.php',
'OC\\Accounts\\AccountManager' => $baseDir . '/lib/private/Accounts/AccountManager.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index 4cf093dcaa8..1bcefc1dc1c 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -476,11 +476,12 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\WorkflowEngine\\ICheck' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/ICheck.php',
'OCP\\WorkflowEngine\\IComplexOperation' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/IComplexOperation.php',
'OCP\\WorkflowEngine\\IEntity' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/IEntity.php',
- 'OCP\\WorkflowEngine\\IEntityAware' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/IEntityAware.php',
+ 'OCP\\WorkflowEngine\\IEntityCheck' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/IEntityCheck.php',
'OCP\\WorkflowEngine\\IEntityEvent' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/IEntityEvent.php',
'OCP\\WorkflowEngine\\IFileCheck' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/IFileCheck.php',
'OCP\\WorkflowEngine\\IManager' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/IManager.php',
'OCP\\WorkflowEngine\\IOperation' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/IOperation.php',
+ 'OCP\\WorkflowEngine\\IRuleMatcher' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/IRuleMatcher.php',
'OCP\\WorkflowEngine\\ISpecificOperation' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/ISpecificOperation.php',
'OC\\Accounts\\Account' => __DIR__ . '/../../..' . '/lib/private/Accounts/Account.php',
'OC\\Accounts\\AccountManager' => __DIR__ . '/../../..' . '/lib/private/Accounts/AccountManager.php',
diff --git a/lib/public/WorkflowEngine/ICheck.php b/lib/public/WorkflowEngine/ICheck.php
index 6e9c2fc765e..f5586e83d51 100644
--- a/lib/public/WorkflowEngine/ICheck.php
+++ b/lib/public/WorkflowEngine/ICheck.php
@@ -70,24 +70,4 @@ interface ICheck {
* @since 18.0.0
*/
public function isAvailableForScope(int $scope): bool;
-
- /**
- * 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.
- *
- * When an implementation does not depend on a subject being passed to it,
- * for example RequestTime, the implemented method SHOULD just pass, without
- * any further operation.
- *
- * @param IEntity $entity
- * @param mixed $subject
- * @throws \UnexpectedValueException
- */
- public function setEntitySubject(IEntity $entity, $subject): void;
}
diff --git a/lib/public/WorkflowEngine/IEntityCheck.php b/lib/public/WorkflowEngine/IEntityCheck.php
new file mode 100644
index 00000000000..82687a052ba
--- /dev/null
+++ b/lib/public/WorkflowEngine/IEntityCheck.php
@@ -0,0 +1,53 @@
+<?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
+ */
+ public function setEntitySubject(IEntity $entity, $subject): void;
+
+}
diff --git a/lib/public/WorkflowEngine/IFileCheck.php b/lib/public/WorkflowEngine/IFileCheck.php
index ce15d6c352c..557ba0f3c10 100644
--- a/lib/public/WorkflowEngine/IFileCheck.php
+++ b/lib/public/WorkflowEngine/IFileCheck.php
@@ -33,12 +33,10 @@ use OCP\Files\Storage\IStorage;
* @package OCP\WorkflowEngine
* @since 18.0.0
*/
-interface IFileCheck {
+interface IFileCheck extends IEntityCheck {
/**
- * @param IStorage $storage
- * @param string $path
* @since 18.0.0
*/
- public function setFileInfo(IStorage $storage, $path);
+ public function setFileInfo(IStorage $storage, string $path);
}
diff --git a/lib/public/WorkflowEngine/IManager.php b/lib/public/WorkflowEngine/IManager.php
index 8be47d961e7..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
*
@@ -42,21 +39,6 @@ interface IManager {
const EVENT_NAME_REG_CHECK = 'OCP\WorkflowEngine::registerChecks';
/**
- * @param IStorage $storage
- * @param string $path
- * @since 9.1
- */
- public function setFileInfo(IStorage $storage, $path);
-
- /**
- * @param string $class
- * @param bool $returnFirstMatchingOperationOnly
- * @return array
- * @since 9.1
- */
- public function getMatchingOperations($class, $returnFirstMatchingOperationOnly = true);
-
- /**
* Listen to `\OCP\WorkflowEngine::EVENT_NAME_REG_ENTITY` at the
* EventDispatcher for registering your entities.
*
@@ -79,4 +61,9 @@ interface IManager {
* @since 18.0.0
*/
public function registerCheck(ICheck $check): void;
+
+ /**
+ * @since 18.0.0
+ */
+ public function getRuleMatcher(): IRuleMatcher;
}
diff --git a/lib/public/WorkflowEngine/IEntityAware.php b/lib/public/WorkflowEngine/IRuleMatcher.php
index 5ef5066f9ad..5569800edb7 100644
--- a/lib/public/WorkflowEngine/IEntityAware.php
+++ b/lib/public/WorkflowEngine/IRuleMatcher.php
@@ -25,16 +25,15 @@ declare(strict_types=1);
namespace OCP\WorkflowEngine;
/**
- * Interface IEntityAware
+ * Class IRuleMatcher
*
* @package OCP\WorkflowEngine
*
* @since 18.0.0
*/
-interface IEntityAware {
+interface IRuleMatcher extends IFileCheck {
/**
- * @param object $entity
* @since 18.0.0
*/
- public function setEntity($entity);
+ public function getMatchingOperations(string $class, bool $returnFirstMatchingOperationOnly = true): array;
}