aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/systemtag
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/systemtag')
-rw-r--r--lib/public/systemtag/isystemtag.php68
-rw-r--r--lib/public/systemtag/isystemtagmanager.php116
-rw-r--r--lib/public/systemtag/isystemtagmanagerfactory.php59
-rw-r--r--lib/public/systemtag/isystemtagobjectmapper.php130
-rw-r--r--lib/public/systemtag/managerevent.php85
-rw-r--r--lib/public/systemtag/mapperevent.php93
-rw-r--r--lib/public/systemtag/tagalreadyexistsexception.php29
-rw-r--r--lib/public/systemtag/tagnotfoundexception.php56
8 files changed, 0 insertions, 636 deletions
diff --git a/lib/public/systemtag/isystemtag.php b/lib/public/systemtag/isystemtag.php
deleted file mode 100644
index 02d02037293..00000000000
--- a/lib/public/systemtag/isystemtag.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-/**
- * @author Vincent Petry <pvince81@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;
-
-/**
- * Public interface for a system-wide tag.
- *
- * @since 9.0.0
- */
-interface ISystemTag {
-
- /**
- * Returns the tag id
- *
- * @return string id
- *
- * @since 9.0.0
- */
- public function getId();
-
- /**
- * Returns the tag display name
- *
- * @return string tag display name
- *
- * @since 9.0.0
- */
- public function getName();
-
- /**
- * Returns whether the tag is visible for regular users
- *
- * @return bool true if visible, false otherwise
- *
- * @since 9.0.0
- */
- public function isUserVisible();
-
- /**
- * Returns whether the tag can be assigned to objects by regular users
- *
- * @return bool true if assignable, false otherwise
- *
- * @since 9.0.0
- */
- public function isUserAssignable();
-
-}
-
diff --git a/lib/public/systemtag/isystemtagmanager.php b/lib/public/systemtag/isystemtagmanager.php
deleted file mode 100644
index 983bfd636ce..00000000000
--- a/lib/public/systemtag/isystemtagmanager.php
+++ /dev/null
@@ -1,116 +0,0 @@
-<?php
-/**
- * @author Joas Schilling <nickvergessen@owncloud.com>
- * @author Vincent Petry <pvince81@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;
-
-/**
- * Public interface to access and manage system-wide tags.
- *
- * @since 9.0.0
- */
-interface ISystemTagManager {
-
- /**
- * Returns the tag objects matching the given tag ids.
- *
- * @param array|string $tagIds id or array of unique ids of the tag to retrieve
- *
- * @return \OCP\SystemTag\ISystemTag[] array of system tags with tag id as key
- *
- * @throws \InvalidArgumentException if at least one given tag ids is invalid (string instead of integer, etc.)
- * @throws \OCP\SystemTag\TagNotFoundException if at least one given tag ids did no exist
- * The message contains a json_encoded array of the ids that could not be found
- *
- * @since 9.0.0
- */
- public function getTagsByIds($tagIds);
-
- /**
- * Returns the tag object matching the given attributes.
- *
- * @param string $tagName tag name
- * @param bool $userVisible whether the tag is visible by users
- * @param bool $userAssignable whether the tag is assignable by users
- *
- * @return \OCP\SystemTag\ISystemTag system tag
- *
- * @throws \OCP\SystemTag\TagNotFoundException if tag does not exist
- *
- * @since 9.0.0
- */
- public function getTag($tagName, $userVisible, $userAssignable);
-
- /**
- * Creates the tag object using the given attributes.
- *
- * @param string $tagName tag name
- * @param bool $userVisible whether the tag is visible by users
- * @param bool $userAssignable whether the tag is assignable by users
- *
- * @return \OCP\SystemTag\ISystemTag system tag
- *
- * @throws \OCP\SystemTag\TagAlreadyExistsException if tag already exists
- *
- * @since 9.0.0
- */
- public function createTag($tagName, $userVisible, $userAssignable);
-
- /**
- * Returns all known tags, optionally filtered by visibility.
- *
- * @param bool|null $visibilityFilter filter by visibility if non-null
- * @param string $nameSearchPattern optional search pattern for the tag name
- *
- * @return \OCP\SystemTag\ISystemTag[] array of system tags or empty array if none found
- *
- * @since 9.0.0
- */
- public function getAllTags($visibilityFilter = null, $nameSearchPattern = null);
-
- /**
- * Updates the given tag
- *
- * @param string $tagId tag id
- * @param string $newName the new tag name
- * @param bool $userVisible whether the tag is visible by users
- * @param bool $userAssignable whether the tag is assignable by users
- *
- * @throws \OCP\SystemTag\TagNotFoundException if tag with the given id does not exist
- * @throws \OCP\SystemTag\TagAlreadyExistsException if there is already another tag
- * with the same attributes
- *
- * @since 9.0.0
- */
- public function updateTag($tagId, $newName, $userVisible, $userAssignable);
-
- /**
- * Delete the given tags from the database and all their relationships.
- *
- * @param string|array $tagIds array of tag ids
- *
- * @throws \OCP\SystemTag\TagNotFoundException if at least one tag did not exist
- *
- * @since 9.0.0
- */
- public function deleteTags($tagIds);
-
-}
diff --git a/lib/public/systemtag/isystemtagmanagerfactory.php b/lib/public/systemtag/isystemtagmanagerfactory.php
deleted file mode 100644
index ad7467633b1..00000000000
--- a/lib/public/systemtag/isystemtagmanagerfactory.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-/**
- * @author Vincent Petry <pvince81@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 OCP\IServerContainer;
-
-/**
- * Interface ISystemTagManagerFactory
- *
- * Factory interface for system tag managers
- *
- * @package OCP\SystemTag
- * @since 9.0.0
- */
-interface ISystemTagManagerFactory {
-
- /**
- * Constructor for the system tag manager factory
- *
- * @param IServerContainer $serverContainer server container
- * @since 9.0.0
- */
- public function __construct(IServerContainer $serverContainer);
-
- /**
- * creates and returns an instance of the system tag manager
- *
- * @return ISystemTagManager
- * @since 9.0.0
- */
- public function getManager();
-
- /**
- * creates and returns an instance of the system tag object
- * mapper
- *
- * @return ISystemTagObjectMapper
- * @since 9.0.0
- */
- public function getObjectMapper();
-}
diff --git a/lib/public/systemtag/isystemtagobjectmapper.php b/lib/public/systemtag/isystemtagobjectmapper.php
deleted file mode 100644
index 59b988a3656..00000000000
--- a/lib/public/systemtag/isystemtagobjectmapper.php
+++ /dev/null
@@ -1,130 +0,0 @@
-<?php
-/**
- * @author Joas Schilling <nickvergessen@owncloud.com>
- * @author Vincent Petry <pvince81@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;
-
-/**
- * Public interface to access and manage system-wide tags.
- *
- * @since 9.0.0
- */
-interface ISystemTagObjectMapper {
-
- /**
- * Get a list of tag ids for the given object ids.
- *
- * This returns an array that maps object id to tag ids
- * [
- * 1 => array('id1', 'id2'),
- * 2 => array('id3', 'id2'),
- * 3 => array('id5'),
- * 4 => array()
- * ]
- *
- * Untagged objects will have an empty array associated.
- *
- * @param string|array $objIds object ids
- * @param string $objectType object type
- *
- * @return array with object id as key and an array
- * of tag ids as value
- *
- * @since 9.0.0
- */
- public function getTagIdsForObjects($objIds, $objectType);
-
- /**
- * Get a list of objects tagged with $tagIds.
- *
- * @param string|array $tagIds Tag id or array of tag ids.
- * @param string $objectType object type
- * @param int $limit Count of object ids you want to get
- * @param string $offset The last object id you already received
- *
- * @return string[] array of object ids or empty array if none found
- *
- * @throws \OCP\SystemTag\TagNotFoundException if at least one of the
- * given tags does not exist
- * @throws \InvalidArgumentException When a limit is specified together with
- * multiple tag ids
- *
- * @since 9.0.0
- */
- public function getObjectIdsForTags($tagIds, $objectType, $limit = 0, $offset = '');
-
- /**
- * Assign the given tags to the given object.
- *
- * If at least one of the given tag ids doesn't exist, none of the tags
- * will be assigned.
- *
- * If the relationship already existed, fail silently.
- *
- * @param string $objId object id
- * @param string $objectType object type
- * @param string|array $tagIds tag id or array of tag ids to assign
- *
- * @throws \OCP\SystemTag\TagNotFoundException if at least one of the
- * given tags does not exist
- *
- * @since 9.0.0
- */
- public function assignTags($objId, $objectType, $tagIds);
-
- /**
- * Unassign the given tags from the given object.
- *
- * If at least one of the given tag ids doesn't exist, none of the tags
- * will be unassigned.
- *
- * If the relationship did not exist in the first place, fail silently.
- *
- * @param string $objId object id
- * @param string $objectType object type
- * @param string|array $tagIds tag id or array of tag ids to unassign
- *
- * @throws \OCP\SystemTag\TagNotFoundException if at least one of the
- * given tags does not exist
- *
- * @since 9.0.0
- */
- public function unassignTags($objId, $objectType, $tagIds);
-
- /**
- * Checks whether the given objects have the given tag.
- *
- * @param string|array $objIds object ids
- * @param string $objectType object type
- * @param string $tagId tag id to check
- * @param bool $all true to check that ALL objects have the tag assigned,
- * false to check that at least ONE object has the tag.
- *
- * @return bool true if the condition set by $all is matched, false
- * otherwise
- *
- * @throws \OCP\SystemTag\TagNotFoundException if the tag does not exist
- *
- * @since 9.0.0
- */
- public function haveTag($objIds, $objectType, $tagId, $all = true);
-
-}
diff --git a/lib/public/systemtag/managerevent.php b/lib/public/systemtag/managerevent.php
deleted file mode 100644
index a0429fc9f67..00000000000
--- a/lib/public/systemtag/managerevent.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?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
deleted file mode 100644
index e05a5ce09c8..00000000000
--- a/lib/public/systemtag/mapperevent.php
+++ /dev/null
@@ -1,93 +0,0 @@
-<?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;
- }
-}
diff --git a/lib/public/systemtag/tagalreadyexistsexception.php b/lib/public/systemtag/tagalreadyexistsexception.php
deleted file mode 100644
index 5c3d86ad642..00000000000
--- a/lib/public/systemtag/tagalreadyexistsexception.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-/**
- * @author Vincent Petry <pvince81@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;
-
-/**
- * Exception when a tag already exists.
- *
- * @since 9.0.0
- */
-class TagAlreadyExistsException extends \RuntimeException {}
diff --git a/lib/public/systemtag/tagnotfoundexception.php b/lib/public/systemtag/tagnotfoundexception.php
deleted file mode 100644
index 12feda8f58a..00000000000
--- a/lib/public/systemtag/tagnotfoundexception.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-/**
- * @author Joas Schilling <nickvergessen@owncloud.com>
- * @author Vincent Petry <pvince81@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;
-
-/**
- * Exception when a tag was not found.
- *
- * @since 9.0.0
- */
-class TagNotFoundException extends \RuntimeException {
-
- /** @var string[] */
- protected $tags;
-
- /**
- * TagNotFoundException constructor.
- *
- * @param string $message
- * @param int $code
- * @param \Exception $previous
- * @param string[] $tags
- * @since 9.0.0
- */
- public function __construct($message = '', $code = 0, \Exception $previous = null, array $tags = []) {
- parent::__construct($message, $code, $previous);
- $this->tags = $tags;
- }
-
- /**
- * @return string[]
- * @since 9.0.0
- */
- public function getMissingTags() {
- return $this->tags;
- }
-}