diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2019-09-03 12:31:29 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2019-09-09 22:56:04 +0200 |
commit | bed518e8abd60875f4fe3d2b0e15fd87b489b6d4 (patch) | |
tree | 84c758d8a4f0ab108278a18b47b3d749e0b39cc4 /apps/workflowengine/lib | |
parent | 20901c59d47e74179a04ca7938afe1ff131f6576 (diff) | |
download | nextcloud-server-bed518e8abd60875f4fe3d2b0e15fd87b489b6d4.tar.gz nextcloud-server-bed518e8abd60875f4fe3d2b0e15fd87b489b6d4.zip |
introduce GenericEntityEvent and adapt File entity
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/workflowengine/lib')
-rw-r--r-- | apps/workflowengine/lib/Entity/File.php | 17 | ||||
-rw-r--r-- | apps/workflowengine/lib/Entity/GenericEntityEmitterEvent.php | 59 | ||||
-rw-r--r-- | apps/workflowengine/lib/Entity/IEntityEmitterEvent.php | 34 |
3 files changed, 8 insertions, 102 deletions
diff --git a/apps/workflowengine/lib/Entity/File.php b/apps/workflowengine/lib/Entity/File.php index d4f41625e4e..b420217c4b6 100644 --- a/apps/workflowengine/lib/Entity/File.php +++ b/apps/workflowengine/lib/Entity/File.php @@ -24,9 +24,9 @@ declare(strict_types=1); namespace OCA\WorkflowEngine\Entity; -use OCP\Files\IRootFolder; use OCP\IL10N; use OCP\IURLGenerator; +use OCP\WorkflowEngine\GenericEntityEvent; use OCP\WorkflowEngine\IEntity; class File implements IEntity { @@ -50,15 +50,14 @@ class File implements IEntity { } public function getEvents(): array { - $emitterClass = IRootFolder::class; - $slot = '\OC\Files'; + $namespace = '\OCP\Files::'; return [ - new GenericEntityEmitterEvent($emitterClass, $slot, 'postCreate', $this->l10n->t('File created')), - new GenericEntityEmitterEvent($emitterClass, $slot, 'postWrite', $this->l10n->t('File updated')), - new GenericEntityEmitterEvent($emitterClass, $slot, 'postRename', $this->l10n->t('File renamed')), - new GenericEntityEmitterEvent($emitterClass, $slot, 'postDelete', $this->l10n->t('File deleted')), - new GenericEntityEmitterEvent($emitterClass, $slot, 'postTouch', $this->l10n->t('File accessed')), - new GenericEntityEmitterEvent($emitterClass, $slot, 'postCopy', $this->l10n->t('File copied')), + new GenericEntityEvent($this->l10n->t('File created'), $namespace . 'postCreate' ), + new GenericEntityEvent($this->l10n->t('File updated'), $namespace . 'postWrite' ), + new GenericEntityEvent($this->l10n->t('File renamed'), $namespace . 'postRename' ), + new GenericEntityEvent($this->l10n->t('File deleted'), $namespace . 'postDelete' ), + new GenericEntityEvent($this->l10n->t('File accessed'), $namespace . 'postTouch' ), + new GenericEntityEvent($this->l10n->t('File copied'), $namespace . 'postCopy' ), ]; } } diff --git a/apps/workflowengine/lib/Entity/GenericEntityEmitterEvent.php b/apps/workflowengine/lib/Entity/GenericEntityEmitterEvent.php deleted file mode 100644 index 60b238432c9..00000000000 --- a/apps/workflowengine/lib/Entity/GenericEntityEmitterEvent.php +++ /dev/null @@ -1,59 +0,0 @@ -<?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 OCA\WorkflowEngine\Entity; - -class GenericEntityEmitterEvent implements IEntityEmitterEvent { - /** @var string */ - private $emitterClassName; - /** @var string */ - private $eventName; - /** @var string */ - private $displayName; - /** @var string */ - private $slot; - - public function __construct(string $emitterClassName, string $slot, string $eventName, string $displayName) { - $this->emitterClassName = $emitterClassName; - $this->eventName = $eventName; - $this->displayName = $displayName; - $this->slot = $slot; - } - - public function getEmitterClassName(): string { - return $this->emitterClassName; - } - - public function getSlot(): string { - return $this->slot; - } - - public function getDisplayName(): string { - return $this->displayName; - } - - public function getEventName(): string { - return $this->eventName; - } -} diff --git a/apps/workflowengine/lib/Entity/IEntityEmitterEvent.php b/apps/workflowengine/lib/Entity/IEntityEmitterEvent.php deleted file mode 100644 index 7e2c802fe76..00000000000 --- a/apps/workflowengine/lib/Entity/IEntityEmitterEvent.php +++ /dev/null @@ -1,34 +0,0 @@ -<?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 OCA\WorkflowEngine\Entity; - - -use OCP\WorkflowEngine\IEntityEvent; - -interface IEntityEmitterEvent extends IEntityEvent { - public function getEmitterClassName(): string; - - public function getSlot(): string; -} |