diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-02 13:08:01 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-02 13:08:01 +0100 |
commit | 2d1d89ee29e49412192b051412755610e0538198 (patch) | |
tree | 7aa78b5317412f2bacf781f599bc29aee70406ab /lib/public | |
parent | 37d6fff9761817299a71e9183890267f4290d492 (diff) | |
parent | 7f563dc3e9a03284d9eff69214b6686cf9eb1916 (diff) | |
download | nextcloud-server-2d1d89ee29e49412192b051412755610e0538198.tar.gz nextcloud-server-2d1d89ee29e49412192b051412755610e0538198.zip |
Merge pull request #22049 from owncloud/issue-22041-activities-for-systemtags
Issue 22041 activities for systemtags
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/systemtag/managerevent.php | 85 | ||||
-rw-r--r-- | lib/public/systemtag/mapperevent.php | 93 |
2 files changed, 178 insertions, 0 deletions
diff --git a/lib/public/systemtag/managerevent.php b/lib/public/systemtag/managerevent.php new file mode 100644 index 00000000000..a0429fc9f67 --- /dev/null +++ b/lib/public/systemtag/managerevent.php @@ -0,0 +1,85 @@ +<?php +/** + * @author Joas Schilling <nickvergessen@owncloud.com> + * + * @copyright Copyright (c) 2016, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * 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, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace OCP\SystemTag; + +use Symfony\Component\EventDispatcher\Event; + +/** + * Class ManagerEvent + * + * @package OCP\SystemTag + * @since 9.0.0 + */ +class ManagerEvent extends Event { + + const EVENT_CREATE = 'OCP\SystemTag\ISystemTagManager::createTag'; + const EVENT_UPDATE = 'OCP\SystemTag\ISystemTagManager::updateTag'; + const EVENT_DELETE = 'OCP\SystemTag\ISystemTagManager::deleteTag'; + + /** @var string */ + protected $event; + /** @var ISystemTag */ + protected $tag; + /** @var ISystemTag */ + protected $beforeTag; + + /** + * DispatcherEvent constructor. + * + * @param string $event + * @param ISystemTag $tag + * @param ISystemTag $beforeTag + * @since 9.0.0 + */ + public function __construct($event, ISystemTag $tag, ISystemTag $beforeTag = null) { + $this->event = $event; + $this->tag = $tag; + $this->beforeTag = $beforeTag; + } + + /** + * @return string + * @since 9.0.0 + */ + public function getEvent() { + return $this->event; + } + + /** + * @return ISystemTag + * @since 9.0.0 + */ + public function getTag() { + return $this->tag; + } + + /** + * @return ISystemTag + * @since 9.0.0 + */ + public function getTagBefore() { + if ($this->event !== self::EVENT_UPDATE) { + throw new \BadMethodCallException('getTagBefore is only available on the update Event'); + } + return $this->beforeTag; + } +} diff --git a/lib/public/systemtag/mapperevent.php b/lib/public/systemtag/mapperevent.php new file mode 100644 index 00000000000..e05a5ce09c8 --- /dev/null +++ b/lib/public/systemtag/mapperevent.php @@ -0,0 +1,93 @@ +<?php +/** + * @author Joas Schilling <nickvergessen@owncloud.com> + * + * @copyright Copyright (c) 2016, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * 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, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace OCP\SystemTag; + +use Symfony\Component\EventDispatcher\Event; + +/** + * Class MapperEvent + * + * @package OCP\SystemTag + * @since 9.0.0 + */ +class MapperEvent extends Event { + + const EVENT_ASSIGN = 'OCP\SystemTag\ISystemTagObjectMapper::assignTags'; + const EVENT_UNASSIGN = 'OCP\SystemTag\ISystemTagObjectMapper::unassignTags'; + + /** @var string */ + protected $event; + /** @var string */ + protected $objectType; + /** @var string */ + protected $objectId; + /** @var int[] */ + protected $tags; + + /** + * DispatcherEvent constructor. + * + * @param string $event + * @param string $objectType + * @param string $objectId + * @param int[] $tags + * @since 9.0.0 + */ + public function __construct($event, $objectType, $objectId, array $tags) { + $this->event = $event; + $this->objectType = $objectType; + $this->objectId = $objectId; + $this->tags = $tags; + } + + /** + * @return string + * @since 9.0.0 + */ + public function getEvent() { + return $this->event; + } + + /** + * @return string + * @since 9.0.0 + */ + public function getObjectType() { + return $this->objectType; + } + + /** + * @return string + * @since 9.0.0 + */ + public function getObjectId() { + return $this->objectId; + } + + /** + * @return int[] + * @since 9.0.0 + */ + public function getTags() { + return $this->tags; + } +} |