Source code: com/opencms/file/CmsObject.java
1 /*
2 * File : $Source: /usr/local/cvs/opencms/src/com/opencms/file/CmsObject.java,v $
3 * Date : $Date: 2004/01/06 12:45:04 $
4 * Version: $Revision: 1.268.2.2 $
5 *
6 * This library is part of OpenCms -
7 * the Open Source Content Mananagement System
8 *
9 * Copyright (C) 2001 The OpenCms Group
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * For further information about OpenCms, please see the
22 * OpenCms Website: http://www.opencms.org
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 */
28
29 package com.opencms.file;
30
31
32 import com.opencms.boot.I_CmsLogChannels;
33 import com.opencms.core.*;
34 import com.opencms.flex.util.CmsResourceTranslator;
35 import com.opencms.launcher.CmsLauncherManager;
36 import com.opencms.linkmanagement.CmsPageLinks;
37 import com.opencms.linkmanagement.LinkChecker;
38 import com.opencms.report.CmsShellReport;
39 import com.opencms.report.I_CmsReport;
40 import com.opencms.template.cache.CmsElementCache;
41 import com.opencms.util.LinkSubstitution;
42 import com.opencms.util.Utils;
43
44 import java.util.ArrayList;
45 import java.util.Collections;
46 import java.util.Date;
47 import java.util.HashMap;
48 import java.util.Hashtable;
49 import java.util.Map;
50 import java.util.Vector;
51
52 import source.org.apache.java.util.Configurations;
53
54 /**
55 * This class provides access to the OpenCms and its resources.
56 * <br>
57 * The CmsObject encapsulates user identification and client requests and
58 * is the central object to transport information in the Cms Servlet.
59 * <br>
60 * All operations on the CmsObject are forwarded to the class which extends A_CmsRessourceBroker
61 * to ensure user authentification in all operations.
62 *
63 * @author Andreas Schouten
64 * @author Michael Emmerich
65 * @author Alexander Kandzior (a.kandzior@alkacon.com)
66 * @author Michaela Schleich
67 *
68 * @version $Revision: 1.268.2.2 $
69 */
70 public class CmsObject implements I_CmsConstants {
71
72 /**
73 * Method that can be invoked to find out all currently logged in users.
74 */
75 private CmsCoreSession m_sessionStorage = null;
76
77 /**
78 * The resource broker to access the cms.
79 */
80 private I_CmsResourceBroker m_rb = null;
81
82 /**
83 * The resource broker to access the cms.
84 */
85 private CmsRequestContext m_context = null;
86
87 /**
88 * The launcher manager used with this object,
89 * Is needed to clear the template caches.
90 */
91 private CmsLauncherManager m_launcherManager = null;
92
93 /**
94 * The class for linkmanagement.
95 */
96 private LinkChecker m_linkChecker = null;
97
98 /**
99 * The class for processing links.
100 */
101 private LinkSubstitution m_linkSubstitution = null;
102
103 /**
104 * the modus the cmsObject runs in (used i.e. for static export)
105 */
106 private int m_mode = C_MODUS_AUTO;
107
108 /**
109 * The default constructor.
110 */
111 public CmsObject () {
112 }
113
114 /** Internal debug flag, set to 9 for maximum verbosity */
115 private static final int DEBUG = 0;
116
117
118 /**
119 * Accept a task from the Cms.
120 *
121 * @param taskid the id of the task to accept.
122 *
123 * @throws CmsException if operation was not successful.
124 */
125 public void acceptTask(int taskId) throws CmsException {
126 m_rb.acceptTask(m_context.currentUser(), m_context.currentProject(), taskId);
127 }
128 /**
129 * Checks, if the user may create this resource.
130 *
131 * @param resource the resource to check.
132 * @return <code>true</code> if the user has the appropriate rigths to create the resource; <code>false</code> otherwise
133 *
134 * @throws CmsException if operation was not successful.
135 */
136 public boolean accessCreate(String resource) throws CmsException {
137 try {
138 return m_rb.accessCreate(m_context.currentUser(), m_context.currentProject(), getSiteRoot(resource));
139 } catch (Exception exc) {
140 throw new CmsException(CmsException.C_UNKNOWN_EXCEPTION, exc);
141 }
142 }
143 /**
144 * Checks, if the user may lock this resource.
145 *
146 * @param resource the resource to check.
147 * @return <code>true</code> if the user has the appropriate rights to lock this resource; <code>false</code> otherwise
148 *
149 * @throws CmsException if operation was not successful.
150 */
151 public boolean accessLock(String resource) throws CmsException {
152 try {
153 return m_rb.accessLock(m_context.currentUser(), m_context.currentProject(), getSiteRoot(resource));
154 } catch (Exception exc) {
155 throw new CmsException(CmsException.C_UNKNOWN_EXCEPTION, exc);
156 }
157 }
158 /**
159 * Checks if the user can access the project.
160 *
161 * @param projectId the id of the project.
162 * @return <code>true</code>, if the user may access this project; <code>false</code> otherwise
163 *
164 * @throws CmsException if operation was not successful.
165 */
166 public boolean accessProject(int projectId) throws CmsException {
167 return (m_rb.accessProject(m_context.currentUser(), m_context.currentProject(), projectId));
168 }
169 /**
170 * Checks, if the user may read this resource.
171 *
172 * @param resource The resource to check.
173 * @return <code>true</code>, if the user has the appropriate rigths to read the resource; <code>false</code> otherwise.
174 *
175 * @throws CmsException if operation was not successful.
176 */
177 public boolean accessRead(String resource) throws CmsException {
178 try {
179 return m_rb.accessRead(m_context.currentUser(), m_context.currentProject(), getSiteRoot(resource));
180 } catch (Exception exc) {
181 throw new CmsException(CmsException.C_UNKNOWN_EXCEPTION, exc);
182 }
183 }
184 /**
185 * Checks, if the user may write this resource.
186 *
187 * @param resource the resource to check.
188 * @return <code>true</code>, if the user has the appropriate rigths to write the resource; <code>false</code> otherwise.
189 *
190 * @throws CmsException if operation was not successful.
191 */
192 public boolean accessWrite(String resource) throws CmsException {
193 try {
194 return m_rb.accessWrite(m_context.currentUser(), m_context.currentProject(), getSiteRoot(resource));
195 } catch (Exception exc) {
196 throw new CmsException(CmsException.C_UNKNOWN_EXCEPTION, exc);
197 }
198 }
199 /**
200 * Adds a file extension to the list of known file extensions.
201 * <p>
202 * <b>Security:</b>
203 * Only members of the group administrators are allowed to add a file extension.
204 *
205 * @param extension a file extension like "html","txt" etc.
206 * @param resTypeName name of the resource type associated with the extension.
207 *
208 * @throws CmsException if operation was not successful.
209 */
210
211 public void addFileExtension(String extension, String resTypeName) throws CmsException {
212 m_rb.addFileExtension(m_context.currentUser(), m_context.currentProject(), extension, resTypeName);
213 }
214 /**
215 * Adds a new group to the Cms.<p>
216 *
217 * <b>Security:</b>
218 * Only members of the group administrators are allowed to add a new group.
219 *
220 * @param name the name of the new group
221 * @param description the description of the new group
222 * @param flags the flags for the new group
223 * @param parent the parent group
224 *
225 * @return a <code>CmsGroup</code> object representing the newly created group.
226 *
227 * @throws CmsException if operation was not successful.
228 */
229 public CmsGroup addGroup(String name, String description, int flags, String parent) throws CmsException {
230 return (m_rb.addGroup(m_context.currentUser(), m_context.currentProject(), name, description, flags, parent));
231 }
232
233 /**
234 * Adds a user to the Cms.
235 * <p>
236 * <b>Security:</b>
237 * Only members of the group administrators are allowed to add a user.
238 *
239 * @param name the new name for the user.
240 * @param password the new password for the user.
241 * @param group the default groupname for the user.
242 * @param description the description for the user.
243 * @param additionalInfos a Hashtable with additional infos for the user. These
244 * Infos may be stored into the Usertables (depending on the implementation).
245 * @param flags the flags for a user (e.g. C_FLAG_ENABLED).
246 *
247 * @return a <code>CmsUser</code> object representing the added user.
248 *
249 * @throws CmsException if operation was not successful.
250 */
251 public CmsUser addUser(String name, String password, String group, String description, Hashtable additionalInfos, int flags) throws CmsException {
252 return (m_rb.addUser(this, m_context.currentUser(), m_context.currentProject(), name, password, group, description, additionalInfos, flags));
253 }
254
255 /**
256 * Adds a user to the Cms by import.
257 * <p>
258 * <b>Security:</b>
259 * Only members of the group administrators are allowed to add a user.
260 *
261 * @param name the new name for the user.
262 * @param password the new password for the user.
263 * @param recoveryPassword the new password for the user.
264 * @param description the description for the user.
265 * @param firstname the firstname of the user.
266 * @param lastname the lastname of the user.
267 * @param email the email of the user.
268 * @param flags the flags for a user (e.g. C_FLAG_ENABLED).
269 * @param additionalInfos a Hashtable with additional infos for the user. These
270 * Infos may be stored into the Usertables (depending on the implementation).
271 * @param defaultGroup the default groupname for the user.
272 * @param address the address of the user.
273 * @param section the section of the user.
274 * @param type the type of the user.
275 *
276 * @return a <code>CmsUser</code> object representing the added user.
277 *
278 * @throws CmsException if operation was not successful.
279 */
280 public CmsUser addImportUser(String name, String password, String recoveryPassword, String description,
281 String firstname, String lastname, String email, int flags, Hashtable additionalInfos,
282 String defaultGroup, String address, String section, int type) throws CmsException {
283 return (m_rb.addImportUser(m_context.currentUser(), m_context.currentProject(), name, password,
284 recoveryPassword, description, firstname, lastname, email, flags, additionalInfos,
285 defaultGroup, address, section, type));
286 }
287
288 /**
289 * Adds a user to a group.
290 * <p>
291 * <b>Security:</b>
292 * Only members of the group administrators are allowed to add a user to a group.
293 *
294 * @param username the name of the user that is to be added to the group.
295 * @param groupname the name of the group.
296 * @throws CmsException if operation was not successful.
297 */
298 public void addUserToGroup(String username, String groupname) throws CmsException {
299 m_rb.addUserToGroup(m_context.currentUser(), m_context.currentProject(), username, groupname);
300 }
301 /**
302 * Adds a web user to the Cms.
303 * <br>
304 * A web user has no access to the workplace but is able to access personalized
305 * functions controlled by the OpenCms.
306 *
307 * @param name the new name for the user.
308 * @param password the new password for the user.
309 * @param group the default groupname for the user.
310 * @param description the description for the user.
311 * @param additionalInfos a Hashtable with additional infos for the user. These
312 * Infos may be stored into the Usertables (depending on the implementation).
313 * @param flags the flags for a user (e.g. C_FLAG_ENABLED)
314 *
315 * @return a <code>CmsUser</code> object representing the newly created user.
316 *
317 * @throws CmsException if operation was not successful.
318 */
319 public CmsUser addWebUser(String name, String password, String group, String description, Hashtable additionalInfos, int flags) throws CmsException {
320 return (m_rb.addWebUser(this, m_context.currentUser(), m_context.currentProject(), name, password, group, description, additionalInfos, flags));
321 }
322 /**
323 * Adds a web user to the Cms.
324 * <br>
325 * A web user has no access to the workplace but is able to access personalized
326 * functions controlled by the OpenCms.
327 *
328 * @param name the new name for the user.
329 * @param password the new password for the user.
330 * @param group the default groupname for the user.
331 * @param additionalGroup An additional group for the user.
332 * @param description the description for the user.
333 * @param additionalInfos a Hashtable with additional infos for the user. These
334 * Infos may be stored into the Usertables (depending on the implementation).
335 * @param flags the flags for a user (e.g. C_FLAG_ENABLED)
336 *
337 * @return a <code>CmsUser</code> object representing the newly created user.
338 *
339 * @throws CmsException if operation was not successful.
340 */
341 public CmsUser addWebUser(String name, String password, String group, String additionalGroup, String description, Hashtable additionalInfos, int flags) throws CmsException {
342 CmsUser newWebUser = m_rb.addWebUser(this, m_context.currentUser(), m_context.currentProject(), name, password, group, additionalGroup, description, additionalInfos, flags);
343 return newWebUser;
344 }
345 /**
346 * Returns the anonymous user object.
347 *
348 * @return a <code>CmsUser</code> object representing the anonymous user.
349 * @throws CmsException if operation was not successful.
350 */
351 public CmsUser anonymousUser() throws CmsException {
352 return (m_rb.anonymousUser(m_context.currentUser(), m_context.currentProject()));
353 }
354 /**
355 * Changes the group of a resource.
356 * <br>
357 * Only the group of a resource in an offline project can be changed. The state
358 * of the resource is set to CHANGED (1).
359 * If the content of this resource is not existing in the offline project already,
360 * it is read from the online project and written into the offline project.
361 * <p>
362 * <B>Security:</B>
363 * Access is granted, if:
364 * <ul>
365 * <li>the user has access to the project</li>
366 * <li>the user is owner of the resource or is admin</li>
367 * <li>the resource is locked by the callingUser</li>
368 * </ul>
369 *
370 * @param filename the complete path to the resource.
371 * @param newGroup the name of the new group for this resource.
372 *
373 * @throws CmsException if operation was not successful.
374 */
375 public void chgrp(String filename, String newGroup) throws CmsException {
376 CmsResource res = readFileHeader(filename);
377 I_CmsResourceType rt = getResourceType(res.getType());
378 rt.chgrp(this, filename, newGroup, false);
379 }
380
381 /**
382 * Changes the group of a resource.
383 * <br>
384 * Only the group of a resource in an offline project can be changed. The state
385 * of the resource is set to CHANGED (1).
386 * If the content of this resource is not existing in the offline project already,
387 * it is read from the online project and written into the offline project.
388 * <p>
389 * <B>Security:</B>
390 * Access is granted, if:
391 * <ul>
392 * <li>the user has access to the project</li>
393 * <li>the user is owner of the resource or is admin</li>
394 * <li>the resource is locked by the callingUser</li>
395 * </ul>
396 *
397 * @param filename the complete path to the resource.
398 * @param newGroup the name of the new group for this resource.
399 * @param chRekursive shows if the subResources (of a folder) should be changed too.
400 *
401 * @throws CmsException if operation was not successful.
402 */
403 public void chgrp(String filename, String newGroup, boolean chRekursive) throws CmsException {
404 CmsResource res = readFileHeader(filename);
405 I_CmsResourceType rt = getResourceType(res.getType());
406 rt.chgrp(this, filename, newGroup, chRekursive);
407 }
408
409 /**
410 * Changes the group of a resource.
411 * <br>
412 * Only the group of a resource in an offline project can be changed. The state
413 * of the resource is set to CHANGED (1).
414 * If the content of this resource is not existing in the offline project already,
415 * it is read from the online project and written into the offline project.
416 * <p>
417 * <B>Security:</B>
418 * Access is granted, if:
419 * <ul>
420 * <li>the user has access to the project</li>
421 * <li>the user is owner of the resource or is admin</li>
422 * <li>the resource is locked by the callingUser</li>
423 * </ul>
424 *
425 * @param filename the complete path to the resource.
426 * @param newGroup the name of the new group for this resource.
427 *
428 * @throws CmsException if operation was not successful.
429 */
430 protected void doChgrp(String filename, String newGroup) throws CmsException {
431 m_rb.chgrp(m_context.currentUser(), m_context.currentProject(), getSiteRoot(filename), newGroup);
432 }
433
434 /**
435 * Changes the flags of a resource.
436 * <br>
437 * Only the flags of a resource in an offline project can be changed. The state
438 * of the resource is set to CHANGED (1).
439 * If the content of this resource is not existing in the offline project already,
440 * it is read from the online project and written into the offline project.
441 * The user may change the flags, if he is admin of the resource.
442 * <p>
443 * <B>Security:</B>
444 * Access is granted, if:
445 * <ul>
446 * <li>the user has access to the project</li>
447 * <li>the user can write the resource</li>
448 * <li>the resource is locked by the callingUser</li>
449 * </ul>
450 *
451 * @param filename the complete path to the resource.
452 * @param flags the new flags for the resource.
453 *
454 * @throws CmsException if operation was not successful.
455 * for this resource.
456 */
457 public void chmod(String filename, int flags) throws CmsException {
458 CmsResource res = readFileHeader(filename);
459 I_CmsResourceType rt = getResourceType(res.getType());
460 rt.chmod(this, filename, flags, false);
461 }
462
463 /**
464 * Changes the flags of a resource.
465 * <br>
466 * Only the flags of a resource in an offline project can be changed. The state
467 * of the resource is set to CHANGED (1).
468 * If the content of this resource is not existing in the offline project already,
469 * it is read from the online project and written into the offline project.
470 * The user may change the flags, if he is admin of the resource.
471 * <p>
472 * <B>Security:</B>
473 * Access is granted, if:
474 * <ul>
475 * <li>the user has access to the project</li>
476 * <li>the user can write the resource</li>
477 * <li>the resource is locked by the callingUser</li>
478 * </ul>
479 *
480 * @param filename the complete path to the resource.
481 * @param flags the new flags for the resource.
482 * @param chRekursive shows if the subResources (of a folder) should be changed too.
483 *
484 * @throws CmsException if operation was not successful.
485 * for this resource.
486 */
487 public void chmod(String filename, int flags, boolean chRekursive) throws CmsException {
488 CmsResource res = readFileHeader(filename);
489 I_CmsResourceType rt = getResourceType(res.getType());
490 rt.chmod(this, filename, flags, chRekursive);
491 }
492
493 /**
494 * Changes the flags of a resource.
495 * <br>
496 * Only the flags of a resource in an offline project can be changed. The state
497 * of the resource is set to CHANGED (1).
498 * If the content of this resource is not existing in the offline project already,
499 * it is read from the online project and written into the offline project.
500 * The user may change the flags, if he is admin of the resource.
501 * <p>
502 * <B>Security:</B>
503 * Access is granted, if:
504 * <ul>
505 * <li>the user has access to the project</li>
506 * <li>the user can write the resource</li>
507 * <li>the resource is locked by the callingUser</li>
508 * </ul>
509 *
510 * @param filename the complete path to the resource.
511 * @param flags the new flags for the resource.
512 *
513 * @throws CmsException if operation was not successful.
514 * for this resource.
515 */
516 protected void doChmod(String filename, int flags) throws CmsException {
517 m_rb.chmod(m_context.currentUser(), m_context.currentProject(), getSiteRoot(filename), flags);
518 }
519
520 /**
521 * Changes the owner of a resource.
522 * <br>
523 * Only the owner of a resource in an offline project can be changed. The state
524 * of the resource is set to CHANGED (1).
525 * If the content of this resource is not existing in the offline project already,
526 * it is read from the online project and written into the offline project.
527 * The user may change this, if he is admin of the resource.
528 * <p>
529 * <B>Security:</B>
530 * Access is granted, if:
531 * <ul>
532 * <li>the user has access to the project</li>
533 * <li>the user is owner of the resource or the user is admin</li>
534 * <li>the resource is locked by the callingUser</li>
535 * </ul>
536 *
537 * @param filename the complete path to the resource.
538 * @param newOwner the name of the new owner for this resource.
539 *
540 * @throws CmsException if operation was not successful.
541 */
542 public void chown(String filename, String newOwner) throws CmsException {
543 CmsResource res = readFileHeader(filename);
544 I_CmsResourceType rt = getResourceType(res.getType());
545 rt.chown(this, filename, newOwner, false);
546 }
547
548 /**
549 * Changes the owner of a resource.
550 * <br>
551 * Only the owner of a resource in an offline project can be changed. The state
552 * of the resource is set to CHANGED (1).
553 * If the content of this resource is not existing in the offline project already,
554 * it is read from the online project and written into the offline project.
555 * The user may change this, if he is admin of the resource.
556 * <p>
557 * <B>Security:</B>
558 * Access is granted, if:
559 * <ul>
560 * <li>the user has access to the project</li>
561 * <li>the user is owner of the resource or the user is admin</li>
562 * <li>the resource is locked by the callingUser</li>
563 * </ul>
564 *
565 * @param filename the complete path to the resource.
566 * @param newOwner the name of the new owner for this resource.
567 * @param chRekursive shows if the subResources (of a folder) should be changed too.
568 *
569 * @throws CmsException if operation was not successful.
570 */
571 public void chown(String filename, String newOwner, boolean chRekursive) throws CmsException {
572 CmsResource res = readFileHeader(filename);
573 I_CmsResourceType rt = getResourceType(res.getType());
574 rt.chown(this, filename, newOwner, chRekursive);
575 }
576
577 /**
578 * Changes the owner of a resource.
579 * <br>
580 * Only the owner of a resource in an offline project can be changed. The state
581 * of the resource is set to CHANGED (1).
582 * If the content of this resource is not existing in the offline project already,
583 * it is read from the online project and written into the offline project.
584 * The user may change this, if he is admin of the resource.
585 * <p>
586 * <B>Security:</B>
587 * Access is granted, if:
588 * <ul>
589 * <li>the user has access to the project</li>
590 * <li>the user is owner of the resource or the user is admin</li>
591 * <li>the resource is locked by the callingUser</li>
592 * </ul>
593 *
594 * @param filename the complete path to the resource.
595 * @param newOwner the name of the new owner for this resource.
596 *
597 * @throws CmsException if operation was not successful.
598 */
599 protected void doChown(String filename, String newOwner) throws CmsException {
600 m_rb.chown(m_context.currentUser(), m_context.currentProject(), getSiteRoot(filename), newOwner);
601 }
602
603 /**
604 * Changes the resourcetype of a resource.
605 * <br>
606 * Only the resourcetype of a resource in an offline project can be changed. The state
607 * of the resource is set to CHANGED (1).
608 * If the content of this resource is not exisiting in the offline project already,
609 * it is read from the online project and written into the offline project.
610 * The user may change this, if he is admin of the resource.
611 * <p>
612 * <B>Security:</B>
613 * Access is granted, if:
614 * <ul>
615 * <li>the user has access to the project</li>
616 * <li>the user is owner of the resource or is admin</li>
617 * <li>the resource is locked by the callingUser</li>
618 * </ul>
619 *
620 * @param filename the complete path to the resource.
621 * @param newType the name of the new resourcetype for this resource.
622 *
623 * @throws CmsException if operation was not successful.
624 */
625 public void chtype(String filename, String newType) throws CmsException {
626 CmsResource res = readFileHeader(filename);
627 I_CmsResourceType rt = getResourceType(res.getType());
628 rt.chtype(this, filename, newType);
629 }
630
631 /**
632 * Changes the resourcetype of a resource.
633 * <br>
634 * Only the resourcetype of a resource in an offline project can be changed. The state
635 * of the resource is set to CHANGED (1).
636 * If the content of this resource is not exisiting in the offline project already,
637 * it is read from the online project and written into the offline project.
638 * The user may change this, if he is admin of the resource.
639 * <p>
640 * <B>Security:</B>
641 * Access is granted, if:
642 * <ul>
643 * <li>the user has access to the project</li>
644 * <li>the user is owner of the resource or is admin</li>
645 * <li>the resource is locked by the callingUser</li>
646 * </ul>
647 *
648 * @param filename the complete path to the resource.
649 * @param newType the name of the new resourcetype for this resource.
650 *
651 * @throws CmsException if operation was not successful.
652 */
653 protected void doChtype(String filename, String newType) throws CmsException {
654 m_rb.chtype(m_context.currentUser(), m_context.currentProject(), getSiteRoot(filename), newType);
655 }
656
657 /**
658 * Clears all internal DB-Caches.
659 */
660 public void clearcache() {
661 m_rb.clearcache();
662 System.gc();
663 }
664
665 /**
666 * Clears the element cache.
667 */
668 public void clearElementCache(){
669 this.getOnlineElementCache().clearCache();
670 }
671
672 /**
673 * Copies a file.
674 *
675 * @param source the complete path of the sourcefile.
676 * @param destination the complete path of the destinationfolder.
677 *
678 * @throws CmsException if the file couldn't be copied, or the user
679 * has not the appropriate rights to copy the file.
680 */
681 public void copyResource(String source, String destination) throws CmsException {
682 CmsResource res = readFileHeader(source);
683 I_CmsResourceType rt = getResourceType(res.getType());
684 rt.copyResource(this, source, destination, false);
685 }
686 /**
687 * Copies a file.
688 *
689 * @param source the complete path of the sourcefile.
690 * @param destination the complete path of the destinationfolder.
691 * @param keepFlags <code>true</code> if the copy should keep the source file's flags,
692 * <code>false</code> if the copy should get the user's default flags.
693 *
694 * @throws CmsException if the file couldn't be copied, or the user
695 * has not the appropriate rights to copy the file.
696 */
697 public void copyResource(String source, String destination, boolean keepFlags) throws CmsException {
698 CmsResource res = readFileHeader(source);
699 I_CmsResourceType rt = getResourceType(res.getType());
700 rt.copyResource(this, source, destination, keepFlags);
701 }
702 /**
703 * Copies a file.
704 *
705 * @param source the complete path of the sourcefile.
706 * @param destination the complete path of the destinationfolder.
707 *
708 * @throws CmsException if the file couldn't be copied, or the user
709 * has not the appropriate rights to copy the file.
710 */
711 protected void doCopyFile(String source, String destination) throws CmsException {
712 m_rb.copyFile(m_context.currentUser(), m_context.currentProject(), getSiteRoot(source), getSiteRoot(destination));
713 }
714
715 /**
716 * Copies a folder.
717 *
718 * @param source the complete path of the sourcefolder.
719 * @param destination the complete path of the destinationfolder.
720 *
721 * @throws CmsException if the folder couldn't be copied, or if the
722 * user has not the appropriate rights to copy the folder.
723 */
724 protected void doCopyFolder(String source, String destination) throws CmsException {
725 m_rb.copyFolder(m_context.currentUser(), m_context.currentProject(), getSiteRoot(source), getSiteRoot(destination));
726 }
727
728 /**
729 * Copies a file.
730 *
731 * @param source the complete path of the sourcefile.
732 * @param destination the complete path of the destinationfolder.
733 *
734 * @throws CmsException if the file couldn't be copied, or the user
735 * has not the appropriate rights to copy the file.
736 *
737 * @deprecated Use copyResource instead.
738 */
739 public void copyFile(String source, String destination) throws CmsException {
740 copyResource(source, destination);
741 }
742 /**
743 * Copies a folder.
744 *
745 * @param source the complete path of the sourcefolder.
746 * @param destination the complete path of the destinationfolder.
747 *
748 * @throws CmsException if the folder couldn't be copied, or if the
749 * user has not the appropriate rights to copy the folder.
750 *
751 * @deprecated Use copyResource instead.
752 */
753 public void copyFolder(String source, String destination) throws CmsException {
754 copyResource(source, destination);
755 }
756
757 /**
758 * Copies a resource from the online project to a new, specified project.
759 * <br>
760 * Copying a resource will copy the file header or folder into the specified
761 * offline project and set its state to UNCHANGED.
762 *
763 * @param resource the name of the resource.
764 * @throws CmsException if operation was not successful.
765 */
766 public void copyResourceToProject(String resource) throws CmsException {
767 CmsResource res = readFileHeader(resource);
768 I_CmsResourceType rt = getResourceType(res.getType());
769 rt.copyResourceToProject(this, resource);
770 }
771
772 /**
773 * Copies a resource from the online project to a new, specified project.
774 * <br>
775 * Copying a resource will copy the file header or folder into the specified
776 * offline project and set its state to UNCHANGED.
777 *
778 * @param resource the name of the resource.
779 * @throws CmsException if operation was not successful.
780 */
781 protected void doCopyResourceToProject(String resource) throws CmsException {
782 m_rb.copyResourceToProject(m_context.currentUser(), m_context.currentProject(), getSiteRoot(resource));
783 }
784
785 /**
786 * Counts the locked resources in a project.
787 *
788 * @param id the id of the project
789 * @return the number of locked resources in this project.
790 *
791 * @throws CmsException if operation was not successful.
792 */
793 public int countLockedResources(int id) throws CmsException {
794 return m_rb.countLockedResources(m_context.currentUser(), m_context.currentProject(), id);
795 }
796 /**
797 * Creates a new file with the given content and resourcetype.<br>
798 *
799 * @param folder the complete path to the folder in which the file will be created.
800 * @param filename the name of the new file.
801 * @param contents the contents of the new file.
802 * @param type the resourcetype of the new file.
803 *
804 * @return file a <code>CmsFile</code> object representing the newly created file.
805 *
806 * @throws if the resourcetype is set to folder. The CmsException is also thrown, if the
807 * filename is not valid or if the user has not the appropriate rights to create a new file.
808 *
809 * @deprecated Use createResource instead.
810 */
811 public CmsFile createFile(String folder, String filename, byte[] contents, String type) throws CmsException {
812 return (CmsFile)createResource(folder, filename, type, null, contents);
813 }
814 /**
815 * Creates a new file with the given content and resourcetype.
816 *
817 * @param folder the complete path to the folder in which the file will be created.
818 * @param filename the name of the new file.
819 * @param contents the contents of the new file.
820 * @param type the resourcetype of the new file.
821 * @param properties A Hashtable of properties, that should be set for this file.
822 * The keys for this Hashtable are the names for properties, the values are
823 * the values for the properties.
824 *
825 * @return file a <code>CmsFile</code> object representing the newly created file.
826 *
827 * @throws CmsException or if the resourcetype is set to folder.
828 * The CmsException is also thrown, if the filename is not valid or if the user
829 * has not the appropriate rights to create a new file.
830 *
831 * @deprecated Use createResource instead.
832 */
833 public CmsFile createFile(String folder, String filename, byte[] contents, String type, Hashtable properties) throws CmsException {
834 return (CmsFile)createResource(folder, filename, type, properties, contents);
835 }
836
837 /**
838 * Replaces and existing resource by another file with different content
839 * and different file type.
840 *
841 * @param filename the resource to replace
842 * @param type the type of the new resource
843 * @param newContent the content of the new resource
844 */
845 public void replaceResource(String filename, String type, Hashtable newProperties, byte[] newContent) throws CmsException {
846 // save the properties of the old file
847 Hashtable oldProperties = null;
848 try {
849 oldProperties = this.readAllProperties(filename);
850 }
851 catch (CmsException e) {
852 oldProperties = new Hashtable();
853 }
854
855 // add the properties that might have been collected during
856 // a file-upload-dialogue chain etc.
857 if (newProperties!=null) {
858 oldProperties.putAll( newProperties );
859 }
860
861 try {
862 // delete the old file
863 this.deleteResource(filename);
864
865 // re-create the resource with the new content and the properties
866 // of the old file that we deleted before
867 this.createResource(filename, type, oldProperties, newContent, null);
868 }
869 catch (CmsException e1) {
870 throw new CmsException( CmsException.C_FILESYSTEM_ERROR, e1 );
871 }
872
873 // clean-up the link management
874 this.joinLinksToTargets( new CmsShellReport() );
875 }
876
877 /**
878 * Creates a new folder.
879 *
880 * @param folder the complete path to the folder in which the new folder
881 * will be created.
882 * @param newFolderName the name of the new folder.
883 *
884 * @return folder a <code>CmsFolder</code> object representing the newly created folder.
885 *
886 * @throws CmsException if the foldername is not valid, or if the user has not the appropriate rights to create
887 * a new folder.
888 *
889 * @deprecated Use createResource instead.
890 */
891 public CmsFolder createFolder(String folder, String newFolderName) throws CmsException {
892 return (CmsFolder)createResource(folder, newFolderName, C_TYPE_FOLDER_NAME);
893 }
894
895 /**
896 * Creates a new channel.
897 *
898 * @param parentChannel the complete path to the channel in which the new channel
899 * will be created.
900 * @param newChannelName the name of the new channel.
901 *
902 * @return folder a <code>CmsFolder</code> object representing the newly created channel.
903 *
904 * @throws CmsException if the channelname is not valid, or if the user has not the appropriate rights to create
905 * a new channel.
906 *
907 */
908 public CmsFolder createChannel(String parentChannel, String newChannelName) throws CmsException {
909 try {
910 setContextToCos();
911 Hashtable properties = new Hashtable();
912 int newChannelId = com.opencms.dbpool.CmsIdGenerator.nextId(com.opencms.defaults.master.CmsChannelBackoffice.C_TABLE_CHANNELID);
913 properties.put(I_CmsConstants.C_PROPERTY_CHANNELID, newChannelId+"");
914 return (CmsFolder)createResource(parentChannel, newChannelName, C_TYPE_FOLDER_NAME, properties);
915 } finally {
916 setContextToVfs();
917 }
918 }
919
920 public CmsResource createResource(String folder, String name, String type) throws CmsException {
921 return this.createResource(folder + name, type, new HashMap(), new byte[0], null );
922 }
923
924 public CmsResource createResource(String folder, String name, String type, Map properties) throws CmsException {
925 return this.createResource(folder + name, type, properties, new byte[0], null);
926 }
927
928 public CmsResource createResource(String folder, String name, String type, Map properties, byte[] contents) throws CmsException {
929 return this.createResource(folder + name, type, properties, contents, null);
930 }
931
932 public CmsResource createResource(String newResourceName, String type, Map properties, byte[] contents, Object parameter) throws CmsException {
933 I_CmsResourceType rt = getResourceType(type);
934 return rt.createResource(this, newResourceName, properties, contents, parameter);
935 }
936
937 /**
938 * Creates a new file with the given content and resourcetype.<br>
939 *
940 * @param folder the complete path to the folder in which the file will be created.
941 * @param filename the name of the new file.
942 * @param contents the contents of the new file.
943 * @param type the resourcetype of the new file.
944 *
945 * @return file a <code>CmsFile</code> object representing the newly created file.
946 *
947 * @throws CmsException if the resourcetype is set to folder. The CmsException is also thrown, if the
948 * filename is not valid or if the user has not the appropriate rights to create a new file.
949 */
950 protected CmsFile doCreateFile(String newFileName, byte[] contents, String type) throws CmsException {
951 CmsFile file = m_rb.createFile(m_context.currentUser(), m_context.currentGroup(),
952 m_context.currentProject(), getSiteRoot(newFileName), contents,
953 type, new HashMap());
954 return file;
955 }
956 /**
957 * Creates a new file with the given content and resourcetype.
958 *
959 * @param folder the complete path to the folder in which the file will be created.
960 * @param filename the name of the new file.
961 * @param contents the contents of the new file.
962 * @param type the resourcetype of the new file.
963 * @param properties A Hashtable of properties, that should be set for this file.
964 * The keys for this Hashtable are the names for properties, the values are
965 * the values for the properties.
966 *
967 * @return file a <code>CmsFile</code> object representing the newly created file.
968 *
969 * @throws CmsException if the wrong properties are given, or if the resourcetype is set to folder.
970 * The CmsException is also thrown, if the filename is not valid or if the user
971 * has not the appropriate rights to create a new file.
972 */
973 protected CmsFile doCreateFile(String newFileName, byte[] contents, String type, Map properties) throws CmsException {
974 // avoid null-pointer exceptions
975 if(properties == null) {
976 properties = new Hashtable();
977 }
978 CmsFile file = m_rb.createFile(m_context.currentUser(), m_context.currentGroup(),
979 m_context.currentProject(), getSiteRoot(newFileName), contents,
980 type, properties);
981 return file;
982 }
983
984 /**
985 * Creates a new folder.
986 *
987 * @param folder the complete path to the folder in which the new folder
988 * will be created.
989 * @param newFolderName the name of the new folder.
990 *
991 * @return folder a <code>CmsFolder</code> object representing the newly created folder.
992 *
993 * @throws CmsException if the foldername is not valid, or if the user has not the appropriate rights to create
994 * a new folder.
995 */
996 protected CmsFolder doCreateFolder(String folder, String newFolderName) throws CmsException {
997 CmsFolder cmsFolder = m_rb.createFolder(m_context.currentUser(), m_context.currentGroup(), m_context.currentProject(),
998 getSiteRoot(folder + newFolderName + C_FOLDER_SEPARATOR), new Hashtable());
999 return cmsFolder;
1000}
1001
1002/**
1003 * Creates a new folder.
1004 *
1005 * @param folder the complete path to the folder in which the new folder will
1006 * be created.
1007 * @param newFolderName the name of the new folder.
1008 * @param properties A Hashtable of properties, that should be set for this folder.
1009 * The keys for this Hashtable are the names for property-definitions, the values are
1010 * the values for the properties.
1011 *
1012 * @return a <code>CmsFolder</code> object representing the newly created folder.
1013 * @throws CmsException if the foldername is not valid, or if the user has not the appropriate rights to create
1014 * a new folder.
1015 *
1016 */
1017protected CmsFolder doCreateFolder(String newFolderName, Map properties) throws CmsException {
1018 CmsFolder cmsFolder = m_rb.createFolder(m_context.currentUser(), m_context.currentGroup(), m_context.currentProject(),
1019 getSiteRoot(newFolderName), properties);
1020 return cmsFolder;
1021}
1022
1023 /**
1024 * Creates a new resource.
1025 *
1026 * @param folder the complete path to the folder in which the new resource will
1027 * be created.
1028 * @param newResourceName the name of the new resource.
1029 * @param resourceType The resourcetype of the new resource
1030 * @param properties A Hashtable of propertyinfos, that should be set for this folder.
1031 * The keys for this Hashtable are the names for propertydefinitions, the values are
1032 * the values for the propertyinfos.
1033 * @param launcherType The launcher type of the new resource
1034 * @param launcherClassname The name of the launcherclass of the new resource
1035 * @param ownername The name of the owner of the new resource
1036 * @param groupname The name of the group of the new resource
1037 * @param accessFlags The accessFlags of the new resource
1038 * @param filecontent The content of the resource if it is of type file
1039 *
1040 * @return a <code>CmsFolder</code> object representing the newly created folder.
1041 * @throws CmsException if the resourcename is not valid, or if the user has not the appropriate rights to create
1042 * a new resource.
1043 *
1044 */
1045 protected CmsResource doImportResource(String newResourceName, int resourceType, Map properties, int launcherType,
1046 String launcherClassname, String ownername, String groupname, int accessFlags, long lastmodified, byte[] filecontent) throws CmsException {
1047 CmsResource cmsResource = m_rb.importResource(m_context.currentUser(), m_context.currentProject(),
1048 getSiteRoot(newResourceName), resourceType, properties, launcherType,
1049 launcherClassname, ownername, groupname, accessFlags, lastmodified, filecontent);
1050
1051 return cmsResource;
1052 }
1053
1054
1055 /**
1056 * Writes a resource and its properties to the Cms.<br>
1057 *
1058 * @param resourcename The name of the resource to write.
1059 * @param properties The properties of the resource.
1060 * @param username The name of the new owner of the resource
1061 * @param groupname The name of the new group of the resource
1062 * @param accessFlags The new accessFlags of the resource
1063 * @param resourceType The new type of the resource
1064 * @param filecontent The new filecontent of the resource
1065 *
1066 * @throws CmsException Throws CmsException if operation was not succesful.
1067 */
1068 protected void doWriteResource(String resourcename, Map properties,
1069 String username, String groupname, int accessFlags,
1070 int resourceType, byte[] filecontent)
1071 throws CmsException{
1072 m_rb.writeResource(m_context.currentUser(), m_context.currentProject(), getSiteRoot(resourcename),
1073 properties, username, groupname, accessFlags, resourceType,
1074 filecontent);
1075 }
1076/**
1077 * Creates a new project for task handling.
1078 *
1079 * @param projectname the name of the project
1080 * @param projectType the type of the Project
1081 * @param role a Usergroup for the project
1082 * @param timeout the time when the Project must finished
1083 * @param priority a Priority for the Project
1084 *
1085 * @return a <code>CmsTask</code> object representing the newly created task.
1086 *
1087 * @throws CmsException if operation was not successful.
1088 */
1089public CmsTask createProject(String projectname, int projectType, String roleName, long timeout, int priority) throws CmsException {
1090 return m_rb.createProject(m_context.currentUser(), projectname, projectType, roleName, timeout, priority);
1091}
1092/**
1093 * Creates a new project.
1094 *
1095 * @param name the name of the project to read.
1096 * @param description the description for the new project.
1097 * @param groupname the name of the group to be set.
1098 * @param managergroupname the name of the managergroup to be set.
1099 *
1100 * @throws CmsException if operation was not successful.
1101 */
1102public CmsProject createProject(String name, String description, String groupname, String managergroupname) throws CmsException
1103{
1104 CmsProject newProject = m_rb.createProject(m_context.currentUser(), m_context.currentProject(), name, description, groupname, managergroupname);
1105 return (newProject);
1106}
1107
1108/**
1109 * Creates a new project.
1110 *
1111 * @param name the name of the project to read.
1112 * @param description the description for the new project.
1113 * @param groupname the name of the group to be set.
1114 * @param managergroupname the name of the managergroup to be set.
1115 * @param projecttype the type of the project (normal or temporary)
1116 *
1117 * @throws CmsException if operation was not successful.
1118 */
1119public CmsProject createProject(String name, String description, String groupname, String managergroupname, int projecttype) throws CmsException
1120{
1121 CmsProject newProject = m_rb.createProject(m_context.currentUser(), m_context.currentProject(), name, description, groupname, managergroupname, projecttype);
1122 return (newProject);
1123}
1124
1125/**
1126 * Creates a new project for the temporary files.
1127 *
1128 * @throws CmsException if operation was not successful.
1129 */
1130public CmsProject createTempfileProject() throws CmsException
1131{
1132 CmsProject newProject = m_rb.createTempfileProject(this, m_context.currentUser(), m_context.currentProject());
1133 return (newProject);
1134}
1135
1136/**
1137 * Creates the property-definition for a resource type.
1138 *
1139 * @param name the name of the property-definition to overwrite.
1140 * @param resourcetype the name of the resource-type for the property-definition.
1141 *
1142 * @throws CmsException if operation was not successful.
1143 */
1144public CmsPropertydefinition createPropertydefinition(String name, String resourcetype) throws CmsException {
1145 return (m_rb.createPropertydefinition(m_context.currentUser(), m_context.currentProject(), name, resourcetype));
1146}
1147
1148/**
1149 * Creates a new task.
1150 * <p>
1151 * <B>Security:</B>
1152 * All users can create a new task.
1153 *
1154 * @param projectid the Id of the current project task of the user.
1155 * @param agentname the User who will edit the task.
1156 * @param rolename a Usergroup for the task.
1157 * @param taskname a Name of the task.
1158 * @param tasktype the type of the task.
1159 * @param taskcomment a description of the task.
1160 * @param timeout the time when the task must finished.
1161 * @param priority the Id for the priority of the task.
1162 *
1163 * @return a <code>CmsTask</code> object representing the newly created task.
1164 *
1165 * @throws CmsException Throws CmsException if something goes wrong.
1166 */
1167public CmsTask createTask(int projectid, String agentName, String roleName, String taskname, String taskcomment, int tasktype, long timeout, int priority) throws CmsException {
1168 return m_rb.createTask(m_context.currentUser(), projectid, agentName, roleName, taskname, taskcomment, tasktype, timeout, priority);
1169}
1170/**
1171 * Creates a new task.
1172 * <p>
1173 * <B>Security:</B>
1174 * All users can create a new task.
1175 * @param agent the User who will edit the task.
1176 * @param role a Usergroup for the task.
1177 * @param taskname the name of the task.
1178 * @param taskcomment a description of the task.
1179 * @param timeout the time when the task must finished.
1180 * @param priority the Id for the priority of the task.
1181 *
1182 * @return a <code>CmsTask</code> object representing the newly created task.
1183 *
1184 * @throws CmsException if operation was not successful.
1185 */
1186public CmsTask createTask(String agentName, String roleName, String taskname, String taskcomment, long timeout, int priority) throws CmsException {
1187 return (m_rb.createTask(m_context.currentUser(), m_context.currentProject(), agentName, roleName, taskname, taskcomment, timeout, priority));
1188}
1189/**
1190 * Deletes all properties for a file or folder.
1191 *
1192 * @param resourcename the name of the resource for which all properties should be deleted.
1193 *
1194 * @throws CmsException if operation was not successful.
1195 */
1196public void deleteAllProperties(String resourcename) throws CmsException {
1197 m_rb.deleteAllProperties(m_context.currentUser(), m_context.currentProject(), getSiteRoot(resourcename));
1198}
1199/**
1200 * Deletes a file.
1201 *
1202 * @param filename the complete path of the file.
1203 *
1204 * @throws CmsException if the file couldn't be deleted, or if the user
1205 * has not the appropriate rights to delete the file.
1206 *
1207 * @deprecated Use deleteResource instead.
1208 */
1209public void deleteFile(String filename) throws CmsException {
1210 deleteResource(filename);
1211}
1212/**
1213 * Deletes a folder.
1214 * <br>
1215 * This is a very complex operation, because all sub-resources may be
1216 * deleted too.
1217 *
1218 * @param foldername the complete path of the folder.
1219 *
1220 * @throws CmsException if the folder couldn't be deleted, or if the user
1221 * has not the rights to delete this folder.
1222 *
1223 * @deprecated Use deleteResource instead.
1224 */
1225public void deleteFolder(String foldername) throws CmsException {
1226 deleteResource(foldername);
1227}
1228
1229/**
1230 * Deletes a folder.
1231 * <br>
1232 * This is a very complex operation, because all sub-resources may be
1233 * deleted too.
1234 *
1235 * @param foldername the complete path of the folder.
1236 *
1237 * @throws CmsException if the folder couldn't be deleted, or if the user
1238 * has not the rights to delete this folder.
1239 *
1240 */
1241public void deleteEmptyFolder(String foldername) throws CmsException {
1242 m_rb.deleteFolder(m_context.currentUser(), m_context.currentProject(), getSiteRoot(foldername));
1243}
1244
1245/**
1246 * Deletes a resource.
1247 *
1248 * @param filename the complete path of the file.
1249 *
1250 * @throws CmsException if the file couldn't be deleted, or if the user
1251 * has not the appropriate rights to delete the file.
1252 */
1253public void deleteResource(String filename) throws CmsException {
1254 CmsResource res = readFileHeader(filename);
1255 I_CmsResourceType rt = getResourceType(res.getType());
1256 rt.deleteResource(this, filename);
1257}
1258
1259/**
1260 * Deletes a file.
1261 *
1262 * @param filename the complete path of the file.
1263 *
1264 * @throws CmsException if the file couldn't be deleted, or if the user
1265 * has not the appropriate rights to delete the file.
1266 */
1267protected void doDeleteFile(String filename) throws CmsException {
1268 m_rb.deleteFile(m_context.currentUser(), m_context.currentProject(), getSiteRoot(filename));
1269}
1270
1271/**
1272 * Deletes a folder.
1273 * <br>
1274 * This is a very complex operation, because all sub-resources may be
1275 * deleted too.
1276 *
1277 * @param foldername the complete path of the folder.
1278 *
1279 * @throws CmsException if the folder couldn't be deleted, or if the user
1280 * has not the rights to delete this folder.
1281 */
1282protected void doDeleteFolder(String foldername) throws CmsException {
1283 m_rb.deleteFolder(m_context.currentUser(), m_context.currentProject(), getSiteRoot(foldername));
1284}
1285
1286/**
1287 * Undeletes a resource.
1288 *
1289 * @param filename the complete path of the file.
1290 *
1291 * @throws CmsException if the file couldn't be undeleted, or if the user
1292 * has not the appropriate rights to undelete the file.
1293 */
1294public void undeleteResource(String filename) throws CmsException {
1295 //read the file header including deleted
1296 CmsResource res = m_rb.readFileHeader(m_context.currentUser(), m_context.currentProject(), getSiteRoot(filename), true);
1297 I_CmsResourceType rt = getResourceType(res.getType());
1298 rt.undeleteResource(this, filename);
1299}
1300
1301/**
1302 * Undeletes a file.
1303 *
1304 * @param filename the complete path of the file.
1305 *
1306 * @throws CmsException if the file couldn't be undeleted, or if the user
1307 * has not the appropriate rights to undelete the file.
1308 */
1309protected void doUndeleteFile(String filename) throws CmsException {
1310 m_rb.undeleteResource(m_context.currentUser(), m_context.currentProject(), getSiteRoot(filename));
1311}
1312
1313/**
1314 * Undeletes a folder.
1315 * <br>
1316 * This is a very complex operation, because all sub-resources may be
1317 * undeleted too.
1318 *
1319 * @param foldername the complete path of the folder.
1320 *
1321 * @throws CmsException if the folder couldn't be undeleted, or if the user
1322 * has not the rights to undelete this folder.
1323 */
1324protected void doUndeleteFolder(String foldername) throws CmsException {
1325 m_rb.undeleteResource(m_context.currentUser(), m_context.currentProject(), getSiteRoot(foldername));
1326}
1327
1328/**
1329 * Deletes a group.
1330 * <p>
1331 * <b>Security:</b>
1332 * Only the admin user is allowed to delete a group.
1333 *
1334 * @param delgroup the name of the group.
1335 * @throws CmsException if operation was not successful.
1336 */
1337public void deleteGroup(String delgroup) throws CmsException {
1338 m_rb.deleteGroup(m_context.currentUser(), m_context.currentProject(), delgroup);
1339}
1340/**
1341 * Deletes a project.
1342 *
1343 * @param id the id of the project.
1344 *
1345 * @throws CmsException if operation was not successful.
1346 */
1347public void deleteProject(int id) throws CmsException {
1348 m_rb.deleteProject(m_context.currentUser(), m_context.currentProject(), id);
1349}
1350/**
1351 * Deletes a property for a file or folder.
1352 *
1353 * @param resourcename the name of a resource for which the property should be deleted.
1354 * @param property the name of the property.
1355 *
1356 * @throws CmsException Throws if operation was not successful.
1357 */
1358public void deleteProperty(String resourcename, String property) throws CmsException {
1359 m_rb.deleteProperty(m_context.currentUser(), m_context.currentProject(), getSiteRoot(resourcename), property);
1360}
1361/**
1362 * Deletes the property-definition for a resource type.
1363 *
1364 * @param name the name of the property-definition to delete.
1365 * @param resourcetype the name of the resource-type for the property-definition.
1366 *
1367 * @throws CmsException if operation was not successful.
1368 */
1369public void deletePropertydefinition(String name, String resourcetype) throws CmsException {
1370 m_rb.deletePropertydefinition(m_context.currentUser(), m_context.currentProject(), name, resourcetype);
1371}
1372/**
1373 * Deletes a user from the Cms.
1374 * <p>
1375 * <b>Security:</b>
1376 * Only a admin user is allowed to delete a user.
1377 *
1378 * @param name the Id of the user to be deleted.
1379 *
1380 * @throws CmsException if operation was not successful.
1381 */
1382public void deleteUser(int userId) throws CmsException {
1383 m_rb.deleteUser(m_context.currentUser(), m_context.currentProject(), userId);
1384}
1385/**
1386 * Deletes a user from the Cms.
1387 * <p>
1388 * <b>Security:</b>
1389 * Only a admin user is allowed to delete a user.
1390 *
1391 * @param name the name of the user to be deleted.
1392 *
1393 * @throws CmsException if operation was not successful.
1394 */
1395public void deleteUser(String username) throws CmsException {
1396 m_rb.deleteUser(m_context.currentUser(), m_context.currentProject(), username);
1397}
1398/**
1399 * Deletes a web user from the Cms.
1400 *
1401 * @param name the id of the user to be deleted.
1402 *
1403 * @throws CmsException if operation was not successful.
1404 */
1405public void deleteWebUser(int userId) throws CmsException {
1406 m_rb.deleteWebUser(m_context.currentUser(), m_context.currentProject(), userId);
1407}
1408/**
1409 * Destroys the resource borker and required modules and connections.
1410 * @throws CmsException if operation was not successful.
1411 */
1412public void destroy() throws CmsException {
1413 m_rb.destroy();
1414}
1415/**
1416 * Ends a task of the Cms.
1417 *
1418 * @param taskid the ID of the task to end.
1419 *
1420 * @throws CmsException if operation was not successful.
1421 */
1422public void endTask(int taskid) throws CmsException {
1423 m_rb.endTask(m_context.currentUser(), m_context.currentProject(), taskid);
1424}
1425/**
1426 * Exports cms-resources to a zip-file.
1427 *
1428 * @param exportFile the name (absolute Path) of the export resource (zip-file).
1429 * @param exportPath the name (absolute Path) of folder from which should be exported.
1430 *
1431 * @throws CmsException if operation was not successful.
1432 */
1433public void exportResources(String exportFile, String[] exportPaths) throws CmsException {
1434 // export the resources
1435 m_rb.exportResources(m_context.currentUser(), m_context.currentProject(), exportFile, exportPaths, this);
1436}
1437/**
1438 * Exports cms-resources to a zip-file.
1439 *
1440 * @param exportFile the name (absolute Path) of the export resource (zip-file).
1441 * @param exportPath the name (absolute Path) of folder from which should be exported.
1442 * @param includeSystem indicates if the system resources will be included in the export.
1443 * @param excludeUnchanged <code>true</code>, if unchanged files should be excluded.
1444 *
1445 * @throws CmsException if operation was not successful.
1446 */
1447public void exportResources(String exportFile, String[] exportPaths, boolean includeSystem, boolean excludeUnchanged) throws CmsException {
1448 // export the resources
1449 m_rb.exportResources(m_context.currentUser(), m_context.currentProject(), exportFile, exportPaths, this, includeSystem, excludeUnchanged);
1450}
1451
1452/**
1453 * Exports cms-resources to a zip-file.
1454 *
1455 * @param exportFile the name (absolute Path) of the export resource (zip-file).
1456 * @param exportPath the name (absolute Path) of folder from which should be exported.
1457 * @param includeSystem indicates if the system resources will be included in the export.
1458 * @param excludeUnchanged <code>true</code>, if unchanged files should be excluded.
1459 * @param report the cmsReport to handle the log messages.
1460 *
1461 * @throws CmsException if operation was not successful.
1462 */
1463public void exportResources(String exportFile, String[] exportPaths, boolean includeSystem, boolean excludeUnchanged, boolean exportUserdata, long contentAge, I_CmsReport report) throws CmsException {
1464 // export the resources
1465 m_rb.exportRes