Add the getNamespace() method to the list handler.
authorGunnar Wrobel <p@rdus.de>
Thu, 6 Jan 2011 14:27:46 +0000 (15:27 +0100)
committerGunnar Wrobel <p@rdus.de>
Fri, 7 Jan 2011 20:30:38 +0000 (21:30 +0100)
framework/Kolab_Storage/lib/Horde/Kolab/Storage/List.php
framework/Kolab_Storage/lib/Horde/Kolab/Storage/List/Base.php
framework/Kolab_Storage/lib/Horde/Kolab/Storage/List/Decorator/Cache.php
framework/Kolab_Storage/lib/Horde/Kolab/Storage/List/Decorator/Log.php
framework/Kolab_Storage/lib/Horde/Kolab/Storage/List/Query.php
framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/BaseTest.php
framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/Decorator/CacheTest.php
framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/Decorator/LogTest.php

index b444dd5..6d2ed1a 100644 (file)
@@ -51,6 +51,13 @@ extends Horde_Kolab_Storage_Queriable
     public function listFolderTypes();
 
     /**
+     * Returns the namespace for the list.
+     *
+     * @return Horde_Kolab_Storage_Folder_Namespace The namespace handler.
+     */
+    public function getNamespace();
+
+    /**
      * Synchronize the list information with the information from the backend.
      *
      * @return NULL
index 6bcae18..2dc8cbe 100644 (file)
@@ -88,6 +88,16 @@ implements Horde_Kolab_Storage_List
     }
 
     /**
+     * Returns the namespace for the list.
+     *
+     * @return Horde_Kolab_Storage_Folder_Namespace The namespace handler.
+     */
+    public function getNamespace()
+    {
+        return $this->_driver->getNamespace();
+    }
+
+    /**
      * Synchronize the list information with the information from the backend.
      *
      * @return NULL
index 5f1d963..31bf407 100644 (file)
@@ -114,6 +114,16 @@ implements Horde_Kolab_Storage_List
     }
 
     /**
+     * Returns the namespace for the list.
+     *
+     * @return Horde_Kolab_Storage_Folder_Namespace The namespace handler.
+     */
+    public function getNamespace()
+    {
+        return $this->_list->getNamespace();
+    }
+
+    /**
      * Synchronize the list information with the information from the backend.
      *
      * @return NULL
index c9476d8..ae154e2 100644 (file)
@@ -117,6 +117,16 @@ implements Horde_Kolab_Storage_List
     }
 
     /**
+     * Returns the namespace for the list.
+     *
+     * @return Horde_Kolab_Storage_Folder_Namespace The namespace handler.
+     */
+    public function getNamespace()
+    {
+        return $this->_list->getNamespace();
+    }
+
+    /**
      * Synchronize the list information with the information from the backend.
      *
      * @return NULL
index f63cf72..d3d3346 100644 (file)
@@ -52,4 +52,24 @@ extends Horde_Kolab_Storage_Query
      * @return array The list of folders.
      */
     public function listByType($type);
+
+    /**
+     * Get the default folder for a certain type.
+     *
+     * @param string $type The type of the share/folder.
+     *
+     * @return string|boolean The name of the default folder, false if there is no default.
+     */
+//    public function getDefault($type);
+
+    /**
+     * Get the default folder for a certain type from a different owner.
+     *
+     * @param string $owner The folder owner.
+     * @param string $type  The type of the share/folder.
+     *
+     * @return string|boolean The name of the default folder, false if there is no default.
+     */
+//    public function getForeignDefault($owner, $type);
+
 }
\ No newline at end of file
index 4cac408..ff3f320 100644 (file)
@@ -65,6 +65,15 @@ extends Horde_Kolab_Storage_TestCase
         $this->assertType('array', $list->listFolderTypes());
     }
 
+    public function testGetNamespace()
+    {
+        $list = $this->getNullList();
+        $this->assertInstanceOf(
+            'Horde_Kolab_Storage_Folder_Namespace',
+            $list->getNamespace()
+        );
+    }
+
     public function testListQueriable()
     {
         $list = new Horde_Kolab_Storage_List_Base(
@@ -106,4 +115,5 @@ extends Horde_Kolab_Storage_TestCase
             $list->getQuery('Horde_Kolab_Storage_Stub_FactoryQuery')
         );
     }
+
 }
index a85589c..cb5169a 100644 (file)
@@ -325,6 +325,18 @@ extends Horde_Kolab_Storage_TestCase
         $list->listFolders();
     }
 
+    public function testGetNamespace()
+    {
+        $list = new Horde_Kolab_Storage_List_Decorator_Cache(
+            $this->getNullList(),
+            $this->getMockListCache()
+        );
+        $this->assertInstanceOf(
+            'Horde_Kolab_Storage_Folder_Namespace',
+            $list->getNamespace()
+        );
+    }
+
     public function testGetQuery()
     {
         $factory = new Horde_Kolab_Storage_Factory();
index 3f3b620..0462885 100644 (file)
@@ -65,6 +65,18 @@ extends Horde_Kolab_Storage_TestCase
         $this->assertLogContains('List for test@example.com@mock:0 contained 4 folders and annotations.');
     }
 
+    public function testGetNamespace()
+    {
+        $list = new Horde_Kolab_Storage_List_Decorator_Log(
+            $this->getNullList(),
+            $this->getMockLogger()
+        );
+        $this->assertInstanceOf(
+            'Horde_Kolab_Storage_Folder_Namespace',
+            $list->getNamespace()
+        );
+    }
+
     public function testGetQuery()
     {
         $factory = new Horde_Kolab_Storage_Factory();