KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > file > CmsObject


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/file/CmsObject.java,v $
3  * Date : $Date: 2006/09/21 09:34:47 $
4  * Version: $Revision: 1.147 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.file;
33
34 import org.opencms.db.CmsPublishList;
35 import org.opencms.db.CmsSecurityManager;
36 import org.opencms.file.types.I_CmsResourceType;
37 import org.opencms.lock.CmsLock;
38 import org.opencms.main.CmsException;
39 import org.opencms.main.CmsIllegalArgumentException;
40 import org.opencms.main.I_CmsEventListener;
41 import org.opencms.main.OpenCms;
42 import org.opencms.report.CmsShellReport;
43 import org.opencms.report.I_CmsReport;
44 import org.opencms.security.CmsAccessControlEntry;
45 import org.opencms.security.CmsAccessControlList;
46 import org.opencms.security.CmsPermissionSet;
47 import org.opencms.security.CmsPrincipal;
48 import org.opencms.security.CmsRole;
49 import org.opencms.security.CmsRoleViolationException;
50 import org.opencms.security.CmsSecurityException;
51 import org.opencms.security.I_CmsPrincipal;
52 import org.opencms.util.CmsUUID;
53 import org.opencms.workflow.CmsTaskService;
54
55 import java.util.Collections JavaDoc;
56 import java.util.List JavaDoc;
57 import java.util.Map JavaDoc;
58 import java.util.Set JavaDoc;
59
60 /**
61  * This pivotal class provides all authorized access to the OpenCms VFS resources.<p>
62  *
63  * It encapsulates user identification and permissions.
64  * Think of it as an initialized "shell" to access the OpenCms VFS.
65  * Every call to a method here will be checked for user permissions
66  * according to the <code>{@link org.opencms.file.CmsRequestContext}</code> this CmsObject instance was created with.<p>
67  *
68  * From a JSP page running in OpenCms, use <code>{@link org.opencms.jsp.CmsJspBean#getCmsObject()}</code> to gain
69  * access to the current users CmsObject. Usually this is done with a <code>{@link org.opencms.jsp.CmsJspActionElement}</code>.<p>
70  *
71  * To generate a new instance of this class in your application, use
72  * <code>{@link org.opencms.main.OpenCms#initCmsObject(String)}</code>. The argument String should be
73  * the name of the guest user, usually "Guest" and more formally obtained by <code>{@link org.opencms.db.CmsDefaultUsers#getUserGuest()}</code>.
74  * This will give you an initialized context with guest user permissions.
75  * Then use <code>{@link CmsObject#loginUser(String, String)}</code> to log in the user you want.
76  * Obviously you need the password for the new user.
77  * You should never try to create an instance of this class using the constructor,
78  * this is reserved for internal operation only.<p>
79  *
80  * @author Alexander Kandzior
81  * @author Thomas Weckert
82  * @author Carsten Weinholz
83  * @author Andreas Zahner
84  * @author Michael Moossen
85  *
86  * @version $Revision: 1.147 $
87  *
88  * @since 6.0.0
89  */

90 public final class CmsObject {
91
92     /**
93      * The request context.
94      */

95     protected CmsRequestContext m_context;
96
97     /**
98      * The security manager to access the cms.
99      */

100     protected CmsSecurityManager m_securityManager;
101
102     /**
103      * Connects an OpenCms user context to a running database.<p>
104      *
105      * <b>Please note:</b> This constructor is internal to OpenCms and not for public use.
106      * If you want to create a new instance of a <code>{@link CmsObject}</code> in your application,
107      * use <code>{@link org.opencms.main.OpenCms#initCmsObject(String)}</code>.<p>
108      *
109      * @param securityManager the security manager
110      * @param context the request context that contains the user authentification
111      */

112     public CmsObject(CmsSecurityManager securityManager, CmsRequestContext context) {
113
114         init(securityManager, context);
115     }
116
117     /**
118      * Adds a user to a group.<p>
119      *
120      * @param username the name of the user that is to be added to the group
121      * @param groupname the name of the group
122      *
123      * @throws CmsException if something goes wrong
124      */

125     public void addUserToGroup(String JavaDoc username, String JavaDoc groupname) throws CmsException {
126
127         m_securityManager.addUserToGroup(m_context, username, groupname);
128     }
129
130     /**
131      * Creates a new web user.<p>
132      *
133      * A web user has no access to the workplace but is able to access personalized
134      * functions controlled by the OpenCms.<br>
135      *
136      * Moreover, a web user can be created by any user, the intention being that
137      * a "Guest" user can create a personalized account for himself.<p>
138      *
139      * @param name the name for the new web user
140      * @param password the password for the user
141      * @param group the default groupname for the user
142      * @param description the description for the user
143      * @param additionalInfos a <code>{@link Map}</code> with additional infos for the user
144      *
145      * @return the newly created user
146      *
147      * @throws CmsException if something goes wrong
148      */

149     public CmsUser addWebUser(String JavaDoc name, String JavaDoc password, String JavaDoc group, String JavaDoc description, Map JavaDoc additionalInfos)
150     throws CmsException {
151
152         return m_securityManager.addWebUser(m_context, name, password, group, description, additionalInfos);
153     }
154
155     /**
156      * Creates a backup of the current project.<p>
157      *
158      * @param versionId the version of the backup
159      * @param publishDate the date of publishing
160      *
161      * @throws CmsException if operation was not succesful
162      */

163     public void backupProject(int versionId, long publishDate) throws CmsException {
164
165         m_securityManager.backupProject(m_context, versionId, publishDate);
166     }
167
168     /**
169      * Changes the access control for a given resource and a given principal(user/group).<p>
170      *
171      * @param resourceName name of the resource
172      * @param principalType the type of the principal (currently group or user):
173      * <ul>
174      * <li><code>{@link I_CmsPrincipal#PRINCIPAL_USER}</code></li>
175      * <li><code>{@link I_CmsPrincipal#PRINCIPAL_GROUP}</code></li>
176      * </ul>
177      * @param principalName name of the principal
178      * @param allowedPermissions bitset of allowed permissions
179      * @param deniedPermissions bitset of denied permissions
180      * @param flags additional flags of the access control entry
181      *
182      * @throws CmsException if something goes wrong
183      */

184     public void chacc(
185         String JavaDoc resourceName,
186         String JavaDoc principalType,
187         String JavaDoc principalName,
188         int allowedPermissions,
189         int deniedPermissions,
190         int flags) throws CmsException {
191
192         CmsResource res = readResource(resourceName, CmsResourceFilter.ALL);
193
194         I_CmsPrincipal principal = CmsPrincipal.readPrincipal(this, principalType, principalName);
195         CmsAccessControlEntry acEntry = new CmsAccessControlEntry(
196             res.getResourceId(),
197             principal.getId(),
198             allowedPermissions,
199             deniedPermissions,
200             flags);
201         acEntry.setFlagsForPrincipal(principal);
202
203         m_securityManager.writeAccessControlEntry(m_context, res, acEntry);
204     }
205
206     /**
207      * Changes the access control for a given resource and a given principal(user/group).<p>
208      *
209      * @param resourceName name of the resource
210      * @param principalType the type of the principal (group or user):
211      * <ul>
212      * <li><code>{@link I_CmsPrincipal#PRINCIPAL_USER}</code></li>
213      * <li><code>{@link I_CmsPrincipal#PRINCIPAL_GROUP}</code></li>
214      * </ul>
215      * @param principalName name of the principal
216      * @param permissionString the permissions in the format ((+|-)(r|w|v|c|i|o))*
217      *
218      * @throws CmsException if something goes wrong
219      */

220     public void chacc(String JavaDoc resourceName, String JavaDoc principalType, String JavaDoc principalName, String JavaDoc permissionString)
221     throws CmsException {
222
223         CmsResource res = readResource(resourceName, CmsResourceFilter.ALL);
224
225         I_CmsPrincipal principal = CmsPrincipal.readPrincipal(this, principalType, principalName);
226         CmsAccessControlEntry acEntry = new CmsAccessControlEntry(
227             res.getResourceId(),
228             principal.getId(),
229             permissionString);
230         acEntry.setFlagsForPrincipal(principal);
231
232         m_securityManager.writeAccessControlEntry(m_context, res, acEntry);
233     }
234
235     /**
236      * Changes the project id of the resource to the current project, indicating that
237      * the resource was last modified in this project.<p>
238      *
239      * This information is used while publishing. Only resources inside the
240      * project folders that are new/modified/changed <i>and</i> that "belong"
241      * to the project (i.e. have the id of the project set) are published
242      * with the project.<p>
243      *
244      * @param resourcename the name of the resource to change the project id for (full path)
245      *
246      * @throws CmsException if something goes wrong
247      */

248     public void changeLastModifiedProjectId(String JavaDoc resourcename) throws CmsException {
249
250         CmsResource resource = readResource(resourcename, CmsResourceFilter.ALL);
251         getResourceType(resource.getTypeId()).changeLastModifiedProjectId(this, m_securityManager, resource);
252     }
253
254     /**
255      * Changes the lock of a resource to the current user,
256      * that is "steals" the lock from another user.<p>
257      *
258      * This is the "steal lock" operation.<p>
259      *
260      * @param resourcename the name of the resource to change the lock with complete path
261      *
262      * @throws CmsException if something goes wrong
263      */

264     public void changeLock(String JavaDoc resourcename) throws CmsException {
265
266         CmsResource resource = readResource(resourcename, CmsResourceFilter.ALL);
267         getResourceType(resource.getTypeId()).changeLock(this, m_securityManager, resource);
268     }
269
270     /**
271      * Returns a list with all sub resources of a given folder that have set the given property,
272      * matching the current property's value with the given old value and replacing it by a given new value.<p>
273      *
274      * @param resourcename the name of the resource to change the property value
275      * @param property the name of the property to change the value
276      * @param oldValue the old value of the property, can be a regular expression
277      * @param newValue the new value of the property
278      * @param recursive if true, change recursively all property values on sub-resources (only for folders)
279      *
280      * @return a list with the <code>{@link CmsResource}</code>'s where the property value has been changed
281      *
282      * @throws CmsException if operation was not successful
283      */

284     public List changeResourcesInFolderWithProperty(
285         String JavaDoc resourcename,
286         String JavaDoc property,
287         String JavaDoc oldValue,
288         String JavaDoc newValue,
289         boolean recursive) throws CmsException {
290
291         CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION);
292         return m_securityManager.changeResourcesInFolderWithProperty(
293             m_context,
294             resource,
295             property,
296             oldValue,
297             newValue,
298             recursive);
299     }
300
301     /**
302      * Changes the type of a user given its id.<p>
303      *
304      * @param userId The id of the user to change
305      * @param userType The new type of the user
306      *
307      * @throws CmsException if something goes wrong
308      */

309     public void changeUserType(CmsUUID userId, int userType) throws CmsException {
310
311         m_securityManager.changeUserType(m_context, userId, userType);
312     }
313
314     /**
315      * Changes the type of a user given its name.<p>
316      *
317      * @param username The name of the user to change
318      * @param userType The new type of the user
319      *
320      * @throws CmsException if something goes wrong
321      */

322     public void changeUserType(String JavaDoc username, int userType) throws CmsException {
323
324         m_securityManager.changeUserType(m_context, username, userType);
325     }
326
327     /**
328      * Checks if the given base publish list can be published by the current user.<p>
329      *
330      * @param publishList the base publish list to check
331      *
332      * @throws CmsException in case the publish permissions are not granted
333      */

334     public void checkPublishPermissions(CmsPublishList publishList) throws CmsException {
335
336         // now perform the permission test
337
m_securityManager.checkPublishPermissions(m_context, publishList);
338     }
339
340     /**
341      * Checks if the user of this OpenCms context
342      * is a member of at last one of the roles in the given role set.<p>
343      *
344      * @param roles the roles to check
345      *
346      * @throws CmsRoleViolationException if the user does not have the required role permissions
347      */

348     public void checkRole(CmsRole roles) throws CmsRoleViolationException {
349
350         m_securityManager.checkRole(m_context, roles);
351     }
352
353     /**
354      * Changes the resource flags of a resource.<p>
355      *
356      * The resource flags are used to indicate various "special" conditions
357      * for a resource. Most notably, the "internal only" setting which signals
358      * that a resource can not be directly requested with it's URL.<p>
359      *
360      * @param resourcename the name of the resource to change the flags for (full path)
361      * @param flags the new flags for this resource
362      *
363      * @throws CmsException if something goes wrong
364      */

365     public void chflags(String JavaDoc resourcename, int flags) throws CmsException {
366
367         CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION);
368         getResourceType(resource.getTypeId()).chflags(this, m_securityManager, resource, flags);
369     }
370
371     /**
372      * Changes the resource type of a resource.<p>
373      *
374      * OpenCms handles resources according to the resource type,
375      * not the file suffix. This is e.g. why a JSP in OpenCms can have the
376      * suffix ".html" instead of ".jsp" only. Changing the resource type
377      * makes sense e.g. if you want to make a plain text file a JSP resource,
378      * or a binary file an image, etc.<p>
379      *
380      * @param resourcename the name of the resource to change the type for (full path)
381      * @param type the new resource type for this resource
382      *
383      * @throws CmsException if something goes wrong
384      */

385     public void chtype(String JavaDoc resourcename, int type) throws CmsException {
386
387         CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION);
388         getResourceType(resource.getTypeId()).chtype(this, m_securityManager, resource, type);
389     }
390
391     /**
392      * Copies a resource.<p>
393      *
394      * The copied resource will always be locked to the current user
395      * after the copy operation.<p>
396      *
397      * Siblings will be treated according to the
398      * <code>{@link org.opencms.file.CmsResource#COPY_PRESERVE_SIBLING}</code> mode.<p>
399      *
400      * @param source the name of the resource to copy (full path)
401      * @param destination the name of the copy destination (full path)
402      *
403      * @throws CmsException if something goes wrong
404      * @throws CmsIllegalArgumentException if the <code>destination</code> argument is null or of length 0
405      *
406      * @see #copyResource(String, String, int)
407      */

408     public void copyResource(String JavaDoc source, String JavaDoc destination) throws CmsException, CmsIllegalArgumentException {
409
410         copyResource(source, destination, CmsResource.COPY_PRESERVE_SIBLING);
411     }
412
413     /**
414      * Copies a resource.<p>
415      *
416      * The copied resource will always be locked to the current user
417      * after the copy operation.<p>
418      *
419      * The <code>siblingMode</code> parameter controls how to handle siblings
420      * during the copy operation.<br>
421      * Possible values for this parameter are: <br>
422      * <ul>
423      * <li><code>{@link org.opencms.file.CmsResource#COPY_AS_NEW}</code></li>
424      * <li><code>{@link org.opencms.file.CmsResource#COPY_AS_SIBLING}</code></li>
425      * <li><code>{@link org.opencms.file.CmsResource#COPY_PRESERVE_SIBLING}</code></li>
426      * </ul><p>
427      *
428      * @param source the name of the resource to copy (full path)
429      * @param destination the name of the copy destination (full path)
430      * @param siblingMode indicates how to handle siblings during copy
431      *
432      * @throws CmsException if something goes wrong
433      * @throws CmsIllegalArgumentException if the <code>destination</code> argument is null or of length 0
434      */

435     public void copyResource(String JavaDoc source, String JavaDoc destination, int siblingMode)
436     throws CmsException, CmsIllegalArgumentException {
437
438         CmsResource resource = readResource(source, CmsResourceFilter.IGNORE_EXPIRATION);
439         getResourceType(resource.getTypeId()).copyResource(this, m_securityManager, resource, destination, siblingMode);
440     }
441
442     /**
443      * Copies a resource to the current project of the user.<p>
444      *
445      * This is used to extend the current users project with the
446      * specified resource, in case that the resource is not yet part of the project.
447      * The resource is not really copied like in a regular copy operation,
448      * it is in fact only "enabled" in the current users project.<p>
449      *
450      * @param resourcename the name of the resource to copy to the current project (full path)
451      *
452      * @throws CmsException if something goes wrong
453      */

454     public void copyResourceToProject(String JavaDoc resourcename) throws CmsException {
455
456         CmsResource resource = readResource(resourcename, CmsResourceFilter.ALL);
457         getResourceType(resource.getTypeId()).copyResourceToProject(this, m_securityManager, resource);
458     }
459
460     /**
461      * Counts the locked resources in a project.<p>
462      *
463      * @param id the id of the project
464      *
465      * @return the number of locked resources in this project
466      *
467      * @throws CmsException if operation was not successful
468      */

