Source Code Cross Referenced for CmsObject.java in  » Content-Management-System » opencms » org » opencms » file » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Content Management System » opencms » org.opencms.file 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * File   : $Source: /usr/local/cvs/opencms/src/org/opencms/file/CmsObject.java,v $
0003:         * Date   : $Date: 2008-02-27 12:05:38 $
0004:         * Version: $Revision: 1.158 $
0005:         *
0006:         * This library is part of OpenCms -
0007:         * the Open Source Content Management System
0008:         *
0009:         * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
0010:         *
0011:         * This library is free software; you can redistribute it and/or
0012:         * modify it under the terms of the GNU Lesser General Public
0013:         * License as published by the Free Software Foundation; either
0014:         * version 2.1 of the License, or (at your option) any later version.
0015:         *
0016:         * This library is distributed in the hope that it will be useful,
0017:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
0018:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0019:         * Lesser General Public License for more details.
0020:         *
0021:         * For further information about Alkacon Software GmbH, please see the
0022:         * company website: http://www.alkacon.com
0023:         *
0024:         * For further information about OpenCms, please see the
0025:         * project website: http://www.opencms.org
0026:         * 
0027:         * You should have received a copy of the GNU Lesser General Public
0028:         * License along with this library; if not, write to the Free Software
0029:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
0030:         */
0031:
0032:        package org.opencms.file;
0033:
0034:        import org.opencms.db.CmsDbEntryNotFoundException;
0035:        import org.opencms.db.CmsPublishList;
0036:        import org.opencms.db.CmsResourceState;
0037:        import org.opencms.db.CmsSecurityManager;
0038:        import org.opencms.db.CmsUserSettings;
0039:        import org.opencms.file.history.CmsHistoryPrincipal;
0040:        import org.opencms.file.history.CmsHistoryProject;
0041:        import org.opencms.file.history.I_CmsHistoryResource;
0042:        import org.opencms.file.types.I_CmsResourceType;
0043:        import org.opencms.lock.CmsLock;
0044:        import org.opencms.lock.CmsLockFilter;
0045:        import org.opencms.lock.CmsLockType;
0046:        import org.opencms.main.CmsException;
0047:        import org.opencms.main.CmsIllegalArgumentException;
0048:        import org.opencms.main.I_CmsEventListener;
0049:        import org.opencms.main.OpenCms;
0050:        import org.opencms.relations.CmsRelationFilter;
0051:        import org.opencms.relations.CmsRelationType;
0052:        import org.opencms.report.CmsShellReport;
0053:        import org.opencms.report.I_CmsReport;
0054:        import org.opencms.security.CmsAccessControlEntry;
0055:        import org.opencms.security.CmsAccessControlList;
0056:        import org.opencms.security.CmsOrganizationalUnit;
0057:        import org.opencms.security.CmsPermissionSet;
0058:        import org.opencms.security.CmsPrincipal;
0059:        import org.opencms.security.CmsRole;
0060:        import org.opencms.security.CmsRoleViolationException;
0061:        import org.opencms.security.CmsSecurityException;
0062:        import org.opencms.security.I_CmsPermissionHandler;
0063:        import org.opencms.security.I_CmsPrincipal;
0064:        import org.opencms.util.CmsUUID;
0065:        import org.opencms.workplace.CmsWorkplace;
0066:
0067:        import java.util.Collections;
0068:        import java.util.HashMap;
0069:        import java.util.List;
0070:        import java.util.Map;
0071:        import java.util.Set;
0072:
0073:        /**
0074:         * This pivotal class provides all authorized access to the OpenCms VFS resources.<p>
0075:         * 
0076:         * It encapsulates user identification and permissions.
0077:         * Think of it as an initialized "shell" to access the OpenCms VFS.
0078:         * Every call to a method here will be checked for user permissions
0079:         * according to the <code>{@link org.opencms.file.CmsRequestContext}</code> this CmsObject instance was created with.<p>
0080:         * 
0081:         * From a JSP page running in OpenCms, use <code>{@link org.opencms.jsp.CmsJspBean#getCmsObject()}</code> to gain 
0082:         * access to the current users CmsObject. Usually this is done with a <code>{@link org.opencms.jsp.CmsJspActionElement}</code>.<p>
0083:         * 
0084:         * To generate a new instance of this class in your application, use 
0085:         * <code>{@link org.opencms.main.OpenCms#initCmsObject(String)}</code>. The argument String should be 
0086:         * the name of the guest user, usually "Guest" and more formally obtained by <code>{@link org.opencms.db.CmsDefaultUsers#getUserGuest()}</code>.
0087:         * This will give you an initialized context with guest user permissions.
0088:         * Then use <code>{@link CmsObject#loginUser(String, String)}</code> to log in the user you want.
0089:         * Obviously you need the password for the new user.
0090:         * You should never try to create an instance of this class using the constructor, 
0091:         * this is reserved for internal operation only.<p> 
0092:         *
0093:         * @author Alexander Kandzior 
0094:         * @author Thomas Weckert  
0095:         * @author Carsten Weinholz 
0096:         * @author Andreas Zahner 
0097:         * @author Michael Moossen 
0098:         * 
0099:         * @version $Revision: 1.158 $
0100:         * 
0101:         * @since 6.0.0 
0102:         */
0103:        public final class CmsObject {
0104:
0105:            /** The request context. */
0106:            protected CmsRequestContext m_context;
0107:
0108:            /** The security manager to access the cms. */
0109:            protected CmsSecurityManager m_securityManager;
0110:
0111:            /**
0112:             * Connects an OpenCms user context to a running database.<p>
0113:             * 
0114:             * <b>Please note:</b> This constructor is internal to OpenCms and not for public use.
0115:             * If you want to create a new instance of a <code>{@link CmsObject}</code> in your application,
0116:             * use <code>{@link org.opencms.main.OpenCms#initCmsObject(String)}</code>.<p>
0117:             * 
0118:             * @param securityManager the security manager
0119:             * @param context the request context that contains the user authentication
0120:             */
0121:            public CmsObject(CmsSecurityManager securityManager,
0122:                    CmsRequestContext context) {
0123:
0124:                init(securityManager, context);
0125:            }
0126:
0127:            /**
0128:             * Adds a new relation to the given resource.<p>
0129:             * 
0130:             * @param resourceName the name of the source resource
0131:             * @param targetPath the path of the target resource
0132:             * @param type the type of the relation
0133:             * 
0134:             * @throws CmsException if something goes wrong
0135:             */
0136:            public void addRelationToResource(String resourceName,
0137:                    String targetPath, String type) throws CmsException {
0138:
0139:                createRelation(resourceName, targetPath, type, false);
0140:            }
0141:
0142:            /**
0143:             * Adds a user to a group.<p>
0144:             * 
0145:             * @param username the name of the user that is to be added to the group
0146:             * @param groupname the name of the group
0147:             * 
0148:             * @throws CmsException if something goes wrong
0149:             */
0150:            public void addUserToGroup(String username, String groupname)
0151:                    throws CmsException {
0152:
0153:                m_securityManager.addUserToGroup(m_context, username,
0154:                        groupname, false);
0155:            }
0156:
0157:            /**
0158:             * Creates a new web user.<p>
0159:             * 
0160:             * A web user has no access to the workplace but is able to access personalized
0161:             * functions controlled by the OpenCms.<br>
0162:             * 
0163:             * Moreover, a web user can be created by any user, the intention being that
0164:             * a "Guest" user can create a personalized account for himself.<p>
0165:             *
0166:             * @param name the name for the new web user
0167:             * @param password the password for the user
0168:             * @param group the default group name for the user
0169:             * @param description the description for the user
0170:             * @param additionalInfos a <code>{@link Map}</code> with additional infos for the user
0171:             * 
0172:             * @return the newly created user
0173:             * 
0174:             * @throws CmsException if something goes wrong
0175:             * 
0176:             * @deprecated there are no more web users, use a user without any role!
0177:             */
0178:            public CmsUser addWebUser(String name, String password,
0179:                    String group, String description, Map additionalInfos)
0180:                    throws CmsException {
0181:
0182:                CmsUser user = m_securityManager.createUser(m_context, name,
0183:                        password, description, additionalInfos);
0184:                addUserToGroup(name, group);
0185:                return user;
0186:            }
0187:
0188:            /**
0189:             * Creates a backup of the current project.<p>
0190:             * 
0191:             * @param versionId the version of the backup
0192:             * @param publishDate the date of publishing
0193:             *
0194:             * @throws CmsException if operation was not successful
0195:             * 
0196:             * @deprecated Use {@link #writeHistoryProject(int,long)} instead
0197:             */
0198:            public void backupProject(int versionId, long publishDate)
0199:                    throws CmsException {
0200:
0201:                writeHistoryProject(versionId, publishDate);
0202:            }
0203:
0204:            /**
0205:             * Changes the access control for a given resource and a given principal(user/group).<p>
0206:             * 
0207:             * @param resourceName name of the resource
0208:             * @param principalType the type of the principal (currently group or user):
0209:             *      <ul>
0210:             *          <li><code>{@link I_CmsPrincipal#PRINCIPAL_USER}</code></li>
0211:             *          <li><code>{@link I_CmsPrincipal#PRINCIPAL_GROUP}</code></li>
0212:             *      </ul>
0213:             * @param principalName name of the principal
0214:             * @param allowedPermissions bit set of allowed permissions
0215:             * @param deniedPermissions bit set of denied permissions
0216:             * @param flags additional flags of the access control entry
0217:             * 
0218:             * @throws CmsException if something goes wrong
0219:             */
0220:            public void chacc(String resourceName, String principalType,
0221:                    String principalName, int allowedPermissions,
0222:                    int deniedPermissions, int flags) throws CmsException {
0223:
0224:                CmsResource res = readResource(resourceName,
0225:                        CmsResourceFilter.ALL);
0226:
0227:                CmsAccessControlEntry acEntry = null;
0228:                try {
0229:                    I_CmsPrincipal principal = CmsPrincipal.readPrincipal(this ,
0230:                            principalType, principalName);
0231:                    acEntry = new CmsAccessControlEntry(res.getResourceId(),
0232:                            principal.getId(), allowedPermissions,
0233:                            deniedPermissions, flags);
0234:                    acEntry.setFlagsForPrincipal(principal);
0235:                } catch (CmsDbEntryNotFoundException e) {
0236:                    // check for special ids
0237:                    if (principalName
0238:                            .equalsIgnoreCase(CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_NAME)) {
0239:                        acEntry = new CmsAccessControlEntry(
0240:                                res.getResourceId(),
0241:                                CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_ID,
0242:                                allowedPermissions, deniedPermissions, flags);
0243:                        acEntry
0244:                                .setFlags(CmsAccessControlEntry.ACCESS_FLAGS_ALLOTHERS);
0245:                    } else if (principalName
0246:                            .equalsIgnoreCase(CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_NAME)) {
0247:                        acEntry = new CmsAccessControlEntry(
0248:                                res.getResourceId(),
0249:                                CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_ID,
0250:                                allowedPermissions, deniedPermissions, flags);
0251:                        acEntry
0252:                                .setFlags(CmsAccessControlEntry.ACCESS_FLAGS_OVERWRITE_ALL);
0253:                    } else if (principalType
0254:                            .equalsIgnoreCase(CmsRole.PRINCIPAL_ROLE)) {
0255:                        // only vfs managers can set role based permissions
0256:                        m_securityManager.checkRoleForResource(m_context,
0257:                                CmsRole.VFS_MANAGER, res);
0258:                        // check for role
0259:                        CmsRole role = CmsRole.valueOfRoleName(principalName);
0260:                        // role based permissions can only be set in the system folder
0261:                        if ((role == null)
0262:                                || (!res.getRootPath().startsWith(
0263:                                        CmsWorkplace.VFS_PATH_SYSTEM))) {
0264:                            throw e;
0265:                        }
0266:                        acEntry = new CmsAccessControlEntry(
0267:                                res.getResourceId(), role.getId(),
0268:                                allowedPermissions, deniedPermissions, flags);
0269:                        acEntry
0270:                                .setFlags(CmsAccessControlEntry.ACCESS_FLAGS_ROLE);
0271:                    } else {
0272:                        throw e;
0273:                    }
0274:                }
0275:
0276:                m_securityManager.writeAccessControlEntry(m_context, res,
0277:                        acEntry);
0278:            }
0279:
0280:            /**
0281:             * Changes the access control for a given resource and a given principal(user/group).<p>
0282:             * 
0283:             * @param resourceName name of the resource
0284:             * @param principalType the type of the principal (group or user):
0285:             *      <ul>
0286:             *          <li><code>{@link I_CmsPrincipal#PRINCIPAL_USER}</code></li>
0287:             *          <li><code>{@link I_CmsPrincipal#PRINCIPAL_GROUP}</code></li>
0288:             *      </ul>
0289:             * @param principalName name of the principal
0290:             * @param permissionString the permissions in the format ((+|-)(r|w|v|c|i|o))*
0291:             * 
0292:             * @throws CmsException if something goes wrong
0293:             */
0294:            public void chacc(String resourceName, String principalType,
0295:                    String principalName, String permissionString)
0296:                    throws CmsException {
0297:
0298:                CmsResource res = readResource(resourceName,
0299:                        CmsResourceFilter.ALL);
0300:
0301:                CmsAccessControlEntry acEntry = null;
0302:                try {
0303:                    I_CmsPrincipal principal = CmsPrincipal.readPrincipal(this ,
0304:                            principalType, principalName);
0305:                    acEntry = new CmsAccessControlEntry(res.getResourceId(),
0306:                            principal.getId(), permissionString);
0307:                    acEntry.setFlagsForPrincipal(principal);
0308:                } catch (CmsDbEntryNotFoundException e) {
0309:                    // check for special ids
0310:                    if (principalName
0311:                            .equalsIgnoreCase(CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_NAME)) {
0312:                        acEntry = new CmsAccessControlEntry(
0313:                                res.getResourceId(),
0314:                                CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_ID,
0315:                                permissionString);
0316:                        acEntry
0317:                                .setFlags(CmsAccessControlEntry.ACCESS_FLAGS_ALLOTHERS);
0318:                    } else if (principalName
0319:                            .equalsIgnoreCase(CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_NAME)) {
0320:                        acEntry = new CmsAccessControlEntry(
0321:                                res.getResourceId(),
0322:                                CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_ID,
0323:                                permissionString);
0324:                        acEntry
0325:                                .setFlags(CmsAccessControlEntry.ACCESS_FLAGS_OVERWRITE_ALL);
0326:                    } else if (principalType
0327:                            .equalsIgnoreCase(CmsRole.PRINCIPAL_ROLE)) {
0328:                        // only vfs managers can set role based permissions
0329:                        m_securityManager.checkRoleForResource(m_context,
0330:                                CmsRole.VFS_MANAGER, res);
0331:                        // check for role
0332:                        CmsRole role = CmsRole.valueOfRoleName(principalName);
0333:                        // role based permissions can only be set in the system folder
0334:                        if ((role == null)
0335:                                || (!res.getRootPath().startsWith(
0336:                                        CmsWorkplace.VFS_PATH_SYSTEM)
0337:                                        && !res.getRootPath().equals("/") && !res
0338:                                        .getRootPath().equals("/system"))) {
0339:                            throw e;
0340:                        }
0341:                        acEntry = new CmsAccessControlEntry(
0342:                                res.getResourceId(), role.getId(),
0343:                                permissionString);
0344:                        acEntry
0345:                                .setFlags(CmsAccessControlEntry.ACCESS_FLAGS_ROLE);
0346:                    } else {
0347:                        throw e;
0348:                    }
0349:                }
0350:
0351:                m_securityManager.writeAccessControlEntry(m_context, res,
0352:                        acEntry);
0353:            }
0354:
0355:            /**
0356:             * Changes the lock of a resource to the current user,
0357:             * that is "steals" the lock from another user.<p>
0358:             * 
0359:             * This is the "steal lock" operation.<p>
0360:             * 
0361:             * @param resourcename the name of the resource to change the lock with complete path
0362:             * 
0363:             * @throws CmsException if something goes wrong
0364:             */
0365:            public void changeLock(String resourcename) throws CmsException {
0366:
0367:                CmsResource resource = readResource(resourcename,
0368:                        CmsResourceFilter.ALL);
0369:                getResourceType(resource).changeLock(this , m_securityManager,
0370:                        resource);
0371:            }
0372:
0373:            /**
0374:             * Returns a list with all sub resources of a given folder that have set the given property, 
0375:             * matching the current property's value with the given old value and replacing it by a given new value.<p>
0376:             *
0377:             * @param resourcename the name of the resource to change the property value
0378:             * @param property the name of the property to change the value
0379:             * @param oldValue the old value of the property, can be a regular expression
0380:             * @param newValue the new value of the property
0381:             * @param recursive if true, change recursively all property values on sub-resources (only for folders)
0382:             *
0383:             * @return a list with the <code>{@link CmsResource}</code>'s where the property value has been changed
0384:             *
0385:             * @throws CmsException if operation was not successful
0386:             */
0387:            public List changeResourcesInFolderWithProperty(
0388:                    String resourcename, String property, String oldValue,
0389:                    String newValue, boolean recursive) throws CmsException {
0390:
0391:                CmsResource resource = readResource(resourcename,
0392:                        CmsResourceFilter.IGNORE_EXPIRATION);
0393:                return m_securityManager.changeResourcesInFolderWithProperty(
0394:                        m_context, resource, property, oldValue, newValue,
0395:                        recursive);
0396:            }
0397:
0398:            /**
0399:             * Checks if the given base publish list can be published by the current user.<p>
0400:             * 
0401:             * @param publishList the base publish list to check
0402:             * 
0403:             * @throws CmsException in case the publish permissions are not granted
0404:             * 
0405:             * @deprecated notice that checking is no longer possible from the CmsObject
0406:             */
0407:            public void checkPublishPermissions(CmsPublishList publishList)
0408:                    throws CmsException {
0409:
0410:                m_securityManager.checkPublishPermissions(m_context,
0411:                        publishList);
0412:            }
0413:
0414:            /**
0415:             * Checks if the user of this OpenCms context is a member of the given role.<p>
0416:             *  
0417:             * This method can only be used for roles that are not organizational unit dependent.<p>
0418:             *  
0419:             * @param role the role to check
0420:             * 
0421:             * @throws CmsRoleViolationException if the user does not have the required role permissions
0422:             * 
0423:             * @see CmsRole#isOrganizationalUnitIndependent()
0424:             *      
0425:             * @deprecated use {@link OpenCms#getRoleManager()} methods instead
0426:             */
0427:            public void checkRole(CmsRole role)
0428:                    throws CmsRoleViolationException {
0429:
0430:                OpenCms.getRoleManager().checkRole(this , role);
0431:            }
0432:
0433:            /**
0434:             * Changes the resource flags of a resource.<p>
0435:             * 
0436:             * The resource flags are used to indicate various "special" conditions
0437:             * for a resource. Most notably, the "internal only" setting which signals 
0438:             * that a resource can not be directly requested with it's URL.<p>
0439:             *
0440:             * @param resourcename the name of the resource to change the flags for (full current site relative path)
0441:             * @param flags the new flags for this resource
0442:             *
0443:             * @throws CmsException if something goes wrong
0444:             */
0445:            public void chflags(String resourcename, int flags)
0446:                    throws CmsException {
0447:
0448:                CmsResource resource = readResource(resourcename,
0449:                        CmsResourceFilter.IGNORE_EXPIRATION);
0450:                getResourceType(resource).chflags(this , m_securityManager,
0451:                        resource, flags);
0452:            }
0453:
0454:            /**
0455:             * Changes the resource type of a resource.<p>
0456:             * 
0457:             * OpenCms handles resources according to the resource type,
0458:             * not the file suffix. This is e.g. why a JSP in OpenCms can have the 
0459:             * suffix ".html" instead of ".jsp" only. Changing the resource type
0460:             * makes sense e.g. if you want to make a plain text file a JSP resource,
0461:             * or a binary file an image, etc.<p> 
0462:             *
0463:             * @param resourcename the name of the resource to change the type for (full current site relative path)
0464:             * @param type the new resource type for this resource
0465:             *
0466:             * @throws CmsException if something goes wrong
0467:             */
0468:            public void chtype(String resourcename, int type)
0469:                    throws CmsException {
0470:
0471:                CmsResource resource = readResource(resourcename,
0472:                        CmsResourceFilter.IGNORE_EXPIRATION);
0473:                getResourceType(resource).chtype(this , m_securityManager,
0474:                        resource, type);
0475:            }
0476:
0477:            /**
0478:             * Copies a resource.<p>
0479:             * 
0480:             * The copied resource will always be locked to the current user
0481:             * after the copy operation.<p>
0482:             * 
0483:             * Siblings will be treated according to the
0484:             * <code>{@link org.opencms.file.CmsResource#COPY_PRESERVE_SIBLING}</code> mode.<p>
0485:             * 
0486:             * @param source the name of the resource to copy (full current site relative path)
0487:             * @param destination the name of the copy destination (full current site relative path)
0488:             * 
0489:             * @throws CmsException if something goes wrong
0490:             * @throws CmsIllegalArgumentException if the <code>destination</code> argument is null or of length 0
0491:             * 
0492:             * @see #copyResource(String, String, CmsResource.CmsResourceCopyMode)
0493:             */
0494:            public void copyResource(String source, String destination)
0495:                    throws CmsException, CmsIllegalArgumentException {
0496:
0497:                copyResource(source, destination,
0498:                        CmsResource.COPY_PRESERVE_SIBLING);
0499:            }
0500:
0501:            /**
0502:             * Copies a resource.<p>
0503:             * 
0504:             * The copied resource will always be locked to the current user
0505:             * after the copy operation.<p>
0506:             * 
0507:             * The <code>siblingMode</code> parameter controls how to handle siblings 
0508:             * during the copy operation.<br>
0509:             * Possible values for this parameter are: <br>
0510:             * <ul>
0511:             * <li><code>{@link CmsResource#COPY_AS_NEW}</code></li>
0512:             * <li><code>{@link CmsResource#COPY_AS_SIBLING}</code></li>
0513:             * <li><code>{@link CmsResource#COPY_PRESERVE_SIBLING}</code></li>
0514:             * </ul><p>
0515:             * 
0516:             * @param source the name of the resource to copy (full current site relative path)
0517:             * @param destination the name of the copy destination (full current site relative path)
0518:             * @param siblingMode indicates how to handle siblings during copy
0519:             * 
0520:             * @throws CmsException if something goes wrong
0521:             * @throws CmsIllegalArgumentException if the <code>destination</code> argument is null or of length 0
0522:             */
0523:            public void copyResource(String source, String destination,
0524:                    CmsResource.CmsResourceCopyMode siblingMode)
0525:                    throws CmsException, CmsIllegalArgumentException {
0526:
0527:                CmsResource resource = readResource(source,
0528:                        CmsResourceFilter.IGNORE_EXPIRATION);
0529:                getResourceType(resource).copyResource(this , m_securityManager,
0530:                        resource, destination, siblingMode);
0531:            }
0532:
0533:            /**
0534:             * Copies a resource.<p>
0535:             * 
0536:             * The copied resource will always be locked to the current user
0537:             * after the copy operation.<p>
0538:             * 
0539:             * @param source the name of the resource to copy (full path)
0540:             * @param destination the name of the copy destination (full path)
0541:             * @param siblingMode indicates how to handle siblings during copy
0542:             * 
0543:             * @throws CmsException if something goes wrong
0544:             * @throws CmsIllegalArgumentException if the <code>destination</code> argument is null or of length 0
0545:             * 
0546:             * @deprecated use {@link #copyResource(String, String, CmsResource.CmsResourceCopyMode)} method instead
0547:             */
0548:            public void copyResource(String source, String destination,
0549:                    int siblingMode) throws CmsException,
0550:                    CmsIllegalArgumentException {
0551:
0552:                copyResource(source, destination,
0553:                        CmsResource.CmsResourceCopyMode.valueOf(siblingMode));
0554:            }
0555:
0556:            /**
0557:             * Copies a resource to the current project of the user.<p>
0558:             * 
0559:             * This is used to extend the current users project with the
0560:             * specified resource, in case that the resource is not yet part of the project.
0561:             * The resource is not really copied like in a regular copy operation, 
0562:             * it is in fact only "enabled" in the current users project.<p>   
0563:             * 
0564:             * @param resourcename the name of the resource to copy to the current project (full current site relative path)
0565:             * 
0566:             * @throws CmsException if something goes wrong
0567:             */
0568:            public void copyResourceToProject(String resourcename)
0569:                    throws CmsException {
0570:
0571:                CmsResource resource = readResource(resourcename,
0572:                        CmsResourceFilter.ALL);
0573:                getResourceType(resource).copyResourceToProject(this ,
0574:                        m_securityManager, resource);
0575:            }
0576:
0577:            /**
0578:             * Counts the locked resources in a project.<p>
0579:             *
0580:             * @param id the id of the project
0581:             * 
0582:             * @return the number of locked resources in this project
0583:             *
0584:             * @throws CmsException if operation was not successful
0585:             */
0586:            public int countLockedResources(CmsUUID id) throws CmsException {
0587:
0588:                return m_securityManager.countLockedResources(m_context, id);
0589:            }
0590:
0591:            /**
0592:             * Counts the locked resources in a project.<p>
0593:             *
0594:             * @param id the id of the project
0595:             * 
0596:             * @return the number of locked resources in this project
0597:             *
0598:             * @throws CmsException if operation was not successful
0599:             * 
0600:             * @deprecated use {@link #countLockedResources(CmsUUID)} instead
0601:             */
0602:            public int countLockedResources(int id) throws CmsException {
0603:
0604:                return countLockedResources(m_securityManager.getProjectId(
0605:                        m_context, id));
0606:            }
0607:
0608:            /**
0609:             * Copies access control entries of a given resource to another resource.<p>
0610:             * 
0611:             * Already existing access control entries of the destination resource are removed.<p>
0612:             * 
0613:             * @param sourceName the name of the resource of which the access control entries are copied
0614:             * @param destName the name of the resource to which the access control entries are applied
0615:             * 
0616:             * @throws CmsException if something goes wrong
0617:             */
0618:            public void cpacc(String sourceName, String destName)
0619:                    throws CmsException {
0620:
0621:                CmsResource source = readResource(sourceName);
0622:                CmsResource dest = readResource(destName);
0623:                m_securityManager.copyAccessControlEntries(m_context, source,
0624:                        dest);
0625:            }
0626:
0627:            /**
0628:             * Creates a new user group.<p>
0629:             * 
0630:             * @param groupFqn the name of the new group
0631:             * @param description the description of the new group
0632:             * @param flags the flags for the new group
0633:             * @param parent the parent group (or <code>null</code>)
0634:             *
0635:             * @return a <code>{@link CmsGroup}</code> object representing the newly created group
0636:             *
0637:             * @throws CmsException if operation was not successful
0638:             */
0639:            public CmsGroup createGroup(String groupFqn, String description,
0640:                    int flags, String parent) throws CmsException {
0641:
0642:                return m_securityManager.createGroup(m_context, groupFqn,
0643:                        description, flags, parent);
0644:            }
0645:
0646:            /**
0647:             * Creates a new project.<p>
0648:             *
0649:             * @param name the name of the project to create
0650:             * @param description the description for the new project
0651:             * @param groupname the name of the project user group
0652:             * @param managergroupname the name of the project manager group
0653:             * 
0654:             * @return the created project
0655:             * 
0656:             * @throws CmsException if something goes wrong
0657:             */
0658:            public CmsProject createProject(String name, String description,
0659:                    String groupname, String managergroupname)
0660:                    throws CmsException {
0661:
0662:                return m_securityManager.createProject(m_context, name,
0663:                        description, groupname, managergroupname,
0664:                        CmsProject.PROJECT_TYPE_NORMAL);
0665:            }
0666:
0667:            /**
0668:             * Creates a new project.<p>
0669:             *
0670:             * @param name the name of the project to create
0671:             * @param description the description for the new project
0672:             * @param groupname the name of the project user group
0673:             * @param managergroupname the name of the project manager group
0674:             * @param projecttype the type of the project (normal or temporary)
0675:             * 
0676:             * @return the created project
0677:             * 
0678:             * @throws CmsException if operation was not successful
0679:             */
0680:            public CmsProject createProject(String name, String description,
0681:                    String groupname, String managergroupname,
0682:                    CmsProject.CmsProjectType projecttype) throws CmsException {
0683:
0684:                return m_securityManager.createProject(m_context, name,
0685:                        description, groupname, managergroupname, projecttype);
0686:            }
0687:
0688:            /**
0689:             * Creates a new project.<p>
0690:             *
0691:             * @param name the name of the project to create
0692:             * @param description the description for the new project
0693:             * @param groupname the name of the project user group
0694:             * @param managergroupname the name of the project manager group
0695:             * @param projecttype the type of the project (normal or temporary)
0696:             * 
0697:             * @return the created project
0698:             * 
0699:             * @throws CmsException if operation was not successful
0700:             * @deprecated use {@link #createProject(String,String,String,String,CmsProject.CmsProjectType)} method instead
0701:             */
0702:            public CmsProject createProject(String name, String description,
0703:                    String groupname, String managergroupname, int projecttype)
0704:                    throws CmsException {
0705:
0706:                return createProject(name, description, groupname,
0707:                        managergroupname, CmsProject.CmsProjectType
0708:                                .valueOf(projecttype));
0709:            }
0710:
0711:            /**
0712:             * Creates a property definition.<p>
0713:             *
0714:             * Property definitions are valid for all resource types.<p>
0715:             * 
0716:             * @param name the name of the property definition to create
0717:             * 
0718:             * @return the created property definition
0719:             * 
0720:             * @throws CmsException if something goes wrong
0721:             */
0722:            public CmsPropertyDefinition createPropertyDefinition(String name)
0723:                    throws CmsException {
0724:
0725:                return (m_securityManager.createPropertyDefinition(m_context,
0726:                        name));
0727:            }
0728:
0729:            /**
0730:             * Creates a new resource of the given resource type with 
0731:             * empty content and no properties.<p>
0732:             * 
0733:             * @param resourcename the name of the resource to create (full current site relative path)
0734:             * @param type the type of the resource to create
0735:             * 
0736:             * @return the created resource
0737:             * 
0738:             * @throws CmsException if something goes wrong
0739:             * @throws CmsIllegalArgumentException if the given <code>resourcename</code> is null or of length 0
0740:             * 
0741:             * @see #createResource(String, int, byte[], List)
0742:             */
0743:            public CmsResource createResource(String resourcename, int type)
0744:                    throws CmsException, CmsIllegalArgumentException {
0745:
0746:                return createResource(resourcename, type, new byte[0],
0747:                        Collections.EMPTY_LIST);
0748:            }
0749:
0750:            /**
0751:             * Creates a new resource of the given resource type
0752:             * with the provided content and properties.<p>
0753:             * 
0754:             * @param resourcename the name of the resource to create (full current site relative path)
0755:             * @param type the type of the resource to create
0756:             * @param content the contents for the new resource
0757:             * @param properties the properties for the new resource
0758:             * 
0759:             * @return the created resource
0760:             * 
0761:             * @throws CmsException if something goes wrong
0762:             * @throws CmsIllegalArgumentException if the <code>resourcename</code> argument is null or of length 0
0763:             */
0764:            public CmsResource createResource(String resourcename, int type,
0765:                    byte[] content, List properties) throws CmsException,
0766:                    CmsIllegalArgumentException {
0767:
0768:                return getResourceType(type).createResource(this ,
0769:                        m_securityManager, resourcename, content, properties);
0770:            }
0771:
0772:            /**
0773:             * Creates a new sibling of the source resource.<p>
0774:             * 
0775:             * @param source the name of the resource to create a sibling for with complete path
0776:             * @param destination the name of the sibling to create with complete path
0777:             * @param properties the individual properties for the new sibling
0778:             * 
0779:             * @return the new created sibling
0780:             * 
0781:             * @throws CmsException if something goes wrong
0782:             */
0783:            public CmsResource createSibling(String source, String destination,
0784:                    List properties) throws CmsException {
0785:
0786:                CmsResource resource = readResource(source,
0787:                        CmsResourceFilter.IGNORE_EXPIRATION);
0788:                return getResourceType(resource).createSibling(this ,
0789:                        m_securityManager, resource, destination, properties);
0790:            }
0791:
0792:            /**
0793:             * Creates the project for the temporary workplace files.<p>
0794:             *
0795:             * @return the created project for the temporary workplace files
0796:             * 
0797:             * @throws CmsException if something goes wrong
0798:             */
0799:            public CmsProject createTempfileProject() throws CmsException {
0800:
0801:                return m_securityManager.createTempfileProject(m_context);
0802:            }
0803:
0804:            /**
0805:             * Creates a new user.<p>
0806:             * 
0807:             * @param userFqn the name for the new user
0808:             * @param password the password for the new user
0809:             * @param description the description for the new user
0810:             * @param additionalInfos the additional infos for the user
0811:             *
0812:             * @return the created user
0813:             * 
0814:             * @throws CmsException if something goes wrong
0815:             */
0816:            public CmsUser createUser(String userFqn, String password,
0817:                    String description, Map additionalInfos)
0818:                    throws CmsException {
0819:
0820:                return m_securityManager.createUser(m_context, userFqn,
0821:                        password, description, additionalInfos);
0822:            }
0823:
0824:            /**
0825:             * Deletes all published resource entries.<p>
0826:             * 
0827:             * @param linkType the type of resource deleted (0= non-parameter, 1=parameter)
0828:             * 
0829:             * @throws CmsException if something goes wrong
0830:             */
0831:            public void deleteAllStaticExportPublishedResources(int linkType)
0832:                    throws CmsException {
0833:
0834:                m_securityManager.deleteAllStaticExportPublishedResources(
0835:                        m_context, linkType);
0836:            }
0837:
0838:            /**
0839:             * Deletes the versions from the backup tables that are older then the given time stamp  
0840:             * and/or number of remaining versions.<p>
0841:             * 
0842:             * The number of versions always wins, i.e. if the given time stamp would delete more versions 
0843:             * than given in the versions parameter, the time stamp will be ignored. <p>
0844:             * 
0845:             * Deletion will delete file header, content and properties. <p>
0846:             * 
0847:             * @param timestamp time stamp which defines the date after which backup resources must be deleted.
0848:             *                  This parameter must be 0 if the backup should be deleted by number of version
0849:             * @param versions the number of versions per file which should kept in the system. 
0850:             * @param report the report for output logging
0851:             * 
0852:             * @throws CmsException if something goes wrong
0853:             * 
0854:             * @deprecated use {@link #deleteHistoricalVersions(String, int, int, long, I_CmsReport)} instead,
0855:             *             notice that there is no longer possible to delete historical versions by date
0856:             */
0857:            public void deleteBackups(long timestamp, int versions,
0858:                    I_CmsReport report) throws CmsException {
0859:
0860:                if (timestamp != 0) {
0861:                    if (versions == 0) {
0862:                        // use default value
0863:                        versions = OpenCms.getSystemInfo().getHistoryVersions();
0864:                    }
0865:                }
0866:                deleteHistoricalVersions("/", versions, versions, timestamp,
0867:                        report);
0868:            }
0869:
0870:            /**
0871:             * Deletes a group, where all permissions, users and children of the group
0872:             * are transfered to a replacement group.<p>
0873:             * 
0874:             * @param groupId the id of the group to be deleted
0875:             * @param replacementId the id of the group to be transfered, can be <code>null</code>
0876:             *
0877:             * @throws CmsException if operation was not successful
0878:             */
0879:            public void deleteGroup(CmsUUID groupId, CmsUUID replacementId)
0880:                    throws CmsException {
0881:
0882:                m_securityManager
0883:                        .deleteGroup(m_context, groupId, replacementId);
0884:            }
0885:
0886:            /**
0887:             * Deletes a user group.<p>
0888:             *
0889:             * Only groups that contain no subgroups can be deleted.<p>
0890:             * 
0891:             * @param group the name of the group
0892:             * 
0893:             * @throws CmsException if operation was not successful
0894:             */
0895:            public void deleteGroup(String group) throws CmsException {
0896:
0897:                m_securityManager.deleteGroup(m_context, group);
0898:            }
0899:
0900:            /**
0901:             * Deletes the versions from the history tables, keeping the given number of versions per resource.<p>
0902:             * 
0903:             * @param folderName the name of the folder (with sub resources) to delete historical versions for 
0904:             * @param versionsToKeep number of versions to keep, is ignored if negative 
0905:             * @param versionsDeleted number of versions to keep for deleted resources, is ignored if negative
0906:             * @param timeDeleted deleted resources older than this will also be deleted, is ignored if negative
0907:             * @param report the report for output logging
0908:             * 
0909:             * @throws CmsException if operation was not successful
0910:             */
0911:            public void deleteHistoricalVersions(String folderName,
0912:                    int versionsToKeep, int versionsDeleted, long timeDeleted,
0913:                    I_CmsReport report) throws CmsException {
0914:
0915:                CmsFolder folder = readFolder(folderName);
0916:                m_securityManager.deleteHistoricalVersions(m_context, folder,
0917:                        versionsToKeep, versionsDeleted, timeDeleted, report);
0918:            }
0919:
0920:            /**
0921:             * Deletes a project.<p>
0922:             *
0923:             * All resources inside the project have to be be reset to their online state.<p>
0924:             * 
0925:             * @param id the id of the project to delete
0926:             *
0927:             * @throws CmsException if operation was not successful
0928:             */
0929:            public void deleteProject(CmsUUID id) throws CmsException {
0930:
0931:                m_securityManager.deleteProject(m_context, id);
0932:            }
0933:
0934:            /**
0935:             * Deletes a project.<p>
0936:             *
0937:             * All resources inside the project have to be be reset to their online state.<p>
0938:             * 
0939:             * @param id the id of the project to delete
0940:             *
0941:             * @throws CmsException if operation was not successful
0942:             * 
0943:             * @deprecated use {@link #deleteProject(CmsUUID)} instead
0944:             */
0945:            public void deleteProject(int id) throws CmsException {
0946:
0947:                deleteProject(m_securityManager.getProjectId(m_context, id));
0948:            }
0949:
0950:            /**
0951:             * Deletes a property for a file or folder.<p>
0952:             *
0953:             * @param resourcename the name of a resource for which the property should be deleted
0954:             * @param key the name of the property
0955:             * 
0956:             * @throws CmsException if something goes wrong
0957:             * 
0958:             * @deprecated use <code>{@link #writePropertyObject(String, CmsProperty)}</code> instead.
0959:             */
0960:            public void deleteProperty(String resourcename, String key)
0961:                    throws CmsException {
0962:
0963:                CmsProperty property = new CmsProperty();
0964:                property.setName(key);
0965:                property.setStructureValue(CmsProperty.DELETE_VALUE);
0966:
0967:                writePropertyObject(resourcename, property);
0968:            }
0969:
0970:            /**
0971:             * Deletes a property definition.<p>
0972:             *
0973:             * @param name the name of the property definition to delete
0974:             *
0975:             * @throws CmsException if something goes wrong
0976:             */
0977:            public void deletePropertyDefinition(String name)
0978:                    throws CmsException {
0979:
0980:                m_securityManager.deletePropertyDefinition(m_context, name);
0981:            }
0982:
0983:            /**
0984:             * Deletes the relations to a given resource.<p>
0985:             *
0986:             * @param resourceName the resource to delete the relations from
0987:             * @param filter the filter to use for deleting the relations
0988:             *
0989:             * @throws CmsException if something goes wrong
0990:             */
0991:            public void deleteRelationsFromResource(String resourceName,
0992:                    CmsRelationFilter filter) throws CmsException {
0993:
0994:                CmsResource resource = readResource(resourceName,
0995:                        CmsResourceFilter.ALL);
0996:                m_securityManager.deleteRelationsForResource(m_context,
0997:                        resource, filter);
0998:            }
0999:
1000:            /**
1001:             * Deletes a resource given its name.<p>
1002:             * 
1003:             * The <code>siblingMode</code> parameter controls how to handle siblings 
1004:             * during the delete operation.<br>
1005:             * Possible values for this parameter are: <br>
1006:             * <ul>
1007:             * <li><code>{@link CmsResource#DELETE_REMOVE_SIBLINGS}</code></li>
1008:             * <li><code>{@link CmsResource#DELETE_PRESERVE_SIBLINGS}</code></li>
1009:             * </ul><p>
1010:             * 
1011:             * @param resourcename the name of the resource to delete (full current site relative path)
1012:             * @param siblingMode indicates how to handle siblings of the deleted resource
1013:             *
1014:             * @throws CmsException if something goes wrong
1015:             */
1016:            public void deleteResource(String resourcename,
1017:                    CmsResource.CmsResourceDeleteMode siblingMode)
1018:                    throws CmsException {
1019:
1020:                CmsResource resource = readResource(resourcename,
1021:                        CmsResourceFilter.IGNORE_EXPIRATION);
1022:                getResourceType(resource).deleteResource(this ,
1023:                        m_securityManager, resource, siblingMode);
1024:            }
1025:
1026:            /**
1027:             * Deletes a resource given its name.<p>
1028:             * 
1029:             * The <code>siblingMode</code> parameter controls how to handle siblings 
1030:             * during the delete operation.<br>
1031:             * 
1032:             * @param resourcename the name of the resource to delete (full path)
1033:             * @param siblingMode indicates how to handle siblings of the deleted resource
1034:             *
1035:             * @throws CmsException if something goes wrong
1036:             *      
1037:             * @deprecated use {@link #deleteResource(String, CmsResource.CmsResourceDeleteMode)} method instead
1038:             */
1039:            public void deleteResource(String resourcename, int siblingMode)
1040:                    throws CmsException {
1041:
1042:                deleteResource(resourcename, CmsResource.CmsResourceDeleteMode
1043:                        .valueOf(siblingMode));
1044:            }
1045:
1046:            /**
1047:             * Deletes a published resource entry.<p>
1048:             * 
1049:             * @param resourceName The name of the resource to be deleted in the static export
1050:             * @param linkType the type of resource deleted (0= non-parameter, 1=parameter)
1051:             * @param linkParameter the parameters of the resource
1052:             * 
1053:             * @throws CmsException if something goes wrong
1054:             */
1055:            public void deleteStaticExportPublishedResource(
1056:                    String resourceName, int linkType, String linkParameter)
1057:                    throws CmsException {
1058:
1059:                m_securityManager.deleteStaticExportPublishedResource(
1060:                        m_context, resourceName, linkType, linkParameter);
1061:            }
1062:
1063:            /**
1064:             * Deletes a user.<p>
1065:             *
1066:             * @param userId the id of the user to be deleted
1067:             *
1068:             * @throws CmsException if operation was not successful
1069:             */
1070:            public void deleteUser(CmsUUID userId) throws CmsException {
1071:
1072:                m_securityManager.deleteUser(m_context, userId);
1073:            }
1074:
1075:            /**
1076:             * Deletes a user, where all permissions and resources attributes of the user
1077:             * were transfered to a replacement user.<p>
1078:             *
1079:             * @param userId the id of the user to be deleted
1080:             * @param replacementId the id of the user to be transfered, can be <code>null</code>
1081:             *
1082:             * @throws CmsException if operation was not successful
1083:             */
1084:            public void deleteUser(CmsUUID userId, CmsUUID replacementId)
1085:                    throws CmsException {
1086:
1087:                m_securityManager.deleteUser(m_context, userId, replacementId);
1088:            }
1089:
1090:            /**
1091:             * Deletes a user.<p>
1092:             * 
1093:             * @param username the name of the user to be deleted
1094:             *
1095:             * @throws CmsException if operation was not successful
1096:             */
1097:            public void deleteUser(String username) throws CmsException {
1098:
1099:                m_securityManager.deleteUser(m_context, username);
1100:            }
1101:
1102:            /**
1103:             * Deletes a web user.<p>
1104:             *
1105:             * @param userId the id of the user to be deleted
1106:             *
1107:             * @throws CmsException if operation was not successful
1108:             * 
1109:             * @deprecated there are no more web users, use a user without any role!
1110:             */
1111:            public void deleteWebUser(CmsUUID userId) throws CmsException {
1112:
1113:                m_securityManager.deleteUser(m_context, userId);
1114:            }
1115:
1116:            /**
1117:             * Checks the availability of a resource in the VFS,
1118:             * using the <code>{@link CmsResourceFilter#DEFAULT}</code> filter.<p> 
1119:             *
1120:             * A resource may be of type <code>{@link CmsFile}</code> or 
1121:             * <code>{@link CmsFolder}</code>.<p>
1122:             * 
1123:             * This method also takes into account the user permissions, so if 
1124:             * the given resource exists, but the current user has not the required 
1125:             * permissions, then this method will return <code>false</code>.<p>
1126:             *
1127:             * @param resourcename the name of the resource to check (full current site relative path)
1128:             *
1129:             * @return <code>true</code> if the resource is available
1130:             *
1131:             * @see #readResource(String)
1132:             * @see #existsResource(String, CmsResourceFilter)
1133:             */
1134:            public boolean existsResource(String resourcename) {
1135:
1136:                return existsResource(resourcename, CmsResourceFilter.DEFAULT);
1137:            }
1138:
1139:            /**
1140:             * Checks the availability of a resource in the VFS,
1141:             * using the <code>{@link CmsResourceFilter#DEFAULT}</code> filter.<p> 
1142:             *
1143:             * A resource may be of type <code>{@link CmsFile}</code> or 
1144:             * <code>{@link CmsFolder}</code>.<p>  
1145:             *
1146:             * The specified filter controls what kind of resources should be "found" 
1147:             * during the read operation. This will depend on the application. For example, 
1148:             * using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently
1149:             * "valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code>
1150:             * will ignore the date release / date expired information of the resource.<p>
1151:             * 
1152:             * This method also takes into account the user permissions, so if 
1153:             * the given resource exists, but the current user has not the required 
1154:             * permissions, then this method will return <code>false</code>.<p>
1155:             *
1156:             * @param resourcename the name of the resource to check (full current site relative path)
1157:             * @param filter the resource filter to use while checking
1158:             *
1159:             * @return <code>true</code> if the resource is available
1160:             * 
1161:             * @see #readResource(String)
1162:             * @see #readResource(String, CmsResourceFilter)
1163:             */
1164:            public boolean existsResource(String resourcename,
1165:                    CmsResourceFilter filter) {
1166:
1167:                return m_securityManager.existsResource(m_context,
1168:                        addSiteRoot(resourcename), filter);
1169:            }
1170:
1171:            /**
1172:             * Returns the list of access control entries of a resource given its name.<p>
1173:             * 
1174:             * @param resourceName the name of the resource
1175:             * 
1176:             * @return a list of <code>{@link CmsAccessControlEntry}</code> objects
1177:             * 
1178:             * @throws CmsException if something goes wrong
1179:             */
1180:            public List getAccessControlEntries(String resourceName)
1181:                    throws CmsException {
1182:
1183:                return getAccessControlEntries(resourceName, true);
1184:            }
1185:
1186:            /**
1187:             * Returns the list of access control entries of a resource given its name.<p>
1188:             * 
1189:             * @param resourceName the name of the resource
1190:             * @param getInherited <code>true</code>, if inherited access control entries should be returned, too
1191:             * 
1192:             * @return a list of <code>{@link CmsAccessControlEntry}</code> objects defining all permissions for the given resource
1193:             * 
1194:             * @throws CmsException if something goes wrong
1195:             */
1196:            public List getAccessControlEntries(String resourceName,
1197:                    boolean getInherited) throws CmsException {
1198:
1199:                CmsResource res = readResource(resourceName,
1200:                        CmsResourceFilter.ALL);
1201:                return m_securityManager.getAccessControlEntries(m_context,
1202:                        res, getInherited);
1203:            }
1204:
1205:            /**
1206:             * Returns the access control list (summarized access control entries) of a given resource.<p>
1207:             * 
1208:             * @param resourceName the name of the resource
1209:             * 
1210:             * @return the access control list of the resource
1211:             * 
1212:             * @throws CmsException if something goes wrong
1213:             */
1214:            public CmsAccessControlList getAccessControlList(String resourceName)
1215:                    throws CmsException {
1216:
1217:                return getAccessControlList(resourceName, false);
1218:            }
1219:
1220:            /**
1221:             * Returns the access control list (summarized access control entries) of a given resource.<p>
1222:             * 
1223:             * If <code>inheritedOnly</code> is set, only inherited access control entries are returned.<p>
1224:             * 
1225:             * @param resourceName the name of the resource
1226:             * @param inheritedOnly if set, the non-inherited entries are skipped
1227:             * 
1228:             * @return the access control list of the resource
1229:             * 
1230:             * @throws CmsException if something goes wrong
1231:             */
1232:            public CmsAccessControlList getAccessControlList(
1233:                    String resourceName, boolean inheritedOnly)
1234:                    throws CmsException {
1235:
1236:                CmsResource res = readResource(resourceName,
1237:                        CmsResourceFilter.ALL);
1238:                return m_securityManager.getAccessControlList(m_context, res,
1239:                        inheritedOnly);
1240:            }
1241:
1242:            /**
1243:             * Returns all projects which are owned by the current user or which are 
1244:             * accessible for the group of the user.<p>
1245:             *
1246:             * @return a list of objects of type <code>{@link CmsProject}</code>
1247:             *
1248:             * @throws CmsException if operation was not successful
1249:             */
1250:            public List getAllAccessibleProjects() throws CmsException {
1251:
1252:                return m_securityManager.getAllAccessibleProjects(m_context);
1253:            }
1254:
1255:            /**
1256:             * Returns a list with all projects from history.<p>
1257:             *
1258:             * @return list of <code>{@link CmsHistoryProject}</code> objects 
1259:             *           with all projects from history.
1260:             *
1261:             * @throws CmsException  if operation was not successful
1262:             * 
1263:             * @deprecated Use {@link #getAllHistoricalProjects()} instead
1264:             */
1265:            public List getAllBackupProjects() throws CmsException {
1266:
1267:                return getAllHistoricalProjects();
1268:            }
1269:
1270:            /**
1271:             * Returns a list with all projects from history.<p>
1272:             *
1273:             * @return list of <code>{@link CmsHistoryProject}</code> objects 
1274:             *           with all projects from history
1275:             *
1276:             * @throws CmsException  if operation was not successful
1277:             */
1278:            public List getAllHistoricalProjects() throws CmsException {
1279:
1280:                return m_securityManager.getAllHistoricalProjects(m_context);
1281:            }
1282:
1283:            /**
1284:             * Returns all projects which are owned by the current user or which are manageable
1285:             * for the group of the user.<p>
1286:             *
1287:             * @return a list of objects of type <code>{@link CmsProject}</code>
1288:             *
1289:             * @throws CmsException if operation was not successful
1290:             */
1291:            public List getAllManageableProjects() throws CmsException {
1292:
1293:                return m_securityManager.getAllManageableProjects(m_context);
1294:            }
1295:
1296:            /**
1297:             * Returns the next version id for the published backup resources.<p>
1298:             *
1299:             * @return int the new version id
1300:             * 
1301:             * @throws CmsException if operation was not successful
1302:             * 
1303:             * @deprecated this concept has been abandoned for OpenCms version 7
1304:             */
1305:            public int getBackupTagId() throws CmsException {
1306:
1307:                return ((CmsHistoryProject) getAllHistoricalProjects().get(0))
1308:                        .getPublishTag() + 1;
1309:            }
1310:
1311:            /**
1312:             * Returns all child groups of a group.<p>
1313:             *
1314:             * @param groupname the name of the group
1315:             * 
1316:             * @return a list of all child <code>{@link CmsGroup}</code> objects or <code>null</code>
1317:             * 
1318:             * @throws CmsException if operation was not successful
1319:             * 
1320:             * @deprecated use {@link #getChildren(String, boolean)} with <code>false</code> instead.
1321:             */
1322:            public List getChild(String groupname) throws CmsException {
1323:
1324:                return getChildren(groupname, false);
1325:            }
1326:
1327:            /**
1328:             * Returns all child groups of a group.<p>
1329:             * 
1330:             * @param groupname the name of the group
1331:             * @param includeSubChildren if set also returns all sub-child groups of the given group
1332:             *
1333:             * @return a list of all child <code>{@link CmsGroup}</code> objects or <code>null</code>
1334:             * 
1335:             * @throws CmsException if operation was not successful
1336:             */
1337:            public List getChildren(String groupname, boolean includeSubChildren)
1338:                    throws CmsException {
1339:
1340:                return m_securityManager.getChildren(m_context, groupname,
1341:                        includeSubChildren);
1342:            }
1343:
1344:            /**
1345:             * Returns all child groups of a group.<p>
1346:             * 
1347:             * This method also returns all sub-child groups of the current group.<p>
1348:             * 
1349:             * @param groupname the name of the group
1350:             * 
1351:             * @return a list of all child <code>{@link CmsGroup}</code> objects or <code>null</code>
1352:             * 
1353:             * @throws CmsException if operation was not successful
1354:             * 
1355:             * @deprecated use {@link #getChildren(String, boolean)} with <code>true</code> instead.
1356:             */
1357:            public List getChilds(String groupname) throws CmsException {
1358:
1359:                return getChildren(groupname, true);
1360:            }
1361:
1362:            /**
1363:             * Returns all groups to which a given user directly belongs.<p>
1364:             *
1365:             * @param username the name of the user to get all groups for
1366:             * 
1367:             * @return a list of <code>{@link CmsGroup}</code> objects
1368:             *
1369:             * @throws CmsException if operation was not successful
1370:             * 
1371:             * @deprecated use {@link #getGroupsOfUser(String, boolean)} instead
1372:             */
1373:            public List getDirectGroupsOfUser(String username)
1374:                    throws CmsException {
1375:
1376:                return getGroupsOfUser(username, true);
1377:            }
1378:
1379:            /**
1380:             * Returns all file resources contained in a folder.<p>
1381:             * 
1382:             * The result is filtered according to the rules of 
1383:             * the <code>{@link CmsResourceFilter#DEFAULT}</code> filter.<p>
1384:             * 
1385:             * @param resourcename the full current site relative path of the resource to return the child resources for
1386:             * 
1387:             * @return a list of all child files as <code>{@link CmsResource}</code> objects
1388:             * 
1389:             * @throws CmsException if something goes wrong
1390:             * 
1391:             * @see #getFilesInFolder(String, CmsResourceFilter)
1392:             */
1393:            public List getFilesInFolder(String resourcename)
1394:                    throws CmsException {
1395:
1396:                return getFilesInFolder(resourcename, CmsResourceFilter.DEFAULT);
1397:            }
1398:
1399:            /**
1400:             * Returns all file resources contained in a folder.<p>
1401:             * 
1402:             * With the <code>{@link CmsResourceFilter}</code> provided as parameter
1403:             * you can control if you want to include deleted, invisible or 
1404:             * time-invalid resources in the result.<p>
1405:             * 
1406:             * @param resourcename the full path of the resource to return the child resources for
1407:             * @param filter the resource filter to use
1408:             * 
1409:             * @return a list of all child file as <code>{@link CmsResource}</code> objects
1410:             * 
1411:             * @throws CmsException if something goes wrong
1412:             */
1413:            public List getFilesInFolder(String resourcename,
1414:                    CmsResourceFilter filter) throws CmsException {
1415:
1416:                CmsResource resource = readResource(resourcename,
1417:                        CmsResourceFilter.ALL);
1418:                return m_securityManager.readChildResources(m_context,
1419:                        resource, filter, false, true);
1420:            }
1421:
1422:            /**
1423:             * Returns all groups.<p>
1424:             *
1425:             * @return a list of all <code>{@link CmsGroup}</code> objects
1426:             *
1427:             * @throws CmsException if operation was not successful
1428:             * 
1429:             * @deprecated use {@link org.opencms.security.CmsOrgUnitManager#getGroups(CmsObject, String, boolean) OpenCms.getOrgUnitManager().getGroupsForOrganizationalUnit(CmsObject, String, boolean)} instead
1430:             */
1431:            public List getGroups() throws CmsException {
1432:
1433:                return OpenCms.getOrgUnitManager().getGroups(this , "", true);
1434:            }
1435:
1436:            /**
1437:             * Returns all the groups the given user, directly or indirectly, belongs to.<p>
1438:             *
1439:             * @param username the name of the user
1440:             * 
1441:             * @return a list of <code>{@link CmsGroup}</code> objects
1442:             * 
1443:             * @throws CmsException if operation was not successful
1444:             * 
1445:             * @deprecated use {@link #getGroupsOfUser(String, boolean)} instead
1446:             */
1447:            public List getGroupsOfUser(String username) throws CmsException {
1448:
1449:                return getGroupsOfUser(username, false);
1450:            }
1451:
1452:            /**
1453:             * Returns all the groups the given user belongs to.<p>
1454:             *
1455:             * @param username the name of the user
1456:             * @param directGroupsOnly if set only the direct assigned groups will be returned, if not also indirect roles
1457:             * 
1458:             * @return a list of <code>{@link CmsGroup}</code> objects
1459:             * 
1460:             * @throws CmsException if operation was not successful
1461:             */
1462:            public List getGroupsOfUser(String username,
1463:                    boolean directGroupsOnly) throws CmsException {
1464:
1465:                return getGroupsOfUser(username, directGroupsOnly, true);
1466:            }
1467:
1468:            /**
1469:             * Returns all the groups the given user belongs to.<p>
1470:             *
1471:             * @param username the name of the user
1472:             * @param directGroupsOnly if set only the direct assigned groups will be returned, if not also indirect roles
1473:             * @param includeOtherOus if to include groups of other organizational units
1474:             * 
1475:             * @return a list of <code>{@link CmsGroup}</code> objects
1476:             * 
1477:             * @throws CmsException if operation was not successful
1478:             */
1479:            public List getGroupsOfUser(String username,
1480:                    boolean directGroupsOnly, boolean includeOtherOus)
1481:                    throws CmsException {
1482:
1483:                return getGroupsOfUser(username, directGroupsOnly,
1484:                        includeOtherOus, m_context.getRemoteAddress());
1485:            }
1486:
1487:            /**
1488:             * Returns the groups of a user filtered by the specified IP address.<p>
1489:             *
1490:             * @param username the name of the user
1491:             * @param directGroupsOnly if set only the direct assigned groups will be returned, if not also indirect roles
1492:             * @param remoteAddress the IP address to filter the groups in the result list
1493:             * @param includeOtherOus if to include groups of other organizational units
1494:             * 
1495:             * @return a list of <code>{@link CmsGroup}</code> objects filtered by the specified IP address
1496:             * 
1497:             * @throws CmsException if operation was not successful
1498:             */
1499:            public List getGroupsOfUser(String username,
1500:                    boolean directGroupsOnly, boolean includeOtherOus,
1501:                    String remoteAddress) throws CmsException {
1502:
1503:                return m_securityManager.getGroupsOfUser(m_context, username,
1504:                        (includeOtherOus ? "" : CmsOrganizationalUnit
1505:                                .getParentFqn(username)), includeOtherOus,
1506:                        false, directGroupsOnly, remoteAddress);
1507:            }
1508:
1509:            /**
1510:             * Returns the groups of a user filtered by the specified IP address.<p>
1511:             *
1512:             * @param username the name of the user
1513:             * @param remoteAddress the IP address to filter the groups in the result list
1514:             * 
1515:             * @return a list of <code>{@link CmsGroup}</code> objects filtered by the specified IP address
1516:             * 
1517:             * @throws CmsException if operation was not successful
1518:             * 
1519:             * @deprecated use {@link #getGroupsOfUser(String, boolean, boolean, String)} instead
1520:             */
1521:            public List getGroupsOfUser(String username, String remoteAddress)
1522:                    throws CmsException {
1523:
1524:                return getGroupsOfUser(username, false, false, remoteAddress);
1525:            }
1526:
1527:            /**
1528:             * Returns the edition lock state for a specified resource.<p>
1529:             * 
1530:             * If the resource is waiting to be publish you might get a lock of type {@link CmsLockType#PUBLISH}.<p>
1531:             * 
1532:             * @param resource the resource to return the edition lock state for
1533:             * 
1534:             * @return the edition lock state for the specified resource
1535:             * 
1536:             * @throws CmsException if something goes wrong
1537:             */
1538:            public CmsLock getLock(CmsResource resource) throws CmsException {
1539:
1540:                return m_securityManager.getLock(m_context, resource);
1541:            }
1542:
1543:            /**
1544:             * Returns the lock state for a specified resource name.<p>
1545:             * 
1546:             * If the resource is waiting to be publish you might get a lock of type {@link CmsLockType#PUBLISH}.<p>
1547:             * 
1548:             * @param resourcename the name if the resource to get the lock state for (full current site relative path)
1549:             * 
1550:             * @return the lock state for the specified resource
1551:             * 
1552:             * @throws CmsException if something goes wrong
1553:             */
1554:            public CmsLock getLock(String resourcename) throws CmsException {
1555:
1556:                CmsResource resource = readResource(resourcename,
1557:                        CmsResourceFilter.ALL);
1558:                return getLock(resource);
1559:            }
1560:
1561:            /**
1562:             * Returns all locked resources within a folder.<p>
1563:             *
1564:             * @param foldername the name of the folder
1565:             * @param filter the lock filter
1566:             * 
1567:             * @return a list of locked resource paths (relative to current site)
1568:             *
1569:             * @throws CmsException if operation was not successful
1570:             */
1571:            public List getLockedResources(String foldername,
1572:                    CmsLockFilter filter) throws CmsException {
1573:
1574:                CmsResource resource = readResource(foldername,
1575:                        CmsResourceFilter.ALL);
1576:                return m_securityManager.getLockedResources(m_context,
1577:                        resource, filter);
1578:            }
1579:
1580:            /**
1581:             * Returns the name a resource would have if it were moved to the
1582:             * "lost and found" folder. <p>
1583:             * 
1584:             * In general, it is the same name as the given resource has, the only exception is
1585:             * if a resource in the "lost and found" folder with the same name already exists. 
1586:             * In such case, a counter is added to the resource name.<p>
1587:             * 
1588:             * @param resourcename the name of the resource to get the "lost and found" name for (full current site relative path)
1589:             *
1590:             * @return the tentative name of the resource inside the "lost and found" folder
1591:             * 
1592:             * @throws CmsException if something goes wrong
1593:             * 
1594:             * @see #moveToLostAndFound(String)
1595:             */
1596:            public String getLostAndFoundName(String resourcename)
1597:                    throws CmsException {
1598:
1599:                CmsResource resource = readResource(resourcename,
1600:                        CmsResourceFilter.ALL);
1601:                return m_securityManager.moveToLostAndFound(m_context,
1602:                        resource, true);
1603:            }
1604:
1605:            /**
1606:             * Returns the parent group of a group.<p>
1607:             *
1608:             * @param groupname the name of the group
1609:             * 
1610:             * @return group the parent group or <code>null</code>
1611:             * 
1612:             * @throws CmsException if operation was not successful
1613:             */
1614:            public CmsGroup getParent(String groupname) throws CmsException {
1615:
1616:                return m_securityManager.getParent(m_context, groupname);
1617:            }
1618:
1619:            /**
1620:             * Returns the set of permissions of the current user for a given resource.<p>
1621:             * 
1622:             * @param resourceName the name of the resource
1623:             * 
1624:             * @return the bit set of the permissions of the current user
1625:             * 
1626:             * @throws CmsException if something goes wrong
1627:             */
1628:            public CmsPermissionSet getPermissions(String resourceName)
1629:                    throws CmsException {
1630:
1631:                return getPermissions(resourceName, m_context.currentUser()
1632:                        .getName());
1633:            }
1634:
1635:            /**
1636:             * Returns the set of permissions of a given user for a given resource.<p>
1637:             * 
1638:             * @param resourceName the name of the resource
1639:             * @param userName the name of the user
1640:             * 
1641:             * @return the current permissions on this resource
1642:             * 
1643:             * @throws CmsException if something goes wrong
1644:             */
1645:            public CmsPermissionSet getPermissions(String resourceName,
1646:                    String userName) throws CmsException {
1647:
1648:                // reading permissions is allowed even if the resource is marked as deleted
1649:                CmsResource resource = readResource(resourceName,
1650:                        CmsResourceFilter.ALL);
1651:                CmsUser user = readUser(userName);
1652:                return m_securityManager.getPermissions(m_context, resource,
1653:                        user);
1654:            }
1655:
1656:            /**
1657:             * Returns a publish list with all new/changed/deleted resources of the current (offline)
1658:             * project that actually get published.<p>
1659:             * 
1660:             * @return a publish list
1661:             * 
1662:             * @throws CmsException if something goes wrong
1663:             * 
1664:             * @deprecated use <code>{@link OpenCms#getPublishManager()}.{@link org.opencms.publish.CmsPublishManager#getPublishList(CmsObject) getPublishList(CmsObject)}</code> instead
1665:             */
1666:            public CmsPublishList getPublishList() throws CmsException {
1667:
1668:                return OpenCms.getPublishManager().getPublishList(this );
1669:            }
1670:
1671:            /**
1672:             * Returns a publish list with all new/changed/deleted resources of the current (offline)
1673:             * project that actually get published for a direct publish of a single resource.<p>
1674:             * 
1675:             * @param directPublishResource the resource which will be directly published
1676:             * @param directPublishSiblings <code>true</code>, if all eventual siblings of the direct 
1677:             *                      published resource should also get published.
1678:             * 
1679:             * @return a publish list
1680:             * 
1681:             * @throws CmsException if something goes wrong
1682:             * 
1683:             * @deprecated use <code>{@link OpenCms#getPublishManager()}.{@link org.opencms.publish.CmsPublishManager#getPublishList(CmsObject, CmsResource, boolean) getPublishList(CmsObject, CmsResource, boolean)}</code> instead
1684:             */
1685:            public CmsPublishList getPublishList(
1686:                    CmsResource directPublishResource,
1687:                    boolean directPublishSiblings) throws CmsException {
1688:
1689:                return OpenCms.getPublishManager().getPublishList(this ,
1690:                        directPublishResource, directPublishSiblings);
1691:            }
1692:
1693:            /**
1694:             * Returns a publish list with all new/changed/deleted resources of the current (offline)
1695:             * project that actually get published for a direct publish of a List of resources.<p>
1696:             * 
1697:             * @param directPublishResources the resources which will be directly published
1698:             * @param directPublishSiblings <code>true</code>, if all eventual siblings of the direct 
1699:             *                      published resources should also get published.
1700:             * 
1701:             * @return a publish list
1702:             * 
1703:             * @throws CmsException if something goes wrong
1704:             * 
1705:             * @deprecated use <code>{@link OpenCms#getPublishManager()}.{@link org.opencms.publish.CmsPublishManager#getPublishList(CmsObject, List, boolean) getPublishList(CmsObject, List, boolean)}</code> instead
1706:             */
1707:            public CmsPublishList getPublishList(List directPublishResources,
1708:                    boolean directPublishSiblings) throws CmsException {
1709:
1710:                return OpenCms.getPublishManager().getPublishList(this ,
1711:                        directPublishResources, directPublishSiblings, true);
1712:            }
1713:
1714:            /**
1715:             * Returns a publish list with all new/changed/deleted resources of the current (offline)
1716:             * project that actually get published for a direct publish of a List of resources.<p>
1717:             * 
1718:             * @param directPublishResources the {@link CmsResource} objects which will be directly published
1719:             * @param directPublishSiblings <code>true</code>, if all eventual siblings of the direct 
1720:             *                      published resources should also get published.
1721:             * @param publishSubResources indicates if sub-resources in folders should be published (for direct publish only)
1722:             * 
1723:             * @return a publish list
1724:             * 
1725:             * @throws CmsException if something goes wrong
1726:             * 
1727:             * @deprecated use <code>{@link OpenCms#getPublishManager()}.{@link org.opencms.publish.CmsPublishManager#getPublishList(CmsObject, List, boolean, boolean) getPublishList(CmsObject, List, boolean)}</code> instead
1728:             */
1729:            public CmsPublishList getPublishList(List directPublishResources,
1730:                    boolean directPublishSiblings, boolean publishSubResources)
1731:                    throws CmsException {
1732:
1733:                return OpenCms.getPublishManager().getPublishList(this ,
1734:                        directPublishResources, directPublishSiblings,
1735:                        publishSubResources);
1736:            }
1737:
1738:            /**
1739:             * Returns all relations for the given resource matching the given filter.<p> 
1740:             * 
1741:             * You should have view/read permissions on the given resource.<p>
1742:             * 
1743:             * You may become source and/or target paths to resource you do not have view/read permissions on.<p> 
1744:             * 
1745:             * @param resourceName the name of the resource to retrieve the relations for
1746:             * @param filter the filter to match the relation 
1747:             * 
1748:             * @return a List containing all {@link org.opencms.relations.CmsRelation} 
1749:             *          objects for the given resource matching the given filter
1750:             * 
1751:             * @throws CmsException if something goes wrong
1752:             * 
1753:             * @see CmsSecurityManager#getRelationsForResource(CmsRequestContext, CmsResource, CmsRelationFilter)
1754:             */
1755:            public List getRelationsForResource(String resourceName,
1756:                    CmsRelationFilter filter) throws CmsException {
1757:
1758:                CmsResource resource = readResource(resourceName,
1759:                        CmsResourceFilter.ALL);
1760:                return m_securityManager.getRelationsForResource(m_context,
1761:                        resource, filter);
1762:            }
1763:
1764:            /**
1765:             * Returns the current users request context.<p>
1766:             *
1767:             * This request context is used to authenticate the user for all 
1768:             * OpenCms operations. It also contains the request runtime settings, e.g.
1769:             * about the current site this request was made on.<p>
1770:             *
1771:             * @return the current users request context
1772:             */
1773:            public CmsRequestContext getRequestContext() {
1774:
1775:                return m_context;
1776:            }
1777:
1778:            /**
1779:             * Returns all resources associated to a given principal via an ACE with the given permissions.<p> 
1780:             * 
1781:             * If the <code>includeAttr</code> flag is set it returns also all resources associated to 
1782:             * a given principal through some of following attributes.<p> 
1783:             * 
1784:             * <ul>
1785:             *    <li>User Created</li>
1786:             *    <li>User Last Modified</li>
1787:             * </ul><p>
1788:             * 
1789:             * @param principalId the id of the principal
1790:             * @param permissions a set of permissions to match, can be <code>null</code> for all ACEs
1791:             * @param includeAttr a flag to include resources associated by attributes
1792:             * 
1793:             * @return a list of <code>{@link CmsResource}</code> objects
1794:             * 
1795:             * @throws CmsException if something goes wrong
1796:             */
1797:            public List getResourcesForPrincipal(CmsUUID principalId,
1798:                    CmsPermissionSet permissions, boolean includeAttr)
1799:                    throws CmsException {
1800:
1801:                return m_securityManager.getResourcesForPrincipal(
1802:                        getRequestContext(), principalId, permissions,
1803:                        includeAttr);
1804:            }
1805:
1806:            /**
1807:             * Returns all child resources of a resource, that is the resources
1808:             * contained in a folder.<p>
1809:             * 
1810:             * With the <code>{@link CmsResourceFilter}</code> provided as parameter
1811:             * you can control if you want to include deleted, invisible or 
1812:             * time-invalid resources in the result.<p>
1813:             * 
1814:             * This method is mainly used by the workplace explorer.<p>
1815:             * 
1816:             * @param resourcename the full current site relative path of the resource to return the child resources for
1817:             * @param filter the resource filter to use
1818:             * 
1819:             * @return a list of all child <code>{@link CmsResource}</code>s
1820:             * 
1821:             * @throws CmsException if something goes wrong
1822:             */
1823:            public List getResourcesInFolder(String resourcename,
1824:                    CmsResourceFilter filter) throws CmsException {
1825:
1826:                CmsResource resource = readResource(resourcename,
1827:                        CmsResourceFilter.ALL);
1828:                return m_securityManager.readChildResources(m_context,
1829:                        resource, filter, true, true);
1830:            }
1831:
1832:            /**
1833:             * Returns a list with all sub resources of the given parent folder (and all of it's subfolders) 
1834:             * that have been modified in the given time range.<p>
1835:             * 
1836:             * The result list is descending sorted (newest resource first).<p>
1837:             *
1838:             * @param folder the folder to get the sub resources from
1839:             * @param starttime the begin of the time range
1840:             * @param endtime the end of the time range
1841:             * 
1842:             * @return a list with all <code>{@link CmsResource}</code> objects 
1843:             *               that have been modified in the given time range.
1844:             *
1845:             * @throws CmsException if operation was not successful
1846:             * 
1847:             * @deprecated use {@link #readResources(String, CmsResourceFilter)} and create a filter 
1848:             *      based on {@link CmsResourceFilter#IGNORE_EXPIRATION}
1849:             *      using {@link CmsResourceFilter#addRequireLastModifiedAfter(long)} and
1850:             *      {@link CmsResourceFilter#addRequireLastModifiedBefore(long)} instead
1851:             */
1852:            public List getResourcesInTimeRange(String folder, long starttime,
1853:                    long endtime) throws CmsException {
1854:
1855:                CmsResourceFilter filter = CmsResourceFilter.IGNORE_EXPIRATION;
1856:                filter = filter.addRequireLastModifiedAfter(starttime);
1857:                filter = filter.addRequireLastModifiedBefore(endtime);
1858:
1859:                return readResources(folder, filter);
1860:            }
1861:
1862:            /**
1863:             * Adjusts the absolute resource root path for the current site.<p> 
1864:             * 
1865:             * The full root path of a resource is always available using
1866:             * <code>{@link CmsResource#getRootPath()}</code>. From this name this method cuts 
1867:             * of the current site root using 
1868:             * <code>{@link CmsRequestContext#removeSiteRoot(String)}</code>.<p>
1869:             * 
1870:             * If the resource root path does not start with the current site root,
1871:             * it is left untouched.<p>
1872:             * 
1873:             * @param resource the resource to get the adjusted site root path for
1874:             * 
1875:             * @return the absolute resource path adjusted for the current site
1876:             * 
1877:             * @see CmsRequestContext#removeSiteRoot(String)
1878:             * @see CmsRequestContext#getSitePath(CmsResource)
1879:             * @see CmsResource#getRootPath()
1880:             */
1881:            public String getSitePath(CmsResource resource) {
1882:
1883:                return m_context.getSitePath(resource);
1884:            }
1885:
1886:            /**
1887:             * Returns all folder resources contained in a folder.<p>
1888:             * 
1889:             * The result is filtered according to the rules of 
1890:             * the <code>{@link CmsResourceFilter#DEFAULT}</code> filter.<p>
1891:             * 
1892:             * @param resourcename the full current site relative path of the resource to return the child resources for. 
1893:             * 
1894:             * @return a list of all child file as <code>{@link CmsResource}</code> objects
1895:             * 
1896:             * @throws CmsException if something goes wrong
1897:             * 
1898:             * @see #getSubFolders(String, CmsResourceFilter)
1899:             */
1900:            public List getSubFolders(String resourcename) throws CmsException {
1901:
1902:                return getSubFolders(resourcename, CmsResourceFilter.DEFAULT);
1903:            }
1904:
1905:            /**
1906:             * Returns all folder resources contained in a folder.<p>
1907:             * 
1908:             * With the <code>{@link CmsResourceFilter}</code> provided as parameter
1909:             * you can control if you want to include deleted, invisible or 
1910:             * time-invalid resources in the result.<p>
1911:             * 
1912:             * @param resourcename the full current site relative path of the resource to return the child resources for. 
1913:             * 
1914:             * @return a list of all child folder <code>{@link CmsResource}</code>s
1915:             * @param filter the resource filter to use
1916:             * 
1917:             * @throws CmsException if something goes wrong
1918:             */
1919:            public List getSubFolders(String resourcename,
1920:                    CmsResourceFilter filter) throws CmsException {
1921:
1922:                CmsResource resource = readResource(resourcename,
1923:                        CmsResourceFilter.ALL);
1924:                return m_securityManager.readChildResources(m_context,
1925:                        resource, filter, true, false);
1926:            }
1927:
1928:            /**
1929:             * Returns all users.<p>
1930:             *
1931:             * @return a list of all <code>{@link CmsUser}</code> objects
1932:             * 
1933:             * @throws CmsException if operation was not successful
1934:             * 
1935:             * @deprecated use {@link org.opencms.security.CmsOrgUnitManager#getUsers(CmsObject, String, boolean) OpenCms.getOrgUnitManager().getUsersForOrganizationalUnit(CmsObject, String, boolean)} instead
1936:             */
1937:            public List getUsers() throws CmsException {
1938:
1939:                return OpenCms.getOrgUnitManager().getUsers(this , "", true);
1940:            }
1941:
1942:            /**
1943:             * Returns all direct users of a given group.<p>
1944:             *
1945:             * Users that are "indirectly" in the group are not returned in the result.<p>
1946:             *
1947:             * @param groupname the name of the group to get all users for
1948:             * 
1949:             * @return all <code>{@link CmsUser}</code> objects in the group
1950:             *
1951:             * @throws CmsException if operation was not successful
1952:             */
1953:            public List getUsersOfGroup(String groupname) throws CmsException {
1954:
1955:                return getUsersOfGroup(groupname, true);
1956:            }
1957:
1958:            /**
1959:             * Returns all direct users of a given group.<p>
1960:             *
1961:             * Users that are "indirectly" in the group are not returned in the result.<p>
1962:             *
1963:             * @param groupname the name of the group to get all users for
1964:             * @param includeOtherOus if the result should include users of other ous
1965:             * 
1966:             * @return all <code>{@link CmsUser}</code> objects in the group
1967:             *
1968:             * @throws CmsException if operation was not successful
1969:             */
1970:            public List getUsersOfGroup(String groupname,
1971:                    boolean includeOtherOus) throws CmsException {
1972:
1973:                return m_securityManager.getUsersOfGroup(m_context, groupname,
1974:                        includeOtherOus, false, false);
1975:            }
1976:
1977:            /**
1978:             * Checks if the current user has required permissions to access a given resource.<p>
1979:             * 
1980:             * @param resource the resource to check the permissions for
1981:             * @param requiredPermissions the set of permissions to check for
1982:             * 
1983:             * @return <code>true</code> if the required permissions are satisfied
1984:             * 
1985:             * @throws CmsException if something goes wrong
1986:             */
1987:            public boolean hasPermissions(CmsResource resource,
1988:                    CmsPermissionSet requiredPermissions) throws CmsException {
1989:
1990:                return m_securityManager.hasPermissions(m_context, resource,
1991:                        requiredPermissions, true, CmsResourceFilter.ALL)
1992:                        .isAllowed();
1993:            }
1994:
1995:            /**
1996:             * Checks if the current user has required permissions to access a given resource.<p>
1997:             * 
1998:             * @param resource the resource to check the permissions for
1999:             * @param requiredPermissions the set of permissions to check for
2000:             * @param checkLock if <code>true</code>, a lock for the current user is required for 
2001:             *      all write operations, if <code>false</code> it's ok to write as long as the resource
2002:             *      is not locked by another user.
2003:             * @param filter the resource filter to use
2004:             * 
2005:             * @return <code>true</code> if the required permissions are satisfied
2006:             * 
2007:             * @throws CmsException if something goes wrong
2008:             */
2009:            public boolean hasPermissions(CmsResource resource,
2010:                    CmsPermissionSet requiredPermissions, boolean checkLock,
2011:                    CmsResourceFilter filter) throws CmsException {
2012:
2013:                return I_CmsPermissionHandler.PERM_ALLOWED == m_securityManager
2014:                        .hasPermissions(m_context, resource,
2015:                                requiredPermissions, checkLock, filter);
2016:            }
2017:
2018:            /**
2019:             * Checks if the given resource or the current project can be published by the current user 
2020:             * using his current OpenCms context.<p>
2021:             * 
2022:             * If the resource parameter is <code>null</code>, then the current project is checked,
2023:             * otherwise the resource is checked for direct publish permissions.<p>
2024:             * 
2025:             * @param resourcename the direct publish resource name (optional, if null only the current project is checked)
2026:             * 
2027:             * @return <code>true</code>, if the current user can direct publish the given resource in his current context
2028:             * 
2029:             * @deprecated notice that checking is no longer possible from the CmsObject
2030:             */
2031:            public boolean hasPublishPermissions(String resourcename) {
2032:
2033:                CmsResource resource = null;
2034:                if (resourcename != null) {
2035:                    // resource name is optional
2036:                    try {
2037:                        resource = readResource(resourcename,
2038:                                CmsResourceFilter.ALL);
2039:                        checkPublishPermissions(new CmsPublishList(Collections
2040:                                .singletonList(resource), false));
2041:                    } catch (CmsException e) {
2042:                        // if any exception (e.g. security) occurs the result is false
2043:                        return false;
2044:                    }
2045:                }
2046:                // no exception means permissions are granted
2047:                return true;
2048:            }
2049:
2050:            /**
2051:             * Checks if the user of the current OpenCms context 
2052:             * is a member of at last one of the roles in the given role set.<p>
2053:             *  
2054:             * @param role the role to check
2055:             * 
2056:             * @return <code>true</code> if the user of the current OpenCms context is at a member of at last 
2057:             *      one of the roles in the given role set
2058:             *      
2059:             * @deprecated use {@link OpenCms#getRoleManager()} methods instead
2060:             */
2061:            public boolean hasRole(CmsRole role) {
2062:
2063:                return OpenCms.getRoleManager().hasRole(this , role);
2064:            }
2065:
2066:            /**
2067:             * Writes a list of access control entries as new access control entries of a given resource.<p>
2068:             * 
2069:             * Already existing access control entries of this resource are removed before.<p>
2070:             * 
2071:             * @param resource the resource to attach the control entries to
2072:             * @param acEntries a list of <code>{@link CmsAccessControlEntry}</code> objects
2073:             * 
2074:             * @throws CmsException if something goes wrong
2075:             */
2076:            public void importAccessControlEntries(CmsResource resource,
2077:                    List acEntries) throws CmsException {
2078:
2079:                m_securityManager.importAccessControlEntries(m_context,
2080:                        resource, acEntries);
2081:            }
2082:
2083:            /**
2084:             * Imports a new relation to the given resource.<p>
2085:             * 
2086:             * @param resourceName the name of the source resource
2087:             * @param targetPath the path of the target resource
2088:             * @param relationType the type of the relation
2089:             * 
2090:             * @throws CmsException if something goes wrong
2091:             */
2092:            public void importRelation(String resourceName, String targetPath,
2093:                    String relationType) throws CmsException {
2094:
2095:                createRelation(resourceName, targetPath, relationType, true);
2096:            }
2097:
2098:            /**
2099:             * Imports a resource to the OpenCms VFS.<p>
2100:             * 
2101:             * If a resource already exists in the VFS (i.e. has the same name and 
2102:             * same id) it is replaced by the imported resource.<p>
2103:             * 
2104:             * If a resource with the same name but a different id exists, 
2105:             * the imported resource is (usually) moved to the "lost and found" folder.<p> 
2106:             *
2107:             * @param resourcename the name for the resource after import (full current site relative path)
2108:             * @param resource the resource object to be imported
2109:             * @param content the content of the resource
2110:             * @param properties the properties of the resource
2111:             * 
2112:             * @return the imported resource
2113:             * 
2114:             * @throws CmsException if something goes wrong
2115:             * 
2116:             * @see CmsObject#moveToLostAndFound(String)
2117:             */
2118:            public CmsResource importResource(String resourcename,
2119:                    CmsResource resource, byte[] content, List properties)
2120:                    throws CmsException {
2121:
2122:                return getResourceType(resource).importResource(this ,
2123:                        m_securityManager, resourcename, resource, content,
2124:                        properties);
2125:            }
2126:
2127:            /**
2128:             * Creates a new user by import.<p>
2129:             * 
2130:             * @param id the id of the user
2131:             * @param name the new name for the user
2132:             * @param password the new password for the user
2133:             * @param firstname the first name of the user
2134:             * @param lastname the last name of the user
2135:             * @param email the email of the user
2136:             * @param flags the flags for a user (for example <code>{@link I_CmsPrincipal#FLAG_ENABLED}</code>)
2137:             * @param dateCreated the creation date
2138:             * @param additionalInfos the additional user infos
2139:             * 
2140:             * @return the imported user
2141:             *
2142:             * @throws CmsException if something goes wrong
2143:             */
2144:            public CmsUser importUser(String id, String name, String password,
2145:                    String firstname, String lastname, String email, int flags,
2146:                    long dateCreated, Map additionalInfos) throws CmsException {
2147:
2148:                return m_securityManager.importUser(m_context, id, name,
2149:                        password, firstname, lastname, email, flags,
2150:                        dateCreated, additionalInfos);
2151:            }
2152:
2153:            /**
2154:             * Creates a new user by import.<p>
2155:             * 
2156:             * @param id the id of the user
2157:             * @param name the new name for the user
2158:             * @param password the new password for the user
2159:             * @param description the description for the user
2160:             * @param firstname the first name of the user
2161:             * @param lastname the last name of the user
2162:             * @param email the email of the user
2163:             * @param address the address of the user
2164:             * @param flags the flags for a user (for example <code>{@link I_CmsPrincipal#FLAG_ENABLED}</code>)
2165:             * @param additionalInfos the additional user infos
2166:             * 
2167:             * @return the imported user
2168:             *
2169:             * @throws CmsException if something goes wrong
2170:             * 
2171:             * @deprecated use {@link #importUser(String, String, String, String, String, String, int, long, Map)} instead
2172:             */
2173:            public CmsUser importUser(String id, String name, String password,
2174:                    String description, String firstname, String lastname,
2175:                    String email, String address, int flags, Map additionalInfos)
2176:                    throws CmsException {
2177:
2178:                Map info = new HashMap();
2179:                if (additionalInfos != null) {
2180:                    info.putAll(additionalInfos);
2181:                }
2182:                if (description != null) {
2183:                    info.put(CmsUserSettings.ADDITIONAL_INFO_DESCRIPTION,
2184:                            description);
2185:                }
2186:                if (address != null) {
2187:                    info.put(CmsUserSettings.ADDITIONAL_INFO_ADDRESS, address);
2188:                }
2189:                return importUser(id, name, password, firstname, lastname,
2190:                        email, flags, System.currentTimeMillis(), info);
2191:            }
2192:
2193:            /**
2194:             * Checks if the current user has role access to <code>{@link CmsRole#ROOT_ADMIN}</code>.<p>
2195:             *
2196:             * @return <code>true</code>, if the current user has role access to <code>{@link CmsRole#ROOT_ADMIN}</code>
2197:             * 
2198:             * @deprecated use <code>{@link #hasRole(CmsRole)}</code> or <code>{@link #checkRole(CmsRole)}</code> instead
2199:             */
2200:            public boolean isAdmin() {
2201:
2202:                return hasRole(CmsRole.ROOT_ADMIN);
2203:            }
2204:
2205:            /**
2206:             * Checks if the specified resource is inside the current project.<p>
2207:             * 
2208:             * The project "view" is determined by a set of path prefixes. 
2209:             * If the resource starts with any one of this prefixes, it is considered to 
2210:             * be "inside" the project.<p>
2211:             * 
2212:             * @param resourcename the specified resource name (full current site relative path)
2213:             * 
2214:             * @return <code>true</code>, if the specified resource is inside the current project
2215:             */
2216:            public boolean isInsideCurrentProject(String resourcename) {
2217:
2218:                return m_securityManager.isInsideCurrentProject(m_context,
2219:                        addSiteRoot(resourcename));
2220:            }
2221:
2222:            /**
2223:             * Checks if the current user has management access to the current project.<p>
2224:             *
2225:             * @return <code>true</code>, if the user has management access to the current project
2226:             */
2227:
2228:            public boolean isManagerOfProject() {
2229:
2230:                return m_securityManager.isManagerOfProject(m_context);
2231:            }
2232:
2233:            /**
2234:             * Locks a resource.<p>
2235:             *
2236:             * This will be an exclusive, persistent lock that is removed only if the user unlocks it.<p>
2237:             *
2238:             * @param resourcename the name of the resource to lock (full current site relative path)
2239:             * 
2240:             * @throws CmsException if something goes wrong
2241:             */
2242:            public void lockResource(String resourcename) throws CmsException {
2243:
2244:                lockResource(resourcename, CmsLockType.EXCLUSIVE);
2245:            }
2246:
2247:            /**
2248:             * Locks a resource.<p>
2249:             *
2250:             * The <code>mode</code> parameter controls what kind of lock is used.<br>
2251:             * 
2252:             * @param resourcename the name of the resource to lock (full path)
2253:             * @param mode flag indicating the mode for the lock
2254:             * 
2255:             * @throws CmsException if something goes wrong
2256:             * 
2257:             * @deprecated use {@link #lockResource(String)} or {@link #lockResourceTemporary(String)} instead
2258:             */
2259:            public void lockResource(String resourcename, int mode)
2260:                    throws CmsException {
2261:
2262:                lockResource(resourcename, CmsLockType.valueOf(mode));
2263:            }
2264:
2265:            /**
2266:             * Locks a resource temporary.<p>
2267:             *
2268:             * This will be an exclusive, temporary lock valid only for the current users session.
2269:             * Usually this should not be used directly, this method is intended for the OpenCms workplace only.<p>
2270:             *
2271:             * @param resourcename the name of the resource to lock (full current site relative path)
2272:             * 
2273:             * @throws CmsException if something goes wrong
2274:             * 
2275:             * @see CmsObject#lockResource(String)
2276:             */
2277:            public void lockResourceTemporary(String resourcename)
2278:                    throws CmsException {
2279:
2280:                lockResource(resourcename, CmsLockType.TEMPORARY);
2281:            }
2282:
2283:            /**
2284:             * Logs a user into the Cms, if the password is correct.<p>
2285:             *
2286:             * @param username the name of the user
2287:             * @param password the password of the user
2288:             * 
2289:             * @return the name of the logged in user
2290:             *
2291:             * @throws CmsException if the login was not successful
2292:             */
2293:            public String loginUser(String username, String password)
2294:                    throws CmsException {
2295:
2296:                return loginUser(username, password, m_context
2297:                        .getRemoteAddress());
2298:            }
2299:
2300:            /**
2301:             * Logs a user with a given ip address into the Cms, if the password is correct.<p>
2302:             *
2303:             * @param username the name of the user
2304:             * @param password the password of the user
2305:             * @param remoteAddress the ip address
2306:             * 
2307:             * @return the name of the logged in user
2308:             *
2309:             * @throws CmsException if the login was not successful
2310:             */
2311:            public String loginUser(String username, String password,
2312:                    String remoteAddress) throws CmsException {
2313:
2314:                // login the user
2315:                CmsUser newUser = m_securityManager.loginUser(m_context,
2316:                        username, password, remoteAddress);
2317:                // set the project back to the "Online" project
2318:                CmsProject newProject = m_securityManager
2319:                        .readProject(CmsProject.ONLINE_PROJECT_ID);
2320:                // switch the cms context to the new user and project
2321:                m_context.switchUser(newUser, newProject, CmsOrganizationalUnit
2322:                        .getParentFqn(username));
2323:                // init this CmsObject with the new user
2324:                init(m_securityManager, m_context);
2325:                // fire a login event
2326:                fireEvent(I_CmsEventListener.EVENT_LOGIN_USER, newUser);
2327:                // return the users login name
2328:                return newUser.getName();
2329:            }
2330:
2331:            /**
2332:             * Logs a web user into the Cms, if the password is correct.
2333:             *
2334:             * @param username the name of the user
2335:             * @param password the password of the user
2336:             * 
2337:             * @return the name of the logged in user
2338:             *
2339:             * @throws CmsException if the login was not successful
2340:             * 
2341:             * @deprecated there are no more web users, use a user without any role!
2342:             */
2343:            public String loginWebUser(String username, String password)
2344:                    throws CmsException {
2345:
2346:                return loginUser(username, password, m_context
2347:                        .getRemoteAddress());
2348:            }
2349:
2350:            /**
2351:             * Lookups and reads the user or group with the given UUID.<p>
2352:             *   
2353:             * @param principalId the uuid of a user or group
2354:             * 
2355:             * @return the user or group with the given UUID
2356:             */
2357:            public I_CmsPrincipal lookupPrincipal(CmsUUID principalId) {
2358:
2359:                return m_securityManager
2360:                        .lookupPrincipal(m_context, principalId);
2361:            }
2362:
2363:            /**
2364:             * Lookups and reads the user or group with the given name.<p>
2365:             * 
2366:             * @param principalName the name of the user or group
2367:             * 
2368:             * @return the user or group with the given name
2369:             */
2370:            public I_CmsPrincipal lookupPrincipal(String principalName) {
2371:
2372:                return m_securityManager.lookupPrincipal(m_context,
2373:                        principalName);
2374:            }
2375:
2376:            /**
2377:             * Moves a resource to the given destination.<p>
2378:             * 
2379:             * A move operation in OpenCms is always a copy (as sibling) followed by a delete,
2380:             * this is a result of the online/offline structure of the 
2381:             * OpenCms VFS. This way you can see the deleted files/folders in the offline
2382:             * project, and you will be unable to undelete them.<p>
2383:             * 
2384:             * @param source the name of the resource to move (full current site relative path)
2385:             * @param destination the destination resource name (full current site relative path)
2386:             *
2387:             * @throws CmsException if something goes wrong
2388:             * 
2389:             * @see #renameResource(String, String)
2390:             */
2391:            public void moveResource(String source, String destination)
2392:                    throws CmsException {
2393:
2394:                CmsResource resource = readResource(source,
2395:                        CmsResourceFilter.IGNORE_EXPIRATION);
2396:                getResourceType(resource).moveResource(this , m_securityManager,
2397:                        resource, destination);
2398:            }
2399:
2400:            /**
2401:             * Moves a resource to the "lost and found" folder.<p>
2402:             * 
2403:             * The "lost and found" folder is a special system folder. 
2404:             * 
2405:             * This operation is used e.g. during import of resources
2406:             * when a resource with the same name but a different resource ID
2407:             * already exists in the VFS. In this case, the imported resource is 
2408:             * moved to the "lost and found" folder.<p>
2409:             * 
2410:             * @param resourcename the name of the resource to move to "lost and found" (full current site relative path)
2411:             *
2412:             * @return the name of the resource inside the "lost and found" folder
2413:             * 
2414:             * @throws CmsException if something goes wrong
2415:             * 
2416:             * @see #getLostAndFoundName(String)
2417:             */
2418:            public String moveToLostAndFound(String resourcename)
2419:                    throws CmsException {
2420:
2421:                CmsResource resource = readResource(resourcename,
2422:                        CmsResourceFilter.ALL);
2423:                return m_securityManager.moveToLostAndFound(m_context,
2424:                        resource, false);
2425:            }
2426:
2427:            /**
2428:             * Publishes the current project, printing messages to a shell report.<p>
2429:             *
2430:             * @return the publish history id of the published project
2431:             * 
2432:             * @throws Exception if something goes wrong
2433:             * 
2434:             * @see CmsShellReport
2435:             * 
2436:             * @deprecated use <code>{@link OpenCms#getPublishManager()}.{@link org.opencms.publish.CmsPublishManager#publishProject(CmsObject) publishProject(CmsObject)}</code> instead
2437:             */
2438:            public CmsUUID publishProject() throws Exception {
2439:
2440:                CmsUUID publishHistoryId = OpenCms.getPublishManager()
2441:                        .publishProject(this ,
2442:                                new CmsShellReport(m_context.getLocale()));
2443:                OpenCms.getPublishManager().waitWhileRunning();
2444:                return publishHistoryId;
2445:            }
2446:
2447:            /**
2448:             * Publishes the current project.<p>
2449:             *
2450:             * @param report an instance of <code>{@link I_CmsReport}</code> to print messages
2451:             * 
2452:             * @return the publish history id of the published project
2453:             * 
2454:             * @throws CmsException if something goes wrong
2455:             * 
2456:             * @deprecated use <code>{@link OpenCms#getPublishManager()}.{@link org.opencms.publish.CmsPublishManager#publishProject(CmsObject, I_CmsReport) publishProject(CmsObject, I_CmsReport)}</code> instead
2457:             */
2458:            public CmsUUID publishProject(I_CmsReport report)
2459:                    throws CmsException {
2460:
2461:                CmsUUID publishHistoryId = OpenCms.getPublishManager()
2462:                        .publishProject(
2463:                                this ,
2464:                                report,
2465:                                OpenCms.getPublishManager()
2466:                                        .getPublishList(this ));
2467:                OpenCms.getPublishManager().waitWhileRunning();
2468:                return publishHistoryId;
2469:            }
2470:
2471:            /**
2472:             * Publishes the resources of a specified publish list.<p>
2473:             * 
2474:             * @param report an instance of <code>{@link I_CmsReport}</code> to print messages
2475:             * @param publishList a publish list
2476:             * 
2477:             * @return the publish history id of the published project
2478:             * 
2479:             * @throws CmsException if something goes wrong
2480:             * 
2481:             * @see #getPublishList()
2482:             * @see #getPublishList(CmsResource, boolean)
2483:             * @see #getPublishList(List, boolean)
2484:             * 
2485:             * @deprecated use <code>{@link OpenCms#getPublishManager()}.{@link org.opencms.publish.CmsPublishManager#publishProject(CmsObject, I_CmsReport, CmsPublishList) publishProject(CmsObject, I_CmsReport, CmsPublishList)}</code> instead
2486:             */
2487:            public CmsUUID publishProject(I_CmsReport report,
2488:                    CmsPublishList publishList) throws CmsException {
2489:
2490:                CmsUUID publishHistoryId = OpenCms.getPublishManager()
2491:                        .publishProject(this , report, publishList);
2492:                OpenCms.getPublishManager().waitWhileRunning();
2493:                return publishHistoryId;
2494:            }
2495:
2496:            /**
2497:             * Direct publishes a specified resource.<p>
2498:             * 
2499:             * @param report an instance of <code>{@link I_CmsReport}</code> to print messages
2500:             * @param directPublishResource a <code>{@link CmsResource}</code> that gets directly published; 
2501:             *                          or <code>null</code> if an entire project gets published.
2502:             * @param directPublishSiblings if a <code>{@link CmsResource}</code> that should get published directly is 
2503:             *                          provided as an argument, all eventual siblings of this resource 
2504:             *                          get publish too, if this flag is <code>true</code>.
2505:             * 
2506:             * @return the publish history id of the published project
2507:             * 
2508:             * @throws CmsException if something goes wrong
2509:             * 
2510:             * @see #publishResource(String)
2511:             * @see #publishResource(String, boolean, I_CmsReport)
2512:             * 
2513:             * @deprecated use <code>{@link OpenCms#getPublishManager()}.{@link org.opencms.publish.CmsPublishManager#publishProject(CmsObject, I_CmsReport, CmsResource, boolean) publishProject(CmsObject, I_CmsReport, CmsResource, boolean)}</code> instead
2514:             */
2515:            public CmsUUID publishProject(I_CmsReport report,
2516:                    CmsResource directPublishResource,
2517:                    boolean directPublishSiblings) throws CmsException {
2518:
2519:                CmsUUID publishHistoryId = OpenCms.getPublishManager()
2520:                        .publishProject(
2521:                                this ,
2522:                                report,
2523:                                OpenCms.getPublishManager().getPublishList(
2524:                                        this , directPublishResource,
2525:                                        directPublishSiblings));
2526:                OpenCms.getPublishManager().waitWhileRunning();
2527:                return publishHistoryId;
2528:            }
2529:
2530:            /**
2531:             * Publishes a single resource, printing messages to a shell report.<p>
2532:             * 
2533:             * The siblings of the resource will not be published.<p>
2534:             *
2535:             * @param resourcename the name of the resource to be published
2536:             * 
2537:             * @return the publish history id of the published project
2538:             * 
2539:             * @throws Exception if something goes wrong
2540:             * 
2541:             * @see CmsShellReport
2542:             * 
2543:             * @deprecated use <code>{@link OpenCms#getPublishManager()}.{@link org.opencms.publish.CmsPublishManager#publishResource(CmsObject, String) publishResource(CmsObject, String)}</code> instead
2544:             */
2545:            public CmsUUID publishResource(String resourcename)
2546:                    throws Exception {
2547:
2548:                CmsUUID publishHistoryId = OpenCms.getPublishManager()
2549:                        .publishResource(this , resourcename, false,
2550:                                new CmsShellReport(m_context.getLocale()));
2551:                OpenCms.getPublishManager().waitWhileRunning();
2552:                return publishHistoryId;
2553:            }
2554:
2555:            /**
2556:             * Publishes a single resource.<p>
2557:             * 
2558:             * @param resourcename the name of the resource to be published
2559:             * @param publishSiblings if <code>true</code>, all siblings of the resource are also published
2560:             * @param report the report to write the progress information to
2561:             * 
2562:             * @return the publish history id of the published project
2563:             * 
2564:             * @throws Exception if something goes wrong
2565:             * 
2566:             * @deprecated use <code>{@link OpenCms#getPublishManager()}.{@link org.opencms.publish.CmsPublishManager#publishResource(CmsObject, String, boolean, I_CmsReport) publishResource(CmsObject, String, boolean, I_CmsReport)}</code> instead
2567:             */
2568:            public CmsUUID publishResource(String resourcename,
2569:                    boolean publishSiblings, I_CmsReport report)
2570:                    throws Exception {
2571:
2572:                CmsResource resource = readResource(resourcename,
2573:                        CmsResourceFilter.ALL);
2574:                CmsUUID publishHistoryId = OpenCms
2575:                        .getPublishManager()
2576:                        .publishProject(this , report, resource, publishSiblings);
2577:                OpenCms.getPublishManager().waitWhileRunning();
2578:                return publishHistoryId;
2579:            }
2580:
2581:            /**
2582:             * Reads all historical versions of a resource.<br>
2583:             * 
2584:             * The reading excludes the file content, if the resource is a file.<p>
2585:             *
2586:             * @param resourceName the name of the resource to be read
2587:             *
2588:             * @return a list of historical resources, as <code>{@link I_CmsHistoryResource}</code> objects
2589:             *
2590:             * @throws CmsException if operation was not successful
2591:             */
2592:            public List readAllAvailableVersions(String resourceName)
2593:                    throws CmsException {
2594:
2595:                CmsResource resource = readResource(resourceName,
2596:                        CmsResourceFilter.ALL);
2597:                return m_securityManager.readAllAvailableVersions(m_context,
2598:                        resource);
2599:            }
2600:
2601:            /**
2602:             * Reads all file headers of a file.<br>
2603:             * 
2604:             * This method returns a list with the history of all file headers, i.e.
2605:             * the file headers of a file, independent of the project they were attached to.<br>
2606:             *
2607:             * The reading excludes the file content.<p>
2608:             *
2609:             * @param filename the name of the file to be read
2610:             *
2611:             * @return a list of file headers, as <code>{@link I_CmsHistoryResource}</code> objects, read from the Cms
2612:             *
2613:             * @throws CmsException  if operation was not successful
2614:             * 
2615:             * @deprecated Use {@link #readAllAvailableVersions(String)} instead
2616:             */
2617:            public List readAllBackupFileHeaders(String filename)
2618:                    throws CmsException {
2619:
2620:                return readAllAvailableVersions(filename);
2621:            }
2622:
2623:            /**
2624:             * Reads all property definitions.<p>
2625:             *
2626:             * @return a list with the <code>{@link CmsPropertyDefinition}</code> objects (may be empty)
2627:             *
2628:             * @throws CmsException if something goes wrong
2629:             */
2630:            public List readAllPropertyDefinitions() throws CmsException {
2631:
2632:                return m_securityManager.readAllPropertyDefinitions(m_context);
2633:            }
2634:
2635:            /**
2636:             * Returns the first ancestor folder matching the filter criteria.<p>
2637:             * 
2638:             * If no folder matching the filter criteria is found, null is returned.<p>
2639:             * 
2640:             * @param resourcename the name of the resource to start (full current site relative path)
2641:             * @param filter the resource filter to match while reading the ancestors
2642:             * 
2643:             * @return the first ancestor folder matching the filter criteria or null if no folder was found
2644:             * 
2645:             * @throws CmsException if something goes wrong
2646:             */
2647:            public CmsFolder readAncestor(String resourcename,
2648:                    CmsResourceFilter filter) throws CmsException {
2649:
2650:                CmsResource resource = readResource(resourcename,
2651:                        CmsResourceFilter.ALL);
2652:                return m_securityManager.readAncestor(m_context, resource,
2653:                        filter);
2654:            }
2655:
2656:            /**
2657:             * Returns the first ancestor folder matching the resource type.<p>
2658:             * 
2659:             * If no folder with the requested resource type is found, null is returned.<p>
2660:             * 
2661:             * @param resourcename the name of the resource to start (full current site relative path)
2662:             * @param type the resource type of the folder to match
2663:             * 
2664:             * @return the first ancestor folder matching the filter criteria or null if no folder was found
2665:             * 
2666:             * @throws CmsException if something goes wrong
2667:             */
2668:            public CmsFolder readAncestor(String resourcename, int type)
2669:                    throws CmsException {
2670:
2671:                return readAncestor(resourcename, CmsResourceFilter
2672:                        .requireType(type));
2673:            }
2674:
2675:            /**
2676:             * Returns a file from the history.<br>
2677:             * 
2678:             * The reading includes the file content.<p>
2679:             *
2680:             * @param structureId the structure id of the file to be read
2681:             * @param publishTag the tag id of the resource
2682:             *
2683:             * @return the file read
2684:             *
2685:             * @throws CmsException if the user has not the rights to read the file, or 
2686:             *                      if the file couldn't be read.
2687:             *                      
2688:             * @deprecated use {@link #readResourceByPublishTag(CmsUUID, int)} or {@link #readResource(CmsUUID, int)} instead, 
2689:             *             but notice that the <code>publishTag != version</code>
2690:             *             and there is no possibility to access to a historical entry with just the filename.
2691:             */
2692:            public I_CmsHistoryResource readBackupFile(CmsUUID structureId,
2693:                    int publishTag) throws CmsException {
2694:
2695:                return readResourceByPublishTag(structureId, publishTag);
2696:            }
2697:
2698:            /**
2699:             * Returns a resource from the historical archive.<br>
2700:             * 
2701:             * The reading includes the file content, if the resource is a file.<p>
2702:             *
2703:             * @param filename the path of the file to be read
2704:             * @param publishTag the publish tag
2705:             *
2706:             * @return the file read
2707:             *
2708:             * @throws CmsException if the user has not the rights to read the file, or 
2709:             *                      if the file couldn't be read.
2710:             *                      
2711:             * @deprecated use {@link #readResource(CmsUUID, int)} instead, 
2712:             *             but notice that the <code>publishTag != version</code>
2713:             *             and there is no possibility to access to an historical entry with just the filename.
2714:             */
2715:            public I_CmsHistoryResource readBackupFile(String filename,
2716:                    int publishTag) throws CmsException {
2717:
2718:                CmsResource resource = readResource(filename,
2719:                        CmsResourceFilter.ALL);
2720:                return readResourceByPublishTag(resource.getStructureId(),
2721:                        publishTag);
2722:            }
2723:
2724:            /**
2725:             * Returns a backup project.<p>
2726:             *
2727:             * @param tagId the tag of the backup project to be read
2728:             * 
2729:             * @return the requested backup project
2730:             * 
2731:             * @throws CmsException if operation was not successful
2732:             * 
2733:             * @deprecated Use {@link #readHistoryProject(int)} instead
2734:             */
2735:            public CmsHistoryProject readBackupProject(int tagId)
2736:                    throws CmsException {
2737:
2738:                return readHistoryProject(tagId);
2739:            }
2740:
2741:            /**
2742:             * Reads the list of <code>{@link CmsProperty}</code> objects that belong the the given backup resource.<p>
2743:             * 
2744:             * @param resource the backup resource to read the properties from
2745:             * 
2746:             * @return the list of <code>{@link CmsProperty}</code> objects that belong the the given backup resource
2747:             * 
2748:             * @throws CmsException if something goes wrong
2749:             * 
2750:             * @deprecated Use {@link #readHistoryPropertyObjects(I_CmsHistoryResource)} instead
2751:             */
2752:            public List readBackupPropertyObjects(I_CmsHistoryResource resource)
2753:                    throws CmsException {
2754:
2755:                return readHistoryPropertyObjects(resource);
2756:            }
2757:
2758:            /**
2759:             * Returns the default resource for the given folder.<p>
2760:             * 
2761:             * If the given resource name or id identifies a file, then this file is returned.<p>
2762:             * 
2763:             * Otherwise, in case of a folder:<br> 
2764:             * <ol>
2765:             *   <li>the {@link CmsPropertyDefinition#PROPERTY_DEFAULT_FILE} is checked, and
2766:             *   <li>if still no file could be found, the configured default files in the 
2767:             *       <code>opencms-vfs.xml</code> configuration are iterated until a match is 
2768:             *       found, and
2769:             *   <li>if still no file could be found, <code>null</code> is returned
2770:             * </ol>
2771:             * 
2772:             * @param resourceNameOrID the name or id of the folder to read the default file for
2773:             * 
2774:             * @return the default file for the given folder
2775:             * 
2776:             * @throws CmsException if something goes wrong
2777:             * @throws CmsSecurityException if the user has no permissions to read the resulting file
2778:             * 
2779:             * @see CmsSecurityManager#readDefaultFile(CmsRequestContext, CmsResource)
2780:             */
2781:            public CmsResource readDefaultFile(String resourceNameOrID)
2782:                    throws CmsException, CmsSecurityException {
2783:
2784:                CmsResource resource;
2785:                try {
2786:                    resource = readResource(new CmsUUID(resourceNameOrID));
2787:                } catch (NumberFormatException e) {
2788:                    resource = readResource(resourceNameOrID);
2789:                }
2790:                return m_securityManager.readDefaultFile(m_context, resource);
2791:            }
2792:
2793:            /**
2794:             * Reads all deleted (historical) resources below the given path, 
2795:             * including the full tree below the path, if required.<p>
2796:             * 
2797:             * The result list may include resources with the same name of  
2798:             * resources (with different id's).<p>
2799:             * 
2800:             * Use in conjunction with the {@link #restoreDeletedResource(CmsUUID)} 
2801:             * method.<p>
2802:             * 
2803:             * @param resourcename the parent path to read the resources from
2804:             * @param readTree <code>true</code> to read all sub resources
2805:             * 
2806:             * @return a list of <code>{@link I_CmsHistoryResource}</code> objects
2807:             * 
2808:             * @throws CmsException if something goes wrong
2809:             * 
2810:             * @see #readResource(CmsUUID, int)
2811:             * @see #readResources(String, CmsResourceFilter, boolean)
2812:             */
2813:            public List readDeletedResources(String resourcename,
2814:                    boolean readTree) throws CmsException {
2815:
2816:                CmsResource resource = readResource(resourcename,
2817:                        CmsResourceFilter.ALL);
2818:                return m_securityManager.readDeletedResources(m_context,
2819:                        resource, readTree);
2820:            }
2821:
2822:            /**
2823:             * Reads a file resource (including it's binary content) from the VFS,
2824:             * for the given resource (this may also be an historical version of the resource).<p>
2825:             * 
2826:             * In case the input {@link CmsResource} object already is a {@link CmsFile} with contents
2827:             * available, it is casted to a file and returned unchanged. Otherwise the file is read 
2828:             * from the VFS.<p>
2829:             * 
2830:             * In case you do not need the file content, 
2831:             * use <code>{@link #readResource(String)}</code> or
2832:             * <code>{@link #readResource(String, CmsResourceFilter)}</code> instead.<p>
2833:             * 
2834:             * No resource filter is applied when reading the resource, since we already have
2835:             * a full resource instance and assume we just want the content for that instance. 
2836:             * In case you need to apply a filter, use {@link #readFile(String, CmsResourceFilter)} instead.<p>
2837:             * 
2838:             * @param resource the resource to read
2839:             *
2840:             * @return the file resource that was read
2841:             *
2842:             * @throws CmsException if the file resource could not be read for any reason
2843:             * 
2844:             * @see #readFile(String)
2845:             * @see #readFile(String, CmsResourceFilter)
2846:             */
2847:            public CmsFile readFile(CmsResource resource) throws CmsException {
2848:
2849:                // test if we already have a file
2850:                if (resource instanceof  CmsFile) {
2851:                    // resource is already a file
2852:                    CmsFile file = (CmsFile) resource;
2853:                    if ((file.getContents() != null)
2854:                            && (file.getContents().length > 0)) {
2855:                        // file has the contents already available
2856:                        return file;
2857:                    }
2858:                }
2859:
2860:                return m_securityManager.readFile(m_context, resource);
2861:            }
2862:
2863:            /**
2864:             * Reads a file resource (including it's binary content) from the VFS,
2865:             * using the <code>{@link CmsResourceFilter#DEFAULT}</code> filter.<p>
2866:             *  
2867:             * In case you do not need the file content, 
2868:             * use <code>{@link #readResource(String)}</code> instead.<p>
2869:             *
2870:             * @param resourcename the name of the resource to read (full current site relative path)
2871:             *
2872:             * @return the file resource that was read
2873:             *
2874:             * @throws CmsException if the file resource could not be read for any reason
2875:             * 
2876:             * @see #readFile(String, CmsResourceFilter)
2877:             * @see #readFile(CmsResource)
2878:             * @see #readResource(String)
2879:             */
2880:            public CmsFile readFile(String resourcename) throws CmsException {
2881:
2882:                return readFile(resourcename, CmsResourceFilter.DEFAULT);
2883:            }
2884:
2885:            /**
2886:             * Reads a file resource (including it's binary content) from the VFS,
2887:             * using the specified resource filter.<p>
2888:             * 
2889:             * In case you do not need the file content, 
2890:             * use <code>{@link #readResource(String, CmsResourceFilter)}</code> instead.<p>
2891:             * 
2892:             * The specified filter controls what kind of resources should be "found" 
2893:             * during the read operation. This will depend on the application. For example, 
2894:             * using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently
2895:             * "valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code>
2896:             * will ignore the date release / date expired information of the resource.<p>
2897:             *
2898:             * @param resourcename the name of the resource to read (full current site relative path)
2899:             * @param filter the resource filter to use while reading
2900:             *
2901:             * @return the file resource that was read
2902:             *
2903:             * @throws CmsException if the file resource could not be read for any reason
2904:             *
2905:             * @see #readFile(String)
2906:             * @see #readFile(CmsResource)
2907:             * @see #readResource(String, CmsResourceFilter)
2908:             */
2909:            public CmsFile readFile(String resourcename,
2910:                    CmsResourceFilter filter) throws CmsException {
2911:
2912:                CmsResource resource = readResource(resourcename, filter);
2913:                return readFile(resource);
2914:            }
2915:
2916:            /**
2917:             * Reads a resource from the VFS,
2918:             * using the <code>{@link CmsResourceFilter#DEFAULT}</code> filter.<p> 
2919:             *
2920:             * @param resourcename the name of the resource to read (full current site relative path)
2921:             *
2922:             * @return the file resource that was read
2923:             *
2924:             * @throws CmsException if something goes wrong
2925:             *
2926:             * @deprecated use <code>{@link #readResource(String, CmsResourceFilter)}</code> instead.
2927:             */
2928:            public CmsResource readFileHeader(String resourcename)
2929:                    throws CmsException {
2930:
2931:                return readResource(resourcename, CmsResourceFilter.DEFAULT);
2932:            }
2933:
2934:            /**
2935:             * Reads a folder resource from the VFS,
2936:             * using the <code>{@link CmsResourceFilter#DEFAULT}</code> filter.<p> 
2937:             *
2938:             * @param resourcename the name of the folder resource to read (full current site relative path)
2939:             *
2940:             * @return the folder resource that was read
2941:             *
2942:             * @throws CmsException if the resource could not be read for any reason
2943:             *
2944:             * @see #readResource(String, CmsResourceFilter)
2945:             * @see #readFolder(String, CmsResourceFilter)
2946:             */
2947:            public CmsFolder readFolder(String resourcename)
2948:                    throws CmsException {
2949:
2950:                return readFolder(resourcename, CmsResourceFilter.DEFAULT);
2951:            }
2952:
2953:            /**
2954:             * Reads a folder resource from the VFS,
2955:             * using the specified resource filter.<p>
2956:             *
2957:             * The specified filter controls what kind of resources should be "found" 
2958:             * during the read operation. This will depend on the application. For example, 
2959:             * using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently
2960:             * "valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code>
2961:             * will ignore the date release / date expired information of the resource.<p>
2962:             * 
2963:             * @param resourcename the name of the folder resource to read (full current site relative path)
2964:             * @param filter the resource filter to use while reading
2965:             *
2966:             * @return the folder resource that was read
2967:             *
2968:             * @throws CmsException if the resource could not be read for any reason
2969:             * 
2970:             * @see #readResource(String, CmsResourceFilter)
2971:             */
2972:            public CmsFolder readFolder(String resourcename,
2973:                    CmsResourceFilter filter) throws CmsException {
2974:
2975:                return m_securityManager.readFolder(m_context,
2976:                        addSiteRoot(resourcename), filter);
2977:            }
2978:
2979:            /**
2980:             * Reads the group of a project.<p>
2981:             *
2982:             * @param project the project to read the group from
2983:             * 
2984:             * @return the group of the given project
2985:             */
2986:            public CmsGroup readGroup(CmsProject project) {
2987:
2988:                return m_securityManager.readGroup(m_context, project);
2989:            }
2990:
2991:            /**
2992:             * Reads a group based on its id.<p>
2993:             *
2994:             * @param groupId the id of the group to be read
2995:             * 
2996:             * @return the group that has the provided id
2997:             * 
2998:             * @throws CmsException if something goes wrong
2999:             * 
3000:             * @see #readHistoryPrincipal(CmsUUID) for retrieving deleted groups
3001:             */
3002:            public CmsGroup readGroup(CmsUUID groupId) throws CmsException {
3003:
3004:                return m_securityManager.readGroup(m_context, groupId);
3005:            }
3006:
3007:            /**
3008:             * Reads a group based on its name.<p>
3009:             * 
3010:             * @param groupName the name of the group to be read
3011:             * 
3012:             * @return the group that has the provided name
3013:             * 
3014:             * @throws CmsException if something goes wrong
3015:             */
3016:            public CmsGroup readGroup(String groupName) throws CmsException {
3017:
3018:                return m_securityManager.readGroup(m_context, groupName);
3019:            }
3020:
3021:            /**
3022:             * Reads a principal (an user or group) from the historical archive based on its ID.<p>
3023:             * 
3024:             * @param principalId the id of the principal to read
3025:             * 
3026:             * @return the historical principal entry with the given id
3027:             * 
3028:             * @throws CmsException if something goes wrong, ie. {@link org.opencms.db.CmsDbEntryNotFoundException}
3029:             * 
3030:             * @see #readUser(CmsUUID)
3031:             * @see #readGroup(CmsUUID)
3032:             */
3033:            public CmsHistoryPrincipal readHistoryPrincipal(CmsUUID principalId)
3034:                    throws CmsException {
3035:
3036:                return m_securityManager.readHistoricalPrincipal(m_context,
3037:                        principalId);
3038:            }
3039:
3040:            /**
3041:             * Returns a historical project entry.<p>
3042:             *
3043:             * @param publishTag publish tag of the project
3044:             * 
3045:             * @return the requested historical project entry
3046:             * 
3047:             * @throws CmsException if operation was not successful
3048:             */
3049:            public CmsHistoryProject readHistoryProject(int publishTag)
3050:                    throws CmsException {
3051:
3052:                return (m_securityManager.readHistoryProject(m_context,
3053:                        publishTag));
3054:            }
3055:
3056:            /**
3057:             * Reads the list of all <code>{@link CmsProperty}</code> objects that belong to the given historical resource version.<p>
3058:             * 
3059:             * @param resource the historical resource version to read the properties for
3060:             * 
3061:             * @return the list of <code>{@link CmsProperty}</code> objects
3062:             * 
3063:             * @throws CmsException if something goes wrong
3064:             */
3065:            public List readHistoryPropertyObjects(I_CmsHistoryResource resource)
3066:                    throws CmsException {
3067:
3068:                return m_securityManager.readHistoryPropertyObjects(m_context,
3069:                        resource);
3070:            }
3071:
3072:            /**
3073:             * Returns the project manager group of a project.<p>
3074:             *
3075:             * @param project the project
3076:             * 
3077:             * @return the manager group of the project
3078:             */
3079:            public CmsGroup readManagerGroup(CmsProject project) {
3080:
3081:                return m_securityManager.readManagerGroup(m_context, project);
3082:            }
3083:
3084:            /**
3085:             * Reads the owner of a project.<p>
3086:             *
3087:             * @param project the project to read the owner from
3088:             * 
3089:             * @return the owner of the project
3090:             * 
3091:             * @throws CmsException if something goes wrong
3092:             */
3093:            public CmsUser readOwner(CmsProject project) throws CmsException {
3094:
3095:                return m_securityManager.readOwner(m_context, project);
3096:            }
3097:
3098:            /**
3099:             * Builds a list of resources for a given path.<p>
3100:             * 
3101:             * @param path the requested path
3102:             * @param filter a filter object (only "includeDeleted" information is used!)
3103:             * 
3104:             * @return list of <code>{@link CmsResource}</code>s
3105:             * 
3106:             * @throws CmsException if something goes wrong
3107:             */
3108:            public List readPath(String path, CmsResourceFilter filter)
3109:                    throws CmsException {
3110:
3111:                return m_securityManager.readPath(m_context, m_context
3112:                        .currentProject().getUuid(), addSiteRoot(path), filter);
3113:            }
3114:
3115:            /**
3116:             * Reads the project with the given id.<p>
3117:             *
3118:             * @param id the id of the project
3119:             * 
3120:             * @return the project with the given id
3121:             *
3122:             * @throws CmsException if operation was not successful
3123:             */
3124:            public CmsProject readProject(CmsUUID id) throws CmsException {
3125:
3126:                return m_securityManager.readProject(id);
3127:            }
3128:
3129:            /**
3130:             * Reads the project with the given id.<p>
3131:             *
3132:             * @param id the id of the project
3133:             * 
3134:             * @return the project with the given id
3135:             *
3136:             * @throws CmsException if operation was not successful
3137:             * 
3138:             * @deprecated use {@link #readProject(CmsUUID)} instead
3139:             */
3140:            public CmsProject readProject(int id) throws CmsException {
3141:
3142:                return readProject(m_securityManager
3143:                        .getProjectId(m_context, id));
3144:            }
3145:
3146:            /**
3147:             * Reads the project with the given name.<p>
3148:             *
3149:             * @param name the name of the project
3150:             * 
3151:             * @return the project with the given name
3152:             * 
3153:             * @throws CmsException if operation was not successful
3154:             */
3155:            public CmsProject readProject(String name) throws CmsException {
3156:
3157:                return m_securityManager.readProject(name);
3158:            }
3159:
3160:            /**
3161:             * Returns the list of all resource names that define the "view" of the given project.<p>
3162:             * 
3163:             * @param project the project to get the project resources for
3164:             * 
3165:             * @return the list of all resource names, as <code>{@link String}</code> objects 
3166:             *              that define the "view" of the given project.
3167:             * 
3168:             * @throws CmsException if something goes wrong
3169:             */
3170:            public List readProjectResources(CmsProject project)
3171:                    throws CmsException {
3172:
3173:                return m_securityManager.readProjectResources(m_context,
3174:                        project);
3175:            }
3176:
3177:            /**
3178:             * Reads all resources of a project that match a given state from the VFS.<p>
3179:             * 
3180:             * Possible values for the <code>state</code> parameter are:<br>
3181:             * <ul>
3182:             * <li><code>{@link CmsResource#STATE_CHANGED}</code>: Read all "changed" resources in the project</li>
3183:             * <li><code>{@link CmsResource#STATE_NEW}</code>: Read all "new" resources in the project</li>
3184:             * <li><code>{@link CmsResource#STATE_DELETED}</code>: Read all "deleted" resources in the project</li>
3185:             * <li><code>{@link CmsResource#STATE_KEEP}</code>: Read all resources either "changed", "new" or "deleted" in the project</li>
3186:             * </ul><p>
3187:             * 
3188:             * @param projectId the id of the project to read the file resources for
3189:             * @param state the resource state to match
3190:             *
3191:             * @return all <code>{@link CmsResource}</code>s of a project that match a given criteria from the VFS
3192:             * 
3193:             * @throws CmsException if something goes wrong
3194:             */
3195:            public List readProjectView(CmsUUID projectId,
3196:                    CmsResourceState state) throws CmsException {
3197:
3198:                return m_securityManager.readProjectView(m_context, projectId,
3199:                        state);
3200:            }
3201:
3202:            /**
3203:             * @see #readProjectView(CmsUUID, CmsResourceState)
3204:             * 
3205:             * @param projectId the id of the project to read the file resources for
3206:             * @param state the resource state to match
3207:             *
3208:             * @return all <code>{@link CmsResource}</code>s of a project that match a given criteria from the VFS
3209:             * 
3210:             * @throws CmsException if something goes wrong
3211:             * 
3212:             * @deprecated use {@link #readProjectView(CmsUUID, CmsResourceState)} instead
3213:             */
3214:            public List readProjectView(int projectId, CmsResourceState state)
3215:                    throws CmsException {
3216:
3217:                return readProjectView(m_securityManager.getProjectId(
3218:                        m_context, projectId), state);
3219:            }
3220:
3221:            /**
3222:             * Reads all resources of a project that match a given state from the VFS.<p>
3223:             * 
3224:             * 
3225:             * @param projectId the id of the project to read the file resources for
3226:             * @param state the resource state to match
3227:             *
3228:             * @return all <code>{@link CmsResource}</code>s of a project that match a given criteria from the VFS
3229:             * 
3230:             * @throws CmsException if something goes wrong
3231:             * 
3232:             * @deprecated use {@link #readProjectView(CmsUUID, CmsResourceState)} instead
3233:             */
3234:            public List readProjectView(int projectId, int state)
3235:                    throws CmsException {
3236:
3237:                return readProjectView(m_securityManager.getProjectId(
3238:                        m_context, projectId), CmsResourceState.valueOf(state));
3239:            }
3240:
3241:            /**
3242:             * Reads the (compound) values of all properties mapped to a specified resource.<p>
3243:             * 
3244:             * @param resourcePath the resource to look up the property for
3245:             * 
3246:             * @return a map of <code>String</code> objects representing all properties of the resource
3247:             * 
3248:             * @throws CmsException in case there where problems reading the properties
3249:             * 
3250:             * @deprecated use <code>{@link #readPropertyObjects(String, boolean)}</code> instead.
3251:             */
3252:            public Map readProperties(String resourcePath) throws CmsException {
3253:
3254:                CmsResource resource = readResource(resourcePath,
3255:                        CmsResourceFilter.ALL);
3256:                List properties = m_securityManager.readPropertyObjects(
3257:                        m_context, resource, false);
3258:                return CmsProperty.toMap(properties);
3259:            }
3260:
3261:            /**
3262:             * Reads the (compound) values of all properties mapped to a specified resource
3263:             * with optional direcory upward cascading.<p>
3264:             * 
3265:             * @param resourcePath the resource to look up the property for
3266:             * @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)
3267:             * 
3268:             * @return Map of <code>String</code> objects representing all properties of the resource
3269:             * 
3270:             * @throws CmsException in case there where problems reading the properties
3271:             * 
3272:             * @deprecated use <code>{@link #readPropertyObjects(String, boolean)}</code> instead.
3273:             */
3274:            public Map readProperties(String resourcePath, boolean search)
3275:                    throws CmsException {
3276:
3277:                CmsResource resource = readResource(resourcePath,
3278:                        CmsResourceFilter.ALL);
3279:                List properties = m_securityManager.readPropertyObjects(
3280:                        m_context, resource, search);
3281:                return CmsProperty.toMap(properties);
3282:            }
3283:
3284:            /**
3285:             * Reads the (compound) value of a property mapped to a specified resource.<p>
3286:             *
3287:             * @param resourcePath the resource to look up the property for
3288:             * @param property the name of the property to look up
3289:             * 
3290:             * @return the value of the property found, <code>null</code> if nothing was found
3291:             * 
3292:             * @throws CmsException in case there where problems reading the property
3293:             * 
3294:             * @see CmsProperty#getValue()
3295:             * 
3296:             * @deprecated use <code>{@link #readPropertyObject(String, String, boolean)}</code> instead.
3297:             */
3298:            public String readProperty(String resourcePath, String property)
3299:                    throws CmsException {
3300:
3301:                CmsResource resource = readResource(resourcePath,
3302:                        CmsResourceFilter.ALL);
3303:                CmsProperty value = m_securityManager.readPropertyObject(
3304:                        m_context, resource, property, false);
3305:                return value.isNullProperty() ? null : value.getValue();
3306:            }
3307:
3308:            /**
3309:             * Reads the (compound) value of a property mapped to a specified resource 
3310:             * with optional direcory upward cascading.<p>
3311:             * 
3312:             * @param resourcePath the resource to look up the property for
3313:             * @param property the name of the property to look up
3314:             * @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)
3315:             * 
3316:             * @return the value of the property found, <code>null</code> if nothing was found
3317:             * 
3318:             * @throws CmsException in case there where problems reading the property
3319:             * 
3320:             * @see CmsProperty#getValue()
3321:             * 
3322:             * @deprecated use <code>{@link #readPropertyObject(String, String, boolean)}</code> instead.
3323:             */
3324:            public String readProperty(String resourcePath, String property,
3325:                    boolean search) throws CmsException {
3326:
3327:                CmsResource resource = readResource(resourcePath,
3328:                        CmsResourceFilter.ALL);
3329:                CmsProperty value = m_securityManager.readPropertyObject(
3330:                        m_context, resource, property, search);
3331:                return value.isNullProperty() ? null : value.getValue();
3332:            }
3333:
3334:            /**
3335:             * Reads the (compound) value of a property mapped to a specified resource 
3336:             * with optional directory upward cascading, a default value will be returned if the property 
3337:             * is not found on the resource (or it's parent folders in case search is set to <code>true</code>).<p>
3338:             * 
3339:             * @param resourcePath the resource to look up the property for
3340:             * @param property the name of the property to look up
3341:             * @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)
3342:             * @param propertyDefault a default value that will be returned if the property was not found on the selected resource
3343:             * 
3344:             * @return the value of the property found, if nothing was found the value of the <code>propertyDefault</code> parameter is returned
3345:             * 
3346:             * @throws CmsException in case there where problems reading the property
3347:             * 
3348:             * @see CmsProperty#getValue()
3349:             * 
3350:             * @deprecated use <code>{@link #readPropertyObject(String, String, boolean)}</code> instead.
3351:             */
3352:            public String readProperty(String resourcePath, String property,
3353:                    boolean search, String propertyDefault) throws CmsException {
3354:
3355:                CmsResource resource = readResource(resourcePath,
3356:                        CmsResourceFilter.ALL);
3357:                CmsProperty value = m_securityManager.readPropertyObject(
3358:                        m_context, resource, property, search);
3359:                return value.isNullProperty() ? propertyDefault : value
3360:                        .getValue();
3361:            }
3362:
3363:            /**
3364:             * Reads a property definition.<p>
3365:             *
3366:             * If no property definition with the given name is found, 
3367:             * <code>null</code> is returned.<p>
3368:             * 
3369:             * @param name the name of the property definition to read
3370:             * 
3371:             * @return the property definition that was read, 
3372:             *          or <code>null</code> if there is no property definition with the given name.
3373:             *
3374:             * @throws CmsException if something goes wrong
3375:             */
3376:            public CmsPropertyDefinition readPropertyDefinition(String name)
3377:                    throws CmsException {
3378:
3379:                return (m_securityManager.readPropertyDefinition(m_context,
3380:                        name));
3381:            }
3382:
3383:            /**
3384:             * Reads a property object from a resource specified by a property name.<p>
3385:             * 
3386:             * Returns <code>{@link CmsProperty#getNullProperty()}</code> if the property is not found.<p>
3387:             * 
3388:             * This method is more efficient then using <code>{@link CmsObject#readPropertyObject(String, String, boolean)}</code>
3389:             * if you already have an instance of the resource to look up the property from.<p>
3390:             * 
3391:             * @param resource the resource where the property is attached to
3392:             * @param property the property name
3393:             * @param search if true, the property is searched on all parent folders of the resource, 
3394:             *      if it's not found attached directly to the resource
3395:             * 
3396:             * @return the required property, or <code>{@link CmsProperty#getNullProperty()}</code> if the property was not found
3397:             * 
3398:             * @throws CmsException if something goes wrong
3399:             */
3400:            public CmsProperty readPropertyObject(CmsResource resource,
3401:                    String property, boolean search) throws CmsException {
3402:
3403:                return m_securityManager.readPropertyObject(m_context,
3404:                        resource, property, search);
3405:            }
3406:
3407:            /**
3408:             * Reads a property object from a resource specified by a property name.<p>
3409:             * 
3410:             * Returns <code>{@link CmsProperty#getNullProperty()}</code> if the property is not found.<p>
3411:             * 
3412:             * @param resourcePath the name of resource where the property is attached to
3413:             * @param property the property name
3414:             * @param search if true, the property is searched on all parent folders of the resource, 
3415:             *      if it's not found attached directly to the resource
3416:             * 
3417:             * @return the required property, or <code>{@link CmsProperty#getNullProperty()}</code> if the property was not found
3418:             * 
3419:             * @throws CmsException if something goes wrong
3420:             */
3421:            public CmsProperty readPropertyObject(String resourcePath,
3422:                    String property, boolean search) throws CmsException {
3423:
3424:                CmsResource resource = readResource(resourcePath,
3425:                        CmsResourceFilter.ALL);
3426:                return m_securityManager.readPropertyObject(m_context,
3427:                        resource, property, search);
3428:            }
3429:
3430:            /**
3431:             * Reads all property objects from a resource.<p>
3432:             * 
3433:             * Returns an empty list if no properties are found.<p>
3434:             * 
3435:             * This method is more efficient then using <code>{@link CmsObject#readPropertyObjects(String, boolean)}</code>
3436:             * if you already have an instance of the resource to look up the property from.<p>
3437:             * 
3438:             * If the <code>search</code> parameter is <code>true</code>, the properties of all 
3439:             * parent folders of the resource are also read. The results are merged with the 
3440:             * properties directly attached to the resource. While merging, a property
3441:             * on a parent folder that has already been found will be ignored.
3442:             * So e.g. if a resource has a property "Title" attached, and it's parent folder 
3443:             * has the same property attached but with a different value, the result list will
3444:             * contain only the property with the value from the resource, not form the parent folder(s).<p>
3445:             * 
3446:             * @param resource the resource where the property is mapped to
3447:             * @param search if <code>true</code>, the properties of all parent folders of the resource 
3448:             *      are merged with the resource properties.
3449:             * 
3450:             * @return a list of <code>{@link CmsProperty}</code> objects
3451:             * 
3452:             * @throws CmsException if something goes wrong
3453:             */
3454:            public List readPropertyObjects(CmsResource resource, boolean search)
3455:                    throws CmsException {
3456:
3457:                return m_securityManager.readPropertyObjects(m_context,
3458:                        resource, search);
3459:            }
3460:
3461:            /**
3462:             * Reads all property objects from a resource.<p>
3463:             * 
3464:             * Returns an empty list if no properties are found.<p>
3465:             * 
3466:             * All properties in the result List will be in frozen (read only) state, so you can't change the values.<p>
3467:             * 
3468:             * If the <code>search</code> parameter is <code>true</code>, the properties of all 
3469:             * parent folders of the resource are also read. The results are merged with the 
3470:             * properties directly attached to the resource. While merging, a property
3471:             * on a parent folder that has already been found will be ignored.
3472:             * So e.g. if a resource has a property "Title" attached, and it's parent folder 
3473:             * has the same property attached but with a different value, the result list will
3474:             * contain only the property with the value from the resource, not form the parent folder(s).<p>
3475:             * 
3476:             * @param resourcePath the name of resource where the property is mapped to
3477:             * @param search if <code>true</code>, the properties of all parent folders of the resource 
3478:             *      are merged with the resource properties.
3479:             * 
3480:             * @return a list of <code>{@link CmsProperty}</code> objects
3481:             * 
3482:             * @throws CmsException if something goes wrong
3483:             */
3484:            public List readPropertyObjects(String resourcePath, boolean search)
3485:                    throws CmsException {
3486:
3487:                CmsResource resource = readResource(resourcePath,
3488:                        CmsResourceFilter.ALL);
3489:                return m_securityManager.readPropertyObjects(m_context,
3490:                        resource, search);
3491:            }
3492:
3493:            /**
3494:             * Reads the resources that were published in a publish task for a given publish history ID.<p>
3495:             * 
3496:             * @param publishHistoryId unique ID to identify each publish task in the publish history
3497:             * 
3498:             * @return a list of <code>{@link org.opencms.db.CmsPublishedResource}</code> objects
3499:             * 
3500:             * @throws CmsException if something goes wrong
3501:             */
3502:            public List readPublishedResources(CmsUUID publishHistoryId)
3503:                    throws CmsException {
3504:
3505:                return m_securityManager.readPublishedResources(m_context,
3506:                        publishHistoryId);
3507:            }
3508:
3509:            /**
3510:             * Reads a resource from the VFS,
3511:             * using the <code>{@link CmsResourceFilter#DEFAULT}</code> filter.<p> 
3512:             *
3513:             * A resource may be of type <code>{@link CmsFile}</code> or 
3514:             * <code>{@link CmsFolder}</code>. In case of
3515:             * a file, the resource will not contain the binary file content. Since reading 
3516:             * the binary content is a cost-expensive database operation, it's recommended 
3517:             * to work with resources if possible, and only read the file content when absolutely
3518:             * required. To "upgrade" a resource to a file, 
3519:             * use <code>{@link #readFile(CmsResource)}</code>.<p> 
3520:             *
3521:             * @param structureID the structure ID of the resource to read
3522:             *
3523:             * @return the resource that was read
3524:             *
3525:             * @throws CmsException if the resource could not be read for any reason
3526:             *
3527:             * @see #readFile(String) 
3528:             * @see #readResource(CmsUUID, CmsResourceFilter)
3529:             */
3530:            public CmsResource readResource(CmsUUID structureID)
3531:                    throws CmsException {
3532:
3533:                return readResource(structureID, CmsResourceFilter.DEFAULT);
3534:            }
3535:
3536:            /**
3537:             * Reads a resource from the VFS,
3538:             * using the specified resource filter.<p>
3539:             *
3540:             * A resource may be of type <code>{@link CmsFile}</code> or 
3541:             * <code>{@link CmsFolder}</code>. In case of
3542:             * a file, the resource will not contain the binary file content. Since reading 
3543:             * the binary content is a cost-expensive database operation, it's recommended 
3544:             * to work with resources if possible, and only read the file content when absolutely
3545:             * required. To "upgrade" a resource to a file, 
3546:             * use <code>{@link #readFile(CmsResource)}</code>.<p> 
3547:             *
3548:             * The specified filter controls what kind of resources should be "found" 
3549:             * during the read operation. This will depend on the application. For example, 
3550:             * using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently
3551:             * "valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code>
3552:             * will ignore the date release / date expired information of the resource.<p>
3553:             * 
3554:             * @param structureID the structure ID of the resource to read
3555:             * @param filter the resource filter to use while reading
3556:             *
3557:             * @return the resource that was read
3558:             *
3559:             * @throws CmsException if the resource could not be read for any reason
3560:             * 
3561:             * @see #readFile(String, CmsResourceFilter)
3562:             * @see #readFolder(String, CmsResourceFilter)
3563:             */
3564:            public CmsResource readResource(CmsUUID structureID,
3565:                    CmsResourceFilter filter) throws CmsException {
3566:
3567:                return m_securityManager.readResource(m_context, structureID,
3568:                        filter);
3569:            }
3570:
3571:            /**
3572:             * Reads the historical resource with the given version for the resource given 
3573:             * the given structure id.<p>
3574:             *
3575:             * A resource may be of type <code>{@link CmsFile}</code> or 
3576:             * <code>{@link CmsFolder}</code>. In case of a file, the resource will not 
3577:             * contain the binary file content. Since reading the binary content is a 
3578:             * cost-expensive database operation, it's recommended to work with resources 
3579:             * if possible, and only read the file content when absolutely required. To 
3580:             * "upgrade" a resource to a file, use 
3581:             * <code>{@link #readFile(CmsResource)}</code>.<p> 
3582:             *
3583:             * Please note that historical versions are just generated during publishing, 
3584:             * so the first version with version number 1 is generated during publishing 
3585:             * of a new resource (exception is a new sibling, that may also contain some 
3586:             * relevant versions of already published siblings) and the last version 
3587:             * available is the version of the current online resource.<p>
3588:             * 
3589:             * @param structureID the structure ID of the resource to read
3590:             * @param version the version number you want to retrieve
3591:             *
3592:             * @return the resource that was read
3593:             *
3594:             * @throws CmsException if the resource could not be read for any reason
3595:             * @throws CmsVfsResourceNotFoundException if the version does not exists
3596:             * 
3597:             * @see #restoreResourceVersion(CmsUUID, int)
3598:             */
3599:            public I_CmsHistoryResource readResource(CmsUUID structureID,
3600:                    int version) throws CmsException,
3601:                    CmsVfsResourceNotFoundException {
3602:
3603:                CmsResource resource = readResource(structureID,
3604:                        CmsResourceFilter.ALL);
3605:                return m_securityManager.readResource(m_context, resource,
3606:                        version);
3607:            }
3608:
3609:            /**
3610:             * Reads a resource from the VFS,
3611:             * using the <code>{@link CmsResourceFilter#DEFAULT}</code> filter.<p> 
3612:             *
3613:             * A resource may be of type <code>{@link CmsFile}</code> or 
3614:             * <code>{@link CmsFolder}</code>. In case of
3615:             * a file, the resource will not contain the binary file content. Since reading 
3616:             * the binary content is a cost-expensive database operation, it's recommended 
3617:             * to work with resources if possible, and only read the file content when absolutely
3618:             * required. To "upgrade" a resource to a file, 
3619:             * use <code>{@link #readFile(CmsResource)}</code>.<p> 
3620:             *
3621:             * @param resourcename the name of the resource to read (full current site relative path)
3622:             *
3623:             * @return the resource that was read
3624:             *
3625:             * @throws CmsException if the resource could not be read for any reason
3626:             *
3627:             * @see #readFile(String) 
3628:             * @see #readResource(String, CmsResourceFilter)
3629:             */
3630:            public CmsResource readResource(String resourcename)
3631:                    throws CmsException {
3632:
3633:                return readResource(resourcename, CmsResourceFilter.DEFAULT);
3634:            }
3635:
3636:            /**
3637:             * Reads a resource from the VFS,
3638:             * using the specified resource filter.<p>
3639:             *
3640:             * A resource may be of type <code>{@link CmsFile}</code> or 
3641:             * <code>{@link CmsFolder}</code>. In case of
3642:             * a file, the resource will not contain the binary file content. Since reading 
3643:             * the binary content is a cost-expensive database operation, it's recommended 
3644:             * to work with resources if possible, and only read the file content when absolutely
3645:             * required. To "upgrade" a resource to a file, 
3646:             * use <code>{@link #readFile(CmsResource)}</code>.<p> 
3647:             *
3648:             * The specified filter controls what kind of resources should be "found" 
3649:             * during the read operation. This will depend on the application. For example, 
3650:             * using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently
3651:             * "valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code>
3652:             * will ignore the date release / date expired information of the resource.<p>
3653:             * 
3654:             * @param resourcename the name of the resource to read (full current site relative path)
3655:             * @param filter the resource filter to use while reading
3656:             *
3657:             * @return the resource that was read
3658:             *
3659:             * @throws CmsException if the resource could not be read for any reason
3660:             * 
3661:             * @see #readFile(String, CmsResourceFilter)
3662:             * @see #readFolder(String, CmsResourceFilter)
3663:             */
3664:            public CmsResource readResource(String resourcename,
3665:                    CmsResourceFilter filter) throws CmsException {
3666:
3667:                return m_securityManager.readResource(m_context,
3668:                        addSiteRoot(resourcename), filter);
3669:            }
3670:
3671:            /**
3672:             * Reads an historical resource in the current project with the given publish tag 
3673:             * from the historical archive.<p>
3674:             * 
3675:             * @param structureId the structure id of the resource to restore from the archive
3676:             * @param publishTag the publish tag of the resource
3677:             * 
3678:             * @return the file in the current project with the given publish tag from the historical 
3679:             *         archive, or {@link CmsVfsResourceNotFoundException} if not found 
3680:             *
3681:             * @throws CmsException if something goes wrong
3682:             * 
3683:             * @see #readResource(CmsUUID, int)
3684:             * 
3685:             * @deprecated use {@link #readResource(CmsUUID, int)} instead
3686:             *             but notice that the <code>publishTag != version</code>
3687:             */
3688:            public I_CmsHistoryResource readResourceByPublishTag(
3689:                    CmsUUID structureId, int publishTag) throws CmsException {
3690:
3691:                CmsResource resource = readResource(structureId,
3692:                        CmsResourceFilter.IGNORE_EXPIRATION);
3693:                return m_securityManager.readResourceForPublishTag(m_context,
3694:                        resource, publishTag);
3695:            }
3696:
3697:            /**
3698:             * Reads all resources below the given path matching the filter criteria, 
3699:             * including the full tree below the path.<p>
3700:             * 
3701:             * @param resourcename the parent path to read the resources from
3702:             * @param filter the filter
3703:             * 
3704:             * @return a list of <code>{@link CmsResource}</code> objects matching the filter criteria
3705:             * 
3706:             * @throws CmsException if something goes wrong
3707:             * 
3708:             * @see #readResources(String, CmsResourceFilter, boolean)
3709:             */
3710:            public List readResources(String resourcename,
3711:                    CmsResourceFilter filter) throws CmsException {
3712:
3713:                return readResources(resourcename, filter, true);
3714:            }
3715:
3716:            /**
3717:             * Reads all resources below the given path matching the filter criteria,
3718:             * including the full tree below the path only in case the <code>readTree</code> 
3719:             * parameter is <code>true</code>.<p>
3720:             * 
3721:             * @param resourcename the parent path to read the resources from
3722:             * @param filter the filter
3723:             * @param readTree <code>true</code> to read all sub resources
3724:             * 
3725:             * @return a list of <code>{@link CmsResource}</code> objects matching the filter criteria
3726:             * 
3727:             * @throws CmsException if something goes wrong
3728:             */
3729:            public List readResources(String resourcename,
3730:                    CmsResourceFilter filter, boolean readTree)
3731:                    throws CmsException {
3732:
3733:                CmsResource resource = readResource(resourcename,
3734:                        CmsResourceFilter.ALL);
3735:                return m_securityManager.readResources(m_context, resource,
3736:                        filter, readTree);
3737:            }
3738:
3739:            /**
3740:             * Reads all resources that have a value set for the specified property.<p>
3741:             * 
3742:             * Both individual and shared properties of a resource are checked.<p>
3743:             * 
3744:             * Will use the {@link CmsResourceFilter#ALL} resource filter.<p>
3745:             *
3746:             * @param propertyDefinition the name of the property to check for
3747:             * 
3748:             * @return a list of all <code>{@link CmsResource}</code> objects 
3749:             *          that have a value set for the specified property.
3750:             * 
3751:             * @throws CmsException if something goes wrong
3752:             */
3753:            public List readResourcesWithProperty(String propertyDefinition)
3754:                    throws CmsException {
3755:
3756:                return readResourcesWithProperty("/", propertyDefinition);
3757:            }
3758:
3759:            /**
3760:             * Reads all resources that have a value set for the specified property in the given path.<p>
3761:             * 
3762:             * Both individual and shared properties of a resource are checked.<p>
3763:             * 
3764:             * Will use the {@link CmsResourceFilter#ALL} resource filter.<p>
3765:             *
3766:             * @param path the folder to get the resources with the property from
3767:             * @param propertyDefinition the name of the property to check for
3768:             * 
3769:             * @return all <code>{@link CmsResource}</code> objects 
3770:             *          that have a value set for the specified property in the given path.
3771:             * 
3772:             * @throws CmsException if something goes wrong
3773:             */
3774:            public List readResourcesWithProperty(String path,
3775:                    String propertyDefinition) throws CmsException {
3776:
3777:                return readResourcesWithProperty(path, propertyDefinition, null);
3778:            }
3779:
3780:            /**
3781:             * Reads all resources that have a value (containing the specified value) set 
3782:             * for the specified property in the given path.<p>
3783:             * 
3784:             * Both individual and shared properties of a resource are checked.<p>
3785:             *
3786:             * If the <code>value</code> parameter is <code>null</code>, all resources having the
3787:             * given property set are returned.<p>
3788:             * 
3789:             * Will use the {@link CmsResourceFilter#ALL} resource filter.<p>
3790:             * 
3791:             * @param path the folder to get the resources with the property from
3792:             * @param propertyDefinition the name of the property to check for
3793:             * @param value the string to search in the value of the property
3794:             * 
3795:             * @return all <code>{@link CmsResource}</code> objects 
3796:             *          that have a value set for the specified property in the given path.
3797:             * 
3798:             * @throws CmsException if something goes wrong
3799:             */
3800:            public List readResourcesWithProperty(String path,
3801:                    String propertyDefinition, String value)
3802:                    throws CmsException {
3803:
3804:                CmsResource resource = readResource(path,
3805:                        CmsResourceFilter.IGNORE_EXPIRATION);
3806:                return m_securityManager.readResourcesWithProperty(m_context,
3807:                        resource, propertyDefinition, value,
3808:                        CmsResourceFilter.ALL);
3809:            }
3810:
3811:            /**
3812:             * Reads all resources that have a value (containing the specified value) set 
3813:             * for the specified property in the given path.<p>
3814:             * 
3815:             * Both individual and shared properties of a resource are checked.<p>
3816:             *
3817:             * If the <code>value</code> parameter is <code>null</code>, all resources having the
3818:             * given property set are returned.<p>
3819:             * 
3820:             * Will use the given resource filter.<p>
3821:             * 
3822:             * @param path the folder to get the resources with the property from
3823:             * @param propertyDefinition the name of the property to check for
3824:             * @param value the string to search in the value of the property
3825:             * @param filter the resource filter to apply to the result set
3826:             * 
3827:             * @return all <code>{@link CmsResource}</code> objects 
3828:             *          that have a value set for the specified property in the given path.
3829:             * 
3830:             * @throws CmsException if something goes wrong
3831:             */
3832:            public List readResourcesWithProperty(String path,
3833:                    String propertyDefinition, String value,
3834:                    CmsResourceFilter filter) throws CmsException {
3835:
3836:                CmsResource resource = readResource(path,
3837:                        CmsResourceFilter.IGNORE_EXPIRATION);
3838:                return m_securityManager.readResourcesWithProperty(m_context,
3839:                        resource, propertyDefinition, value, filter);
3840:            }
3841:
3842:            /**
3843:             * Returns a set of principals that are responsible for a specific resource.<p>
3844:             * 
3845:             * @param resource the resource to get the responsible principals from
3846:             * 
3847:             * @return the set of principals that are responsible for a specific resource
3848:             * 
3849:             * @throws CmsException if something goes wrong
3850:             */
3851:            public Set readResponsiblePrincipals(CmsResource resource)
3852:                    throws CmsException {
3853:
3854:                return m_securityManager.readResponsiblePrincipals(m_context,
3855:                        resource);
3856:            }
3857:
3858:            /**
3859:             * Returns a set of users that are responsible for a specific resource.<p>
3860:             * 
3861:             * @param resource the resource to get the responsible users from
3862:             * 
3863:             * @return the set of users that are responsible for a specific resource
3864:             * 
3865:             * @throws CmsException if something goes wrong
3866:             */
3867:            public Set readResponsibleUsers(CmsResource resource)
3868:                    throws CmsException {
3869:
3870:                return m_securityManager.readResponsibleUsers(m_context,
3871:                        resource);
3872:            }
3873:
3874:            /**
3875:             * Returns a list of all siblings of the specified resource,
3876:             * the specified resource being always part of the result set.<p>
3877:             * 
3878:             * @param resourcename the name of the specified resource
3879:             * @param filter a resource filter
3880:             * 
3881:             * @return a list of <code>{@link CmsResource}</code>s that 
3882:             *          are siblings to the specified resource, 
3883:             *          including the specified resource itself.
3884:             * 
3885:             * @throws CmsException if something goes wrong
3886:             */
3887:            public List readSiblings(String resourcename,
3888:                    CmsResourceFilter filter) throws CmsException {
3889:
3890:                CmsResource resource = readResource(resourcename, filter);
3891:                return m_securityManager.readSiblings(m_context, resource,
3892:                        filter);
3893:            }
3894:
3895:            /**
3896:             * Returns the parameters of a resource in the list of all published template resources.<p>
3897:             * 
3898:             * @param rfsName the rfs name of the resource
3899:             * 
3900:             * @return the parameter string of the requested resource
3901:             * 
3902:             * @throws CmsException if something goes wrong
3903:             */
3904:            public String readStaticExportPublishedResourceParameters(
3905:                    String rfsName) throws CmsException {
3906:
3907:                return m_securityManager
3908:                        .readStaticExportPublishedResourceParameters(m_context,
3909:                                rfsName);
3910:            }
3911:
3912:            /**
3913:             * Returns a list of all template resources which must be processed during a static export.<p>
3914:             * 
3915:             * @param parameterResources flag for reading resources with parameters (1) or without (0)
3916:             * 
3917:             * @param timestamp a time stamp for reading the data from the db
3918:             * 
3919:             * @return a list of template resources as <code>{@link String}</code> objects
3920:             * 
3921:             * @throws CmsException if something goes wrong
3922:             */
3923:            public List readStaticExportResources(int parameterResources,
3924:                    long timestamp) throws CmsException {
3925:
3926:                return m_securityManager.readStaticExportResources(m_context,
3927:                        parameterResources, timestamp);
3928:            }
3929:
3930:            /**
3931:             * Reads a user based on its id.<p>
3932:             *
3933:             * @param userId the id of the user to be read
3934:             * 
3935:             * @return the user with the given id
3936:             * 
3937:             * @throws CmsException if something goes wrong
3938:             * 
3939:             * @see #readHistoryPrincipal(CmsUUID) for retrieving data of deleted users
3940:             */
3941:            public CmsUser readUser(CmsUUID userId) throws CmsException {
3942:
3943:                return m_securityManager.readUser(m_context, userId);
3944:            }
3945:
3946:            /**
3947:             * Reads a user based on its name.<p>
3948:             *
3949:             * @param username the name of the user to be read
3950:             * 
3951:             * @return the user with the given name
3952:             * 
3953:             * @throws CmsException if something goes wrong
3954:             */
3955:            public CmsUser readUser(String username) throws CmsException {
3956:
3957:                return m_securityManager.readUser(m_context, username);
3958:            }
3959:
3960:            /**
3961:             * Returns a user, if the password is correct.<p>
3962:             * 
3963:             * If the user/pwd pair is not valid a <code>{@link CmsException}</code> is thrown.<p>
3964:             *
3965:             * @param username the name of the user to be returned
3966:             * @param password the password of the user to be returned
3967:             * 
3968:             * @return the validated user
3969:             *
3970:             * @throws CmsException if operation was not successful
3971:             */
3972:            public CmsUser readUser(String username, String password)
3973:                    throws CmsException {
3974:
3975:                return m_securityManager
3976:                        .readUser(m_context, username, password);
3977:            }
3978:
3979:            /**
3980:             * Returns a web user.<p>
3981:             *
3982:             * @param username the user name of the web user that is to be read
3983:             * 
3984:             * @return the web user
3985:             *
3986:             * @throws CmsException if operation was not successful
3987:             * 
3988:             * @deprecated there are no more web users, use a user without any role!
3989:             */
3990:            public CmsUser readWebUser(String username) throws CmsException {
3991:
3992:                return m_securityManager.readUser(m_context, username);
3993:            }
3994:
3995:            /**
3996:             * Returns a web user if the password for the user is correct.<p>
3997:             *
3998:             * If the user/password pair is not valid a <code>{@link CmsException}</code> is thrown.<p>
3999:             *
4000:             * @param username the user name of the user that is to be read
4001:             * @param password the password of the user that is to be read
4002:             * 
4003:             * @return a web user
4004:             *
4005:             * @throws CmsException if something goes wrong
4006:             * 
4007:             * @deprecated there are no more web users, use a user without any role!
4008:             */
4009:            public CmsUser readWebUser(String username, String password)
4010:                    throws CmsException {
4011:
4012:                return m_securityManager
4013:                        .readUser(m_context, username, password);
4014:            }
4015:
4016:            /**
4017:             * Removes a resource from the current project of the user.<p>
4018:             * 
4019:             * This is used to reduce the current users project with the
4020:             * specified resource, in case that the resource is already part of the project.
4021:             * The resource is not really removed like in a regular copy operation, 
4022:             * it is in fact only "disabled" in the current users project.<p>   
4023:             * 
4024:             * @param resourcename the name of the resource to remove to the current project (full current site relative path)
4025:             * 
4026:             * @throws CmsException if something goes wrong
4027:             */
4028:            public void removeResourceFromProject(String resourcename)
4029:                    throws CmsException {
4030:
4031:                // TODO: this should be also possible if the resource has been deleted
4032:                CmsResource resource = readResource(resourcename,
4033:                        CmsResourceFilter.ALL);
4034:                getResourceType(resource).removeResourceFromProject(this ,
4035:                        m_securityManager, resource);
4036:            }
4037:
4038:            /**
4039:             * Removes a user from a group.<p>
4040:             *
4041:             * @param username the name of the user that is to be removed from the group
4042:             * @param groupname the name of the group
4043:             * 
4044:             * @throws CmsException if operation was not successful
4045:             */
4046:            public void removeUserFromGroup(String username, String groupname)
4047:                    throws CmsException {
4048:
4049:                m_securityManager.removeUserFromGroup(m_context, username,
4050:                        groupname, false);
4051:            }
4052:
4053:            /**
4054:             * Renames a resource to the given destination name,
4055:             * this is identical to a <code>move</code> operation.<p>
4056:             *
4057:             * @param source the name of the resource to rename (full current site relative path)
4058:             * @param destination the new resource name (full path)
4059:             * 
4060:             * @throws CmsException if something goes wrong
4061:             * 
4062:             * @see #moveResource(String, String)
4063:             */
4064:            public void renameResource(String source, String destination)
4065:                    throws CmsException {
4066:
4067:                moveResource(source, destination);
4068:            }
4069:
4070:            /**
4071:             * Replaces the content, type and properties of a resource.<p>
4072:             * 
4073:             * @param resourcename the name of the resource to replace (full current site relative path)
4074:             * @param type the new type of the resource
4075:             * @param content the new content of the resource
4076:             * @param properties the new properties of the resource
4077:             * 
4078:             * @throws CmsException if something goes wrong
4079:             */
4080:            public void replaceResource(String resourcename, int type,
4081:                    byte[] content, List properties) throws CmsException {
4082:
4083:                CmsResource resource = readResource(resourcename,
4084:                        CmsResourceFilter.IGNORE_EXPIRATION);
4085:                getResourceType(resource).replaceResource(this ,
4086:                        m_securityManager, resource, type, content, properties);
4087:            }
4088:
4089:            /**
4090:             * Restores a deleted resource identified by its structure id from the historical archive.<p>
4091:             * 
4092:             * These ids can be obtained from the {@link #readDeletedResources(String, boolean)} method.<p>
4093:             * 
4094:             * @param structureId the structure id of the resource to restore
4095:             * 
4096:             * @throws CmsException if something goes wrong
4097:             */
4098:            public void restoreDeletedResource(CmsUUID structureId)
4099:                    throws CmsException {
4100:
4101:                m_securityManager
4102:                        .restoreDeletedResource(m_context, structureId);
4103:            }
4104:
4105:            /**
4106:             * Restores a file in the current project with a version from the backup archive.<p>
4107:             * 
4108:             * @param resourcename the name of the resource to restore from the archive (full current site relative path)
4109:             * @param publishTag the desired tag ID of the resource
4110:             *
4111:             * @throws CmsException if something goes wrong
4112:             * 
4113:             * @deprecated use {@link #restoreResourceVersion(CmsUUID, int)} instead,
4114:             *             but notice that the <code>publishTag != version</code>
4115:             *             and there is no possibility to access to an historical entry with just the filename.
4116:             */
4117:            public void restoreResourceBackup(String resourcename,
4118:                    int publishTag) throws CmsException {
4119:
4120:                CmsResource resource = readResource(resourcename,
4121:                        CmsResourceFilter.IGNORE_EXPIRATION);
4122:                I_CmsHistoryResource history = readResourceByPublishTag(
4123:                        resource.getStructureId(), publishTag);
4124:                restoreResourceVersion(resource.getStructureId(), history
4125:                        .getVersion());
4126:            }
4127:
4128:            /**
4129:             * Restores a resource in the current project with a version from the historical archive.<p>
4130:             * 
4131:             * @param structureId the structure id of the resource to restore from the archive
4132:             * @param version the desired version of the resource to be restored
4133:             *
4134:             * @throws CmsException if something goes wrong
4135:             * 
4136:             * @see #readResource(CmsUUID, int)
4137:             */
4138:            public void restoreResourceVersion(CmsUUID structureId, int version)
4139:                    throws CmsException {
4140:
4141:                CmsResource resource = readResource(structureId,
4142:                        CmsResourceFilter.IGNORE_EXPIRATION);
4143:                getResourceType(resource).restoreResource(this ,
4144:                        m_securityManager, resource, version);
4145:            }
4146:
4147:            /**
4148:             * Removes an access control entry of a given principal from a given resource.<p>
4149:             * 
4150:             * @param resourceName name of the resource
4151:             * @param principalType the type of the principal (currently group or user)
4152:             * @param principalName the name of the principal
4153:             * 
4154:             * @throws CmsException if something goes wrong
4155:             */
4156:            public void rmacc(String resourceName, String principalType,
4157:                    String principalName) throws CmsException {
4158:
4159:                CmsResource res = readResource(resourceName,
4160:                        CmsResourceFilter.ALL);
4161:
4162:                if (CmsUUID.isValidUUID(principalName)) {
4163:                    // principal name is in fact a UUID, probably the user was already deleted
4164:                    m_securityManager.removeAccessControlEntry(m_context, res,
4165:                            new CmsUUID(principalName));
4166:                } else {
4167:                    try {
4168:                        // principal name not a UUID, assume this is a normal group or user name
4169:                        I_CmsPrincipal principal = CmsPrincipal.readPrincipal(
4170:                                this , principalType, principalName);
4171:                        m_securityManager.removeAccessControlEntry(m_context,
4172:                                res, principal.getId());
4173:                    } catch (CmsDbEntryNotFoundException e) {
4174:                        // role case
4175:                        CmsRole role = CmsRole.valueOfRoleName(principalName);
4176:                        if (role == null) {
4177:                            throw e;
4178:                        }
4179:                        m_securityManager.removeAccessControlEntry(m_context,
4180:                                res, role.getId());
4181:                    }
4182:                }
4183:            }
4184:
4185:            /**
4186:             * Changes the "expire" date of a resource.<p>
4187:             * 
4188:             * @param resourcename the name of the resource to change (full current site relative path)
4189:             * @param dateExpired the new expire date of the changed resource
4190:             * @param recursive if this operation is to be applied recursively to all resources in a folder
4191:             * 
4192:             * @throws CmsException if something goes wrong
4193:             */
4194:            public void setDateExpired(String resourcename, long dateExpired,
4195:                    boolean recursive) throws CmsException {
4196:
4197:                CmsResource resource = readResource(resourcename,
4198:                        CmsResourceFilter.IGNORE_EXPIRATION);
4199:                getResourceType(resource).setDateExpired(this ,
4200:                        m_securityManager, resource, dateExpired, recursive);
4201:            }
4202:
4203:            /**
4204:             * Changes the "last modified" time stamp of a resource.<p>
4205:             * 
4206:             * @param resourcename the name of the resource to change (full current site relative path)
4207:             * @param dateLastModified time stamp the new time stamp of the changed resource
4208:             * @param recursive if this operation is to be applied recursively to all resources in a folder
4209:             * 
4210:             * @throws CmsException if something goes wrong
4211:             */
4212:            public void setDateLastModified(String resourcename,
4213:                    long dateLastModified, boolean recursive)
4214:                    throws CmsException {
4215:
4216:                CmsResource resource = readResource(resourcename,
4217:                        CmsResourceFilter.IGNORE_EXPIRATION);
4218:                getResourceType(resource).setDateLastModified(this ,
4219:                        m_securityManager, resource, dateLastModified,
4220:                        recursive);
4221:            }
4222:
4223:            /**
4224:             * Changes the "release" date of a resource.<p>
4225:             * 
4226:             * @param resourcename the name of the resource to change (full current site relative path)
4227:             * @param dateReleased the new release date of the changed resource
4228:             * @param recursive if this operation is to be applied recursively to all resources in a folder
4229:             * 
4230:             * @throws CmsException if something goes wrong
4231:             */
4232:            public void setDateReleased(String resourcename, long dateReleased,
4233:                    boolean recursive) throws CmsException {
4234:
4235:                CmsResource resource = readResource(resourcename,
4236:                        CmsResourceFilter.IGNORE_EXPIRATION);
4237:                getResourceType(resource).setDateReleased(this ,
4238:                        m_securityManager, resource, dateReleased, recursive);
4239:            }
4240:
4241:            /**
4242:             * Sets a new parent-group for an already existing group.<p>
4243:             *
4244:             * @param groupName the name of the group that should be updated
4245:             * @param parentGroupName the name of the parent group to set, 
4246:             *                      or <code>null</code> if the parent
4247:             *                      group should be deleted.
4248:             * 
4249:             * @throws CmsException  if operation was not successful
4250:             */
4251:            public void setParentGroup(String groupName, String parentGroupName)
4252:                    throws CmsException {
4253:
4254:                m_securityManager.setParentGroup(m_context, groupName,
4255:                        parentGroupName);
4256:            }
4257:
4258:            /**
4259:             * Sets the password for a user.<p>
4260:             *
4261:             * @param username the name of the user
4262:             * @param newPassword the new password
4263:             *
4264:             * @throws CmsException if operation was not successful
4265:             */
4266:            public void setPassword(String username, String newPassword)
4267:                    throws CmsException {
4268:
4269:                m_securityManager.setPassword(m_context, username, newPassword);
4270:            }
4271:
4272:            /**
4273:             * Sets the password for a specified user.<p>
4274:             *
4275:             * @param username the name of the user
4276:             * @param oldPassword the old password
4277:             * @param newPassword the new password
4278:             * 
4279:             * @throws CmsException if the user data could not be read from the database
4280:             */
4281:            public void setPassword(String username, String oldPassword,
4282:                    String newPassword) throws CmsException {
4283:
4284:                m_securityManager.resetPassword(m_context, username,
4285:                        oldPassword, newPassword);
4286:            }
4287:
4288:            /**
4289:             * Changes the time stamp information of a resource.<p>
4290:             * 
4291:             * This method is used to set the "last modified" date
4292:             * of a resource, the "release" date of a resource, 
4293:             * and also the "expire" date of a resource.<p>
4294:             * 
4295:             * @param resourcename the name of the resource to change (full current site relative path)
4296:             * @param dateLastModified time stamp the new time stamp of the changed resource
4297:             * @param dateReleased the new release date of the changed resource, 
4298:             *              set it to <code>{@link CmsResource#TOUCH_DATE_UNCHANGED}</code> to keep it unchanged.
4299:             * @param dateExpired the new expire date of the changed resource. 
4300:             *              set it to <code>{@link CmsResource#TOUCH_DATE_UNCHANGED}</code> to keep it unchanged.
4301:             * @param recursive if this operation is to be applied recursively to all resources in a folder
4302:             * 
4303:             * @deprecated use <code>{@link #setDateLastModified(String, long, boolean)}</code>, 
4304:             *                 <code>{@link #setDateReleased(String, long, boolean)}</code> or
4305:             *                 <code>{@link #setDateExpired(String, long, boolean)}</code> instead
4306:             * 
4307:             * @throws CmsException if something goes wrong
4308:             */
4309:            public void touch(String resourcename, long dateLastModified,
4310:                    long dateReleased, long dateExpired, boolean recursive)
4311:                    throws CmsException {
4312:
4313:                if (dateReleased != CmsResource.TOUCH_DATE_UNCHANGED) {
4314:                    setDateReleased(resourcename, dateReleased, recursive);
4315:                }
4316:                if (dateExpired != CmsResource.TOUCH_DATE_UNCHANGED) {
4317:                    setDateExpired(resourcename, dateExpired, recursive);
4318:                }
4319:                if (dateLastModified != CmsResource.TOUCH_DATE_UNCHANGED) {
4320:                    setDateLastModified(resourcename, dateLastModified,
4321:                            recursive);
4322:                }
4323:            }
4324:
4325:            /**
4326:             * Undeletes a resource (this is the same operation as "undo changes").<p>
4327:             * 
4328:             * Only resources that have already been published once can be undeleted,
4329:             * if a "new" resource is deleted it can not be undeleted.<p>
4330:             * 
4331:             * Internally, this method undoes all changes to a resource by restoring 
4332:             * the version from the online project, that is to the state of last 
4333:             * publishing.<p>
4334:             * 
4335:             * @param resourcename the name of the resource to undelete (full path)
4336:             *
4337:             * @throws CmsException if something goes wrong
4338:             * 
4339:             * @deprecated use {@link #undeleteResource(String,boolean)} methods instead
4340:             */
4341:            public void undeleteResource(String resourcename)
4342:                    throws CmsException {
4343:
4344:                undeleteResource(resourcename, false);
4345:            }
4346:
4347:            /**
4348:             * Undeletes a resource.<p>
4349:             * 
4350:             * Only resources that have already been published once can be undeleted,
4351:             * if a "new" resource is deleted it can not be undeleted.<p>
4352:             * 
4353:             * @param resourcename the name of the resource to undelete
4354:             * @param recursive if this operation is to be applied recursively to all resources in a folder
4355:             *
4356:             * @throws CmsException if something goes wrong
4357:             * 
4358:             * @see CmsObject#undoChanges(String, CmsResource.CmsResourceUndoMode)
4359:             */
4360:            public void undeleteResource(String resourcename, boolean recursive)
4361:                    throws CmsException {
4362:
4363:                CmsResource resource = readResource(resourcename,
4364:                        CmsResourceFilter.ALL);
4365:                getResourceType(resource).undelete(this , m_securityManager,
4366:                        resource, recursive);
4367:            }
4368:
4369:            /**
4370:             * Undoes all changes to a resource by restoring the version from the 
4371:             * online project to the current offline project.<p>
4372:             * 
4373:             * @param resourcename the name of the resource to undo the changes for (full path)
4374:             * @param recursive if this operation is to be applied recursively to all resources in a folder
4375:             *
4376:             * @throws CmsException if something goes wrong
4377:             * 
4378:             * @deprecated use {@link #undoChanges(String,CmsResource.CmsResourceUndoMode)} methods instead
4379:             */
4380:            public void undoChanges(String resourcename, boolean recursive)
4381:                    throws CmsException {
4382:
4383:                if (recursive) {
4384:                    undoChanges(resourcename,
4385:                            CmsResource.UNDO_CONTENT_RECURSIVE);
4386:                } else {
4387:                    undoChanges(resourcename, CmsResource.UNDO_CONTENT);
4388:                }
4389:            }
4390:
4391:            /**
4392:             * Undoes all changes to a resource by restoring the version from the 
4393:             * online project to the current offline project.<p>
4394:             * 
4395:             * @param resourcename the name of the resource to undo the changes for
4396:             * @param mode the undo mode, one of the <code>{@link CmsResource.CmsResourceUndoMode}#UNDO_XXX</code> constants
4397:             *
4398:             * @throws CmsException if something goes wrong
4399:             * 
4400:             * @see CmsResource#UNDO_CONTENT
4401:             * @see CmsResource#UNDO_CONTENT_RECURSIVE
4402:             * @see CmsResource#UNDO_MOVE_CONTENT
4403:             * @see CmsResource#UNDO_MOVE_CONTENT_RECURSIVE
4404:             */
4405:            public void undoChanges(String resourcename,
4406:                    CmsResource.CmsResourceUndoMode mode) throws CmsException {
4407:
4408:                CmsResource resource = readResource(resourcename,
4409:                        CmsResourceFilter.ALL);
4410:                getResourceType(resource).undoChanges(this , m_securityManager,
4411:                        resource, mode);
4412:            }
4413:
4414:            /**
4415:             * Unlocks all resources of a project.
4416:             *
4417:             * @param id the id of the project to be unlocked
4418:             *
4419:             * @throws CmsException if operation was not successful
4420:             */
4421:            public void unlockProject(CmsUUID id) throws CmsException {
4422:
4423:                m_securityManager.unlockProject(m_context, id);
4424:            }
4425:
4426:            /**
4427:             * Unlocks all resources of a project.
4428:             *
4429:             * @param id the id of the project to be unlocked
4430:             *
4431:             * @throws CmsException if operation was not successful
4432:             * 
4433:             * @deprecated use {@link #unlockProject(CmsUUID)} instead
4434:             */
4435:            public void unlockProject(int id) throws CmsException {
4436:
4437:                unlockProject(m_securityManager.getProjectId(m_context, id));
4438:            }
4439:
4440:            /**
4441:             * Unlocks a resource.<p>
4442:             * 
4443:             * @param resourcename the name of the resource to unlock (full current site relative path)
4444:             * 
4445:             * @throws CmsException if something goes wrong
4446:             */
4447:            public void unlockResource(String resourcename) throws CmsException {
4448:
4449:                CmsResource resource = readResource(resourcename,
4450:                        CmsResourceFilter.ALL);
4451:                getResourceType(resource).unlockResource(this ,
4452:                        m_securityManager, resource);
4453:            }
4454:
4455:            /**
4456:             * Tests if a user is member of the given group.<p>
4457:             *
4458:             * @param username the name of the user to test
4459:             * @param groupname the name of the group to test
4460:             * 
4461:             * @return <code>true</code>, if the user is in the group; or <code>false</code> otherwise
4462:             *
4463:             * @throws CmsException if operation was not successful
4464:             */
4465:            public boolean userInGroup(String username, String groupname)
4466:                    throws CmsException {
4467:
4468:                return (m_securityManager.userInGroup(m_context, username,
4469:                        groupname));
4470:            }
4471:
4472:            /**
4473:             * This method checks if a new password follows the rules for
4474:             * new passwords, which are defined by a Class implementing the 
4475:             * <code>{@link org.opencms.security.I_CmsPasswordHandler}</code> 
4476:             * interface and configured in the opencms.properties file.<p>
4477:             * 
4478:             * If this method throws no exception the password is valid.<p>
4479:             *
4480:             * @param password the new password that has to be checked
4481:             *
4482:             * @throws CmsSecurityException if the password is not valid
4483:             */
4484:            public void validatePassword(String password)
4485:                    throws CmsSecurityException {
4486:
4487:                m_securityManager.validatePassword(password);
4488:            }
4489:
4490:            /**
4491:             * Writes a resource to the OpenCms VFS, including it's content.<p>
4492:             * 
4493:             * Applies only to resources of type <code>{@link CmsFile}</code>
4494:             * i.e. resources that have a binary content attached.<p>
4495:             * 
4496:             * Certain resource types might apply content validation or transformation rules 
4497:             * before the resource is actually written to the VFS. The returned result
4498:             * might therefore be a modified version from the provided original.<p>
4499:             *
4500:             * @param resource the resource to write
4501:             *
4502:             * @return the written resource (may have been modified)
4503:             *
4504:             * @throws CmsException if something goes wrong
4505:             */
4506:            public CmsFile writeFile(CmsFile resource) throws CmsException {
4507:
4508:                return getResourceType(resource).writeFile(this ,
4509:                        m_securityManager, resource);
4510:            }
4511:
4512:            /**
4513:             * Writes a file-header.<p>
4514:             *
4515:             * @param file the file to write
4516:             *
4517:             * @throws CmsException if resource type is set to folder, or
4518:             *                      if the user has not the rights to write the file header.
4519:             *                      
4520:             * @deprecated use {@link #writeResource(CmsResource)} instead
4521:             */
4522:            public void writeFileHeader(CmsFile file) throws CmsException {
4523:
4524:                writeResource(file);
4525:            }
4526:
4527:            /**
4528:             * Writes an already existing group.<p>
4529:             *
4530:             * The group has to be a valid OpenCms group.<br>
4531:             * 
4532:             * The group will be completely overridden by the given data.<p>
4533:             *
4534:             * @param group the group that should be written
4535:             * 
4536:             * @throws CmsException if operation was not successful
4537:             */
4538:            public void writeGroup(CmsGroup group) throws CmsException {
4539:
4540:                m_securityManager.writeGroup(m_context, group);
4541:            }
4542:
4543:            /**
4544:             * Creates a historical entry of the current project.<p>
4545:             * 
4546:             * @param publishTag the correlative publish tag
4547:             * @param publishDate the date of publishing
4548:
4549:             * @throws CmsException if operation was not successful
4550:             */
4551:            public void writeHistoryProject(int publishTag, long publishDate)
4552:                    throws CmsException {
4553:
4554:                m_securityManager.writeHistoryProject(m_context, publishTag,
4555:                        publishDate);
4556:            }
4557:
4558:            /**
4559:             * Writes an already existing project.<p>
4560:             *
4561:             * The project id has to be a valid OpenCms project id.<br>
4562:             * 
4563:             * The project with the given id will be completely overridden
4564:             * by the given data.<p>
4565:             *
4566:             * @param project the project that should be written
4567:             * 
4568:             * @throws CmsException if operation was not successful
4569:             */
4570:            public void writeProject(CmsProject project) throws CmsException {
4571:
4572:                m_securityManager.writeProject(m_context, project);
4573:            }
4574:
4575:            /**
4576:             * Writes a couple of properties as structure values for a file or folder.
4577:             *
4578:             * @param resourceName the resource-name of which the Property has to be set
4579:             * @param properties a map with property-definitions and property values as Strings
4580:             * 
4581:             * @throws CmsException if operation was not successful
4582:             * 
4583:             * @deprecated use <code>{@link #writePropertyObjects(String, List)}</code> instead.
4584:             */
4585:            public void writeProperties(String resourceName, Map properties)
4586:                    throws CmsException {
4587:
4588:                writePropertyObjects(resourceName, CmsProperty
4589:                        .toList(properties));
4590:            }
4591:
4592:            /**
4593:             * Writes a couple of Properties for a file or folder.
4594:             *
4595:             * @param name the resource-name of which the Property has to be set
4596:             * @param properties a map with property-definitions and property values as Strings
4597:             * @param addDefinition flag to indicate if unknown definitions should be added
4598:             * 
4599:             * @throws CmsException if operation was not successful
4600:             * 
4601:             * @deprecated use <code>{@link #writePropertyObjects(String, List)}</code> instead.
4602:             */
4603:            public void writeProperties(String name, Map properties,
4604:                    boolean addDefinition) throws CmsException {
4605:
4606:                writePropertyObjects(name, CmsProperty
4607:                        .setAutoCreatePropertyDefinitions(CmsProperty
4608:                                .toList(properties), addDefinition));
4609:            }
4610:
4611:            /**
4612:             * Writes a property as a structure value for a file or folder.<p>
4613:             *
4614:             * @param resourceName the resource-name for which the property will be set
4615:             * @param key the property definition name
4616:             * @param value the value for the property to be set
4617:             * 
4618:             * @throws CmsException if operation was not successful
4619:             * 
4620:             * @deprecated use <code>{@link #writePropertyObject(String, CmsProperty)}</code> instead.
4621:             */
4622:            public void writeProperty(String resourceName, String key,
4623:                    String value) throws CmsException {
4624:
4625:                CmsProperty property = new CmsProperty();
4626:                property.setName(key);
4627:                property.setStructureValue(value);
4628:
4629:                writePropertyObject(resourceName, property);
4630:            }
4631:
4632:            /**
4633:             * Writes a property for a file or folder.<p>
4634:             *
4635:             * @param resourcename the resource-name for which the property will be set
4636:             * @param key the property-definition name
4637:             * @param value the value for the property to be set
4638:             * @param addDefinition flag to indicate if unknown definitions should be added
4639:             * 
4640:             * @throws CmsException if operation was not successful
4641:             * 
4642:             * @deprecated use <code>{@link #writePropertyObject(String, CmsProperty)}</code> instead.
4643:             */
4644:            public void writeProperty(String resourcename, String key,
4645:                    String value, boolean addDefinition) throws CmsException {
4646:
4647:                CmsProperty property = new CmsProperty();
4648:                property.setName(key);
4649:                property.setStructureValue(value);
4650:                property.setAutoCreatePropertyDefinition(addDefinition);
4651:
4652:                writePropertyObject(resourcename, property);
4653:            }
4654:
4655:            /**
4656:             * Writes a property for a specified resource.<p>
4657:             * 
4658:             * @param resourcename the name of resource with complete path
4659:             * @param property the property to write
4660:             * 
4661:             * @throws CmsException if something goes wrong
4662:             */
4663:            public void writePropertyObject(String resourcename,
4664:                    CmsProperty property) throws CmsException {
4665:
4666:                CmsResource resource = readResource(resourcename,
4667:                        CmsResourceFilter.IGNORE_EXPIRATION);
4668:                getResourceType(resource).writePropertyObject(this ,
4669:                        m_securityManager, resource, property);
4670:            }
4671:
4672:            /**
4673:             * Writes a list of properties for a specified resource.<p>
4674:             * 
4675:             * Code calling this method has to ensure that the no properties 
4676:             * <code>a, b</code> are contained in the specified list so that <code>a.equals(b)</code>, 
4677:             * otherwise an exception is thrown.<p>
4678:             * 
4679:             * @param resourcename the name of resource with complete path
4680:             * @param properties the list of properties to write
4681:             * 
4682:             * @throws CmsException if something goes wrong
4683:             */
4684:            public void writePropertyObjects(String resourcename,
4685:                    List properties) throws CmsException {
4686:
4687:                CmsResource resource = readResource(resourcename,
4688:                        CmsResourceFilter.IGNORE_EXPIRATION);
4689:                getResourceType(resource).writePropertyObjects(this ,
4690:                        m_securityManager, resource, properties);
4691:            }
4692:
4693:            /**
4694:             * Writes a resource.<p>
4695:             *
4696:             * @param resource the file to write
4697:             *
4698:             * @throws CmsException if resource type is set to folder, or
4699:             *                      if the user has not the rights to write the file header.
4700:             */
4701:            public void writeResource(CmsResource resource) throws CmsException {
4702:
4703:                m_securityManager.writeResource(m_context, resource);
4704:            }
4705:
4706:            /**
4707:             * Writes a published resource entry.<p>
4708:             * 
4709:             * This is done during static export.<p>
4710:             * 
4711:             * @param resourceName The name of the resource to be added to the static export
4712:             * @param linkType the type of resource exported (0= non-parameter, 1=parameter)
4713:             * @param linkParameter the parameters added to the resource
4714:             * @param timestamp a time stamp for writing the data into the db
4715:             * 
4716:             * @throws CmsException if something goes wrong
4717:             */
4718:            public void writeStaticExportPublishedResource(String resourceName,
4719:                    int linkType, String linkParameter, long timestamp)
4720:                    throws CmsException {
4721:
4722:                m_securityManager.writeStaticExportPublishedResource(m_context,
4723:                        resourceName, linkType, linkParameter, timestamp);
4724:            }
4725:
4726:            /**
4727:             * Updates the user information. <p>
4728:             * 
4729:             * The user id has to be a valid OpenCms user id.<br>
4730:             * 
4731:             * The user with the given id will be completely overriden
4732:             * by the given data.<p>
4733:             *
4734:             * @param user the user to be written
4735:             *
4736:             * @throws CmsException if operation was not successful
4737:             */
4738:            public void writeUser(CmsUser user) throws CmsException {
4739:
4740:                m_securityManager.writeUser(m_context, user);
4741:            }
4742:
4743:            /**
4744:             * Updates the user information of a web user.<br>
4745:             * 
4746:             * Only a web user can be updated this way.<p>
4747:             *
4748:             * The user id has to be a valid OpenCms user id.<br>
4749:             * 
4750:             * The user with the given id will be completely overridden
4751:             * by the given data.<p>
4752:             *
4753:             * @param user the user to be written
4754:             *
4755:             * @throws CmsException if operation was not successful
4756:             * 
4757:             * @deprecated there are no more web users, use a user without any role!
4758:             */
4759:            public void writeWebUser(CmsUser user) throws CmsException {
4760:
4761:                m_securityManager.writeUser(m_context, user);
4762:            }
4763:
4764:            /**
4765:             * Convenience method to add the site root from the current user's 
4766:             * request context to the given resource name.<p>
4767:             *
4768:             * @param resourcename the resource name
4769:             * 
4770:             * @return the resource name with the site root added
4771:             * 
4772:             * @see CmsRequestContext#addSiteRoot(String)
4773:             */
4774:            private String addSiteRoot(String resourcename) {
4775:
4776:                return m_context.addSiteRoot(resourcename);
4777:            }
4778:
4779:            /**
4780:             * Adds a new relation to the given resource.<p>
4781:             * 
4782:             * @param resourceName the name of the source resource
4783:             * @param targetPath the path of the target resource
4784:             * @param relationType the type of the relation
4785:             * @param importCase if importing relations
4786:             * 
4787:             * @throws CmsException if something goes wrong
4788:             */
4789:            private void createRelation(String resourceName, String targetPath,
4790:                    String relationType, boolean importCase)
4791:                    throws CmsException {
4792:
4793:                CmsResource resource = readResource(resourceName,
4794:                        CmsResourceFilter.IGNORE_EXPIRATION);
4795:                CmsResource target = readResource(targetPath,
4796:                        CmsResourceFilter.IGNORE_EXPIRATION);
4797:                CmsRelationType type = CmsRelationType.valueOf(relationType);
4798:                m_securityManager.addRelationToResource(m_context, resource,
4799:                        target, type, importCase);
4800:            }
4801:
4802:            /**
4803:             * Notify all event listeners that a particular event has occurred.<p>
4804:             * 
4805:             * The event will be given to all registered <code>{@link I_CmsEventListener}</code>s.<p>
4806:             * 
4807:             * @param type the type of the event
4808:             * @param data a data object that contains data used by the event listeners
4809:             * 
4810:             * @see OpenCms#addCmsEventListener(I_CmsEventListener)
4811:             * @see OpenCms#addCmsEventListener(I_CmsEventListener, int[])
4812:             */
4813:            private void fireEvent(int type, Object data) {
4814:
4815:                OpenCms.fireCmsEvent(type, Collections.singletonMap("data",
4816:                        data));
4817:            }
4818:
4819:            /**
4820:             * Convenience method to get the initialized resource type instance for the given resource, 
4821:             * with a fall back to special "unknown" resource types in case the resource type is not configured.<p>
4822:             * 
4823:             * @param resource the resource to get the type for
4824:             * 
4825:             * @return the initialized resource type instance for the given resource
4826:             * 
4827:             * @see org.opencms.loader.CmsResourceManager#getResourceType(int)
4828:             */
4829:            private I_CmsResourceType getResourceType(CmsResource resource) {
4830:
4831:                return OpenCms.getResourceManager().getResourceType(resource);
4832:            }
4833:
4834:            /**
4835:             * Convenience method to return the initialized resource type 
4836:             * instance for the given id.<p>
4837:             * 
4838:             * @param resourceType the id of the resource type to get
4839:             * 
4840:             * @return the initialized resource type instance for the given id
4841:             * 
4842:             * @throws CmsException if something goes wrong
4843:             * 
4844:             * @see org.opencms.loader.CmsResourceManager#getResourceType(int)
4845:             */
4846:            private I_CmsResourceType getResourceType(int resourceType)
4847:                    throws CmsException {
4848:
4849:                return OpenCms.getResourceManager().getResourceType(
4850:                        resourceType);
4851:            }
4852:
4853:            /**
4854:             * Initializes this <code>{@link CmsObject}</code> with the provided user context and database connection.<p>
4855:             * 
4856:             * @param securityManager the security manager
4857:             * @param context the request context that contains the user authentication
4858:             */
4859:            private void init(CmsSecurityManager securityManager,
4860:                    CmsRequestContext context) {
4861:
4862:                m_securityManager = securityManager;
4863:                m_context = context;
4864:            }
4865:
4866:            /**
4867:             * Locks a resource.<p>
4868:             *
4869:             * The <code>type</code> parameter controls what kind of lock is used.<br>
4870:             * Possible values for this parameter are: <br>
4871:             * <ul>
4872:             * <li><code>{@link org.opencms.lock.CmsLockType#EXCLUSIVE}</code></li>
4873:             * <li><code>{@link org.opencms.lock.CmsLockType#TEMPORARY}</code></li>
4874:             * </ul><p>
4875:             * 
4876:             * @param resourcename the name of the resource to lock (full current site relative path)
4877:             * @param type type of the lock
4878:             * 
4879:             * @throws CmsException if something goes wrong
4880:             */
4881:            private void lockResource(String resourcename, CmsLockType type)
4882:                    throws CmsException {
4883:
4884:                CmsResource resource = readResource(resourcename,
4885:                        CmsResourceFilter.ALL);
4886:                getResourceType(resource).lockResource(this, m_securityManager,
4887:                        resource, type);
4888:            }
4889:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.