KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > lenya > cms > publication > SiteTree


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17
18 /* $Id: SiteTree.java 160543 2005-04-08 11:30:01Z andreas $ */
19
20 package org.apache.lenya.cms.publication;
21
22 public interface SiteTree {
23
24     public static final String JavaDoc NAMESPACE_URI = "http://apache.org/cocoon/lenya/sitetree/1.0";
25
26     /**
27      * Add a node.
28      *
29      * @param parentid where the node is to be added
30      * @param id e.g. "concepts"
31      * @param labels the labels of the node that is to be added
32      *
33      * @throws SiteTreeException if the addition failed
34      */

35     void addNode(String JavaDoc parentid, String JavaDoc id, Label[] labels, boolean visibleInNav)
36         throws SiteTreeException;
37
38     /**
39      * Add a node.
40      *
41      * @param parentid the node where the new node is to be inserted
42      * @param id the node id
43      * @param labels the labels
44      * @param visibleInNav the visibility of a node in the navigation. It is meant to hide specific nodes within the "public" navigation whereas the node is visible within the info/site area.
45      * @param href the href of the new node (internal and external references)
46      * @param suffix the suffix of the new node
47      * @param link Visibility of link respectively href. It is meant to support "grouping" nodes in the navigation which do not relate to a document (internal) or external link (www).
48      *
49      * @throws SiteTreeException if the addition failed
50      */

51     void addNode(
52         String JavaDoc parentid,
53         String JavaDoc id,
54         Label[] labels,
55         boolean visibleInNav,
56         String JavaDoc href,
57         String JavaDoc suffix,
58         boolean link)
59         throws SiteTreeException;
60
61     /**
62      * Insert a node before a given node
63      *
64      * @param parentid the node where the new node is to be inserted
65      * @param id the node id
66      * @param labels the labels
67      * @param visibleInNav the visibility of a node in the navigation
68      * @param href the href of the new node
69      * @param suffix the suffix of the new node
70      * @param link the link
71      * @param refDocumentId document-id of the node, before which the new node will be inserted.
72      *
73      * @throws SiteTreeException if the addition failed
74      */

75     void addNode(
76         String JavaDoc parentid,
77         String JavaDoc id,
78         Label[] labels,
79         boolean visibleInNav,
80         String JavaDoc href,
81         String JavaDoc suffix,
82         boolean link,
83         String JavaDoc refDocumentId)
84         throws SiteTreeException;
85
86     /**
87      * Add a node.
88      * Compute the parent id and the id of the node from the document-id
89      *
90      * @param documentid the document-id of the new node.
91      * From this the parent-id and the id are computed
92      * @param labels the labels
93      * @param href the href
94      * @param suffix the suffix
95      * @param link the link
96      *
97      * @throws SiteTreeException if the addition failed
98      */

99     void addNode(
100         String JavaDoc documentid,
101         Label[] labels,
102         boolean visibleInNav,
103         String JavaDoc href,
104         String JavaDoc suffix,
105         boolean link)
106         throws SiteTreeException;
107
108     /**
109      * Insert a node before a given node
110      * Compute the parent id and the id of the node from the document-id
111      *
112      * @param documentid the document-id of the new node.
113      * From this the parent-id and the id are computed
114      * @param labels the labels
115      * @param href the href
116      * @param suffix the suffix
117      * @param link the link
118      * @param refDocumentId document-id of the node, before which the new node will be inserted.
119      *
120      * @throws SiteTreeException if the addition failed
121      */

122     void addNode(
123         String JavaDoc documentid,
124         Label[] labels,
125         boolean visibleInNav,
126         String JavaDoc href,
127         String JavaDoc suffix,
128         boolean link,
129         String JavaDoc refDocumentId)
130         throws SiteTreeException;
131
132     /**
133      * Add a node. This method is typically used when publishing,
134      * i.e. when copying a node from the authoring tree to the live
135      * tree. The existing node already has a parent node (in the
136      * authoring tree). The node that is added will be a copy of
137      * the original node and will be inserted at the same parentid
138      * as the original node.
139      *
140      * @param node the <code>SiteTreeNode</code> that is to be added
141      *
142      * @throws SiteTreeException if the addition failed
143      */

144     void addNode(SiteTreeNode node) throws SiteTreeException;
145
146     /**
147      * Add a node. This method is typically used when publishing,
148      * i.e. when copying a node from the authoring tree to the live
149      * tree. The existing node already has a parent node (in the
150      * authoring tree). The node that is added will be a copy of
151      * the original node and will be inserted at the same parentid
152      * as the original node.
153      *
154      * @param node the <code>SiteTreeNode</code> that is to be added
155      * @param refDocumentId document-id of the node, before which the new node will be inserted.
156      *
157      * @throws SiteTreeException if the addition failed
158      */

159     void addNode(SiteTreeNode node, String JavaDoc refDocumentId)
160         throws SiteTreeException;
161
162     /**
163      * Add a label to an existing node
164      *
165      * @param documentId the document-id to which the label is to be added.
166      * @param label the label to add
167      */

168     void addLabel(String JavaDoc documentId, Label label);
169
170     /**
171      * Sets a label of an existing node. If the label does not exist, it is added.
172      * Otherwise, the existing label is replaced.
173      *
174      * @param documentId the document-id to which the label is to be added.
175      * @param label the label to add
176      */

177     void setLabel(String JavaDoc documentId, Label label);
178
179     /**
180      * Remove a label from a node
181      *
182      * @param documentId the document-id from which the label is to be removed.
183      * @param label the label to remove
184      */

185     void removeLabel(String JavaDoc documentId, Label label);
186
187     /**
188      * Removes the node corresponding to the given document-id
189      * from the tree, and returns it.
190      *
191      * @param documentId the document-id of the node that is to be removed
192      *
193      * @return the removed node
194      * @deprecated Use deleteNode() instead
195      */

196     SiteTreeNode removeNode(String JavaDoc documentId);
197     
198     /**
199      * Removes the node corresponding to the given document-id
200      * from the tree.
201      *
202      * @param documentId the document-id of the node that is to be removed
203      */

204     void deleteNode(String JavaDoc documentId) throws SiteTreeException;
205
206     /**
207      * Return the Node for a given document-id.
208      *
209      * @param documentId the document-id of the node that is requested
210      *
211      * @return a <code>SiteTreeNode</code> if there is a node for the given
212      * document-id, null otherwise.
213      */

214     SiteTreeNode getNode(String JavaDoc documentId);
215
216     /**
217      * Return the top level nodes in the sitetree.
218      * @return the top nodes in the sitetree, or empty array if there are none
219      */

220     SiteTreeNode[] getTopNodes();
221     
222    /**
223      * Move up the node amongst its siblings.
224      *
225      * @param documentid The document id of the node.
226      * @throws SiteTreeException if the moving failed.
227      */

228     void moveUp(String JavaDoc documentid) throws SiteTreeException;
229
230     /**
231      * Move down the node amongst its siblings.
232      * @param documentid The document id of the node.
233      * @throws SiteTreeException if the moving failed.
234      */

235     void moveDown(String JavaDoc documentid) throws SiteTreeException;
236     
237     /**
238      * Copy a node with all its child node.
239      * @param src Node to copy.
240      * @param dst Parent node where node will be inserted.
241      * @param newId The new id of the inserted node (in case when the node id exists already).
242      * @param followingSibling The sibling node that should follow this node (ordering),
243      * if null the node will be inserted at the end.
244      */

245     void copy(SiteTreeNode src, SiteTreeNode dst, String JavaDoc newId, String JavaDoc followingSibling)
246         throws SiteTreeException;
247     
248     /**
249      * Move a node with all its child node.
250      * @param src Node to move.
251      * @param dst Parent node where node will be inserted.
252      * @param newId The new id of the inserted node (in case when the node id exists already).
253      * @param followingSibling The sibling node that should follow the moved node (ordering),
254      * if null the node will be inserted at the end.
255      */

256     void move(SiteTreeNode src, SiteTreeNode dst, String JavaDoc newId, String JavaDoc followingSibling)
257         throws SiteTreeException;
258     
259     /**
260      * Imports a subtree (from this or from another tree) at a certain position.
261      * @param subtreeRoot The root of the subtree to import.
262      * @param newParent The node where the subtree shall be inserted.
263      * @param newid The new id of the inserted subtreeRoot node (to not overwrite
264      * @param refDocumentId The document-id corresponding to the reference node, before which
265      * the subtree should be inserted. If null, the subtree is inserted at the end.
266      * in case there is already a node with the same id in the tree).
267      * @throws SiteTreeException when an error occurs.
268      * @deprecated Use copy, move instead.
269      */

270     void importSubtree(
271         SiteTreeNode subtreeRoot,
272         SiteTreeNode newParent,
273         String JavaDoc newid,
274         String JavaDoc refDocumentId)
275         throws SiteTreeException;
276
277     /**
278      * Save the SiteTree.
279      *
280      * @throws SiteTreeException if the saving failed
281      */

282     void save() throws SiteTreeException;
283 }
284
Popular Tags