469     public int countLockedResources(int id) throws CmsException {
470
471         return m_securityManager.countLockedResources(m_context, id);
472     }
473
474     /**
475      * Counts the locked resources within a folder.<p>
476      *
477      * @param foldername the name of the folder
478      *
479      * @return the number of locked resources in this folder
480      *
481      * @throws CmsException if operation was not successful
482      */

483     public int countLockedResources(String JavaDoc foldername) throws CmsException {
484
485         return m_securityManager.countLockedResources(m_context, addSiteRoot(foldername));
486     }
487
488     /**
489      * Copies access control entries of a given resource to another resource.<p>
490      *
491      * Already existing access control entries of the destination resource are removed.<p>
492      *
493      * @param sourceName the name of the resource of which the access control entries are copied
494      * @param destName the name of the resource to which the access control entries are applied
495      *
496      * @throws CmsException if something goes wrong
497      */

498     public void cpacc(String JavaDoc sourceName, String JavaDoc destName) throws CmsException {
499
500         CmsResource source = readResource(sourceName);
501         CmsResource dest = readResource(destName);
502         m_securityManager.copyAccessControlEntries(m_context, source, dest);
503     }
504
505     /**
506      * Creates a new user group.<p>
507      *
508      * @param name the name of the new group
509      * @param description the description of the new group
510      * @param flags the flags for the new group
511      * @param parent the parent group (or <code>null</code>)
512      *
513      * @return a <code>{@link CmsGroup}</code> object representing the newly created group
514      *
515      * @throws CmsException if operation was not successful
516      */

517     public CmsGroup createGroup(String JavaDoc name, String JavaDoc description, int flags, String JavaDoc parent) throws CmsException {
518
519         return m_securityManager.createGroup(m_context, name, description, flags, parent);
520     }
521
522     /**
523      * Creates a new project.<p>
524      *
525      * @param name the name of the project to create
526      * @param description the description for the new project
527      * @param groupname the name of the project user group
528      * @param managergroupname the name of the project manager group
529      *
530      * @return the created project
531      *
532      * @throws CmsException if something goes wrong
533      */

534     public CmsProject createProject(String JavaDoc name, String JavaDoc description, String JavaDoc groupname, String JavaDoc managergroupname)
535     throws CmsException {
536
537         return m_securityManager.createProject(
538             m_context,
539             name,
540             description,
541             groupname,
542             managergroupname,
543             CmsProject.PROJECT_TYPE_NORMAL);
544     }
545
546     /**
547      * Creates a new project.<p>
548      *
549      * @param name the name of the project to create
550      * @param description the description for the new project
551      * @param groupname the name of the project user group
552      * @param managergroupname the name of the project manager group
553      * @param projecttype the type of the project (normal or temporary)
554      *
555      * @return the created project
556      *
557      * @throws CmsException if operation was not successful
558      */

559     public CmsProject createProject(
560         String JavaDoc name,
561         String JavaDoc description,
562         String JavaDoc groupname,
563         String JavaDoc managergroupname,
564         int projecttype) throws CmsException {
565
566         return m_securityManager.createProject(m_context, name, description, groupname, managergroupname, projecttype);
567     }
568
569     /**
570      * Creates a property definition.<p>
571      *
572      * Property definitions are valid for all resource types.<p>
573      *
574      * @param name the name of the property definition to create
575      *
576      * @return the created property definition
577      *
578      * @throws CmsException if something goes wrong
579      */

580     public CmsPropertyDefinition createPropertyDefinition(String JavaDoc name) throws CmsException {
581
582         return (m_securityManager.createPropertyDefinition(m_context, name));
583     }
584
585     /**
586      * Creates a new resource of the given resource type with
587      * empty content and no properties.<p>
588      *
589      * @param resourcename the name of the resource to create (full path)
590      * @param type the type of the resource to create
591      *
592      * @return the created resource
593      *
594      * @throws CmsException if something goes wrong
595      * @throws CmsIllegalArgumentException if the given <code>resourcename</code> is null or of length 0
596      *
597      * @see #createResource(String, int, byte[], List)
598      */

599     public CmsResource createResource(String JavaDoc resourcename, int type) throws CmsException, CmsIllegalArgumentException {
600
601         return createResource(resourcename, type, new byte[0], Collections.EMPTY_LIST);
602     }
603
604     /**
605      * Creates a new resource of the given resource type
606      * with the provided content and properties.<p>
607      *
608      * @param resourcename the name of the resource to create (full path)
609      * @param type the type of the resource to create
610      * @param content the contents for the new resource
611      * @param properties the properties for the new resource
612      *
613      * @return the created resource
614      *
615      * @throws CmsException if something goes wrong
616      * @throws CmsIllegalArgumentException if the <code>resourcename</code> argument is null or of length 0
617      */

618     public CmsResource createResource(String JavaDoc resourcename, int type, byte[] content, List properties)
619     throws CmsException, CmsIllegalArgumentException {
620
621         return getResourceType(type).createResource(this, m_securityManager, resourcename, content, properties);
622     }
623
624     /**
625      * Creates a new sibling of the source resource.<p>
626      *
627      * @param source the name of the resource to create a sibling for with complete path
628      * @param destination the name of the sibling to create with complete path
629      * @param properties the individual properties for the new sibling
630      *
631      * @throws CmsException if something goes wrong
632      */

633     public void createSibling(String JavaDoc source, String JavaDoc destination, List properties) throws CmsException {
634
635         CmsResource resource = readResource(source, CmsResourceFilter.IGNORE_EXPIRATION);
636         getResourceType(resource.getTypeId()).createSibling(this, m_securityManager, resource, destination, properties);
637     }
638
639     /**
640      * Creates the project for the temporary workplace files.<p>
641      *
642      * @return the created project for the temporary workplace files
643      *
644      * @throws CmsException if something goes wrong
645      */

646     public CmsProject createTempfileProject() throws CmsException {
647
648         return m_securityManager.createTempfileProject(m_context);
649     }
650
651     /**
652      * Creates a new user.<p>
653      *
654      * @param name the name for the new user
655      * @param password the password for the new user
656      * @param description the description for the new user
657      * @param additionalInfos the additional infos for the user
658      *
659      * @return the created user
660      *
661      * @throws CmsException if something goes wrong
662      */

663     public CmsUser createUser(String JavaDoc name, String JavaDoc password, String JavaDoc description, Map JavaDoc additionalInfos)
664     throws CmsException {
665
666         return m_securityManager.createUser(m_context, name, password, description, additionalInfos);
667     }
668
669     /**
670      * Deletes all published resource entries.<p>
671      *
672      * @param linkType the type of resource deleted (0= non-paramter, 1=parameter)
673      *
674      * @throws CmsException if something goes wrong
675      */

676     public void deleteAllStaticExportPublishedResources(int linkType) throws CmsException {
677
678         m_securityManager.deleteAllStaticExportPublishedResources(m_context, linkType);
679     }
680
681     /**
682      * Deletes the versions from the backup tables that are older then the given timestamp
683      * and/or number of remaining versions.<p>
684      *
685      * The number of verions always wins, i.e. if the given timestamp would delete more versions
686      * than given in the versions parameter, the timestamp will be ignored. <p>
687      *
688      * Deletion will delete file header, content and properties. <p>
689      *
690      * @param timestamp timestamp which defines the date after which backup resources must be deleted
691      * @param versions the number of versions per file which should kept in the system
692      * @param report the report for output logging
693      *
694      * @throws CmsException if something goes wrong
695      */

696     public void deleteBackups(long timestamp, int versions, I_CmsReport report) throws CmsException {
697
698         m_securityManager.deleteBackups(m_context, timestamp, versions, report);
699     }
700
701     /**
702      * Deletes a group, where all permissions, users and childs of the group
703      * are transfered to a replacement group.<p>
704      *
705      * @param groupId the id of the group to be deleted
706      * @param replacementId the id of the group to be transfered, can be <code>null</code>
707      *
708      * @throws CmsException if operation was not successful
709      */

710     public void deleteGroup(CmsUUID groupId, CmsUUID replacementId) throws CmsException {
711
712         m_securityManager.deleteGroup(m_context, groupId, replacementId);
713     }
714
715     /**
716      * Deletes a user group.<p>
717      *
718      * Only groups that contain no subgroups can be deleted.<p>
719      *
720      * @param delgroup the name of the group
721      *
722      * @throws CmsException if operation was not successful
723      */

724     public void deleteGroup(String JavaDoc delgroup) throws CmsException {
725
726         m_securityManager.deleteGroup(m_context, delgroup);
727     }
728
729     /**
730      * Deletes a project.<p>
731      *
732      * All resources inside the project have to be be reset to their online state.<p>
733      *
734      * @param id the id of the project to delete
735      *
736      * @throws CmsException if operation was not successful
737      */

738     public void deleteProject(int id) throws CmsException {
739
740         m_securityManager.deleteProject(m_context, id);
741     }
742
743     /**
744      * Deletes a property for a file or folder.<p>
745      *
746      * @param resourcename the name of a resource for which the property should be deleted
747      * @param key the name of the property
748      *
749      * @throws CmsException if something goes wrong
750      *
751      * @deprecated use <code>{@link #writePropertyObject(String, CmsProperty)}</code> instead.
752      */

753     public void deleteProperty(String JavaDoc resourcename, String JavaDoc key) throws CmsException {
754
755         CmsProperty property = new CmsProperty();
756         property.setName(key);
757         property.setStructureValue(CmsProperty.DELETE_VALUE);
758
759         writePropertyObject(resourcename, property);
760     }
761
762     /**
763      * Deletes a property definition.<p>
764      *
765      * @param name the name of the property definition to delete
766      *
767      * @throws CmsException if something goes wrong
768      */

769     public void deletePropertyDefinition(String JavaDoc name) throws CmsException {
770
771         m_securityManager.deletePropertyDefinition(m_context, name);
772     }
773
774     /**
775      * Deletes a resource given its name.<p>
776      *
777      * The <code>siblingMode</code> parameter controls how to handle siblings
778      * during the delete operation.<br>
779      * Possible values for this parameter are: <br>
780      * <ul>
781      * <li><code>{@link org.opencms.file.CmsResource#DELETE_REMOVE_SIBLINGS}</code></li>
782      * <li><code>{@link org.opencms.file.CmsResource#DELETE_PRESERVE_SIBLINGS}</code></li>
783      * </ul><p>
784      *
785      * @param resourcename the name of the resource to delete (full path)
786      * @param siblingMode indicates how to handle siblings of the deleted resource
787      *
788      * @throws CmsException if something goes wrong
789      */

790     public void deleteResource(String JavaDoc resourcename, int siblingMode) throws CmsException {
791
792         CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION);
793         getResourceType(resource.getTypeId()).deleteResource(this, m_securityManager, resource, siblingMode);
794     }
795
796     /**
797      * Deletes a published resource entry.<p>
798      *
799      * @param resourceName The name of the resource to be deleted in the static export
800      * @param linkType the type of resource deleted (0= non-paramter, 1=parameter)
801      * @param linkParameter the parameters of the resource
802      *
803      * @throws CmsException if something goes wrong
804      */

805     public void deleteStaticExportPublishedResource(String JavaDoc resourceName, int linkType, String JavaDoc linkParameter)
806     throws CmsException {
807
808         m_securityManager.deleteStaticExportPublishedResource(m_context, resourceName, linkType, linkParameter);
809     }
810
811     /**
812      * Deletes a user.<p>
813      *
814      * @param userId the id of the user to be deleted
815      *
816      * @throws CmsException if operation was not successful
817      */

818     public void deleteUser(CmsUUID userId) throws CmsException {
819
820         m_securityManager.deleteUser(m_context, userId);
821     }
822
823     /**
824      * Deletes a user, where all permissions and resources attributes of the user
825      * were transfered to a replacement user.<p>
826      *
827      * @param userId the id of the user to be deleted
828      * @param replacementId the id of the user to be transfered, can be <code>null</code>
829      *
830      * @throws CmsException if operation was not successful
831      */

832     public void deleteUser(CmsUUID userId, CmsUUID replacementId) throws CmsException {
833
834         m_securityManager.deleteUser(m_context, userId, replacementId);
835     }
836
837     /**
838      * Deletes a user.<p>
839      *
840      * @param username the name of the user to be deleted
841      *
842      * @throws CmsException if operation was not successful
843      */

844     public void deleteUser(String JavaDoc username) throws CmsException {
845
846         m_securityManager.deleteUser(m_context, username);
847     }
848
849     /**
850      * Deletes a web user.<p>
851      *
852      * @param userId the id of the user to be deleted
853      *
854      * @throws CmsException if operation was not successful
855      */

856     public void deleteWebUser(CmsUUID userId) throws CmsException {
857
858         m_securityManager.deleteWebUser(m_context, userId);
859     }
860
861     /**
862      * Checks the availability of a resource in the VFS,
863      * using the <code>{@link CmsResourceFilter#DEFAULT}</code> filter.<p>
864      *
865      * A resource may be of type <code>{@link CmsFile}</code> or
866      * <code>{@link CmsFolder}</code>.<p>
867      *
868      * This method also takes into account the user permissions, so if
869      * the given resource exists, but the current user has not the required
870      * permissions, then this method will return <code>false</code>.<p>
871      *
872      * @param resourcename the name of the resource to check (full path)
873      *
874      * @return <code>true</code> if the resource is available
875      *
876      * @see #readResource(String)
877      * @see #existsResource(String, CmsResourceFilter)
878      */

879     public boolean existsResource(String JavaDoc resourcename) {
880
881         return existsResource(resourcename, CmsResourceFilter.DEFAULT);
882     }
883
884     /**
885      * Checks the availability of a resource in the VFS,
886      * using the <code>{@link CmsResourceFilter#DEFAULT}</code> filter.<p>
887      *
888      * A resource may be of type <code>{@link CmsFile}</code> or
889      * <code>{@link CmsFolder}</code>.<p>
890      *
891      * The specified filter controls what kind of resources should be "found"
892      * during the read operation. This will depend on the application. For example,
893      * using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently
894      * "valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code>
895      * will ignore the date release / date expired information of the resource.<p>
896      *
897      * This method also takes into account the user permissions, so if
898      * the given resource exists, but the current user has not the required
899      * permissions, then this method will return <code>false</code>.<p>
900      *
901      * @param resourcename the name of the resource to check (full path)
902      * @param filter the resource filter to use while checking
903      *
904      * @return <code>true</code> if the resource is available
905      *
906      * @see #readResource(String)
907      * @see #readResource(String, CmsResourceFilter)
908      */

909     public boolean existsResource(String JavaDoc resourcename, CmsResourceFilter filter) {
910
911         return m_securityManager.existsResource(m_context, addSiteRoot(resourcename), filter);
912     }
913
914     /**
915      * Returns the list of access control entries of a resource given its name.<p>
916      *
917      * @param resourceName the name of the resource
918      *
919      * @return a list of <code>{@link CmsAccessControlEntry}</code> objects
920      *
921      * @throws CmsException if something goes wrong
922      */

923     public List getAccessControlEntries(String JavaDoc resourceName) throws CmsException {
924
925         return getAccessControlEntries(resourceName, true);
926     }
927
928     /**
929      * Returns the list of access control entries of a resource given its name.<p>
930      *
931      * @param resourceName the name of the resource
932      * @param getInherited <code>true</code>, if inherited access control entries should be returned, too
933      *
934      * @return a list of <code>{@link CmsAccessControlEntry}</code> objects defining all permissions for the given resource
935      *
936      * @throws CmsException if something goes wrong
937      */

938     public List getAccessControlEntries(String JavaDoc resourceName, boolean getInherited) throws CmsException {
939
940         CmsResource res = readResource(resourceName, CmsResourceFilter.ALL);
941         return m_securityManager.getAccessControlEntries(m_context, res, getInherited);
942     }
943
944     /**
945      * Returns the access control list (summarized access control entries) of a given resource.<p>
946      *
947      * @param resourceName the name of the resource
948      *
949      * @return the access control list of the resource
950      *
951      * @throws CmsException if something goes wrong
952      */

