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:
authorblizzz <blizzz@arthur-schiwon.de>2020-01-07 11:58:40 +0300
committerGitHub <noreply@github.com>2020-01-07 11:58:40 +0300
commit55fd157f15fa264b1170da4ebce830349fc85991 (patch)
treebe26a1726445840e547e1128a3383612879bf31a /lib
parent1b8f81617079cd49fb35d9d893370815ea5d05c1 (diff)
parent25d4f3230d840d88191f905b2f3767d982c311b6 (diff)
Merge pull request #18535 from nextcloud/enh/flow/newDispatcher
Use the new Events in Flow
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/Events/RegisterChecksEvent.php54
-rw-r--r--lib/public/WorkflowEngine/Events/RegisterEntitiesEvent.php54
-rw-r--r--lib/public/WorkflowEngine/Events/RegisterOperationsEvent.php54
-rw-r--r--lib/public/WorkflowEngine/IManager.php15
6 files changed, 177 insertions, 6 deletions
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index b644d420c84..95156cf633e 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -489,6 +489,9 @@ return array(
'OCP\\WorkflowEngine\\EntityContext\\IDisplayText' => $baseDir . '/lib/public/WorkflowEngine/EntityContext/IDisplayText.php',
'OCP\\WorkflowEngine\\EntityContext\\IIcon' => $baseDir . '/lib/public/WorkflowEngine/EntityContext/IIcon.php',
'OCP\\WorkflowEngine\\EntityContext\\IUrl' => $baseDir . '/lib/public/WorkflowEngine/EntityContext/IUrl.php',
+ 'OCP\\WorkflowEngine\\Events\\RegisterChecksEvent' => $baseDir . '/lib/public/WorkflowEngine/Events/RegisterChecksEvent.php',
+ 'OCP\\WorkflowEngine\\Events\\RegisterEntitiesEvent' => $baseDir . '/lib/public/WorkflowEngine/Events/RegisterEntitiesEvent.php',
+ 'OCP\\WorkflowEngine\\Events\\RegisterOperationsEvent' => $baseDir . '/lib/public/WorkflowEngine/Events/RegisterOperationsEvent.php',
'OCP\\WorkflowEngine\\GenericEntityEvent' => $baseDir . '/lib/public/WorkflowEngine/GenericEntityEvent.php',
'OCP\\WorkflowEngine\\ICheck' => $baseDir . '/lib/public/WorkflowEngine/ICheck.php',
'OCP\\WorkflowEngine\\IComplexOperation' => $baseDir . '/lib/public/WorkflowEngine/IComplexOperation.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index a964fb904b2..f6af611ac1e 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -518,6 +518,9 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\WorkflowEngine\\EntityContext\\IDisplayText' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/EntityContext/IDisplayText.php',
'OCP\\WorkflowEngine\\EntityContext\\IIcon' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/EntityContext/IIcon.php',
'OCP\\WorkflowEngine\\EntityContext\\IUrl' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/EntityContext/IUrl.php',
+ 'OCP\\WorkflowEngine\\Events\\RegisterChecksEvent' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/Events/RegisterChecksEvent.php',
+ 'OCP\\WorkflowEngine\\Events\\RegisterEntitiesEvent' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/Events/RegisterEntitiesEvent.php',
+ 'OCP\\WorkflowEngine\\Events\\RegisterOperationsEvent' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/Events/RegisterOperationsEvent.php',
'OCP\\WorkflowEngine\\GenericEntityEvent' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/GenericEntityEvent.php',
'OCP\\WorkflowEngine\\ICheck' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/ICheck.php',
'OCP\\WorkflowEngine\\IComplexOperation' => __DIR__ . '/../../..' . '/lib/public/WorkflowEngine/IComplexOperation.php',
diff --git a/lib/public/WorkflowEngine/Events/RegisterChecksEvent.php b/lib/public/WorkflowEngine/Events/RegisterChecksEvent.php
new file mode 100644
index 00000000000..cb6cca8bfe2
--- /dev/null
+++ b/lib/public/WorkflowEngine/Events/RegisterChecksEvent.php
@@ -0,0 +1,54 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @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\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\WorkflowEngine\ICheck;
+use OCP\WorkflowEngine\IManager;
+
+/**
+ * @since 18.0.0
+ */
+class RegisterChecksEvent extends Event {
+
+ /** @var IManager */
+ private $manager;
+
+ /**
+ * @since 18.0.0
+ */
+ public function __construct(IManager $manager) {
+ parent::__construct();
+
+ $this->manager = $manager;
+ }
+
+ /**
+ * @since 18.0.0
+ */
+ public function registerCheck(ICheck $check): void {
+ $this->manager->registerCheck($check);
+ }
+}
diff --git a/lib/public/WorkflowEngine/Events/RegisterEntitiesEvent.php b/lib/public/WorkflowEngine/Events/RegisterEntitiesEvent.php
new file mode 100644
index 00000000000..f457a2b97b0
--- /dev/null
+++ b/lib/public/WorkflowEngine/Events/RegisterEntitiesEvent.php
@@ -0,0 +1,54 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @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\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\WorkflowEngine\IEntity;
+use OCP\WorkflowEngine\IManager;
+
+/**
+ * @since 18.0.0
+ */
+class RegisterEntitiesEvent extends Event {
+
+ /** @var IManager */
+ private $manager;
+
+ /**
+ * @since 18.0.0
+ */
+ public function __construct(IManager $manager) {
+ parent::__construct();
+
+ $this->manager = $manager;
+ }
+
+ /**
+ * @since 18.0.0
+ */
+ public function registerEntity(IEntity $entity): void {
+ $this->manager->registerEntity($entity);
+ }
+}
diff --git a/lib/public/WorkflowEngine/Events/RegisterOperationsEvent.php b/lib/public/WorkflowEngine/Events/RegisterOperationsEvent.php
new file mode 100644
index 00000000000..a6bbbcb545e
--- /dev/null
+++ b/lib/public/WorkflowEngine/Events/RegisterOperationsEvent.php
@@ -0,0 +1,54 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @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\Events;
+
+use OCP\EventDispatcher\Event;
+use OCP\WorkflowEngine\IManager;
+use OCP\WorkflowEngine\IOperation;
+
+/**
+ * @since 18.0.0
+ */
+class RegisterOperationsEvent extends Event {
+
+ /** @var IManager */
+ private $manager;
+
+ /**
+ * @since 18.0.0
+ */
+ public function __construct(IManager $manager) {
+ parent::__construct();
+
+ $this->manager = $manager;
+ }
+
+ /**
+ * @since 18.0.0
+ */
+ public function registerOperation(IOperation $operation): void {
+ $this->manager->registerOperation($operation);
+ }
+}
diff --git a/lib/public/WorkflowEngine/IManager.php b/lib/public/WorkflowEngine/IManager.php
index bf2335c8a23..c8a7afb3155 100644
--- a/lib/public/WorkflowEngine/IManager.php
+++ b/lib/public/WorkflowEngine/IManager.php
@@ -35,29 +35,32 @@ interface IManager {
const SCOPE_ADMIN = 0;
const SCOPE_USER = 1;
+ /**
+ * @depreacted Will be removed in NC19. Use the dedicated events in OCP\WorkflowEngine\Events
+ */
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.
+ * Listen to `OCP\WorkflowEngine\Events\RegisterEntitiesEvent` at the
+ * IEventDispatcher 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.
+ * Listen to `OCP\WorkflowEngine\Events\RegisterOperationsEvent` at the
+ * IEventDispatcher for registering your operators.
*
* @since 18.0.0
*/
public function registerOperation(IOperation $operator): void;
/**
- * Listen to `\OCP\WorkflowEngine::EVENT_NAME_REG_CHECK` at the
- * EventDispatcher for registering your operators.
+ * Listen to `OCP\WorkflowEngine\Events\RegisterChecksEvent` at the
+ * IEventDispatcher for registering your operators.
*
* @since 18.0.0
*/