KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > db > I_CmsVfsDriver


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

31
32 package org.opencms.db;
33
34 import org.opencms.db.generic.CmsSqlManager;
35 import org.opencms.file.CmsDataAccessException;
36 import org.opencms.file.CmsFile;
37 import org.opencms.file.CmsFolder;
38 import org.opencms.file.CmsProject;
39 import org.opencms.file.CmsProperty;
40 import org.opencms.file.CmsPropertyDefinition;
41 import org.opencms.file.CmsResource;
42 import org.opencms.util.CmsUUID;
43
44 import java.sql.ResultSet JavaDoc;
45 import java.sql.SQLException JavaDoc;
46 import java.util.List JavaDoc;
47
48 /**
49  * Definitions of all required VFS driver methods.<p>
50  *
51  * @author Thomas Weckert
52  * @author Michael Emmerich
53  *
54  * @version $Revision: 1.114 $
55  *
56  * @since 6.0.0
57  */

58 public interface I_CmsVfsDriver {
59
60     /** The type ID to identify user driver implementations. */
61     int DRIVER_TYPE_ID = 3;
62
63     /**
64      * Creates a resource content with the specified id.<p>
65      *
66      * @param dbc the current database context
67      * @param project the current project
68      * @param resourceId the resource id to create the content for
69      * @param content the content to write
70      * @param versionId for the content of a backup file you need to insert the versionId of the backup
71      *
72      * @throws CmsDataAccessException if something goes wrong
73      */

74     void createContent(CmsDbContext dbc, CmsProject project, CmsUUID resourceId, byte[] content, int versionId)
75     throws CmsDataAccessException;
76
77     /**
78      * Creates a CmsFile instance from a JDBC ResultSet.<p>
79      *
80      * @param res the JDBC ResultSet
81      * @param projectId the project id
82      *
83      * @return the created file
84      * @throws SQLException in case the result set does not include a requested table attribute
85      */

86     CmsFile createFile(ResultSet JavaDoc res, int projectId) throws SQLException JavaDoc;
87
88     /**
89      * Creates a CmsFile instance from a JDBC ResultSet.<p>
90      *
91      * @param res the JDBC ResultSet
92      * @param projectId the project id
93      * @param hasFileContentInResultSet flag to include the file content
94      *
95      * @return the created file
96      * @throws SQLException in case the result set does not include a requested table attribute
97      */

98     CmsFile createFile(ResultSet JavaDoc res, int projectId, boolean hasFileContentInResultSet) throws SQLException JavaDoc;
99
100     /**
101      * Creates a CmsFolder instance from a JDBC ResultSet.<p>
102      *
103      * @param res the JDBC ResultSet
104      * @param projectId the ID of the current project
105      * @param hasProjectIdInResultSet true if the SQL select query includes the PROJECT_ID table attribute
106      *
107      * @return the created folder
108      * @throws SQLException in case the result set does not include a requested table attribute
109      */

110     CmsFolder createFolder(ResultSet JavaDoc res, int projectId, boolean hasProjectIdInResultSet) throws SQLException JavaDoc;
111
112     /**
113      * Creates a new property defintion in the database.<p>
114      *
115      * @param dbc the current database context
116      * @param projectId the project in which the propertydefinition is created
117      * @param name the name of the propertydefinitions to overwrite
118      *
119      * @return the new propertydefinition
120      *
121      * @throws CmsDataAccessException if something goes wrong
122      */

123     CmsPropertyDefinition createPropertyDefinition(CmsDbContext dbc, int projectId, String JavaDoc name)
124     throws CmsDataAccessException;
125
126     /**
127      * Creates a new resource from a given CmsResource object.<p>
128      *
129      * This method works for both files and folders. Existing resources get overwritten.<p>
130      *
131      * @param dbc the current database context
132      * @param project the current project
133      * @param resource the resource to be created
134      * @param content the file content, or null in case of a folder
135      * @return the created Cms resource
136      *
137      * @throws CmsDataAccessException if somethong goes wrong
138      *
139      * @see org.opencms.file.types.I_CmsResourceType#createResource(org.opencms.file.CmsObject, CmsSecurityManager, String, byte[], List)
140      * @see org.opencms.file.types.I_CmsResourceType#importResource(org.opencms.file.CmsObject, CmsSecurityManager, String, CmsResource, byte[], List)
141      * @see org.opencms.file.CmsObject#createResource(String, int, byte[], List)
142      * @see org.opencms.file.CmsObject#importResource(String, CmsResource, byte[], List)
143      */

144     CmsResource createResource(CmsDbContext dbc, CmsProject project, CmsResource resource, byte[] content)
145     throws CmsDataAccessException;
146
147     /**
148      * Creates a CmsResource instance from a JDBC ResultSet.<p>
149      *
150      * @param res the JDBC ResultSet
151      * @param projectId the ID of the current project to adjust the modification date in case the resource is a VFS link
152      *
153      * @return the created resource
154      * @throws SQLException in case the result set does not include a requested table attribute
155      */

156     CmsResource createResource(ResultSet JavaDoc res, int projectId) throws SQLException JavaDoc;
157
158     /**
159      * Creates a new sibling for a specified resource.<p>
160      * @param dbc the current database context
161      * @param project the project where to create the link
162      * @param resource the link prototype
163      *
164      * @throws CmsDataAccessException if something goes wrong
165      */

166     void createSibling(CmsDbContext dbc, CmsProject project, CmsResource resource) throws CmsDataAccessException;
167
168     /**
169      * Deletes a property defintion.<p>
170      *
171      * @param dbc the current database context
172      * @param name the property definitions to be deleted
173      *
174      * @throws CmsDataAccessException if something goes wrong
175      */

176     void deletePropertyDefinition(CmsDbContext dbc, CmsPropertyDefinition name) throws CmsDataAccessException;
177
178     /**
179      * Deletes all property values of a file or folder.<p>
180      *
181      * You may specify which whether just structure or resource property values should
182      * be deleted, or both of them.<p>
183      *
184      * @param dbc the current database context
185      * @param projectId the id of the project
186      * @param resource the resource
187      * @param deleteOption determines which property values should be deleted
188      *
189      * @throws CmsDataAccessException if something goes wrong
190      * @see org.opencms.file.CmsProperty#DELETE_OPTION_DELETE_STRUCTURE_AND_RESOURCE_VALUES
191      * @see org.opencms.file.CmsProperty#DELETE_OPTION_DELETE_STRUCTURE_VALUES
192      * @see org.opencms.file.CmsProperty#DELETE_OPTION_DELETE_RESOURCE_VALUES
193      */

194     void deletePropertyObjects(CmsDbContext dbc, int projectId, CmsResource resource, int deleteOption)
195     throws CmsDataAccessException;
196
197     /**
198      * Destroys this driver.<p>
199      *
200      * @throws Throwable if something goes wrong
201      */

202     void destroy() throws Throwable JavaDoc;
203
204     /**
205      * Returns the SqlManager of this driver.<p>
206      *
207      * @return the SqlManager of this driver
208      */

209     CmsSqlManager getSqlManager();
210
211     /**
212      * Initializes the SQL manager for this driver.<p>
213      *
214      * To obtain JDBC connections from different pools, further
215      * {online|offline|backup} pool Urls have to be specified.<p>
216      *
217      * @param classname the classname of the SQL manager
218      *
219      * @return the SQL manager for this driver
220      */

221     org.opencms.db.generic.CmsSqlManager initSqlManager(String JavaDoc classname);
222
223     /**
224      * Publishes the structure and resource records of an
225      * offline resource into it's online counterpart.<p>
226      *
227      * @param dbc the current database context
228      * @param onlineProject the online project
229      * @param onlineResource the online resource
230      * @param offlineResource the offline resource
231      * @param writeFileContent true, if also the content record of the specified offline resource should be written to the online table; false otherwise
232      *
233      * @throws CmsDataAccessException if somethong goes wrong
234      */

235     void publishResource(
236         CmsDbContext dbc,
237         CmsProject onlineProject,
238         CmsResource onlineResource,
239         CmsResource offlineResource,
240         boolean writeFileContent) throws CmsDataAccessException;
241
242     /**
243      * Reads all child-files and/or child-folders of a specified parent resource.<p>
244      *
245      * @param dbc the current database context
246      * @param currentProject the current project
247      * @param resource the parent folder
248      * @param getFolders if true the child folders of the parent folder are returned in the result set
249      * @param getFiles if true the child files of the parent folder are returned in the result set
250      *
251      * @return a list of all sub folders or sub files
252      * @throws CmsDataAccessException if something goes wrong
253      */

254     List JavaDoc readChildResources(
255         CmsDbContext dbc,
256         CmsProject currentProject,
257         CmsResource resource,
258         boolean getFolders,
259         boolean getFiles) throws CmsDataAccessException;
260
261     /**
262      * Reads a file specified by it's structure ID.<p>
263      *
264      * @param dbc the current database context
265      * @param projectId the ID of the current project
266      * @param includeDeleted true if should be read even if it's state is deleted
267      * @param structureId the id of the file
268      *
269      * @return the file that was read
270      * @throws CmsDataAccessException if something goes wrong
271      */

272     CmsFile readFile(CmsDbContext dbc, int projectId, boolean includeDeleted, CmsUUID structureId)
273     throws CmsDataAccessException;
274
275     /**
276      * Reads a folder specified by it's structure ID.<p>
277      *
278      * @param dbc the current database context
279      * @param projectId the project in which the resource will be used
280      * @param folderId the id of the folder to be read
281      *
282      * @return the read folder
283      * @throws CmsDataAccessException if something goes wrong
284      */

285     CmsFolder readFolder(CmsDbContext dbc, int projectId, CmsUUID folderId) throws CmsDataAccessException;
286
287     /**
288      * Reads a folder specified by it's resource name.<p>
289      *
290      * @param dbc the current database context
291      * @param projectId the project in which the resource will be used
292      * @param foldername the name of the folder to be read
293      *
294      * @return the read folder
295      * @throws CmsDataAccessException if something goes wrong
296      */

297     CmsFolder readFolder(CmsDbContext dbc, int projectId, String JavaDoc foldername) throws CmsDataAccessException;
298
299     /**
300      * Reads a property definition for the soecified resource type.<p>
301      *
302      * If no property definition with the given name is found,
303      * <code>null</code> is returned.<p>
304      *
305      * @param dbc the current database context
306      * @param name the name of the propertydefinition to read
307      * @param projectId the id of the project
308      *
309      * @return the property definition that was read,
310      * or <code>null</code> if there is no property definition with the given name.
311      *
312      * @throws CmsDataAccessException if something goes wrong
313      */

314     CmsPropertyDefinition readPropertyDefinition(CmsDbContext dbc, String JavaDoc name, int projectId)
315     throws CmsDataAccessException;
316
317     /**
318      * Reads all property definitions for the specified mapping type.<p>
319      *
320      * @param dbc the current database context
321      * @param projectId the id of the project
322      *
323      * @return a list with the <code>{@link CmsPropertyDefinition}</code> objects (may be empty)
324      *
325      * @throws CmsDataAccessException if something goes wrong
326      */

327     List JavaDoc readPropertyDefinitions(CmsDbContext dbc, int projectId) throws CmsDataAccessException;
328
329     /**
330      * Reads a property object from the database specified by it's key name mapped to a resource.<p>
331      *
332      * The implementation must return {@link CmsProperty#getNullProperty()} if the property is not found.<p>
333      *
334      * @param dbc the current database context
335      * @param key the key of the property
336      * @param project the current project
337      * @param resource the resource where the property is attached to
338      *
339      * @return a CmsProperty object containing both the structure and resource value of the property
340      * @throws CmsDataAccessException if something goes wrong
341      */

342     CmsProperty readPropertyObject(CmsDbContext dbc, String JavaDoc key, CmsProject project, CmsResource resource)
343     throws CmsDataAccessException;
344
345     /**
346      * Reads all property objects mapped to a specified resource from the database.<p>
347      *
348      * The implementation must return an empty list if no properties are found at all.<p>
349      *
350      * @param dbc the current database context
351      * @param project the current project
352      * @param resource the resource where the property is attached to
353      *
354      * @return a list with CmsProperty objects containing both the structure and resource value of the property
355      * @throws CmsDataAccessException if something goes wrong
356      */

357     List JavaDoc readPropertyObjects(CmsDbContext dbc, CmsProject project, CmsResource resource) throws CmsDataAccessException;
358
359     /**
360      * Reads a resource specified by it's structure ID.<p>
361      *
362      * @param dbc the current database context
363      * @param projectId the Id of the project
364      * @param structureId the Id of the resource
365      * @param includeDeleted true if already deleted files are included
366      *
367      * @return the resource that was read
368      * @throws CmsDataAccessException if something goes wrong
369      */

370     CmsResource readResource(CmsDbContext dbc, int projectId, CmsUUID structureId, boolean includeDeleted)
371     throws CmsDataAccessException;
372
373     /**
374      * Reads a resource specified by it's resource name.<p>
375      *
376      * @param dbc the current database context
377      * @param projectId the Id of the project in which the resource will be used
378      * @param filename the name of the file
379      * @param includeDeleted true if already deleted files are included
380      *
381      * @return the resource that was read
382      * @throws CmsDataAccessException if something goes wrong
383      */

384     CmsResource readResource(CmsDbContext dbc, int projectId, String JavaDoc filename, boolean includeDeleted)
385     throws CmsDataAccessException;
386
387     /**
388      * Reads all resources inside a given project and with a given state.<p>
389      *
390      * @param dbc the current database context
391      * @param currentProject the current project
392      * @param state the state to match
393      * @param mode flag signaling the read mode
394      *
395      * @return a list with all resources that where read
396      * @throws CmsDataAccessException if somethong goes wrong
397      */

398     List JavaDoc readResources(CmsDbContext dbc, int currentProject, int state, int mode) throws CmsDataAccessException;
399
400     /**
401      * Returns all resources associated to a given principal via an ACE.<p>
402      *
403      * @param dbc the current database context
404      * @param project the to read the entries from
405      * @param principalId the id of the principal
406
407      * @return a list of <code>{@link org.opencms.file.CmsResource}</code> objects
408      *
409      * @throws CmsDataAccessException if something goes wrong
410      */

411     List JavaDoc readResourcesForPrincipalACE(CmsDbContext dbc, CmsProject project, CmsUUID principalId)
412     throws CmsDataAccessException;
413
414     /**
415      * Returns all resources associated to a given principal through some of following attributes.<p>
416      *
417      * <ul>
418      * <li>User Created</li>
419      * <li>User Last Modified</li>
420      * </ul><p>
421      *
422      * @param dbc the current database context
423      * @param project the to read the entries from
424      * @param principalId the id of the principal
425
426      * @return a list of <code>{@link org.opencms.file.CmsResource}</code> objects
427      *
428      * @throws CmsDataAccessException if something goes wrong
429      */

430     List JavaDoc readResourcesForPrincipalAttr(CmsDbContext dbc, CmsProject project, CmsUUID principalId)
431     throws CmsDataAccessException;
432
433     /**
434      * Reads all resources that have a value set for the specified property (definition), in the given path.<p>
435      *
436      * Both individual and shared properties of a resource are checked.<p>
437      *
438      * @param dbc the current database context
439      * @param projectId the id of the project
440      * @param propertyDefinition the id of the property definition
441      * @param path the folder to get the resources with the property from
442      *
443      * @return a list of all <code>{@link CmsResource}</code> objects
444      * that have a value set for the specified property.
445      *
446      * @throws CmsDataAccessException if something goes wrong
447      */

448     List JavaDoc readResourcesWithProperty(CmsDbContext dbc, int projectId, CmsUUID propertyDefinition, String JavaDoc path)
449     throws CmsDataAccessException;
450
451     /**
452      * Reads all resources that have a value (containing the specified value)
453      * set for the specified property (definition), in the given path.<p>
454      *
455      * Both individual and shared properties of a resource are checked.<p>
456      *
457      * @param dbc the current database context
458      * @param projectId the id of the project
459      * @param propertyDefinition the id of the property definition
460      * @param path the folder to get the resources with the property from
461      * @param value the string to search in the value of the property
462      *
463      * @return a list of all <code>{@link CmsResource}</code> objects
464      * that have a value set for the specified property.
465      *
466      * @throws CmsDataAccessException if something goes wrong
467      */

468     List JavaDoc readResourcesWithProperty(
469         CmsDbContext dbc,
470         int projectId,
471         CmsUUID propertyDefinition,
472         String JavaDoc path,
473         String JavaDoc value) throws CmsDataAccessException;
474
475     /**
476      * Reads all resources inside a given project matching the criteria specified by parameter values.<p>
477      *
478      * Important: If C_READMODE_EXCLUDE_TREE is true (or C_READMODE_INCLUDE_TREE is false),
479      * the provided parent String must be the UUID of the parent folder, NOT the parent folder path.<p>
480      *
481      * @param dbc the current database context
482      * @param projectId the project id for matching resources or C_READ_OFFLINE_PROJECTS
483      * @param parent the path to the resource used as root of the searched subtree or READ_IGNORE_PARENT (C_READMODE_EXCLUDE_TREE means to read immidiate children only)
484      * @param type the resource type of matching resources or C_READ_IGNORE_TYPES (meaning inverted by C_READMODE_EXCLUDE_TYPE)
485      * @param state the state of matching resources or READ_IGNORE_STATE (meaning inverted by C_READMODE_EXCLUDE_STATE)
486      * @param startTime the start of the time range for the last modification date of matching resources or READ_IGNORE_TIME
487      * @param endTime the end of the time range for the last modification date of matching resources or READ_IGNORE_TIME
488      * @param releasedAfter the start of the time range for the release date of matching resources
489      * @param releasedBefore the end of the time range for the release date of matching resources
490      * @param expiredAfter the start of the time range for the expire date of matching resources
491      * @param expiredBefore the end of the time range for the expire date of matching resources
492      * @param mode additional mode flags:
493      * C_READMODE_INCLUDE_TREE
494      * C_READMODE_EXCLUDE_TREE
495      * C_READMODE_INCLUDE_PROJECT
496      * C_READMODE_EXCLUDE_TYPE
497      * C_READMODE_EXCLUDE_STATE
498      *
499      * @return a list of CmsResource objects matching the given criteria
500      * @throws CmsDataAccessException if somethong goes wrong
501      */

502     List JavaDoc readResourceTree(
503         CmsDbContext dbc,
504         int projectId,
505         String JavaDoc parent,
506         int type,
507         int state,
508         long startTime,
509         long endTime,
510         long releasedAfter,
511         long releasedBefore,
512         long expiredAfter,
513         long expiredBefore,
514         int mode) throws CmsDataAccessException;
515     
516     /**
517      * Reads all siblings that point to the resource record of a specified resource.<p>
518      *
519      * @param dbc the current database context
520      * @param currentProject the current project
521      * @param resource the specified resource
522      * @param includeDeleted <code>true</code> if deleted siblings should be included in the result list
523      *
524      * @return a list of <code>{@link CmsResource}</code>s that
525      * are siblings to the specified resource,
526      * including the specified resource itself.
527      *
528      * @throws CmsDataAccessException if something goes wrong
529      */

530     List JavaDoc readSiblings(CmsDbContext dbc, CmsProject currentProject, CmsResource resource, boolean includeDeleted)
531     throws CmsDataAccessException;
532
533     /**
534      * Removes a file physically in the database.<p>
535      *
536      * @param dbc the current database context
537      * @param currentProject the current project
538      * @param resource the resource
539      * @param removeFileContent if true, the content record is also removed; if false, only the structure/resource records are removed
540      *
541      * @throws CmsDataAccessException if something goes wrong
542      */

543     void removeFile(CmsDbContext dbc, CmsProject currentProject, CmsResource resource, boolean removeFileContent)
544     throws CmsDataAccessException;
545
546     /**
547      * Removes a folder physically in the database.<p>
548      *
549      * @param dbc the current database context
550      * @param currentProject the current project
551      * @param resource the folder
552      *
553      * @throws CmsDataAccessException if something goes wrong
554      */

555     void removeFolder(CmsDbContext dbc, CmsProject currentProject, CmsResource resource) throws CmsDataAccessException;
556
557     /**
558      * Replaces the content and properties of an existing resource.<p>
559      * @param dbc the current database context
560      * @param newResource the new resource
561      * @param newResourceContent the new content
562      * @param newResourceType the resource type
563      *
564      * @throws CmsDataAccessException if something goes wrong
565      */

566     void replaceResource(CmsDbContext dbc, CmsResource newResource, byte[] newResourceContent, int newResourceType)
567     throws CmsDataAccessException;
568
569     /**
570      * Transfers the attributes of a resource from to the given users.<p>
571      *
572      * @param dbc the current database context
573      * @param project the current project
574      * @param resource the resource to modify
575      * @param createdUser the id of the user to be set as the creator of the resource
576      * @param lastModifiedUser the id of the user to be set as the las modificator of the resource
577      *
578      * @throws CmsDataAccessException if something goes wrong
579      */

580     void transferResource(
581         CmsDbContext dbc,
582         CmsProject project,
583         CmsResource resource,
584         CmsUUID createdUser,
585         CmsUUID lastModifiedUser) throws CmsDataAccessException;
586
587     /**
588      * Validates if the specified resource ID in the tables of the specified project {offline|online} exists.<p>
589      *
590      * @param dbc the current database context
591      * @param projectId the project id
592      * @param resourceId the resource id to test for
593      *
594      * @return true if a resource with the given id was found, false otherweise
595      * @throws CmsDataAccessException if something goes wrong
596      */

597     boolean validateResourceIdExists(CmsDbContext dbc, int projectId, CmsUUID resourceId) throws CmsDataAccessException;
598
599     /**
600      * Validates if the specified structure ID in the tables of the specified project {offline|online} exists.<p>
601      *
602      * @param dbc the current database context
603      * @param projectId the ID of current project
604      * @param structureId the structure id
605      *
606      * @return true, if the specified structure ID in the tables of the specified project {offline|online} exists
607      * @throws CmsDataAccessException if something goes wrong
608      */

609     boolean validateStructureIdExists(CmsDbContext dbc, int projectId, CmsUUID structureId)
610     throws CmsDataAccessException;
611
612     /**
613      * Writes the resource content with the specified content id.<p>
614      *
615      * @param dbc the current database context
616      * @param project the current project
617      * @param resourceId the id of the resource used to identify the content to update
618      * @param content the new content of the file
619      *
620      * @throws CmsDataAccessException if something goes wrong
621      */

622     void writeContent(CmsDbContext dbc, CmsProject project, CmsUUID resourceId, byte[] content)
623     throws CmsDataAccessException;
624
625     /**
626      * Writes the "last-modified-in-project" ID of a resource.<p>
627      *
628      * @param dbc the current database context
629      * @param project the resource record is updated with the ID of this project
630      * @param projectId the project id to write into the reource
631      * @param resource the resource that gets updated
632      *
633      * @throws CmsDataAccessException if something goes wrong
634      */

635     void writeLastModifiedProjectId(CmsDbContext dbc, CmsProject project, int projectId, CmsResource resource)
636     throws CmsDataAccessException;
637
638     /**
639      * Writes a property object to the database mapped to a specified resource.<p>
640      *
641      * @param dbc the current database context
642      * @param project the current project
643      * @param resource the resource where the property should be attached to
644      * @param property a CmsProperty object containing both the structure and resource value of the property
645      *
646      * @throws CmsDataAccessException if something goes wrong
647      */

648     void writePropertyObject(CmsDbContext dbc, CmsProject project, CmsResource resource, CmsProperty property)
649     throws CmsDataAccessException;
650
651     /**
652      * Writes a list of property objects to the database mapped to a specified resource.<p>
653      *
654      * @param dbc the current database context
655      * @param project the current project
656      * @param resource the resource where the property should be attached to
657      * @param properties a list of CmsProperty objects
658      *
659      * @throws CmsDataAccessException if something goes wrong
660      */

661     void writePropertyObjects(CmsDbContext dbc, CmsProject project, CmsResource resource, List JavaDoc properties)
662     throws CmsDataAccessException;
663
664     /**
665      * Writes the structure and/or resource record(s) of an existing file.<p>
666      *
667      * Common usages of this method are saving the resource information
668      * after creating, importing or restoring complete files
669      * where all file header attribs are changed. Both the structure and resource
670      * records get written. Thus, using this method affects all siblings of
671      * a resource! Use {@link #writeResourceState(CmsDbContext, CmsProject, CmsResource, int)}
672      * instead if you just want to update the file state, e.g. of a single sibling.<p>
673      *
674      * The file state is set to "changed", unless the current state is "new"
675      * or "deleted". The "changed" argument allows to choose whether the structure
676      * or resource state, or none of them, is set to "changed".<p>
677      *
678      * The rating of the file state values is as follows:<br>
679      * unchanged &lt; changed &lt; new &lt; deleted<p>
680      *
681      * Second, the "state" of the resource is the structure state, if the structure state
682      * has a higher file state value than the resource state. Otherwise the file state is
683      * the resource state.<p>
684      *
685      * @param dbc the current database context
686      * @param project the current project
687      * @param resource the resource to be updated
688      * @param changed determines whether the structure or resource state, or none of them, is set to "changed"
689      *
690      * @throws CmsDataAccessException if something goes wrong
691      *
692      * @see org.opencms.db.CmsDriverManager#UPDATE_RESOURCE_STATE
693      * @see org.opencms.db.CmsDriverManager#UPDATE_STRUCTURE_STATE
694      * @see org.opencms.db.CmsDriverManager#NOTHING_CHANGED
695      * @see #writeResourceState(CmsDbContext, CmsProject, CmsResource, int)
696      */

697     void writeResource(CmsDbContext dbc, CmsProject project, CmsResource resource, int changed)
698     throws CmsDataAccessException;
699
700     /**
701      * Writes file state in either the structure or resource record, or both of them.<p>
702      *
703      * This method allows to change the resource state to any state by setting the
704      * desired state value in the specified CmsResource instance.<p>
705      *
706      * This method is frequently used while resources are published to set the file state
707      * back to "unchanged".<p>
708      *
709      * Only file state attribs. get updated here. Use {@link #writeResource(CmsDbContext, CmsProject, CmsResource, int)}
710      * instead to write the complete file header.<p>
711      *
712      * Please refer to the javadoc of {@link #writeResource(CmsDbContext, CmsProject, CmsResource, int)} to read
713      * how setting resource state values affects the file state.<p>
714      *
715      * @param dbc the current database context
716      * @param project the current project
717      * @param resource the resource to be updated
718      * @param changed determines whether the structure or resource state, or none of them, is set to "changed"
719      *
720      * @throws CmsDataAccessException if somethong goes wrong
721      *
722      * @see org.opencms.db.CmsDriverManager#UPDATE_RESOURCE_STATE
723      * @see org.opencms.db.CmsDriverManager#UPDATE_STRUCTURE_STATE
724      * @see org.opencms.db.CmsDriverManager#UPDATE_ALL
725      */

726     void writeResourceState(CmsDbContext dbc, CmsProject project, CmsResource resource, int changed)
727     throws CmsDataAccessException;
728 }
Popular Tags