953     public CmsAccessControlList getAccessControlList(String JavaDoc resourceName) throws CmsException {
954
955         return getAccessControlList(resourceName, false);
956     }
957
958     /**
959      * Returns the access control list (summarized access control entries) of a given resource.<p>
960      *
961      * If <code>inheritedOnly</code> is set, only inherited access control entries are returned.<p>
962      *
963      * @param resourceName the name of the resource
964      * @param inheritedOnly if set, the non-inherited entries are skipped
965      *
966      * @return the access control list of the resource
967      *
968      * @throws CmsException if something goes wrong
969      */

970     public CmsAccessControlList getAccessControlList(String JavaDoc resourceName, boolean inheritedOnly) throws CmsException {
971
972         CmsResource res = readResource(resourceName, CmsResourceFilter.ALL);
973         return m_securityManager.getAccessControlList(m_context, res, inheritedOnly);
974     }
975
976     /**
977      * Returns all projects which are owned by the current user or which are
978      * accessible for the group of the user.<p>
979      *
980      * @return a list of objects of type <code>{@link CmsProject}</code>
981      *
982      * @throws CmsException if operation was not successful
983      */

984     public List getAllAccessibleProjects() throws CmsException {
985
986         return m_securityManager.getAllAccessibleProjects(m_context);
987     }
988
989     /**
990      * Returns a list with all projects from history.<p>
991      *
992      * @return list of <code>{@link CmsBackupProject}</code> objects
993      * with all projects from history.
994      *
995      * @throws CmsException if operation was not succesful
996      */

997     public List getAllBackupProjects() throws CmsException {
998
999         return m_securityManager.getAllBackupProjects(m_context);
1000    }
1001
1002    /**
1003     * Returns all projects which are owned by the current user or which are manageable
1004     * for the group of the user.<p>
1005     *
1006     * @return a list of objects of type <code>{@link CmsProject}</code>
1007     *
1008     * @throws CmsException if operation was not successful
1009     */

1010    public List getAllManageableProjects() throws CmsException {
1011
1012        return m_securityManager.getAllManageableProjects(m_context);
1013    }
1014
1015    /**
1016     * Returns the next version id for the published backup resources.<p>
1017     *
1018     * @return int the new version id
1019     */

1020    public int getBackupTagId() {
1021
1022        return m_securityManager.getBackupTagId(m_context);
1023    }
1024
1025    /**
1026     * Returns all child groups of a group.<p>
1027     *
1028     * @param groupname the name of the group
1029     *
1030     * @return a list of all child <code>{@link CmsGroup}</code> objects or <code>null</code>
1031     *
1032     * @throws CmsException if operation was not successful
1033     */

1034    public List getChild(String JavaDoc groupname) throws CmsException {
1035
1036        return (m_securityManager.getChild(m_context, groupname));
1037    }
1038
1039    /**
1040     * Returns all child groups of a group.<p>
1041     *
1042     * This method also returns all sub-child groups of the current group.<p>
1043     *
1044     * @param groupname the name of the group
1045     *
1046     * @return a list of all child <code>{@link CmsGroup}</code> objects or <code>null</code>
1047     *
1048     * @throws CmsException if operation was not successful
1049     */

1050    public List getChilds(String JavaDoc groupname) throws CmsException {
1051
1052        return (m_securityManager.getChilds(m_context, groupname));
1053    }
1054
1055    /**
1056     * Returns the configuration read fromr the <code>opencms.properties</code> file.<p>
1057     *
1058     * @return the configuration read fromr the <code>opencms.properties</code> file
1059     */

1060    public Map JavaDoc getConfigurations() {
1061
1062        return m_securityManager.getConfigurations();
1063    }
1064
1065    /**
1066     * Returns all groups to which a given user directly belongs.<p>
1067     *
1068     * @param username the name of the user to get all groups for
1069     *
1070     * @return a list of <code>{@link CmsGroup}</code> objects
1071     *
1072     * @throws CmsException if operation was not successful
1073     */

1074    public List getDirectGroupsOfUser(String JavaDoc username) throws CmsException {
1075
1076        return (m_securityManager.getDirectGroupsOfUser(m_context, username));
1077    }
1078
1079    /**
1080     * Returns all file resources contained in a folder.<p>
1081     *
1082     * The result is filtered according to the rules of
1083     * the <code>{@link CmsResourceFilter#DEFAULT}</code> filter.<p>
1084     *
1085     * @param resourcename the full path of the resource to return the child resources for.
1086     *
1087     * @return a list of all child file <code>{@link CmsResource}</code>s
1088     *
1089     * @throws CmsException if something goes wrong
1090     *
1091     * @see #getFilesInFolder(String, CmsResourceFilter)
1092     */

1093    public List getFilesInFolder(String JavaDoc resourcename) throws CmsException {
1094
1095        return getFilesInFolder(resourcename, CmsResourceFilter.DEFAULT);
1096    }
1097
1098    /**
1099     * Returns all file resources contained in a folder.<p>
1100     *
1101     * With the <code>{@link CmsResourceFilter}</code> provided as parameter
1102     * you can control if you want to include deleted, invisible or
1103     * time-invalid resources in the result.<p>
1104     *
1105     * @param resourcename the full path of the resource to return the child resources for.
1106     *
1107     * @return a list of all child file <code>{@link CmsResource}</code>s
1108     * @param filter the resource filter to use
1109     *
1110     * @throws CmsException if something goes wrong
1111     */

1112    public List getFilesInFolder(String JavaDoc resourcename, CmsResourceFilter filter) throws CmsException {
1113
1114        CmsResource resource = readResource(resourcename, CmsResourceFilter.ALL);
1115        return m_securityManager.readChildResources(m_context, resource, filter, false, true);
1116    }
1117
1118    /**
1119     * Returns all groups.<p>
1120     *
1121     * @return a list of all <code>{@link CmsGroup}</code> objects
1122     *
1123     * @throws CmsException if operation was not successful
1124     */

1125    public List getGroups() throws CmsException {
1126
1127        return (m_securityManager.getGroups(m_context));
1128    }
1129
1130    /**
1131     * Returns all the groups the given user, directly or indirectly, belongs to.<p>
1132     *
1133     * @param username the name of the user
1134     *
1135     * @return a list of <code>{@link CmsGroup}</code> objects
1136     *
1137     * @throws CmsException if operation was not succesful
1138     */

1139    public List getGroupsOfUser(String JavaDoc username) throws CmsException {
1140
1141        return m_securityManager.getGroupsOfUser(m_context, username);
1142    }
1143
1144    /**
1145     * Returns the groups of a user filtered by the specified IP address.<p>
1146     *
1147     * @param username the name of the user
1148     * @param remoteAddress the IP address to filter the groups in the result list
1149     *
1150     * @return a list of <code>{@link CmsGroup}</code> objects filtered by the specified IP address
1151     *
1152     * @throws CmsException if operation was not succesful
1153     */

1154    public List getGroupsOfUser(String JavaDoc username, String JavaDoc remoteAddress) throws CmsException {
1155
1156        return m_securityManager.getGroupsOfUser(m_context, username, remoteAddress);
1157    }
1158
1159    /**
1160     * Returns the lock state for a specified resource.<p>
1161     *
1162     * @param resource the resource to return the lock state for
1163     *
1164     * @return the lock state for the specified resource
1165     *
1166     * @throws CmsException if something goes wrong
1167     */

1168    public CmsLock getLock(CmsResource resource) throws CmsException {
1169
1170        return m_securityManager.getLock(m_context, resource);
1171    }
1172
1173    /**
1174     * Returns the lock state for a specified resource name.<p>
1175     *
1176     * @param resourcename the name if the resource to get the lock state for (full path)
1177     *
1178     * @return the lock state for the specified resource
1179     *
1180     * @throws CmsException if something goes wrong
1181     */

1182    public CmsLock getLock(String JavaDoc resourcename) throws CmsException {
1183
1184        CmsResource resource = readResource(resourcename, CmsResourceFilter.ALL);
1185        return getLock(resource);
1186    }
1187
1188    /**
1189     * Returns the name a resource would have if it were moved to the
1190     * "lost and found" folder. <p>
1191     *
1192     * In general, it is the same name as the given resource has, the only exception is
1193     * if a resource in the "lost and found" folder with the same name already exists.
1194     * In such case, a counter is added to the resource name.<p>
1195     *
1196     * @param resourcename the name of the resource to get the "lost and found" name for (full path)
1197     *
1198     * @return the tentative name of the resource inside the "lost and found" folder
1199     *
1200     * @throws CmsException if something goes wrong
1201     *
1202     * @see #moveToLostAndFound(String)
1203     */

1204    public String JavaDoc getLostAndFoundName(String JavaDoc resourcename) throws CmsException {
1205
1206        return m_securityManager.moveToLostAndFound(m_context, resourcename, true);
1207    }
1208
1209    /**
1210     * Returns the parent group of a group.<p>
1211     *
1212     * @param groupname the name of the group
1213     *
1214     * @return group the parent group or <code>null</code>
1215     *
1216     * @throws CmsException if operation was not successful
1217     */

1218    public CmsGroup getParent(String JavaDoc groupname) throws CmsException {
1219
1220        return m_securityManager.getParent(m_context, groupname);
1221    }
1222
1223    /**
1224     * Returns the set of permissions of the current user for a given resource.<p>
1225     *
1226     * @param resourceName the name of the resource
1227     *
1228     * @return the bitset of the permissions of the current user
1229     *
1230     * @throws CmsException if something goes wrong
1231     */

1232    public CmsPermissionSet getPermissions(String JavaDoc resourceName) throws CmsException {
1233
1234        // reading permissions is allowed even if the resource is marked as deleted
1235
CmsResource resource = readResource(resourceName, CmsResourceFilter.ALL);
1236        CmsUser user = m_context.currentUser();
1237
1238        return m_securityManager.getPermissions(m_context, resource, user);
1239    }
1240
1241    /**
1242     * Returns the set of permissions of a given user for a given resource.<p>
1243     *
1244     * @param resourceName the name of the resource
1245     * @param userName the name of the user
1246     *
1247     * @return the current permissions on this resource
1248     *
1249     * @throws CmsException if something goes wrong
1250     */

1251    public CmsPermissionSet getPermissions(String JavaDoc resourceName, String JavaDoc userName) throws CmsException {
1252
1253        CmsAccessControlList acList = getAccessControlList(resourceName);
1254        CmsUser user = readUser(userName);
1255        return acList.getPermissions(user, getGroupsOfUser(userName));
1256    }
1257
1258    /**
1259     * Returns a publish list with all new/changed/deleted resources of the current (offline)
1260     * project that actually get published.<p>
1261     *
1262     * @return a publish list
1263     *
1264     * @throws CmsException if something goes wrong
1265     */

1266    public CmsPublishList getPublishList() throws CmsException {
1267
1268        return m_securityManager.fillPublishList(m_context, new CmsPublishList(m_context.currentProject()));
1269    }
1270
1271    /**
1272     * Returns a publish list with all new/changed/deleted resources of the current (offline)
1273     * project that actually get published for a direct publish of a single resource.<p>
1274     *
1275     * @param directPublishResource the resource which will be directly published
1276     * @param directPublishSiblings <code>true</code>, if all eventual siblings of the direct
1277     * published resource should also get published.
1278     *
1279     * @return a publish list
1280     *
1281     * @throws CmsException if something goes wrong
1282     */

1283    public CmsPublishList getPublishList(CmsResource directPublishResource, boolean directPublishSiblings)
1284    throws CmsException {
1285
1286        return m_securityManager.fillPublishList(m_context, new CmsPublishList(
1287            directPublishResource,
1288            directPublishSiblings));
1289    }
1290
1291    /**
1292     * Returns a publish list with all new/changed/deleted resources of the current (offline)
1293     * project that actually get published for a direct publish of a List of resources.<p>
1294     *
1295     * @param directPublishResources the resources which will be directly published
1296     * @param directPublishSiblings <code>true</code>, if all eventual siblings of the direct
1297     * published resources should also get published.
1298     *
1299     * @return a publish list
1300     *
1301     * @throws CmsException if something goes wrong
1302     */

1303    public CmsPublishList getPublishList(List directPublishResources, boolean directPublishSiblings)
1304    throws CmsException {
1305
1306        return getPublishList(directPublishResources, directPublishSiblings, true);
1307    }
1308
1309    /**
1310     * Returns a publish list with all new/changed/deleted resources of the current (offline)
1311     * project that actually get published for a direct publish of a List of resources.<p>
1312     *
1313     * @param directPublishResources the resources which will be directly published
1314     * @param directPublishSiblings <code>true</code>, if all eventual siblings of the direct
1315     * published resources should also get published.
1316     * @param publishSubResources indicates if sub-resources in folders should be published (for direct publish only)
1317     *
1318     * @return a publish list
1319     *
1320     * @throws CmsException if something goes wrong
1321     */

1322    public CmsPublishList getPublishList(
1323        List directPublishResources,
1324        boolean directPublishSiblings,
1325        boolean publishSubResources) throws CmsException {
1326
1327        return m_securityManager.fillPublishList(m_context, new CmsPublishList(
1328            directPublishResources,
1329            directPublishSiblings,
1330            publishSubResources));
1331    }
1332
1333    /**
1334     * Returns the current users request context.<p>
1335     *
1336     * This request context is used to authenticate the user for all
1337     * OpenCms operations. It also contains the request runtime settings, e.g.
1338     * about the current site this request was made on.<p>
1339     *
1340     * @return the current users request context
1341     */

1342    public CmsRequestContext getRequestContext() {
1343
1344        return m_context;
1345    }
1346
1347    /**
1348     * Returns all resources associated to a given principal via an ACE with the given permissions.<p>
1349     *
1350     * If the <code>includeAttr</code> flag is set it returns also all resources associated to
1351     * a given principal through some of following attributes.<p>
1352     *
1353     * <ul>
1354     * <li>User Created</li>
1355     * <li>User Last Modified</li>
1356     * </ul><p>
1357     *
1358     * @param principalId the id of the principal
1359     * @param permissions a set of permissions to match, can be <code>null</code> for all ACEs
1360     * @param includeAttr a flag to include resources associated by attributes
1361     *
1362     * @return a list of <code>{@link CmsResource}</code> objects
1363     *
1364     * @throws CmsException if something goes wrong
1365     */

1366    public List getResourcesForPrincipal(CmsUUID principalId, CmsPermissionSet permissions, boolean includeAttr)
1367    throws CmsException {
1368
1369        return m_securityManager.getResourcesForPrincipal(getRequestContext(), principalId, permissions, includeAttr);
1370    }
1371
1372    /**
1373     * Returns all child resources of a resource, that is the resources
1374     * contained in a folder.<p>
1375     *
1376     * With the <code>{@link CmsResourceFilter}</code> provided as parameter
1377     * you can control if you want to include deleted, invisible or
1378     * time-invalid resources in the result.<p>
1379     *
1380     * This method is mainly used by the workplace explorer.<p>
1381     *
1382     * @param resourcename the full path of the resource to return the child resources for
1383     * @param filter the resource filter to use
1384     *
1385     * @return a list of all child <code>{@link CmsResource}</code>s
1386     *
1387     * @throws CmsException if something goes wrong
1388     */

1389    public List getResourcesInFolder(String JavaDoc resourcename, CmsResourceFilter filter) throws CmsException {
1390
1391        CmsResource resource = readResource(resourcename, CmsResourceFilter.ALL);
1392        return m_securityManager.readChildResources(m_context, resource, filter, true, true);
1393    }
1394
1395    /**
1396     * Returns a list with all sub resources of the given parent folder (and all of it's subfolders)
1397     * that have been modified in the given time range.<p>
1398     *
1399     * The result list is descending sorted (newest resource first).<p>
1400     *
1401     * @param folder the folder to get the subresources from
1402     * @param starttime the begin of the time range
1403     * @param endtime the end of the time range
1404     *
1405     * @return a list with all <code>{@link CmsResource}</code> objects
1406     * that have been modified in the given time range.
1407     *
1408     * @throws CmsException if operation was not successful
1409     *
1410     * @deprecated use {@link #readResources(String, CmsResourceFilter)} and create a filter
1411     * based on {@link CmsResourceFilter#IGNORE_EXPIRATION}
1412     * using {@link CmsResourceFilter#addRequireLastModifiedAfter(long)} and
1413     * {@link CmsResourceFilter#addRequireLastModifiedBefore(long)} instead
1414     */

