summaryrefslogtreecommitdiffstats
path: root/lib/private/Calendar
diff options
context:
space:
mode:
authorGeorg Ehrke <developer@georgehrke.com>2018-06-18 14:26:32 +0200
committerGeorg Ehrke <developer@georgehrke.com>2018-06-25 04:58:08 +0200
commitc83629674eca793cd184462fce5d85902964878c (patch)
treec8845f1adfdeffc102740bf97be20051c1f8844f /lib/private/Calendar
parentb832edabbfce23daca6edbb010c4bf180123930f (diff)
downloadnextcloud-server-c83629674eca793cd184462fce5d85902964878c.tar.gz
nextcloud-server-c83629674eca793cd184462fce5d85902964878c.zip
update resource booking interfaces and add managers
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'lib/private/Calendar')
-rw-r--r--lib/private/Calendar/Resource/Manager.php71
-rw-r--r--lib/private/Calendar/Room/Manager.php71
2 files changed, 142 insertions, 0 deletions
diff --git a/lib/private/Calendar/Resource/Manager.php b/lib/private/Calendar/Resource/Manager.php
new file mode 100644
index 00000000000..0cb4a739b7e
--- /dev/null
+++ b/lib/private/Calendar/Resource/Manager.php
@@ -0,0 +1,71 @@
+<?php
+/**
+ * @copyright 2018, Georg Ehrke <oc.list@georgehrke.com>
+ *
+ * @author Georg Ehrke <oc.list@georgehrke.com>
+ *
+ * @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 OC\Calendar\Resource;
+
+use OCP\Calendar\Resource\IBackend;
+
+class Manager implements \OCP\Calendar\Resource\IManager {
+
+ /** @var IBackend[] holds all registered resource backends */
+ private $backends;
+
+ /**
+ * Registers a resource backend
+ *
+ * @param IBackend $backend
+ * @return void
+ * @since 14.0.0
+ */
+ public function registerBackend(IBackend $backend) {
+ $this->backends[$backend->getBackendIdentifier()] = $backend;
+ }
+
+ /**
+ * Unregisters a resource backend
+ *
+ * @param IBackend $backend
+ * @return void
+ * @since 14.0.0
+ */
+ public function unregisterBackend(IBackend $backend) {
+ unset($this->backends[$backend->getBackendIdentifier()]);
+ }
+
+ /**
+ * @return IBackend[]
+ * @since 14.0.0
+ */
+ public function getBackends():array {
+ return array_values($this->backends);
+ }
+
+ /**
+ * removes all registered backend instances
+ * @return void
+ * @since 14.0.0
+ */
+ public function clear() {
+ $this->backends = [];
+ }
+}
diff --git a/lib/private/Calendar/Room/Manager.php b/lib/private/Calendar/Room/Manager.php
new file mode 100644
index 00000000000..ac446aca944
--- /dev/null
+++ b/lib/private/Calendar/Room/Manager.php
@@ -0,0 +1,71 @@
+<?php
+/**
+ * @copyright 2018, Georg Ehrke <oc.list@georgehrke.com>
+ *
+ * @author Georg Ehrke <oc.list@georgehrke.com>
+ *
+ * @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 OC\Calendar\Room;
+
+use OCP\Calendar\Room\IBackend;
+
+class Manager implements \OCP\Calendar\Room\IManager {
+
+ /** @var IBackend[] holds all registered resource backends */
+ private $backends;
+
+ /**
+ * Registers a resource backend
+ *
+ * @param IBackend $backend
+ * @return void
+ * @since 14.0.0
+ */
+ public function registerBackend(IBackend $backend) {
+ $this->backends[$backend->getBackendIdentifier()] = $backend;
+ }
+
+ /**
+ * Unregisters a resource backend
+ *
+ * @param IBackend $backend
+ * @return void
+ * @since 14.0.0
+ */
+ public function unregisterBackend(IBackend $backend) {
+ unset($this->backends[$backend->getBackendIdentifier()]);
+ }
+
+ /**
+ * @return IBackend[]
+ * @since 14.0.0
+ */
+ public function getBackends():array {
+ return array_values($this->backends);
+ }
+
+ /**
+ * removes all registered backend instances
+ * @return void
+ * @since 14.0.0
+ */
+ public function clear() {
+ $this->backends = [];
+ }
+}