1 | <?php |
---|
2 | /* |
---|
3 | * $Id: NodeObject.php 797 2007-11-09 19:21:21Z heltem $ |
---|
4 | * |
---|
5 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
6 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
7 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
8 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
---|
9 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
10 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
---|
11 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
---|
12 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
---|
13 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
---|
14 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
---|
15 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
16 | * |
---|
17 | * This software consists of voluntary contributions made by many individuals |
---|
18 | * and is licensed under the LGPL. For more information please see |
---|
19 | * <http://propel.phpdb.org>. |
---|
20 | */ |
---|
21 | |
---|
22 | /** |
---|
23 | * This interface defines methods that must be implemented by all |
---|
24 | * business objects within the system to handle Node object. |
---|
25 | * |
---|
26 | * @author Heltem <heltem@o2php.com> (Propel) |
---|
27 | * @version $Revision: 797 $ |
---|
28 | * @package propel.om |
---|
29 | */ |
---|
30 | interface NodeObject extends IteratorAggregate { |
---|
31 | /** |
---|
32 | * If object is saved without left/right values, set them as undefined (0) |
---|
33 | * |
---|
34 | * @param PropelPDO $con Connection to use. |
---|
35 | * @return void |
---|
36 | * @throws PropelException |
---|
37 | */ |
---|
38 | public function save(PropelPDO $con = null); |
---|
39 | |
---|
40 | /** |
---|
41 | * Delete node and descendants |
---|
42 | * |
---|
43 | * @param PropelPDO $con Connection to use. |
---|
44 | * @return void |
---|
45 | * @throws PropelException |
---|
46 | */ |
---|
47 | public function delete(PropelPDO $con = null); |
---|
48 | |
---|
49 | /** |
---|
50 | * Sets node properties to make it a root node. |
---|
51 | * |
---|
52 | * @return object The current object (for fluent API support) |
---|
53 | * @throws PropelException |
---|
54 | */ |
---|
55 | public function makeRoot(); |
---|
56 | |
---|
57 | /** |
---|
58 | * Gets the level if set, otherwise calculates this and returns it |
---|
59 | * |
---|
60 | * @param PropelPDO $con Connection to use. |
---|
61 | * @return int |
---|
62 | */ |
---|
63 | public function getLevel(PropelPDO $con = null); |
---|
64 | |
---|
65 | /** |
---|
66 | * Get the path to the node in the tree |
---|
67 | * |
---|
68 | * @param PropelPDO $con Connection to use. |
---|
69 | * @return array |
---|
70 | */ |
---|
71 | public function getPath(PropelPDO $con = null); |
---|
72 | |
---|
73 | /** |
---|
74 | * Gets the number of children for the node (direct descendants) |
---|
75 | * |
---|
76 | * @param PropelPDO $con Connection to use. |
---|
77 | * @return int |
---|
78 | */ |
---|
79 | public function getNumberOfChildren(PropelPDO $con = null); |
---|
80 | |
---|
81 | /** |
---|
82 | * Gets the total number of desceandants for the node |
---|
83 | * |
---|
84 | * @param PropelPDO $con Connection to use. |
---|
85 | * @return int |
---|
86 | */ |
---|
87 | public function getNumberOfDescendants(PropelPDO $con = null); |
---|
88 | |
---|
89 | /** |
---|
90 | * Gets the children for the node |
---|
91 | * |
---|
92 | * @param PropelPDO $con Connection to use. |
---|
93 | * @return array |
---|
94 | */ |
---|
95 | public function getChildren(PropelPDO $con = null); |
---|
96 | |
---|
97 | /** |
---|
98 | * Gets the descendants for the node |
---|
99 | * |
---|
100 | * @param PropelPDO $con Connection to use. |
---|
101 | * @return array |
---|
102 | */ |
---|
103 | public function getDescendants(PropelPDO $con = null); |
---|
104 | |
---|
105 | /** |
---|
106 | * Sets the level of the node in the tree |
---|
107 | * |
---|
108 | * @param int $v new value |
---|
109 | * @return object The current object (for fluent API support) |
---|
110 | */ |
---|
111 | public function setLevel($level); |
---|
112 | |
---|
113 | /** |
---|
114 | * Sets the children array of the node in the tree |
---|
115 | * |
---|
116 | * @param array of Node $children array of Propel node object |
---|
117 | * @return object The current object (for fluent API support) |
---|
118 | */ |
---|
119 | public function setChildren(array $children); |
---|
120 | |
---|
121 | /** |
---|
122 | * Sets the parentNode of the node in the tree |
---|
123 | * |
---|
124 | * @param Node $parent Propel node object |
---|
125 | * @return object The current object (for fluent API support) |
---|
126 | */ |
---|
127 | public function setParentNode(NodeObject $parent = null); |
---|
128 | |
---|
129 | /** |
---|
130 | * Sets the previous sibling of the node in the tree |
---|
131 | * |
---|
132 | * @param Node $node Propel node object |
---|
133 | * @return object The current object (for fluent API support) |
---|
134 | */ |
---|
135 | public function setPrevSibling(NodeObject $node = null); |
---|
136 | |
---|
137 | /** |
---|
138 | * Sets the next sibling of the node in the tree |
---|
139 | * |
---|
140 | * @param Node $node Propel node object |
---|
141 | * @return object The current object (for fluent API support) |
---|
142 | */ |
---|
143 | public function setNextSibling(NodeObject $node = null); |
---|
144 | |
---|
145 | /** |
---|
146 | * Determines if the node is the root node |
---|
147 | * |
---|
148 | * @return bool |
---|
149 | */ |
---|
150 | public function isRoot(); |
---|
151 | |
---|
152 | /** |
---|
153 | * Determines if the node is a leaf node |
---|
154 | * |
---|
155 | * @return bool |
---|
156 | */ |
---|
157 | public function isLeaf(); |
---|
158 | |
---|
159 | /** |
---|
160 | * Tests if object is equal to $node |
---|
161 | * |
---|
162 | * @param object $node Propel object for node to compare to |
---|
163 | * @return bool |
---|
164 | */ |
---|
165 | public function isEqualTo(NodeObject $node); |
---|
166 | |
---|
167 | /** |
---|
168 | * Tests if object has an ancestor |
---|
169 | * |
---|
170 | * @param PropelPDO $con Connection to use. |
---|
171 | * @return bool |
---|
172 | */ |
---|
173 | public function hasParent(PropelPDO $con = null); |
---|
174 | |
---|
175 | /** |
---|
176 | * Determines if the node has children / descendants |
---|
177 | * |
---|
178 | * @return bool |
---|
179 | */ |
---|
180 | public function hasChildren(); |
---|
181 | |
---|
182 | /** |
---|
183 | * Determines if the node has previous sibling |
---|
184 | * |
---|
185 | * @param PropelPDO $con Connection to use. |
---|
186 | * @return bool |
---|
187 | */ |
---|
188 | public function hasPrevSibling(PropelPDO $con = null); |
---|
189 | |
---|
190 | /** |
---|
191 | * Determines if the node has next sibling |
---|
192 | * |
---|
193 | * @param PropelPDO $con Connection to use. |
---|
194 | * @return bool |
---|
195 | */ |
---|
196 | public function hasNextSibling(PropelPDO $con = null); |
---|
197 | |
---|
198 | /** |
---|
199 | * Gets ancestor for the given node if it exists |
---|
200 | * |
---|
201 | * @param PropelPDO $con Connection to use. |
---|
202 | * @return mixed Propel object if exists else false |
---|
203 | */ |
---|
204 | public function retrieveParent(PropelPDO $con = null); |
---|
205 | |
---|
206 | /** |
---|
207 | * Gets first child if it exists |
---|
208 | * |
---|
209 | * @param PropelPDO $con Connection to use. |
---|
210 | * @return mixed Propel object if exists else false |
---|
211 | */ |
---|
212 | public function retrieveFirstChild(PropelPDO $con = null); |
---|
213 | |
---|
214 | /** |
---|
215 | * Gets last child if it exists |
---|
216 | * |
---|
217 | * @param PropelPDO $con Connection to use. |
---|
218 | * @return mixed Propel object if exists else false |
---|
219 | */ |
---|
220 | public function retrieveLastChild(PropelPDO $con = null); |
---|
221 | |
---|
222 | /** |
---|
223 | * Gets prev sibling for the given node if it exists |
---|
224 | * |
---|
225 | * @param PropelPDO $con Connection to use. |
---|
226 | * @return mixed Propel object if exists else false |
---|
227 | */ |
---|
228 | public function retrievePrevSibling(PropelPDO $con = null); |
---|
229 | |
---|
230 | /** |
---|
231 | * Gets next sibling for the given node if it exists |
---|
232 | * |
---|
233 | * @param PropelPDO $con Connection to use. |
---|
234 | * @return mixed Propel object if exists else false |
---|
235 | */ |
---|
236 | public function retrieveNextSibling(PropelPDO $con = null); |
---|
237 | |
---|
238 | /** |
---|
239 | * Inserts as first child of destination node $parent |
---|
240 | * |
---|
241 | * @param object $parent Propel object for given destination node |
---|
242 | * @param PropelPDO $con Connection to use. |
---|
243 | * @return object The current object (for fluent API support) |
---|
244 | */ |
---|
245 | public function insertAsFirstChildOf(NodeObject $parent, PropelPDO $con = null); |
---|
246 | |
---|
247 | /** |
---|
248 | * Inserts as last child of destination node $parent |
---|
249 | * |
---|
250 | * @param object $parent Propel object for given destination node |
---|
251 | * @param PropelPDO $con Connection to use. |
---|
252 | * @return object The current object (for fluent API support) |
---|
253 | */ |
---|
254 | public function insertAsLastChildOf(NodeObject $parent, PropelPDO $con = null); |
---|
255 | |
---|
256 | /** |
---|
257 | * Inserts node as previous sibling to destination node $dest |
---|
258 | * |
---|
259 | * @param object $dest Propel object for given destination node |
---|
260 | * @param PropelPDO $con Connection to use. |
---|
261 | * @return object The current object (for fluent API support) |
---|
262 | */ |
---|
263 | public function insertAsPrevSiblingOf(NodeObject $dest, PropelPDO $con = null); |
---|
264 | |
---|
265 | /** |
---|
266 | * Inserts node as next sibling to destination node $dest |
---|
267 | * |
---|
268 | * @param object $dest Propel object for given destination node |
---|
269 | * @param PropelPDO $con Connection to use. |
---|
270 | * @return object The current object (for fluent API support) |
---|
271 | */ |
---|
272 | public function insertAsNextSiblingOf(NodeObject $dest, PropelPDO $con = null); |
---|
273 | |
---|
274 | /** |
---|
275 | * Moves node to be first child of $parent |
---|
276 | * |
---|
277 | * @param object $parent Propel object for destination node |
---|
278 | * @param PropelPDO $con Connection to use. |
---|
279 | * @return void |
---|
280 | */ |
---|
281 | public function moveToFirstChildOf(NodeObject $parent, PropelPDO $con = null); |
---|
282 | |
---|
283 | /** |
---|
284 | * Moves node to be last child of $parent |
---|
285 | * |
---|
286 | * @param object $parent Propel object for destination node |
---|
287 | * @param PropelPDO $con Connection to use. |
---|
288 | * @return void |
---|
289 | */ |
---|
290 | public function moveToLastChildOf(NodeObject $parent, PropelPDO $con = null); |
---|
291 | |
---|
292 | /** |
---|
293 | * Moves node to be prev sibling to $dest |
---|
294 | * |
---|
295 | * @param object $dest Propel object for destination node |
---|
296 | * @param PropelPDO $con Connection to use. |
---|
297 | * @return void |
---|
298 | */ |
---|
299 | public function moveToPrevSiblingOf(NodeObject $dest, PropelPDO $con = null); |
---|
300 | |
---|
301 | /** |
---|
302 | * Moves node to be next sibling to $dest |
---|
303 | * |
---|
304 | * @param object $dest Propel object for destination node |
---|
305 | * @param PropelPDO $con Connection to use. |
---|
306 | * @return void |
---|
307 | */ |
---|
308 | public function moveToNextSiblingOf(NodeObject $dest, PropelPDO $con = null); |
---|
309 | |
---|
310 | /** |
---|
311 | * Inserts node as parent of given node. |
---|
312 | * |
---|
313 | * @param object $node Propel object for given destination node |
---|
314 | * @param PropelPDO $con Connection to use. |
---|
315 | * @return void |
---|
316 | * @throws Exception When trying to insert node as parent of a root node |
---|
317 | */ |
---|
318 | public function insertAsParentOf(NodeObject $node, PropelPDO $con = null); |
---|
319 | |
---|
320 | /** |
---|
321 | * Wraps the getter for the scope value |
---|
322 | * |
---|
323 | * @return int |
---|
324 | */ |
---|
325 | public function getScopeIdValue(); |
---|
326 | |
---|
327 | /** |
---|
328 | * Set the value of scope column |
---|
329 | * |
---|
330 | * @param int $v new value |
---|
331 | * @return object The current object (for fluent API support) |
---|
332 | */ |
---|
333 | public function setScopeIdValue($v); |
---|
334 | } // NodeObject |
---|