1415    public List getResourcesInTimeRange(String JavaDoc folder, long starttime, long endtime) throws CmsException {
1416
1417        CmsResourceFilter filter = CmsResourceFilter.IGNORE_EXPIRATION;
1418        filter = filter.addRequireLastModifiedAfter(starttime);
1419        filter = filter.addRequireLastModifiedBefore(endtime);
1420
1421        return readResources(folder, filter);
1422    }
1423
1424    /**
1425     * Adjusts the absolute resource root path for the current site.<p>
1426     *
1427     * The full root path of a resource is always available using
1428     * <code>{@link CmsResource#getRootPath()}</code>. From this name this method cuts
1429     * of the current site root using
1430     * <code>{@link CmsRequestContext#removeSiteRoot(String)}</code>.<p>
1431     *
1432     * If the resource root path does not start with the current site root,
1433     * it is left untouched.<p>
1434     *
1435     * @param resource the resource to get the adjusted site root path for
1436     *
1437     * @return the absolute resource path adjusted for the current site
1438     *
1439     * @see CmsRequestContext#removeSiteRoot(String)
1440     * @see CmsRequestContext#getSitePath(CmsResource)
1441     * @see CmsResource#getRootPath()
1442     */

1443    public String JavaDoc getSitePath(CmsResource resource) {
1444
1445        return m_context.getSitePath(resource);
1446    }
1447
1448    /**
1449     * Returns all folder resources contained in a folder.<p>
1450     *
1451     * The result is filtered according to the rules of
1452     * the <code>{@link CmsResourceFilter#DEFAULT}</code> filter.<p>
1453     *
1454     * @param resourcename the full path of the resource to return the child resources for.
1455     *
1456     * @return a list of all child file <code>{@link CmsResource}</code>s
1457     *
1458     * @throws CmsException if something goes wrong
1459     *
1460     * @see #getSubFolders(String, CmsResourceFilter)
1461     */

1462    public List getSubFolders(String JavaDoc resourcename) throws CmsException {
1463
1464        return getSubFolders(resourcename, CmsResourceFilter.DEFAULT);
1465    }
1466
1467    /**
1468     * Returns all folder resources contained in a folder.<p>
1469     *
1470     * With the <code>{@link CmsResourceFilter}</code> provided as parameter
1471     * you can control if you want to include deleted, invisible or
1472     * time-invalid resources in the result.<p>
1473     *
1474     * @param resourcename the full path of the resource to return the child resources for.
1475     *
1476     * @return a list of all child folder <code>{@link CmsResource}</code>s
1477     * @param filter the resource filter to use
1478     *
1479     * @throws CmsException if something goes wrong
1480     */

1481    public List getSubFolders(String JavaDoc resourcename, CmsResourceFilter filter) throws CmsException {
1482
1483        CmsResource resource = readResource(resourcename, CmsResourceFilter.ALL);
1484        return m_securityManager.readChildResources(m_context, resource, filter, true, false);
1485    }
1486
1487    /**
1488     * Returns the current session info manager object.<p>
1489     *
1490     * @return the current session info manager object
1491     */

1492    public CmsTaskService getTaskService() {
1493
1494        return new CmsTaskService(m_context, m_securityManager);
1495    }
1496
1497    /**
1498     * Returns all users.<p>
1499     *
1500     * @return a list of all <code>{@link CmsUser}</code> objects
1501     *
1502     * @throws CmsException if operation was not successful
1503     */

1504    public List getUsers() throws CmsException {
1505
1506        return m_securityManager.getUsers(m_context);
1507    }
1508
1509    /**
1510     * Returns all users of the given type.<p>
1511     *
1512     * @param type the type of the users
1513     *
1514     * @return a list of all <code>{@link CmsUser}</code> objects of the given type
1515     *
1516     * @throws CmsException if operation was not successful
1517     */

1518    public List getUsers(int type) throws CmsException {
1519
1520        return (m_securityManager.getUsers(m_context, type));
1521    }
1522
1523    /**
1524     * Returns all direct users of a given group.<p>
1525     *
1526     * Users that are "indirectly" in the group are not returned in the result.<p>
1527     *
1528     * @param groupname the name of the group to get all users for
1529     *
1530     * @return all <code>{@link CmsUser}</code> objects in the group
1531     *
1532     * @throws CmsException if operation was not successful
1533     */

1534    public List getUsersOfGroup(String JavaDoc groupname) throws CmsException {
1535
1536        return (m_securityManager.getUsersOfGroup(m_context, groupname));
1537    }
1538
1539    /**
1540     * Checks if the current user has required permissions to access a given resource.<p>
1541     *
1542     * @param resource the resource to check the permissions for
1543     * @param requiredPermissions the set of permissions to check for
1544     *
1545     * @return <code>true</code> if the required permissions are satisfied
1546     *
1547     * @throws CmsException if something goes wrong
1548     */

1549    public boolean hasPermissions(CmsResource resource, CmsPermissionSet requiredPermissions) throws CmsException {
1550
1551        return CmsSecurityManager.PERM_ALLOWED == m_securityManager.hasPermissions(
1552            m_context,
1553            resource,
1554            requiredPermissions,
1555            true,
1556            CmsResourceFilter.ALL);
1557    }
1558
1559    /**
1560     * Checks if the current user has required permissions to access a given resource.<p>
1561     *
1562     * @param resource the resource to check the permissions for
1563     * @param requiredPermissions the set of permissions to check for
1564     * @param checkLock if <code>true</code>, a lock for the current user is required for
1565     * all write operations, if <code>false</code> it's ok to write as long as the resource
1566     * is not locked by another user.
1567     * @param filter the resource filter to use
1568     *
1569     * @return <code>true</code> if the required permissions are satisfied
1570     *
1571     * @throws CmsException if something goes wrong
1572     */

1573    public boolean hasPermissions(
1574        CmsResource resource,
1575        CmsPermissionSet requiredPermissions,
1576        boolean checkLock,
1577        CmsResourceFilter filter) throws CmsException {
1578
1579        return CmsSecurityManager.PERM_ALLOWED == m_securityManager.hasPermissions(
1580            m_context,
1581            resource,
1582            requiredPermissions,
1583            checkLock,
1584            filter);
1585    }
1586
1587    /**
1588     * Checks if the given resource or the current project can be published by the current user
1589     * using his current OpenCms context.<p>
1590     *
1591     * If the resource parameter is <code>null</code>, then the current project is checked,
1592     * otherwise the resource is checked for direct publish permissions.<p>
1593     *
1594     * @param resourcename the direct publish resource name (optional, if null only the current project is checked)
1595     *
1596     * @return <code>true</code>, if the current user can direct publish the given resource in his current context
1597     */

1598    public boolean hasPublishPermissions(String JavaDoc resourcename) {
1599
1600        CmsResource resource = null;
1601        if (resourcename != null) {
1602            // resource name is optional
1603
try {
1604                resource = readResource(resourcename, CmsResourceFilter.ALL);
1605                checkPublishPermissions(new CmsPublishList(Collections.singletonList(resource), false));
1606            } catch (CmsException e) {
1607                // if any exception (e.g. security) occurs the result is false
1608
return false;
1609            }
1610        }
1611        // no exception means permissions are granted
1612
return true;
1613    }
1614
1615    /**
1616     * Checks if the user of the current OpenCms context
1617     * is a member of at last one of the roles in the given role set.<p>
1618     *
1619     * @param roles the role to check
1620     *
1621     * @return <code>true</code> if the user of the current OpenCms context is at a member of at last
1622     * one of the roles in the given role set
1623     */

1624    public boolean hasRole(CmsRole roles) {
1625
1626        return m_securityManager.hasRole(m_context, roles);
1627    }
1628
1629    /**
1630     * Writes a list of access control entries as new access control entries of a given resource.<p>
1631     *
1632     * Already existing access control entries of this resource are removed before.<p>
1633     *
1634     * @param resource the resource to attach the control entries to
1635     * @param acEntries a list of <code>{@link CmsAccessControlEntry}</code> objects
1636     *
1637     * @throws CmsException if something goes wrong
1638     */

1639    public void importAccessControlEntries(CmsResource resource, List acEntries) throws CmsException {
1640
1641        m_securityManager.importAccessControlEntries(m_context, resource, acEntries);
1642    }
1643
1644    /**
1645     * Imports a resource to the OpenCms VFS.<p>
1646     *
1647     * If a resource already exists in the VFS (i.e. has the same name and
1648     * same id) it is replaced by the imported resource.<p>
1649     *
1650     * If a resource with the same name but a different id exists,
1651     * the imported resource is (usually) moved to the "lost and found" folder.<p>
1652     *
1653     * @param resourcename the name for the resource after import (full path)
1654     * @param resource the resource object to be imported
1655     * @param content the content of the resource
1656     * @param properties the properties of the resource
1657     *
1658     * @return the imported resource
1659     *
1660     * @throws CmsException if something goes wrong
1661     *
1662     * @see CmsObject#moveToLostAndFound(String)
1663     */

1664    public CmsResource importResource(String JavaDoc resourcename, CmsResource resource, byte[] content, List properties)
1665    throws CmsException {
1666
1667        return getResourceType(resource.getTypeId()).importResource(
1668            this,
1669            m_securityManager,
1670            resourcename,
1671            resource,
1672            content,
1673            properties);
1674    }
1675
1676    /**
1677     * Creates a new user by import.<p>
1678     *
1679     * @param id the id of the user
1680     * @param name the new name for the user
1681     * @param password the new password for the user
1682     * @param description the description for the user
1683     * @param firstname the firstname of the user
1684     * @param lastname the lastname of the user
1685     * @param email the email of the user
1686     * @param address the address of the user
1687     * @param flags the flags for a user (for example <code>{@link I_CmsPrincipal#FLAG_ENABLED}</code>)
1688     * @param type the type of the user
1689     * @param additionalInfos the additional user infos
1690     *
1691     * @return the imported user
1692     *
1693     * @throws CmsException if something goes wrong
1694     */

1695    public CmsUser importUser(
1696        String JavaDoc id,
1697        String JavaDoc name,
1698        String JavaDoc password,
1699        String JavaDoc description,
1700        String JavaDoc firstname,
1701        String JavaDoc lastname,
1702        String JavaDoc email,
1703        String JavaDoc address,
1704        int flags,
1705        int type,
1706        Map JavaDoc additionalInfos) throws CmsException {
1707
1708        return m_securityManager.importUser(
1709            m_context,
1710            id,
1711            name,
1712            password,
1713            description,
1714            firstname,
1715            lastname,
1716            email,
1717            address,
1718            flags,
1719            type,
1720            additionalInfos);
1721    }
1722
1723    /**
1724     * Checks if the current user has role access to <code>{@link CmsRole#ADMINISTRATOR}</code>.<p>
1725     *
1726     * @return <code>true</code>, if the current user has role access to <code>{@link CmsRole#ADMINISTRATOR}</code>
1727     *
1728     * @deprecated use <code>{@link #hasRole(CmsRole)}</code> or <code>{@link #checkRole(CmsRole)}</code> instead
1729     */

1730    public boolean isAdmin() {
1731
1732        return hasRole(CmsRole.ADMINISTRATOR);
1733    }
1734
1735    /**
1736     * Checks if the specified resource is inside the current project.<p>
1737     *
1738     * The project "view" is determined by a set of path prefixes.
1739     * If the resource starts with any one of this prefixes, it is considered to
1740     * be "inside" the project.<p>
1741     *
1742     * @param resourcename the specified resource name (full path)
1743     *
1744     * @return <code>true</code>, if the specified resource is inside the current project
1745     */

1746    public boolean isInsideCurrentProject(String JavaDoc resourcename) {
1747
1748        return m_securityManager.isInsideCurrentProject(m_context, addSiteRoot(resourcename));
1749    }
1750
1751    /**
1752     * Checks if the current user has management access to the current project.<p>
1753     *
1754     * @return <code>true</code>, if the user has management access to the current project
1755     */

1756
1757    public boolean isManagerOfProject() {
1758
1759        return m_securityManager.isManagerOfProject(m_context);
1760    }
1761
1762    /**
1763     * Locks a resource.<p>
1764     *
1765     * The mode for the lock is <code>{@link org.opencms.lock.CmsLock#COMMON}</code>.<p>
1766     *
1767     * @param resourcename the name of the resource to lock (full path)
1768     *
1769     * @throws CmsException if something goes wrong
1770     *
1771     * @see CmsObject#lockResource(String, int)
1772     */

1773    public void lockResource(String JavaDoc resourcename) throws CmsException {
1774
1775        lockResource(resourcename, CmsLock.COMMON);
1776    }
1777
1778    /**
1779     * Locks a resource.<p>
1780     *
1781     * The <code>mode</code> parameter controls what kind of lock is used.<br>
1782     * Possible values for this parameter are: <br>
1783     * <ul>
1784     * <li><code>{@link org.opencms.lock.CmsLock#COMMON}</code></li>
1785     * <li><code>{@link org.opencms.lock.CmsLock#TEMPORARY}</code></li>
1786     * </ul><p>
1787     *
1788     * @param resourcename the name of the resource to lock (full path)
1789     * @param mode flag indicating the mode for the lock
1790     *
1791     * @throws CmsException if something goes wrong
1792     */

1793    public void lockResource(String JavaDoc resourcename, int mode) throws CmsException {
1794
1795        CmsResource resource = readResource(resourcename, CmsResourceFilter.ALL);
1796        getResourceType(resource.getTypeId()).lockResource(this, m_securityManager, resource, mode);
1797    }
1798
1799    /**
1800     * Logs a user into the Cms, if the password is correct.<p>
1801     *
1802     * @param username the name of the user
1803     * @param password the password of the user
1804     *
1805     * @return the name of the logged in user
1806     *
1807     * @throws CmsException if the login was not successful
1808     */

1809    public String JavaDoc loginUser(String JavaDoc username, String JavaDoc password) throws CmsException {
1810
1811        return loginUser(username, password, m_context.getRemoteAddress());
1812    }
1813
1814    /**
1815     * Logs a user with a given ip address into the Cms, if the password is correct.<p>
1816     *
1817     * @param username the name of the user
1818     * @param password the password of the user
1819     * @param remoteAddress the ip address
1820     *
1821     * @return the name of the logged in user
1822     *
1823     * @throws CmsException if the login was not successful
1824     */

1825    public String JavaDoc loginUser(String JavaDoc username, String JavaDoc password, String JavaDoc remoteAddress) throws CmsException {
1826
1827        return loginUser(username, password, remoteAddress, CmsUser.USER_TYPE_SYSTEMUSER);
1828    }
1829
1830    /**
1831     * Logs a user with a given type and a given ip address into the Cms, if the password is correct.<p>
1832     *
1833     * @param username the name of the user
1834     * @param password the password of the user
1835     * @param remoteAddress the ip address
1836     * @param type the user type (System or Web user)
1837     *
1838     * @return the name of the logged in user
1839     *
1840     * @throws CmsException if the login was not successful
1841     */

1842    public String JavaDoc loginUser(String JavaDoc username, String JavaDoc password, String JavaDoc remoteAddress, int type) throws CmsException {
1843
1844        // login the user
1845
CmsUser newUser = m_securityManager.loginUser(m_context, username, password, remoteAddress, type);
1846        // set the project back to the "Online" project
1847
CmsProject newProject = m_securityManager.readProject(CmsProject.ONLINE_PROJECT_ID);
1848        // switch the cms context to the new user and project
1849
m_context.switchUser(newUser, newProject);
1850        // init this CmsObject with the new user
1851
init(m_securityManager, m_context);
1852        // fire a login event
1853
fireEvent(I_CmsEventListener.EVENT_LOGIN_USER, newUser);
1854        // return the users login name
1855
return newUser.getName();
1856    }
1857
1858    /**
1859     * Logs a web user into the Cms, if the password is correct.
1860     *
1861     * @param username the name of the user
1862     * @param password the password of the user
1863     *
1864     * @return the name of the logged in user
1865     *
1866     * @throws CmsException if the login was not successful
1867     */

