From bed518e8abd60875f4fe3d2b0e15fd87b489b6d4 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Tue, 3 Sep 2019 12:31:29 +0200 Subject: introduce GenericEntityEvent and adapt File entity Signed-off-by: Arthur Schiwon --- apps/workflowengine/lib/Entity/File.php | 17 +++---- .../lib/Entity/GenericEntityEmitterEvent.php | 59 ---------------------- .../lib/Entity/IEntityEmitterEvent.php | 34 ------------- 3 files changed, 8 insertions(+), 102 deletions(-) delete mode 100644 apps/workflowengine/lib/Entity/GenericEntityEmitterEvent.php delete mode 100644 apps/workflowengine/lib/Entity/IEntityEmitterEvent.php (limited to 'apps/workflowengine/lib') 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 @@ - - * - * @author Arthur Schiwon - * - * @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 . - * - */ - -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 @@ - - * - * @author Arthur Schiwon - * - * @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 . - * - */ - -namespace OCA\WorkflowEngine\Entity; - - -use OCP\WorkflowEngine\IEntityEvent; - -interface IEntityEmitterEvent extends IEntityEvent { - public function getEmitterClassName(): string; - - public function getSlot(): string; -} -- cgit v1.2.3