1<?php
2/**
3 * Interface describing Kolab objects stored in the server database.
4 *
5 * PHP version 5
6 *
7 * @category Kolab
8 * @package  Kolab_Server
9 * @author   Gunnar Wrobel <wrobel@pardus.de>
10 * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
11 * @link     http://pear.horde.org/index.php?package=Kolab_Server
12 */
13
14/**
15 * Interface describing Kolab objects stored in the server database.
16 *
17 * Copyright 2008-2016 Horde LLC (http://www.horde.org/)
18 *
19 * See the enclosed file COPYING for license information (LGPL). If you
20 * did not receive this file, see http://www.horde.org/licenses/lgpl21.
21 *
22 * @category Kolab
23 * @package  Kolab_Server
24 * @author   Gunnar Wrobel <wrobel@pardus.de>
25 * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
26 * @link     http://pear.horde.org/index.php?package=Kolab_Server
27 */
28interface Horde_Kolab_Server_Object_Interface
29{
30    /**
31     * Get the GUID of this object
32     *
33     * @return string the GUID of this object
34     */
35    public function getGuid();
36
37    /**
38     * Get the external attributes supported by this object.
39     *
40     * @return array The external attributes supported by this object. This is a
41     * list of abbreviated attribute class names.
42     */
43    public function getExternalAttributes();
44
45    /**
46     * Get the internal attributes supported by this object.
47     *
48     * @return array The internal attributes supported by this object.
49     */
50    public function getInternalAttributes();
51
52    /**
53     * Does the object exist?
54     *
55     * @return boolean True if the object exists, false otherwise.
56     */
57    public function exists();
58
59    /**
60     * Read the object into the cache
61     *
62     * @return array The read data.
63     */
64    public function readInternal();
65
66    /**
67     * Get the specified internal attributes.
68     *
69     * @param array $attributes The internal attribute.
70     *
71     * @return array The value(s) of these attribute
72     */
73    public function getInternal(array $attributes);
74
75    /**
76     * Get the specified attribute of this object.
77     *
78     * @param string $attr The attribute to read.
79     *
80     * @return mixed The value of this attribute.
81     */
82    public function getExternal($attr);
83
84    /**
85     * Saves object information. This may either create a new entry or modify an
86     * existing entry.
87     *
88     * Please note that fields with multiple allowed values require the callee
89     * to provide the full set of values for the field. Any old values that are
90     * not resubmitted will be considered to be deleted.
91     *
92     * @param array $info The information about the object.
93     *
94     * @return NULL
95     *
96     * @throws Horde_Kolab_Server_Exception If saving the data failed.
97     */
98    public function save(array $info);
99
100    /**
101     * Delete this object.
102     *
103     * @return NULL
104     *
105     * @throws Horde_Kolab_Server_Exception If deleting the object failed.
106     */
107    public function delete();
108
109    /**
110     * Generates an ID for the given information.
111     *
112     * @param array &$info The data of the object.
113     *
114     * @return string The ID.
115     */
116    public function generateId(array &$info);
117
118    /**
119     * Distill the server side object information to save.
120     *
121     * @param array &$info The information about the object.
122     *
123     * @return NULL.
124     *
125     * @throws Horde_Kolab_Server_Exception If the given information contains errors.
126     */
127    public function prepareObjectInformation(array &$info);
128
129    /**
130     * Returns the set of actions supported by this object type.
131     *
132     * @return array An array of supported actions.
133     */
134    public function getActions();
135
136}
137