1868    public String JavaDoc loginWebUser(String JavaDoc username, String JavaDoc password) throws CmsException {
1869
1870        return loginUser(username, password, m_context.getRemoteAddress(), CmsUser.USER_TYPE_WEBUSER);
1871    }
1872
1873    /**
1874     * Lookups and reads the user or group with the given UUID.<p>
1875     *
1876     * @param principalId the uuid of a user or group
1877     *
1878     * @return the user or group with the given UUID
1879     */

1880    public I_CmsPrincipal lookupPrincipal(CmsUUID principalId) {
1881
1882        return m_securityManager.lookupPrincipal(m_context, principalId);
1883    }
1884
1885    /**
1886     * Lookups and reads the user or group with the given name.<p>
1887     *
1888     * @param principalName the name of the user or group
1889     *
1890     * @return the user or group with the given name
1891     */

1892    public I_CmsPrincipal lookupPrincipal(String JavaDoc principalName) {
1893
1894        return m_securityManager.lookupPrincipal(m_context, principalName);
1895    }
1896
1897    /**
1898     * Moves a resource to the given destination.<p>
1899     *
1900     * A move operation in OpenCms is always a copy (as sibling) followed by a delete,
1901     * this is a result of the online/offline structure of the
1902     * OpenCms VFS. This way you can see the deleted files/folders in the offline
1903     * project, and you will be unable to undelete them.<p>
1904     *
1905     * @param source the name of the resource to move (full path)
1906     * @param destination the destination resource name (full path)
1907     *
1908     * @throws CmsException if something goes wrong
1909     *
1910     * @see #renameResource(String, String)
1911     */

1912    public void moveResource(String JavaDoc source, String JavaDoc destination) throws CmsException {
1913
1914        CmsResource resource = readResource(source, CmsResourceFilter.IGNORE_EXPIRATION);
1915        getResourceType(resource.getTypeId()).moveResource(this, m_securityManager, resource, destination);
1916    }
1917
1918    /**
1919     * Moves a resource to the "lost and found" folder.<p>
1920     *
1921     * The "lost and found" folder is a special system folder.
1922     * This operation is used e.g. during import of resources
1923     * when a resource with the same name but a different resource ID
1924     * already exists in the VFS. In this case, the imported resource is
1925     * moved to the "lost and found" folder.<p>
1926     *
1927     * @param resourcename the name of the resource to move to "lost and found" (full path)
1928     *
1929     * @return the name of the resource inside the "lost and found" folder
1930     *
1931     * @throws CmsException if something goes wrong
1932     *
1933     * @see #getLostAndFoundName(String)
1934     */

1935    public String JavaDoc moveToLostAndFound(String JavaDoc resourcename) throws CmsException {
1936
1937        return m_securityManager.moveToLostAndFound(m_context, resourcename, false);
1938    }
1939
1940    /**
1941     * Publishes the current project, printing messages to a shell report.<p>
1942     *
1943     * @return the publish history id of the published project
1944     *
1945     * @throws Exception if something goes wrong
1946     *
1947     * @see CmsShellReport
1948     */

1949    public CmsUUID publishProject() throws Exception JavaDoc {
1950
1951        return publishProject(new CmsShellReport(m_context.getLocale()));
1952    }
1953
1954    /**
1955     * Publishes the current project.<p>
1956     *
1957     * @param report an instance of <code>{@link I_CmsReport}</code> to print messages
1958     *
1959     * @return the publish history id of the published project
1960     *
1961     * @throws CmsException if something goes wrong
1962     */

1963    public CmsUUID publishProject(I_CmsReport report) throws CmsException {
1964
1965        return publishProject(report, getPublishList());
1966    }
1967
1968    /**
1969     * Publishes the resources of a specified publish list.<p>
1970     *
1971     * @param report an instance of <code>{@link I_CmsReport}</code> to print messages
1972     * @param publishList a publish list
1973     *
1974     * @return the publish history id of the published project
1975     *
1976     * @throws CmsException if something goes wrong
1977     *
1978     * @see #getPublishList()
1979     * @see #getPublishList(CmsResource, boolean)
1980     * @see #getPublishList(List, boolean)
1981     */

1982    public CmsUUID publishProject(I_CmsReport report, CmsPublishList publishList) throws CmsException {
1983
1984        return m_securityManager.publishProject(this, publishList, report);
1985    }
1986
1987    /**
1988     * Direct publishes a specified resource.<p>
1989     *
1990     * @param report an instance of <code>{@link I_CmsReport}</code> to print messages
1991     * @param directPublishResource a <code>{@link CmsResource}</code> that gets directly published;
1992     * or <code>null</code> if an entire project gets published.
1993     * @param directPublishSiblings if a <code>{@link CmsResource}</code> that should get published directly is
1994     * provided as an argument, all eventual siblings of this resource
1995     * get publish too, if this flag is <code>true</code>.
1996     *
1997     * @return the publish history id of the published project
1998     *
1999     * @throws CmsException if something goes wrong
2000     *
2001     * @see #publishResource(String)
2002     * @see #publishResource(String, boolean, I_CmsReport)
2003     */

2004    public CmsUUID publishProject(I_CmsReport report, CmsResource directPublishResource, boolean directPublishSiblings)
2005    throws CmsException {
2006
2007        return publishProject(report, getPublishList(directPublishResource, directPublishSiblings));
2008    }
2009
2010    /**
2011     * Publishes a single resource, printing messages to a shell report.<p>
2012     *
2013     * The siblings of the resource will not be published.<p>
2014     *
2015     * @param resourcename the name of the resource to be published
2016     *
2017     * @return the publish history id of the published project
2018     *
2019     * @throws Exception if something goes wrong
2020     *
2021     * @see CmsShellReport
2022     */

2023    public CmsUUID publishResource(String JavaDoc resourcename) throws Exception JavaDoc {
2024
2025        return publishResource(resourcename, false, new CmsShellReport(m_context.getLocale()));
2026    }
2027
2028    /**
2029     * Publishes a single resource.<p>
2030     *
2031     * @param resourcename the name of the resource to be published
2032     * @param publishSiblings if <code>true</code>, all siblings of the resource are also published
2033     * @param report the report to write the progress information to
2034     *
2035     * @return the publish history id of the published project
2036     *
2037     * @throws Exception if something goes wrong
2038     */

2039    public CmsUUID publishResource(String JavaDoc resourcename, boolean publishSiblings, I_CmsReport report) throws Exception JavaDoc {
2040
2041        CmsResource resource = readResource(resourcename, CmsResourceFilter.ALL);
2042        return publishProject(report, resource, publishSiblings);
2043    }
2044
2045    /**
2046     * Reads all file headers of a file.<br>
2047     *
2048     * This method returns a list with the history of all file headers, i.e.
2049     * the file headers of a file, independent of the project they were attached to.<br>
2050     *
2051     * The reading excludes the file content.<p>
2052     *
2053     * @param filename the name of the file to be read
2054     *
2055     * @return a list of file headers, as <code>{@link CmsBackupResource}</code> objects, read from the Cms
2056     *
2057     * @throws CmsException if operation was not successful
2058     */

2059    public List readAllBackupFileHeaders(String JavaDoc filename) throws CmsException {
2060
2061        CmsResource resource = readResource(filename, CmsResourceFilter.ALL);
2062        return (m_securityManager.readAllBackupFileHeaders(m_context, resource));
2063    }
2064
2065    /**
2066     * Reads all property definitions.<p>
2067     *
2068     * @return a list with the <code>{@link CmsPropertyDefinition}</code> objects (may be empty)
2069     *
2070     * @throws CmsException if something goes wrong
2071     */

2072    public List readAllPropertyDefinitions() throws CmsException {
2073
2074        return m_securityManager.readAllPropertyDefinitions(m_context);
2075    }
2076
2077    /**
2078     * Returns the first ancestor folder matching the filter criteria.<p>
2079     *
2080     * If no folder matching the filter criteria is found, null is returned.<p>
2081     *
2082     * @param resourcename the name of the resource to start (full path)
2083     * @param filter the resource filter to match while reading the ancestors
2084     *
2085     * @return the first ancestor folder matching the filter criteria or null if no folder was found
2086     *
2087     * @throws CmsException if something goes wrong
2088     */

2089    public CmsFolder readAncestor(String JavaDoc resourcename, CmsResourceFilter filter) throws CmsException {
2090
2091        CmsResource resource = readResource(resourcename, CmsResourceFilter.ALL);
2092        return m_securityManager.readAncestor(m_context, resource, filter);
2093    }
2094
2095    /**
2096     * Returns the first ancestor folder matching the resource type.<p>
2097     *
2098     * If no folder with the requested resource type is found, null is returned.<p>
2099     *
2100     * @param resourcename the name of the resource to start (full path)
2101     * @param type the resource type of the folder to match
2102     *
2103     * @return the first ancestor folder matching the filter criteria or null if no folder was found
2104     *
2105     * @throws CmsException if something goes wrong
2106     */

2107    public CmsFolder readAncestor(String JavaDoc resourcename, int type) throws CmsException {
2108
2109        return readAncestor(resourcename, CmsResourceFilter.requireType(type));
2110    }
2111
2112    /**
2113     * Returns a file from the history.<br>
2114     *
2115     * The reading includes the file content.<p>
2116     *
2117     * @param filename the complete path of the file to be read
2118     * @param tagId the tag id of the resource
2119     *
2120     * @return the file read
2121     *
2122     * @throws CmsException if the user has not the rights to read the file, or
2123     * if the file couldn't be read.
2124     */

2125    public CmsBackupResource readBackupFile(String JavaDoc filename, int tagId) throws CmsException {
2126
2127        CmsResource resource = readResource(filename, CmsResourceFilter.ALL);
2128        return m_securityManager.readBackupFile(m_context, tagId, resource);
2129    }
2130
2131    /**
2132     * Returns a backup project.<p>
2133     *
2134     * @param tagId the tag of the backup project to be read
2135     *
2136     * @return the requested backup project
2137     *
2138     * @throws CmsException if operation was not successful
2139     */

2140    public CmsBackupProject readBackupProject(int tagId) throws CmsException {
2141
2142        return (m_securityManager.readBackupProject(m_context, tagId));
2143    }
2144
2145    /**
2146     * Reads the list of <code>{@link CmsProperty}</code> objects that belong the the given backup resource.<p>
2147     *
2148     * @param resource the backup resource to read the properties from
2149     * @return the list of <code>{@link CmsProperty}</code> objects that belong the the given backup resource
2150     *
2151     * @throws CmsException if something goes wrong
2152     */

2153    public List readBackupPropertyObjects(CmsBackupResource resource) throws CmsException {
2154
2155        return m_securityManager.readBackupPropertyObjects(m_context, resource);
2156    }
2157
2158    /**
2159     * Reads a file resource (including it's binary content) from the VFS,
2160     * using the <code>{@link CmsResourceFilter#DEFAULT}</code> filter.<p>
2161     *
2162     * In case you do not need the file content,
2163     * use <code>{@link #readResource(String)}</code> instead.<p>
2164     *
2165     * @param resourcename the name of the resource to read (full path)
2166     *
2167     * @return the file resource that was read
2168     *
2169     * @throws CmsException if the file resource could not be read for any reason
2170     *
2171     * @see #readFile(String, CmsResourceFilter)
2172     * @see #readResource(String)
2173     */

2174    public CmsFile readFile(String JavaDoc resourcename) throws CmsException {
2175
2176        return readFile(resourcename, CmsResourceFilter.DEFAULT);
2177    }
2178
2179    /**
2180     * Reads a file resource (including it's binary content) from the VFS,
2181     * using the specified resource filter.<p>
2182     *
2183     * In case you do not need the file content,
2184     * use <code>{@link #readResource(String, CmsResourceFilter)}</code> instead.<p>
2185     *
2186     * The specified filter controls what kind of resources should be "found"
2187     * during the read operation. This will depend on the application. For example,
2188     * using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently
2189     * "valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code>
2190     * will ignore the date release / date expired information of the resource.<p>
2191     *
2192     * @param resourcename the name of the resource to read (full path)
2193     * @param filter the resource filter to use while reading
2194     *
2195     * @return the file resource that was read
2196     *
2197     * @throws CmsException if the file resource could not be read for any reason
2198     *
2199     * @see #readResource(String, CmsResourceFilter)
2200     */

2201    public CmsFile readFile(String JavaDoc resourcename, CmsResourceFilter filter) throws CmsException {
2202
2203        CmsResource resource = readResource(resourcename, filter);
2204        return m_securityManager.readFile(m_context, resource, filter);
2205    }
2206
2207    /**
2208     * Reads a resource from the VFS,
2209     * using the <code>{@link CmsResourceFilter#DEFAULT}</code> filter.<p>
2210     *
2211     * @param resourcename the name of the resource to read (full path)
2212     *
2213     * @return the file resource that was read
2214     *
2215     * @throws CmsException if something goes wrong
2216     *
2217     * @deprecated use <code>{@link #readResource(String, CmsResourceFilter)}</code> instead.
2218     */

2219    public CmsResource readFileHeader(String JavaDoc resourcename) throws CmsException {
2220
2221        return readResource(resourcename, CmsResourceFilter.DEFAULT);
2222    }
2223
2224    /**
2225     * Reads a folder resource from the VFS,
2226     * using the <code>{@link CmsResourceFilter#DEFAULT}</code> filter.<p>
2227     *
2228     * @param resourcename the name of the folder resource to read (full path)
2229     *
2230     * @return the folder resource that was read
2231     *
2232     * @throws CmsException if the resource could not be read for any reason
2233     *
2234     * @see #readResource(String, CmsResourceFilter)
2235     * @see #readFolder(String, CmsResourceFilter)
2236     */

2237    public CmsFolder readFolder(String JavaDoc resourcename) throws CmsException {
2238
2239        return readFolder(resourcename, CmsResourceFilter.DEFAULT);
2240    }
2241
2242    /**
2243     * Reads a folder resource from the VFS,
2244     * using the specified resource filter.<p>
2245     *
2246     * The specified filter controls what kind of resources should be "found"
2247     * during the read operation. This will depend on the application. For example,
2248     * using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently
2249     * "valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code>
2250     * will ignore the date release / date expired information of the resource.<p>
2251     *
2252     * @param resourcename the name of the folder resource to read (full path)
2253     * @param filter the resource filter to use while reading
2254     *
2255     * @return the folder resource that was read
2256     *
2257     * @throws CmsException if the resource could not be read for any reason
2258     *
2259     * @see #readResource(String, CmsResourceFilter)
2260     */

2261    public CmsFolder readFolder(String JavaDoc resourcename, CmsResourceFilter filter) throws CmsException {
2262
2263        return m_securityManager.readFolder(m_context, addSiteRoot(resourcename), filter);
2264    }
2265
2266    /**
2267     * Reads the group of a project.<p>
2268     *
2269     * @param project the project to read the group from
2270     *
2271     * @return the group of the given project
2272     */

2273    public CmsGroup readGroup(CmsProject project) {
2274
2275        return m_securityManager.readGroup(m_context, project);
2276    }
2277
2278    /**
2279     * Reads a group based on its id.<p>
2280     *
2281     * @param groupId the id of the group to be read
2282     *
2283     * @return the group that has the provided id
2284     *
2285     * @throws CmsException if something goes wrong
2286     */

2287    public CmsGroup readGroup(CmsUUID groupId) throws CmsException {
2288
2289        return m_securityManager.readGroup(m_context, groupId);
2290    }
2291
2292    /**
2293     * Reads a group based on its name.<p>
2294     *
2295     * @param groupName the name of the group to be read
2296     *
2297     * @return the group that has the provided name
2298     *
2299     * @throws CmsException if something goes wrong
2300     */

2301    public CmsGroup readGroup(String JavaDoc groupName) throws CmsException {
2302
2303        return m_securityManager.readGroup(m_context, groupName);
2304    }
2305
2306    /**
2307     * Returns the project manager group of a project.<p>
2308     *
2309     * @param project the project
2310     *
2311     * @return the manager group of the project
2312     */

2313    public CmsGroup readManagerGroup(CmsProject project) {
2314
2315        return m_securityManager.readManagerGroup(m_context, project);
2316    }
2317
2318    /**
2319     * Reads the owner of a project.<p>
2320     *
2321     * @param project the project to read the owner from
2322     *
2323     * @return the owner of the project
2324     *
2325     * @throws CmsException if something goes wrong
2326     */

