View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.jetspeed.om.folder;
18  
19  import java.util.List;
20  
21  import org.apache.jetspeed.om.page.Link;
22  import org.apache.jetspeed.om.page.Page;
23  import org.apache.jetspeed.om.page.PageSecurity;
24  import org.apache.jetspeed.page.PageNotFoundException;
25  import org.apache.jetspeed.page.document.DocumentException;
26  import org.apache.jetspeed.page.document.DocumentNotFoundException;
27  import org.apache.jetspeed.page.document.Node;
28  import org.apache.jetspeed.page.document.NodeException;
29  import org.apache.jetspeed.page.document.NodeSet;
30  
31  /***
32   * Folder
33   *
34   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
35   * @author <a href="mailto:jford@apache.org">Jeremy Ford</a>
36   * @version $Id: Folder.java 516448 2007-03-09 16:25:47Z ate $
37   */
38  public interface Folder extends Node
39  {
40      String FOLDER_TYPE = "folder";
41  
42      String FALLBACK_DEFAULT_PAGE = "default-page.psml";
43      String PAGE_NOT_FOUND_PAGE = "page_not_found.psml";
44      
45      String RESERVED_SUBSITE_FOLDER_PREFIX = "__";
46      String RESERVED_FOLDER_PREFIX = "_";
47      String RESERVED_USER_FOLDER_NAME = RESERVED_FOLDER_PREFIX + "user";
48      String RESERVED_ROLE_FOLDER_NAME = RESERVED_FOLDER_PREFIX + "role";
49      String RESERVED_GROUP_FOLDER_NAME = RESERVED_FOLDER_PREFIX + "group";
50      String RESERVED_MEDIATYPE_FOLDER_NAME = RESERVED_FOLDER_PREFIX + "mediatype";
51      String RESERVED_LANGUAGE_FOLDER_NAME = RESERVED_FOLDER_PREFIX + "language";
52      String RESERVED_COUNTRY_FOLDER_NAME = RESERVED_FOLDER_PREFIX + "country";
53      
54      String USER_FOLDER = PATH_SEPARATOR + RESERVED_USER_FOLDER_NAME + PATH_SEPARATOR;
55      String ROLE_FOLDER = PATH_SEPARATOR + RESERVED_ROLE_FOLDER_NAME + PATH_SEPARATOR;
56      String GROUP_FOLDER = PATH_SEPARATOR + RESERVED_GROUP_FOLDER_NAME + PATH_SEPARATOR;
57      String MEDIATYPE_FOLDER = PATH_SEPARATOR + RESERVED_MEDIATYPE_FOLDER_NAME + PATH_SEPARATOR;
58      String LANGUAGE_FOLDER = PATH_SEPARATOR + RESERVED_LANGUAGE_FOLDER_NAME + PATH_SEPARATOR;
59      String COUNTRY_FOLDER = PATH_SEPARATOR + RESERVED_COUNTRY_FOLDER_NAME + PATH_SEPARATOR;
60  
61      int RESERVED_FOLDER_NONE = 0;    
62      int RESERVED_FOLDER_SUBSITES = 1;
63      int RESERVED_FOLDER_USERS = 2;
64      int RESERVED_FOLDER_ROLES = 3;
65      int RESERVED_FOLDER_GROUPS = 4;
66      int RESERVED_FOLDER_MEDIATYPE = 5;
67      int RESERVED_FOLDER_LANGUAGE = 6;
68      int RESERVED_FOLDER_COUNTRY = 7;
69      int RESERVED_FOLDER_OTHER = 9999;
70     
71      /***
72       * Returns the name of the skin that applies to this
73       * folder.
74       *
75       * @return the page default skin name
76       */
77      String getSkin();
78  
79      /***
80       * Modifies the skin for this folder.
81       *
82       * @param skinName the name of the new skin for the folder
83       */
84      void setSkin(String skinName);
85  
86      /***
87       * Returns the name of the default decorator as set here or
88       * in parent folders that applies to page fragments
89       * in this folder or subfolders.
90       *
91       * @param fragmentType the type of fragment considered
92       * @return the decorator name for the selected type
93       */
94      String getEffectiveDefaultDecorator(String fragmentType);
95  
96      /***
97       * Returns the name of the default decorator that applies to page
98       * fragments in this folder or subfolders.
99       *
100      * @param fragmentType the type of fragment considered
101      * @return the decorator name for the selected type
102      */
103     String getDefaultDecorator(String fragmentType);
104 
105     /***
106      * Modifies the default decorator for the specified fragment type.
107      *
108      * @param decoratorName the name of the new decorator for the type
109      * @param fragmentType the type of fragment considered
110      */
111     void setDefaultDecorator(String decoratorName, String fragmentType);
112 
113     /***
114      * getDocumentOrder
115      *
116      * @return list of ordered document names in folder
117      */
118     List getDocumentOrder();
119     
120     /***
121      * setDocumentOrder
122      *
123      * @param docIndexes list of ordered document names in folder
124      */
125     void setDocumentOrder(List docIndexes);
126 
127     /***
128      * 
129      * <p>
130      * getDefaultPage
131      * </p>
132      *
133      * @return A String representing the default psml page for this folder
134      */
135     String getDefaultPage();
136     
137     /***
138      * 
139      * <p>
140      * setDefaultPage
141      * </p>
142      *
143      * @param defaultPage
144      */
145     void setDefaultPage(String defaultPage);
146 
147     /***
148      * 
149      * <p>
150      * getFolders
151      * </p>
152      *
153      * @return A <code>NodeSet</code> containing all sub-folders directly under
154      * this folder.
155      * @throws DocumentException
156      */
157     NodeSet getFolders() throws DocumentException;
158     
159     /***
160      * 
161      * <p>
162      * getFolder
163      * </p>
164      *
165      * @param name
166      * @return A Folder referenced by this folder.
167      * @throws FolderNotFoundException
168      * @throws DocumentException
169      */
170     Folder getFolder(String name) throws FolderNotFoundException, DocumentException;
171 
172     /***
173      * 
174      * <p>
175      * getPages
176      * </p>
177      *
178      * @return NodeSet of all the Pages referenced by this Folder.
179      * @throws NodeException
180      * @throws PageNotFoundException if any of the Pages referenced by this Folder
181      * could not be found.
182      */
183     NodeSet getPages() throws NodeException;
184     
185     /***
186      * 
187      * <p>
188      * getPage
189      * </p>
190      *
191      * @param name
192      * @return A Page referenced by this folder.
193      * @throws PageNotFoundException if the Page requested could not be found.
194      * @throws DocumentException
195      * @throws NodeException
196      */
197     Page getPage(String name) throws PageNotFoundException, NodeException;
198     
199     /***
200      * 
201      * <p>
202      * getLinks
203      * </p>
204      *
205      * @return NodeSet of all the Links referenced by this Folder.
206      * @throws DocumentException
207      * @throws NodeException
208      */    
209     NodeSet getLinks() throws NodeException;
210     
211     /***
212      * 
213      * <p>
214      * getLink
215      * </p>
216      *
217      * @param name
218      * @return A Link referenced by this folder.
219      * @throws DocumentNotFoundException if the document requested could not be found.
220      * @throws NodeException
221      */    
222     Link getLink(String name) throws DocumentNotFoundException, NodeException;
223     
224     /***
225      * 
226      * <p>
227      * getPageSecurity
228      * </p>
229      *
230      * @param name
231      * @return A PageSecurity referenced by this folder.
232      * @throws DocumentNotFoundException if the document requested could not be found.
233      * @throws NodeException
234      */    
235     PageSecurity getPageSecurity() throws DocumentNotFoundException, NodeException;
236 
237     /***
238      * 
239      * <p>
240      * getAll
241      * </p>
242      *
243      * @return A <code>NodeSet</code> containing all sub-folders and documents directly under
244      * this folder.
245      * @throws DocumentException
246      */
247     NodeSet getAll() throws DocumentException;
248 
249     /***
250      * getMenuDefinitions - get list of menu definitions
251      *
252      * @return definition list
253      */
254     List getMenuDefinitions();
255 
256     /***
257      * newMenuDefinition - creates a new empty menu definition
258      *
259      * @return a newly created MenuDefinition object for use in Folder
260      */
261     MenuDefinition newMenuDefinition();
262 
263     /***
264      * newMenuExcludeDefinition - creates a new empty menu exclude definition
265      *
266      * @return a newly created MenuExcludeDefinition object for use in Folder
267      */
268     MenuExcludeDefinition newMenuExcludeDefinition();
269 
270     /***
271      * newMenuIncludeDefinition - creates a new empty menu include definition
272      *
273      * @return a newly created MenuIncludeDefinition object for use in Folder
274      */
275     MenuIncludeDefinition newMenuIncludeDefinition();
276 
277     /***
278      * newMenuOptionsDefinition - creates a new empty menu options definition
279      *
280      * @return a newly created MenuOptionsDefinition object for use in Folder
281      */
282     MenuOptionsDefinition newMenuOptionsDefinition();
283 
284     /***
285      * newMenuSeparatorDefinition - creates a new empty menu separator definition
286      *
287      * @return a newly created MenuSeparatorDefinition object for use in Folder
288      */
289     MenuSeparatorDefinition newMenuSeparatorDefinition();
290 
291     /***
292      * setMenuDefinitions - set list of menu definitions
293      *
294      * @param definitions definition list
295      */
296     void setMenuDefinitions(List definitions);
297     
298     /***
299      * Determines if a folder is a reserved folder.
300      * Reserved folders are special folders that can
301      * hold subsites, the root of user folders, and the
302      * root of role folders.
303      * @return
304      */
305     boolean isReserved();
306     
307     /***
308      * Returns a valid reserved folder type:
309      *  RESERVED_FOLDER_SUBSITES
310      *  RESERVED_FOLDER_USERS
311      *  RESERVED_FOLDER_ROLES
312      *  RESERVED_FOLDER_GROUPS
313      *  RESERVED_FOLDER_MEDIATYPE
314      *  RESERVED_FOLDER_LANGUAGE
315      *  RESERVED_FOLDER_COUNTRY
316      *  
317      * @return one of the valid reserved folder types
318      */
319     int getReservedType();
320 }