2327    public CmsUser readOwner(CmsProject project) throws CmsException {
2328
2329        return m_securityManager.readOwner(m_context, project);
2330    }
2331
2332    /**
2333     * Builds a list of resources for a given path.<p>
2334     *
2335     * @param path the requested path
2336     * @param filter a filter object (only "includeDeleted" information is used!)
2337     *
2338     * @return list of <code>{@link CmsResource}</code>s
2339     *
2340     * @throws CmsException if something goes wrong
2341     */

2342    public List readPath(String JavaDoc path, CmsResourceFilter filter) throws CmsException {
2343
2344        return m_securityManager.readPath(m_context, m_context.currentProject().getId(), addSiteRoot(path), filter);
2345    }
2346
2347    /**
2348     * Reads the project with the given id.<p>
2349     *
2350     * @param id the id of the project
2351     *
2352     * @return the project with the given id
2353     *
2354     * @throws CmsException if operation was not successful
2355     */

2356    public CmsProject readProject(int id) throws CmsException {
2357
2358        return m_securityManager.readProject(id);
2359    }
2360
2361    /**
2362     * Reads the project with the given name.<p>
2363     *
2364     * @param name the name of the project
2365     *
2366     * @return the project with the given name
2367     *
2368     * @throws CmsException if operation was not successful
2369     */

2370    public CmsProject readProject(String JavaDoc name) throws CmsException {
2371
2372        return m_securityManager.readProject(name);
2373    }
2374
2375    /**
2376     * Returns the list of all resource names that define the "view" of the given project.<p>
2377     *
2378     * @param project the project to get the project resources for
2379     *
2380     * @return the list of all resource names, as <code>{@link String}</code> objects
2381     * that define the "view" of the given project.
2382     *
2383     * @throws CmsException if something goes wrong
2384     */

2385    public List readProjectResources(CmsProject project) throws CmsException {
2386
2387        return m_securityManager.readProjectResources(m_context, project);
2388    }
2389
2390    /**
2391     * Reads all resources of a project that match a given state from the VFS.<p>
2392     *
2393     * Possible values for the <code>state</code> parameter are:<br>
2394     * <ul>
2395     * <li><code>{@link CmsResource#STATE_CHANGED}</code>: Read all "changed" resources in the project</li>
2396     * <li><code>{@link CmsResource#STATE_NEW}</code>: Read all "new" resources in the project</li>
2397     * <li><code>{@link CmsResource#STATE_DELETED}</code>: Read all "deleted" resources in the project</li>
2398     * <li><code>{@link CmsResource#STATE_KEEP}</code>: Read all resources either "changed", "new" or "deleted" in the project</li>
2399     * </ul><p>
2400     *
2401     * @param projectId the id of the project to read the file resources for
2402     * @param state the resource state to match
2403     *
2404     * @return all <code>{@link CmsResource}</code>s of a project that match a given criteria from the VFS
2405     *
2406     * @throws CmsException if something goes wrong
2407     */

2408    public List readProjectView(int projectId, int state) throws CmsException {
2409
2410        return m_securityManager.readProjectView(m_context, projectId, state);
2411    }
2412
2413    /**
2414     * Reads the (compound) values of all properties mapped to a specified resource.<p>
2415     *
2416     * @param resourcePath the resource to look up the property for
2417     *
2418     * @return a map of <code>String</code> objects representing all properties of the resource
2419     *
2420     * @throws CmsException in case there where problems reading the properties
2421     *
2422     * @deprecated use <code>{@link #readPropertyObjects(String, boolean)}</code> instead.
2423     */

2424    public Map JavaDoc readProperties(String JavaDoc resourcePath) throws CmsException {
2425
2426        CmsResource resource = readResource(resourcePath, CmsResourceFilter.ALL);
2427        List properties = m_securityManager.readPropertyObjects(m_context, resource, false);
2428        return CmsProperty.toMap(properties);
2429    }
2430
2431    /**
2432     * Reads the (compound) values of all properties mapped to a specified resource
2433     * with optional direcory upward cascading.<p>
2434     *
2435     * @param resourcePath the resource to look up the property for
2436     * @param search if <code>true</code>, the properties will also be looked up on all parent folders and the results will be merged, if <code>false</code> not (ie. normal property lookup)
2437     *
2438     * @return Map of <code>String</code> objects representing all properties of the resource
2439     *
2440     * @throws CmsException in case there where problems reading the properties
2441     *
2442     * @deprecated use <code>{@link #readPropertyObjects(String, boolean)}</code> instead.
2443     */

2444    public Map JavaDoc readProperties(String JavaDoc resourcePath, boolean search) throws CmsException {
2445
2446        CmsResource resource = readResource(resourcePath, CmsResourceFilter.ALL);
2447        List properties = m_securityManager.readPropertyObjects(m_context, resource, search);
2448        return CmsProperty.toMap(properties);
2449    }
2450
2451    /**
2452     * Reads the (compound) value of a property mapped to a specified resource.<p>
2453     *
2454     * @param resourcePath the resource to look up the property for
2455     * @param property the name of the property to look up
2456     *
2457     * @return the value of the property found, <code>null</code> if nothing was found
2458     *
2459     * @throws CmsException in case there where problems reading the property
2460     *
2461     * @see CmsProperty#getValue()
2462     *
2463     * @deprecated use <code>{@link #readPropertyObject(String, String, boolean)}</code> instead.
2464     */

2465    public String JavaDoc readProperty(String JavaDoc resourcePath, String JavaDoc property) throws CmsException {
2466
2467        CmsResource resource = readResource(resourcePath, CmsResourceFilter.ALL);
2468        CmsProperty value = m_securityManager.readPropertyObject(m_context, resource, property, false);
2469        return value.isNullProperty() ? null : value.getValue();
2470    }
2471
2472    /**
2473     * Reads the (compound) value of a property mapped to a specified resource
2474     * with optional direcory upward cascading.<p>
2475     *
2476     * @param resourcePath the resource to look up the property for
2477     * @param property the name of the property to look up
2478     * @param search if <code>true</code>, the property will be looked up on all parent folders if it is not attached to the the resource, if false not (ie. normal property lookup)
2479     *
2480     * @return the value of the property found, <code>null</code> if nothing was found
2481     *
2482     * @throws CmsException in case there where problems reading the property
2483     *
2484     * @see CmsProperty#getValue()
2485     *
2486     * @deprecated use <code>{@link #readPropertyObject(String, String, boolean)}</code> instead.
2487     */

2488    public String JavaDoc readProperty(String JavaDoc resourcePath, String JavaDoc property, boolean search) throws CmsException {
2489
2490        CmsResource resource = readResource(resourcePath, CmsResourceFilter.ALL);
2491        CmsProperty value = m_securityManager.readPropertyObject(m_context, resource, property, search);
2492        return value.isNullProperty() ? null : value.getValue();
2493    }
2494
2495    /**
2496     * Reads the (compound) value of a property mapped to a specified resource
2497     * with optional direcory upward cascading, a default value will be returned if the property
2498     * is not found on the resource (or it's parent folders in case search is set to <code>true</code>).<p>
2499     *
2500     * @param resourcePath the resource to look up the property for
2501     * @param property the name of the property to look up
2502     * @param search if <code>true</code>, the property will be looked up on all parent folders if it is not attached to the the resource, if <code>false</code> not (ie. normal property lookup)
2503     * @param propertyDefault a default value that will be returned if the property was not found on the selected resource
2504     *
2505     * @return the value of the property found, if nothing was found the value of the <code>propertyDefault</code> parameter is returned
2506     *
2507     * @throws CmsException in case there where problems reading the property
2508     *
2509     * @see CmsProperty#getValue()
2510     *
2511     * @deprecated use <code>{@link #readPropertyObject(String, String, boolean)}</code> instead.
2512     */

2513    public String JavaDoc readProperty(String JavaDoc resourcePath, String JavaDoc property, boolean search, String JavaDoc propertyDefault)
2514    throws CmsException {
2515
2516        CmsResource resource = readResource(resourcePath, CmsResourceFilter.ALL);
2517        CmsProperty value = m_securityManager.readPropertyObject(m_context, resource, property, search);
2518        return value.isNullProperty() ? propertyDefault : value.getValue();
2519    }
2520
2521    /**
2522     * Reads a property definition.<p>
2523     *
2524     * If no property definition with the given name is found,
2525     * <code>null</code> is returned.<p>
2526     *
2527     * @param name the name of the property definition to read
2528     *
2529     * @return the property definition that was read,
2530     * or <code>null</code> if there is no property definition with the given name.
2531     *
2532     * @throws CmsException if something goes wrong
2533     */

2534    public CmsPropertyDefinition readPropertyDefinition(String JavaDoc name) throws CmsException {
2535
2536        return (m_securityManager.readPropertyDefinition(m_context, name));
2537    }
2538
2539    /**
2540     * Reads a property object from a resource specified by a property name.<p>
2541     *
2542     * Returns <code>{@link CmsProperty#getNullProperty()}</code> if the property is not found.<p>
2543     *
2544     * This method is more efficient then using <code>{@link CmsObject#readPropertyObject(String, String, boolean)}</code>
2545     * if you already have an instance of the resource to look up the property from.<p>
2546     *
2547     * @param resource the resource where the property is attached to
2548     * @param property the property name
2549     * @param search if true, the property is searched on all parent folders of the resource,
2550     * if it's not found attached directly to the resource
2551     *
2552     * @return the required property, or <code>{@link CmsProperty#getNullProperty()}</code> if the property was not found
2553     *
2554     * @throws CmsException if something goes wrong
2555     */

2556    public CmsProperty readPropertyObject(CmsResource resource, String JavaDoc property, boolean search) throws CmsException {
2557
2558        return m_securityManager.readPropertyObject(m_context, resource, property, search);
2559    }
2560
2561    /**
2562     * Reads a property object from a resource specified by a property name.<p>
2563     *
2564     * Returns <code>{@link CmsProperty#getNullProperty()}</code> if the property is not found.<p>
2565     *
2566     * @param resourcePath the name of resource where the property is attached to
2567     * @param property the property name
2568     * @param search if true, the property is searched on all parent folders of the resource,
2569     * if it's not found attached directly to the resource
2570     *
2571     * @return the required property, or <code>{@link CmsProperty#getNullProperty()}</code> if the property was not found
2572     *
2573     * @throws CmsException if something goes wrong
2574     */

2575    public CmsProperty readPropertyObject(String JavaDoc resourcePath, String JavaDoc property, boolean search) throws CmsException {
2576
2577        CmsResource resource = readResource(resourcePath, CmsResourceFilter.ALL);
2578        return m_securityManager.readPropertyObject(m_context, resource, property, search);
2579    }
2580
2581    /**
2582     * Reads all property objects from a resource.<p>
2583     *
2584     * Returns an empty list if no properties are found.<p>
2585     *
2586     * This method is more efficient then using <code>{@link CmsObject#readPropertyObjects(String, boolean)}</code>
2587     * if you already have an instance of the resource to look up the property from.<p>
2588     *
2589     * If the <code>search</code> parameter is <code>true</code>, the properties of all
2590     * parent folders of the resource are also read. The results are merged with the
2591     * properties directly attached to the resource. While merging, a property
2592     * on a parent folder that has already been found will be ignored.
2593     * So e.g. if a resource has a property "Title" attached, and it's parent folder
2594     * has the same property attached but with a differrent value, the result list will
2595     * contain only the property with the value from the resource, not form the parent folder(s).<p>
2596     *
2597     * @param resource the resource where the property is mapped to
2598     * @param search if <code>true</code>, the properties of all parent folders of the resource
2599     * are merged with the resource properties.
2600     *
2601     * @return a list of <code>{@link CmsProperty}</code> objects
2602     *
2603     * @throws CmsException if something goes wrong
2604     */

2605    public List readPropertyObjects(CmsResource resource, boolean search) throws CmsException {
2606
2607        return m_securityManager.readPropertyObjects(m_context, resource, search);
2608    }
2609
2610    /**
2611     * Reads all property objects from a resource.<p>
2612     *
2613     * Returns an empty list if no properties are found.<p>
2614     *
2615     * All properties in the result List will be in frozen (read only) state, so you can't change the values.<p>
2616     *
2617     * If the <code>search</code> parameter is <code>true</code>, the properties of all
2618     * parent folders of the resource are also read. The results are merged with the
2619     * properties directly attached to the resource. While merging, a property
2620     * on a parent folder that has already been found will be ignored.
2621     * So e.g. if a resource has a property "Title" attached, and it's parent folder
2622     * has the same property attached but with a differrent value, the result list will
2623     * contain only the property with the value from the resource, not form the parent folder(s).<p>
2624     *
2625     * @param resourcePath the name of resource where the property is mapped to
2626     * @param search if <code>true</code>, the properties of all parent folders of the resource
2627     * are merged with the resource properties.
2628     *
2629     * @return a list of <code>{@link CmsProperty}</code> objects
2630     *
2631     * @throws CmsException if something goes wrong
2632     */

2633    public List readPropertyObjects(String JavaDoc resourcePath, boolean search) throws CmsException {
2634
2635        CmsResource resource = readResource(resourcePath, CmsResourceFilter.ALL);
2636        return m_securityManager.readPropertyObjects(m_context, resource, search);
2637    }
2638
2639    /**
2640     * Reads the resources that were published in a publish task for a given publish history ID.<p>
2641     *
2642     * @param publishHistoryId unique int ID to identify each publish task in the publish history
2643     *
2644     * @return a list of <code>{@link org.opencms.db.CmsPublishedResource}</code> objects
2645     *
2646     * @throws CmsException if something goes wrong
2647     */

2648    public List readPublishedResources(CmsUUID publishHistoryId) throws CmsException {
2649
2650        return m_securityManager.readPublishedResources(m_context, publishHistoryId);
2651    }
2652
2653    /**
2654     * Reads a resource from the VFS,
2655     * using the <code>{@link CmsResourceFilter#DEFAULT}</code> filter.<p>
2656     *
2657     * A resource may be of type <code>{@link CmsFile}</code> or
2658     * <code>{@link CmsFolder}</code>. In case of
2659     * a file, the resource will not contain the binary file content. Since reading
2660     * the binary content is a cost-expensive database operation, it's recommended
2661     * to work with resources if possible, and only read the file content when absolutely
2662     * required. To "upgrade" a resource to a file,
2663     * use <code>{@link CmsFile#upgrade(CmsResource, CmsObject)}</code>.<p>
2664     *
2665     * @param resourcename the name of the resource to read (full path)
2666     *
2667     * @return the resource that was read
2668     *
2669     * @throws CmsException if the resource could not be read for any reason
2670     *
2671     * @see #readFile(String)
2672     * @see #readResource(String, CmsResourceFilter)
2673     * @see CmsFile#upgrade(CmsResource, CmsObject)
2674     */

2675    public CmsResource readResource(String JavaDoc resourcename) throws CmsException {
2676
2677        return readResource(resourcename, CmsResourceFilter.DEFAULT);
2678    }
2679
2680    /**
2681     * Reads a resource from the VFS,
2682     * using the specified resource filter.<p>
2683     *
2684     * A resource may be of type <code>{@link CmsFile}</code> or
2685     * <code>{@link CmsFolder}</code>. In case of
2686     * a file, the resource will not contain the binary file content. Since reading
2687     * the binary content is a cost-expensive database operation, it's recommended
2688     * to work with resources if possible, and only read the file content when absolutly
2689     * required. To "upgrade" a resource to a file,
2690     * use <code>{@link CmsFile#upgrade(CmsResource, CmsObject)}</code>.<p>
2691     *
2692     * The specified filter controls what kind of resources should be "found"
2693     * during the read operation. This will depend on the application. For example,
2694     * using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently
2695     * "valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code>
2696     * will ignore the date release / date expired information of the resource.<p>
2697     *
2698     * @param resourcename the name of the resource to read (full path)
2699     * @param filter the resource filter to use while reading
2700     *
2701     * @return the resource that was read
2702     *
2703     * @throws CmsException if the resource could not be read for any reason
2704     *
2705     * @see #readFile(String, CmsResourceFilter)
2706     * @see #readFolder(String, CmsResourceFilter)
2707     * @see CmsFile#upgrade(CmsResource, CmsObject)
2708     */

2709    public CmsResource readResource(String JavaDoc resourcename, CmsResourceFilter filter) throws CmsException {
2710
2711        return m_securityManager.readResource(m_context, addSiteRoot(resourcename), filter);
2712    }
2713
2714    /**
2715     * Reads all resources below the given path matching the filter criteria,
2716     * including the full tree below the path.<p>
2717     *
2718     * @param resourcename the parent path to read the resources from
2719     * @param filter the filter
2720     *
2721     * @return a list of <code>{@link CmsResource}</code> objects matching the filter criteria
2722     *
2723     * @throws CmsException if something goes wrong
2724     *
2725     * @see #readResources(String, CmsResourceFilter, boolean)
2726     */

2727    public List readResources(String JavaDoc resourcename, CmsResourceFilter filter) throws CmsException {
2728
2729        return readResources(resourcename, filter, true);
2730    }
2731
2732    /**
2733     * Reads all resources below the given path matching the filter criteria,
2734     * including the full tree below the path only in case the <code>readTree</code>
2735     * parameter is <code>true</code>.<p>
2736     *
2737     * @param resourcename the parent path to read the resources from
2738     * @param filter the filter
2739     * @param readTree <code>true</code> to read all subresources
2740     *
2741     * @return a list of <code>{@link CmsResource}</code> objects matching the filter criteria
2742     *
2743     * @throws CmsException if something goes wrong
2744     */

2745    public List readResources(String JavaDoc resourcename, CmsResourceFilter filter, boolean readTree) throws CmsException {
2746
2747        CmsResource resource = readResource(resourcename, CmsResourceFilter.ALL);
2748        return m_securityManager.readResources(m_context, resource, filter, readTree);
2749    }
2750
2751    /**
2752     * Reads all resources that have a value set for the specified property.<p>
2753     *
2754     * Both individual and shared properties of a resource are checked.<p>
2755     *
2756     * @param propertyDefinition the name of the property to check for
2757     *
2758     * @return a list of all <code>{@link CmsResource}</code> objects
2759     * that have a value set for the specified property.
2760     *
2761     * @throws CmsException if something goes wrong
2762     */

2763    public List readResourcesWithProperty(String JavaDoc propertyDefinition) throws CmsException {
2764
2765        return m_securityManager.readResourcesWithProperty(m_context, "/", propertyDefinition);
2766    }
2767
2768    /**
2769     * Reads all resources that have a value set for the specified property in the given path.<p>
2770     *
2771     * Both individual and shared properties of a resource are checked.<p>
2772     *
2773     * @param path the folder to get the resources with the property from
2774     * @param propertyDefinition the name of the property to check for
2775     *
2776     * @return all <code>{@link CmsResource}</code> objects
2777     * that have a value set for the specified property in the given path.
2778     *
2779     * @throws CmsException if something goes wrong
2780     */

2781    public List readResourcesWithProperty(String JavaDoc path, String JavaDoc propertyDefinition) throws CmsException {
2782
2783        return m_securityManager.readResourcesWithProperty(m_context, addSiteRoot(path), propertyDefinition);
2784    }
2785
2786    /**
2787     * Reads all resources that have a value (containing the specified value) set
2788     * for the specified property in the given path.<p>
2789     *
2790     * Both individual and shared properties of a resource are checked.<p>
2791     *
2792     * @param path the folder to get the resources with the property from
2793     * @param propertyDefinition the name of the property to check for
2794     * @param value the string to search in the value of the property
2795     *
2796     * @return all <code>{@link CmsResource}</code> objects
2797     * that have a value set for the specified property in the given path.
2798     *
2799     * @throws CmsException if something goes wrong
2800     */

2801    public List readResourcesWithProperty(String JavaDoc path, String JavaDoc propertyDefinition, String JavaDoc value) throws CmsException {
2802
2803        return m_securityManager.readResourcesWithProperty(m_context, addSiteRoot(path), propertyDefinition, value);
2804    }
2805
2806    /**
2807     * Returns a set of principals that are responsible for a specific resource.<p>
2808     *
2809     * @param resource the resource to get the responsible principals from
2810     *
2811     * @return the set of principals that are responsible for a specific resource
2812     *
2813     * @throws CmsException if something goes wrong
2814     */

2815    public Set readResponsiblePrincipals(CmsResource resource) throws CmsException {
2816
2817        return m_securityManager.readResponsiblePrincipals(m_context, resource);
2818    }
2819
2820    /**
2821     * Returns a set of users that are responsible for a specific resource.<p>
2822     *
2823     * @param resource the resource to get the responsible users from
2824     *
2825     * @return the set of users that are responsible for a specific resource
2826     *
2827     * @throws CmsException if something goes wrong
2828     */

2829    public Set readResponsibleUsers(CmsResource resource) throws CmsException {
2830
2831        return m_securityManager.readResponsibleUsers(m_context, resource);
2832    }
2833
2834    /**
2835     * Returns a list of all siblings of the specified resource,
2836     * the specified resource being always part of the result set.<p>
2837     *
2838     * @param resourcename the name of the specified resource
2839     * @param filter a resource filter
2840     *
2841     * @return a list of <code>{@link CmsResource}</code>s that
2842     * are siblings to the specified resource,
2843     * including the specified resource itself.
2844     *
2845     * @throws CmsException if something goes wrong
2846     */

2847    public List readSiblings(String JavaDoc resourcename, CmsResourceFilter filter) throws CmsException {
2848
2849        CmsResource resource = readResource(resourcename, filter);
2850        return m_securityManager.readSiblings(m_context, resource, filter);
2851    }
2852
2853    /**
2854     * Returns the parameters of a resource in the list of all published template resources.<p>
2855     *
2856     * @param rfsName the rfs name of the resource
2857     *
2858     * @return the parameter string of the requested resource
2859     *
2860     * @throws CmsException if something goes wrong
2861     */

2862    public String JavaDoc readStaticExportPublishedResourceParameters(String JavaDoc rfsName) throws CmsException {
2863
2864        return m_securityManager.readStaticExportPublishedResourceParameters(m_context, rfsName);
2865    }
2866
2867    /**
2868     * Returns a list of all template resources which must be processed during a static export.<p>
2869     *
2870     * @param parameterResources flag for reading resources with parameters (1) or without (0)
2871     *
2872     * @param timestamp a timestamp for reading the data from the db
2873     *
2874     * @return a list of template resources as <code>{@link String}</code> objects
2875     *
2876     * @throws CmsException if something goes wrong
2877     */

2878    public List readStaticExportResources(int parameterResources, long timestamp) throws CmsException {
2879
2880        return m_securityManager.readStaticExportResources(m_context, parameterResources, timestamp);
2881    }
2882
2883    /**
2884     * Reads a user based on its id.<p>
2885     *
2886     * @param userId the id of the user to be read
2887     *
2888     * @return the user with the given id
2889     *
2890     * @throws CmsException if something goes wrong
2891     */

2892    public CmsUser readUser(CmsUUID userId) throws CmsException {
2893
2894        return m_securityManager.readUser(m_context, userId);
2895    }
2896
2897    /**
2898     * Reads a user based on its name.<p>
2899     *
2900     * @param username the name of the user to be read
2901     *
2902     * @return the user with the given name
2903     *
2904     * @throws CmsException if somthing goes wrong
2905     */

2906    public CmsUser readUser(String JavaDoc username) throws CmsException {
2907
2908        return m_securityManager.readUser(username);
2909    }
2910
2911    /**
2912     * Returns a user given its name and type.
2913     *
2914     * @param username the name of the user to be returned
2915     * @param type the type of the user
2916     *
2917     * @return the user with the given name and type
2918     *
2919     * @throws CmsException if operation was not successful
2920     */

2921    public CmsUser readUser(String JavaDoc username, int type) throws CmsException {
2922
2923        return m_securityManager.readUser(m_context, username, type);
2924    }
2925
2926    /**
2927     * Returns a user, if the password is correct.<p>
2928     *
2929     * If the user/pwd pair is not valid a <code>{@link CmsException}</code> is thrown.<p>
2930     *
2931     * @param username the name of the user to be returned
2932     * @param password the password of the user to be returned
2933     *
2934     * @return the validated user
2935     *
2936     * @throws CmsException if operation was not successful
2937     */

2938    public CmsUser readUser(String JavaDoc username, String JavaDoc password) throws CmsException {
2939
2940        return m_securityManager.readUser(m_context, username, password);
2941    }
2942
2943    /**
2944     * Returns a webuser.<p>
2945     *
2946     * @param username the username of the webuser that is to be read
2947     *
2948     * @return the webuser
2949     *
2950     * @throws CmsException if operation was not succesful
2951     */

2952    public CmsUser readWebUser(String JavaDoc username) throws CmsException {
2953
2954        return m_securityManager.readWebUser(m_context, username);
2955    }
2956
2957    /**
2958     * Returns a web user if the password for the user is correct.<p>
2959     *
2960     * If the user/pwd pair is not valid a <code>{@link CmsException}</code> is thrown.<p>
2961     *
2962     * @param username the username of the user that is to be read
2963     * @param password the password of the user that is to be read
2964     *
2965     * @return a web user
2966     *
2967     * @throws CmsException if something goes wrong
2968     */

2969    public CmsUser readWebUser(String JavaDoc username, String JavaDoc password) throws CmsException {
2970
2971        return m_securityManager.readWebUser(m_context, username, password);
2972    }
2973
2974    /**
2975     * Removes a resource from the current project of the user.<p>
2976     *
2977     * This is used to reduce the current users project with the
2978     * specified resource, in case that the resource is already part of the project.
2979     * The resource is not really removed like in a regular copy operation,
2980     * it is in fact only "disabled" in the current users project.<p>
2981     *
2982     * @param resourcename the name of the resource to remove to the current project (full path)
2983     *
2984     * @throws CmsException if something goes wrong
2985     */

2986    public void removeResourceFromProject(String JavaDoc resourcename) throws CmsException {
2987
2988        CmsResource resource = readResource(resourcename, CmsResourceFilter.ALL);
2989        getResourceType(resource.getTypeId()).removeResourceFromProject(this, m_securityManager, resource);
2990    }
2991
2992    /**
2993     * Removes a user from a group.<p>
2994     *
2995     * @param username the name of the user that is to be removed from the group
2996     * @param groupname the name of the group
2997     *
2998     * @throws CmsException if operation was not successful
2999     */

3000    public void removeUserFromGroup(String JavaDoc username, String JavaDoc groupname) throws CmsException {
3001
3002        m_securityManager.removeUserFromGroup(m_context, username, groupname);
3003    }
3004
3005    /**
3006     * Renames a resource to the given destination name,
3007     * this is identical to a <code>move</code> operation.<p>
3008     *
3009     * @param source the name of the resource to rename (full path)
3010     * @param destination the new resource name (full path)
3011     *
3012     * @throws CmsException if something goes wrong
3013     *
3014     * @see #moveResource(String, String)
3015     */

3016    public void renameResource(String JavaDoc source, String JavaDoc destination) throws CmsException {
3017
3018        moveResource(source, destination);
3019    }
3020
3021    /**
3022     * Replaces the content, type and properties of a resource.<p>
3023     *
3024     * @param resourcename the name of the resource to replace (full path)
3025     * @param type the new type of the resource
3026     * @param content the new content of the resource
3027     * @param properties the new properties of the resource
3028     *
3029     * @throws CmsException if something goes wrong
3030     */

3031    public void replaceResource(String JavaDoc resourcename, int type, byte[] content, List properties) throws CmsException {
3032
3033        CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION);
3034        getResourceType(resource.getTypeId()).replaceResource(
3035            this,
3036            m_securityManager,
3037            resource,
3038            type,
3039            content,
3040            properties);
3041    }
3042
3043    /**
3044     * Restores a file in the current project with a version from the backup archive.<p>
3045     *
3046     * @param resourcename the name of the resource to restore from the archive (full path)
3047     * @param tagId the desired tag ID of the resource
3048     *
3049     * @throws CmsException if something goes wrong
3050     */

3051    public void restoreResourceBackup(String JavaDoc resourcename, int tagId) throws CmsException {
3052
3053        CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION);
3054        getResourceType(resource.getTypeId()).restoreResourceBackup(this, m_securityManager, resource, tagId);
3055    }
3056
3057    /**
3058     * Removes an access control entry of a griven principal from a given resource.<p>
3059     *
3060     * @param resourceName name of the resource
3061     * @param principalType the type of the principal (currently group or user)
3062     * @param principalName the name of the principal
3063     *
3064     * @throws CmsException if something goes wrong
3065     */

3066    public void rmacc(String JavaDoc resourceName, String JavaDoc principalType, String JavaDoc principalName) throws CmsException {
3067
3068        CmsResource res = readResource(resourceName, CmsResourceFilter.ALL);
3069
3070        if (CmsUUID.isValidUUID(principalName)) {
3071            // principal name is in fact a UUID, probably the user was already deleted
3072
m_securityManager.removeAccessControlEntry(m_context, res, new CmsUUID(principalName));
3073        } else {
3074            // principal name not a UUID, assume this is a normal name
3075
I_CmsPrincipal principal = CmsPrincipal.readPrincipal(this, principalType, principalName);
3076            m_securityManager.removeAccessControlEntry(m_context, res, principal.getId());
3077        }
3078    }
3079
3080    /**
3081     * Changes the "expire" date of a resource.<p>
3082     *
3083     * @param resourcename the name of the resource to change (full path)
3084     * @param dateExpired the new expire date of the changed resource
3085     * @param recursive if this operation is to be applied recursivly to all resources in a folder
3086     *
3087     * @throws CmsException if something goes wrong
3088     */

3089    public void setDateExpired(String JavaDoc resourcename, long dateExpired, boolean recursive) throws CmsException {
3090
3091        CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION);
3092        getResourceType(resource.getTypeId()).setDateExpired(this, m_securityManager, resource, dateExpired, recursive);
3093    }
3094
3095    /**
3096     * Changes the "last modified" timestamp of a resource.<p>
3097     *
3098     * @param resourcename the name of the resource to change (full path)
3099     * @param dateLastModified timestamp the new timestamp of the changed resource
3100     * @param recursive if this operation is to be applied recursivly to all resources in a folder
3101     *
3102     * @throws CmsException if something goes wrong
3103     */

3104    public void setDateLastModified(String JavaDoc resourcename, long dateLastModified, boolean recursive) throws CmsException {
3105
3106        CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION);
3107        getResourceType(resource.getTypeId()).setDateLastModified(
3108            this,
3109            m_securityManager,
3110            resource,
3111            dateLastModified,
3112            recursive);
3113    }
3114
3115    /**
3116     * Changes the "release" date of a resource.<p>
3117     *
3118     * @param resourcename the name of the resource to change (full path)
3119     * @param dateReleased the new release date of the changed resource
3120     * @param recursive if this operation is to be applied recursivly to all resources in a folder
3121     *
3122     * @throws CmsException if something goes wrong
3123     */

3124    public void setDateReleased(String JavaDoc resourcename, long dateReleased, boolean recursive) throws CmsException {
3125
3126        CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION);
3127        getResourceType(resource.getTypeId()).setDateReleased(
3128            this,
3129            m_securityManager,
3130            resource,
3131            dateReleased,
3132            recursive);
3133    }
3134
3135    /**
3136     * Sets a new parent-group for an already existing group.<p>
3137     *
3138     * @param groupName the name of the group that should be updated
3139     * @param parentGroupName the name of the parent group to set,
3140     * or <code>null</code> if the parent
3141     * group should be deleted.
3142     *
3143     * @throws CmsException if operation was not successfull
3144     */

3145    public void setParentGroup(String JavaDoc groupName, String JavaDoc parentGroupName) throws CmsException {
3146
3147        m_securityManager.setParentGroup(m_context, groupName, parentGroupName);
3148    }
3149
3150    /**
3151     * Sets the password for a user.<p>
3152     *
3153     * @param username the name of the user
3154     * @param newPassword the new password
3155     *
3156     * @throws CmsException if operation was not successful
3157     */

3158    public void setPassword(String JavaDoc username, String JavaDoc newPassword) throws CmsException {
3159
3160        m_securityManager.setPassword(m_context, username, newPassword);
3161    }
3162
3163    /**
3164     * Sets the password for a specified user.<p>
3165     *
3166     * @param username the name of the user
3167     * @param oldPassword the old password
3168     * @param newPassword the new password
3169     *
3170     * @throws CmsException if the user data could not be read from the database
3171     */

3172    public void setPassword(String JavaDoc username, String JavaDoc oldPassword, String JavaDoc newPassword) throws CmsException {
3173
3174        m_securityManager.resetPassword(m_context, username, oldPassword, newPassword);
3175    }
3176
3177    /**
3178     * Changes the timestamp information of a resource.<p>
3179     *
3180     * This method is used to set the "last modified" date
3181     * of a resource, the "release" date of a resource,
3182     * and also the "expire" date of a resource.<p>
3183     *
3184     * @param resourcename the name of the resource to change (full path)
3185     * @param dateLastModified timestamp the new timestamp of the changed resource
3186     * @param dateReleased the new release date of the changed resource,
3187     * set it to <code>{@link CmsResource#TOUCH_DATE_UNCHANGED}</code> to keep it unchanged.
3188     * @param dateExpired the new expire date of the changed resource.
3189     * set it to <code>{@link CmsResource#TOUCH_DATE_UNCHANGED}</code> to keep it unchanged.
3190     * @param recursive if this operation is to be applied recursivly to all resources in a folder
3191     *
3192     * @deprecated use <code>{@link #setDateLastModified(String, long, boolean)}</code>,
3193     * <code>{@link #setDateReleased(String, long, boolean)}</code> or
3194     * <code>{@link #setDateExpired(String, long, boolean)}</code> instead
3195     *
3196     * @throws CmsException if something goes wrong
3197     */

3198    public void touch(String JavaDoc resourcename, long dateLastModified, long dateReleased, long dateExpired, boolean recursive)
3199    throws CmsException {
3200
3201        if (dateReleased != CmsResource.TOUCH_DATE_UNCHANGED) {
3202            setDateReleased(resourcename, dateReleased, recursive);
3203        }
3204        if (dateExpired != CmsResource.TOUCH_DATE_UNCHANGED) {
3205            setDateExpired(resourcename, dateExpired, recursive);
3206        }
3207        if (dateLastModified != CmsResource.TOUCH_DATE_UNCHANGED) {
3208            setDateLastModified(resourcename, dateLastModified, recursive);
3209        }
3210    }
3211
3212    /**
3213     * Undeletes a resource (this is the same operation as "undo changes").<p>
3214     *
3215     * Only resources that have already been published once can be undeleted,
3216     * if a "new" resource is deleted it can not be undeleted.<p>
3217     *
3218     * Internally, this method undos all changes to a resource by restoring
3219     * the version from the online project, that is to the state of last
3220     * publishing.<p>
3221     *
3222     * @param resourcename the name of the resource to undelete (full path)
3223     *
3224     * @throws CmsException if something goes wrong
3225     *
3226     * @see CmsObject#undoChanges(String, boolean)
3227     */

3228    public void undeleteResource(String JavaDoc resourcename) throws CmsException {
3229
3230        undoChanges(resourcename, true);
3231    }
3232
3233    /**
3234     * Undos all changes to a resource by restoring the version from the
3235     * online project to the current offline project.<p>
3236     *
3237     * @param resourcename the name of the resource to undo the changes for (full path)
3238     * @param recursive if this operation is to be applied recursivly to all resources in a folder
3239     *
3240     * @throws CmsException if something goes wrong
3241     */

3242    public void undoChanges(String JavaDoc resourcename, boolean recursive) throws CmsException {
3243
3244        CmsResource resource = readResource(resourcename, CmsResourceFilter.ALL);
3245        getResourceType(resource.getTypeId()).undoChanges(this, m_securityManager, resource, recursive);
3246    }
3247
3248    /**
3249     * Unlocks all resources of a project.
3250     *
3251     * @param id the id of the project to be unlocked
3252     *
3253     * @throws CmsException if operation was not successful
3254     */

3255    public void unlockProject(int id) throws CmsException {
3256
3257        m_securityManager.unlockProject(m_context, id);
3258    }
3259
3260    /**
3261     * Unlocks a resource.<p>
3262     *
3263     * @param resourcename the name of the resource to unlock (full path)
3264     *
3265     * @throws CmsException if something goes wrong
3266     */

3267    public void unlockResource(String JavaDoc resourcename) throws CmsException {
3268
3269        CmsResource resource = readResource(resourcename, CmsResourceFilter.ALL);
3270        getResourceType(resource.getTypeId()).unlockResource(this, m_securityManager, resource);
3271    }
3272
3273    /**
3274     * Tests if a user is member of the given group.<p>
3275     *
3276     * @param username the name of the user to test
3277     * @param groupname the name of the group to test
3278     *
3279     * @return <code>true</code>, if the user is in the group; or <code>false</code> otherwise
3280     *
3281     * @throws CmsException if operation was not successful
3282     */

3283    public boolean userInGroup(String JavaDoc username, String JavaDoc groupname) throws CmsException {
3284
3285        return (m_securityManager.userInGroup(m_context, username, groupname));
3286    }
3287
3288    /**
3289     * Validates the HTML links in the unpublished files of the specified
3290     * publish list, if a file resource type implements the interface
3291     * <code>{@link org.opencms.validation.I_CmsXmlDocumentLinkValidatable}</code>.<p>
3292     *
3293     * @param publishList an OpenCms publish list
3294     * @param report a report to write the messages to
3295     *
3296     * @return a map with lists of invalid links (<code>String</code> objects) keyed by resource names
3297     *
3298     * @throws Exception if something goes wrong
3299     *
3300     * @see org.opencms.validation.I_CmsXmlDocumentLinkValidatable
3301     */

3302    public Map JavaDoc validateHtmlLinks(CmsPublishList publishList, I_CmsReport report) throws Exception JavaDoc {
3303
3304        return m_securityManager.validateHtmlLinks(this, publishList, report);
3305    }
3306
3307    /**
3308     * This method checks if a new password follows the rules for
3309     * new passwords, which are defined by a Class implementing the
3310     * <code>{@link org.opencms.security.I_CmsPasswordHandler}</code>
3311     * interface and configured in the opencms.properties file.<p>
3312     *
3313     * If this method throws no exception the password is valid.<p>
3314     *
3315     * @param password the new password that has to be checked
3316     *
3317     * @throws CmsSecurityException if the password is not valid
3318     */

3319    public void validatePassword(String JavaDoc password) throws CmsSecurityException {
3320
3321        m_securityManager.validatePassword(password);
3322    }
3323
3324    /**
3325     * Writes a resource to the OpenCms VFS, including it's content.<p>
3326     *
3327     * Applies only to resources of type <code>{@link CmsFile}</code>
3328     * i.e. resources that have a binary content attached.<p>
3329     *
3330     * Certain resource types might apply content validation or transformation rules
3331     * before the resource is actually written to the VFS. The returned result
3332     * might therefore be a modified version from the provided original.<p>
3333     *
3334     * @param resource the resource to write
3335     *
3336     * @return the written resource (may have been modified)
3337     *
3338     * @throws CmsException if something goes wrong
3339     */

3340    public CmsFile writeFile(CmsFile resource) throws CmsException {
3341
3342        return getResourceType(resource.getTypeId()).writeFile(this, m_securityManager, resource);
3343    }
3344
3345    /**
3346     * Writes a file-header.<p>
3347     *
3348     * @param file the file to write
3349     *
3350     * @throws CmsException if resourcetype is set to folder, or
3351     * if the user has not the rights to write the file header.
3352     */

3353    public void writeFileHeader(CmsFile file) throws CmsException {
3354
3355        m_securityManager.writeResource(m_context, file);
3356    }
3357
3358    /**
3359     * Writes an already existing group.<p>
3360     *
3361     * The group id has to be a valid OpenCms group id.<br>
3362     *
3363     * The group with the given id will be completely overriden
3364     * by the given data.<p>
3365     *
3366     * @param group the group that should be written
3367     *
3368     * @throws CmsException if operation was not successful
3369     */

3370    public void writeGroup(CmsGroup group) throws CmsException {
3371
3372        m_securityManager.writeGroup(m_context, group);
3373    }
3374
3375    /**
3376     * Writes an already existing project.<p>
3377     *
3378     * The project id has to be a valid OpenCms project id.<br>
3379     *
3380     * The project with the given id will be completely overriden
3381     * by the given data.<p>
3382     *
3383     * @param project the project that should be written
3384     *
3385     * @throws CmsException if operation was not successful
3386     */

3387    public void writeProject(CmsProject project) throws CmsException {
3388
3389        m_securityManager.writeProject(m_context, project);
3390    }
3391
3392    /**
3393     * Writes a couple of properties as structure values for a file or folder.
3394     *
3395     * @param resourceName the resource-name of which the Property has to be set
3396     * @param properties a Hashtable with property-definitions and property values as Strings
3397     *
3398     * @throws CmsException if operation was not successful
3399     *
3400     * @deprecated use <code>{@link #writePropertyObjects(String, List)}</code> instead.
3401     */

3402    public void writeProperties(String JavaDoc resourceName, Map JavaDoc properties) throws CmsException {
3403
3404        writePropertyObjects(resourceName, CmsProperty.toList(properties));
3405    }
3406
3407    /**
3408     * Writes a couple of Properties for a file or folder.
3409     *
3410     * @param name the resource-name of which the Property has to be set
3411     * @param properties a Hashtable with property-definitions and property values as Strings
3412     * @param addDefinition flag to indicate if unknown definitions should be added
3413     *
3414     * @throws CmsException if operation was not successful
3415     *
3416     * @deprecated use <code>{@link #writePropertyObjects(String, List)}</code> instead.
3417     */

3418    public void writeProperties(String JavaDoc name, Map JavaDoc properties, boolean addDefinition) throws CmsException {
3419
3420        writePropertyObjects(name, CmsProperty.setAutoCreatePropertyDefinitions(
3421            CmsProperty.toList(properties),
3422            addDefinition));
3423    }
3424
3425    /**
3426     * Writes a property as a structure value for a file or folder.<p>
3427     *
3428     * @param resourceName the resource-name for which the property will be set
3429     * @param key the property definition name
3430     * @param value the value for the property to be set
3431     *
3432     * @throws CmsException if operation was not successful
3433     *
3434     * @deprecated use <code>{@link #writePropertyObject(String, CmsProperty)}</code> instead.
3435     */

3436    public void writeProperty(String JavaDoc resourceName, String JavaDoc key, String JavaDoc value) throws CmsException {
3437
3438        CmsProperty property = new CmsProperty();
3439        property.setName(key);
3440        property.setStructureValue(value);
3441
3442        writePropertyObject(resourceName, property);
3443    }
3444
3445    /**
3446     * Writes a property for a file or folder.<p>
3447     *
3448     * @param resourcename the resource-name for which the property will be set
3449     * @param key the property-definition name
3450     * @param value the value for the property to be set
3451     * @param addDefinition flag to indicate if unknown definitions should be added
3452     *
3453     * @throws CmsException if operation was not successful
3454     *
3455     * @deprecated use <code>{@link #writePropertyObject(String, CmsProperty)}</code> instead.
3456     */

3457    public void writeProperty(String JavaDoc resourcename, String JavaDoc key, String JavaDoc value, boolean addDefinition) throws CmsException {
3458
3459        CmsProperty property = new CmsProperty();
3460        property.setName(key);
3461        property.setStructureValue(value);
3462        property.setAutoCreatePropertyDefinition(addDefinition);
3463
3464        writePropertyObject(resourcename, property);
3465    }
3466
3467    /**
3468     * Writes a property for a specified resource.<p>
3469     *
3470     * @param resourcename the name of resource with complete path
3471     * @param property the property to write
3472     *
3473     * @throws CmsException if something goes wrong
3474     */

3475    public void writePropertyObject(String JavaDoc resourcename, CmsProperty property) throws CmsException {
3476
3477        CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION);
3478        getResourceType(resource.getTypeId()).writePropertyObject(this, m_securityManager, resource, property);
3479    }
3480
3481    /**
3482     * Writes a list of properties for a specified resource.<p>
3483     *
3484     * Code calling this method has to ensure that the no properties
3485     * <code>a, b</code> are contained in the specified list so that <code>a.equals(b)</code>,
3486     * otherwise an exception is thrown.<p>
3487     *
3488     * @param resourcename the name of resource with complete path
3489     * @param properties the list of properties to write
3490     *
3491     * @throws CmsException if something goes wrong
3492     */

3493    public void writePropertyObjects(String JavaDoc resourcename, List properties) throws CmsException {
3494
3495        CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION);
3496        getResourceType(resource.getTypeId()).writePropertyObjects(this, m_securityManager, resource, properties);
3497    }
3498
3499    /**
3500     * Writes a published resource entry.<p>
3501     *
3502     * This is done during static export.<p>
3503     *
3504     * @param resourceName The name of the resource to be added to the static export
3505     * @param linkType the type of resource exported (0= non-paramter, 1=parameter)
3506     * @param linkParameter the parameters added to the resource
3507     * @param timestamp a timestamp for writing the data into the db
3508     *
3509     * @throws CmsException if something goes wrong
3510     */

3511    public void writeStaticExportPublishedResource(
3512        String JavaDoc resourceName,
3513        int linkType,
3514        String JavaDoc linkParameter,
3515        long timestamp) throws CmsException {
3516
3517        m_securityManager.writeStaticExportPublishedResource(
3518            m_context,
3519            resourceName,
3520            linkType,
3521            linkParameter,
3522            timestamp);
3523    }
3524
3525    /**
3526     * Updates the user information. <p>
3527     *
3528     * The user id has to be a valid OpenCms user id.<br>
3529     *
3530     * The user with the given id will be completely overriden
3531     * by the given data.<p>
3532     *
3533     * @param user the user to be written
3534     *
3535     * @throws CmsException if operation was not successful
3536     */

3537    public void writeUser(CmsUser user) throws CmsException {
3538
3539        m_securityManager.writeUser(m_context, user);
3540    }
3541
3542    /**
3543     * Updates the user information of a web user.<br>
3544     *
3545     * Only a web user can be updated this way.<p>
3546     *
3547     * The user id has to be a valid OpenCms user id.<br>
3548     *
3549     * The user with the given id will be completely overriden
3550     * by the given data.<p>
3551     *
3552     * @param user the user to be written
3553     *
3554     * @throws CmsException if operation was not successful
3555     */

3556    public void writeWebUser(CmsUser user) throws CmsException {
3557
3558        m_securityManager.writeWebUser(m_context, user);
3559    }
3560
3561    /**
3562     * Convenience method to add the site root from the current user's
3563     * request context to the given resource name.<p>
3564     *
3565     * @param resourcename the resource name
3566     *
3567     * @return the resource name with the site root added
3568     *
3569     * @see CmsRequestContext#addSiteRoot(String)
3570     */

3571    private String JavaDoc addSiteRoot(String JavaDoc resourcename) {
3572
3573        return m_context.addSiteRoot(resourcename);
3574    }
3575
3576    /**
3577     * Notify all event listeners that a particular event has occurred.<p>
3578     *
3579     * The event will be given to all registered <code>{@link I_CmsEventListener}</code>s.<p>
3580     *
3581     * @param type the type of the event
3582     * @param data a data object that contains data used by the event listeners
3583     *
3584     * @see OpenCms#addCmsEventListener(I_CmsEventListener)
3585     * @see OpenCms#addCmsEventListener(I_CmsEventListener, int[])
3586     */

3587    private void fireEvent(int type, Object JavaDoc data) {
3588
3589        OpenCms.fireCmsEvent(type, Collections.singletonMap("data", data));
3590    }
3591
3592    /**
3593     * Convenience method to return the initialized resource type
3594     * instance for the given id.<p>
3595     *
3596     * @param resourceType the id of the resource type to get
3597     *
3598     * @return the initialized resource type instance for the given id
3599     *
3600     * @throws CmsException if something goes wrong
3601     *
3602     * @see org.opencms.loader.CmsResourceManager#getResourceType(int)
3603     */

3604    private I_CmsResourceType getResourceType(int resourceType) throws CmsException {
3605
3606        return OpenCms.getResourceManager().getResourceType(resourceType);
3607    }
3608
3609    /**
3610     * Initializes this <code>{@link CmsObject}</code> with the provided user context and database connection.<p>
3611     *
3612     * @param securityManager the security manager
3613     * @param context the request context that contains the user authentification
3614     */

3615    private void init(CmsSecurityManager securityManager, CmsRequestContext context) {
3616
3617        m_securityManager = securityManager;
3618        m_context = context;
3619    }
3620}
Popular Tags