org.opencms.db
Interface I_CmsVfsDriver

All Known Implementing Classes:
CmsVfsDriver

public interface I_CmsVfsDriver

Definitions of all required VFS driver methods.

Since:
6.0.0
Version:
$Revision: 1.114 $
Author:
Thomas Weckert, Michael Emmerich

Field Summary
static int DRIVER_TYPE_ID
          The type ID to identify user driver implementations.
 
Method Summary
 void createContent(CmsDbContext dbc, CmsProject project, CmsUUID resourceId, byte[] content, int versionId)
          Creates a resource content with the specified id.
 CmsFile createFile(java.sql.ResultSet res, int projectId)
          Creates a CmsFile instance from a JDBC ResultSet.
 CmsFile createFile(java.sql.ResultSet res, int projectId, boolean hasFileContentInResultSet)
          Creates a CmsFile instance from a JDBC ResultSet.
 CmsFolder createFolder(java.sql.ResultSet res, int projectId, boolean hasProjectIdInResultSet)
          Creates a CmsFolder instance from a JDBC ResultSet.
 CmsPropertyDefinition createPropertyDefinition(CmsDbContext dbc, int projectId, java.lang.String name)
          Creates a new property defintion in the database.
 CmsResource createResource(CmsDbContext dbc, CmsProject project, CmsResource resource, byte[] content)
          Creates a new resource from a given CmsResource object.
 CmsResource createResource(java.sql.ResultSet res, int projectId)
          Creates a CmsResource instance from a JDBC ResultSet.
 void createSibling(CmsDbContext dbc, CmsProject project, CmsResource resource)
          Creates a new sibling for a specified resource.
 void deletePropertyDefinition(CmsDbContext dbc, CmsPropertyDefinition name)
          Deletes a property defintion.
 void deletePropertyObjects(CmsDbContext dbc, int projectId, CmsResource resource, int deleteOption)
          Deletes all property values of a file or folder.
 void destroy()
          Destroys this driver.
 CmsSqlManager getSqlManager()
          Returns the SqlManager of this driver.
 CmsSqlManager initSqlManager(java.lang.String classname)
          Initializes the SQL manager for this driver.
 void publishResource(CmsDbContext dbc, CmsProject onlineProject, CmsResource onlineResource, CmsResource offlineResource, boolean writeFileContent)
          Publishes the structure and resource records of an offline resource into it's online counterpart.
 java.util.List readChildResources(CmsDbContext dbc, CmsProject currentProject, CmsResource resource, boolean getFolders, boolean getFiles)
          Reads all child-files and/or child-folders of a specified parent resource.
 CmsFile readFile(CmsDbContext dbc, int projectId, boolean includeDeleted, CmsUUID structureId)
          Reads a file specified by it's structure ID.
 CmsFolder readFolder(CmsDbContext dbc, int projectId, CmsUUID folderId)
          Reads a folder specified by it's structure ID.
 CmsFolder readFolder(CmsDbContext dbc, int projectId, java.lang.String foldername)
          Reads a folder specified by it's resource name.
 CmsPropertyDefinition readPropertyDefinition(CmsDbContext dbc, java.lang.String name, int projectId)
          Reads a property definition for the soecified resource type.
 java.util.List readPropertyDefinitions(CmsDbContext dbc, int projectId)
          Reads all property definitions for the specified mapping type.
 CmsProperty readPropertyObject(CmsDbContext dbc, java.lang.String key, CmsProject project, CmsResource resource)
          Reads a property object from the database specified by it's key name mapped to a resource.
 java.util.List readPropertyObjects(CmsDbContext dbc, CmsProject project, CmsResource resource)
          Reads all property objects mapped to a specified resource from the database.
 CmsResource readResource(CmsDbContext dbc, int projectId, CmsUUID structureId, boolean includeDeleted)
          Reads a resource specified by it's structure ID.
 CmsResource readResource(CmsDbContext dbc, int projectId, java.lang.String filename, boolean includeDeleted)
          Reads a resource specified by it's resource name.
 java.util.List readResources(CmsDbContext dbc, int currentProject, int state, int mode)
          Reads all resources inside a given project and with a given state.
 java.util.List readResourcesForPrincipalACE(CmsDbContext dbc, CmsProject project, CmsUUID principalId)
          Returns all resources associated to a given principal via an ACE.
 java.util.List readResourcesForPrincipalAttr(CmsDbContext dbc, CmsProject project, CmsUUID principalId)
          Returns all resources associated to a given principal through some of following attributes.
 java.util.List readResourcesWithProperty(CmsDbContext dbc, int projectId, CmsUUID propertyDefinition, java.lang.String path)
          Reads all resources that have a value set for the specified property (definition), in the given path.
 java.util.List readResourcesWithProperty(CmsDbContext dbc, int projectId, CmsUUID propertyDefinition, java.lang.String path, java.lang.String value)
          Reads all resources that have a value (containing the specified value) set for the specified property (definition), in the given path.
 java.util.List readResourceTree(CmsDbContext dbc, int projectId, java.lang.String parent, int type, int state, long startTime, long endTime, long releasedAfter, long releasedBefore, long expiredAfter, long expiredBefore, int mode)
          Reads all resources inside a given project matching the criteria specified by parameter values.
 java.util.List readSiblings(CmsDbContext dbc, CmsProject currentProject, CmsResource resource, boolean includeDeleted)
          Reads all siblings that point to the resource record of a specified resource.
 void removeFile(CmsDbContext dbc, CmsProject currentProject, CmsResource resource, boolean removeFileContent)
          Removes a file physically in the database.
 void removeFolder(CmsDbContext dbc, CmsProject currentProject, CmsResource resource)
          Removes a folder physically in the database.
 void replaceResource(CmsDbContext dbc, CmsResource newResource, byte[] newResourceContent, int newResourceType)
          Replaces the content and properties of an existing resource.
 void transferResource(CmsDbContext dbc, CmsProject project, CmsResource resource, CmsUUID createdUser, CmsUUID lastModifiedUser)
          Transfers the attributes of a resource from to the given users.
 boolean validateResourceIdExists(CmsDbContext dbc, int projectId, CmsUUID resourceId)
          Validates if the specified resource ID in the tables of the specified project {offline|online} exists.
 boolean validateStructureIdExists(CmsDbContext dbc, int projectId, CmsUUID structureId)
          Validates if the specified structure ID in the tables of the specified project {offline|online} exists.
 void writeContent(CmsDbContext dbc, CmsProject project, CmsUUID resourceId, byte[] content)
          Writes the resource content with the specified content id.
 void writeLastModifiedProjectId(CmsDbContext dbc, CmsProject project, int projectId, CmsResource resource)
          Writes the "last-modified-in-project" ID of a resource.
 void writePropertyObject(CmsDbContext dbc, CmsProject project, CmsResource resource, CmsProperty property)
          Writes a property object to the database mapped to a specified resource.
 void writePropertyObjects(CmsDbContext dbc, CmsProject project, CmsResource resource, java.util.List properties)
          Writes a list of property objects to the database mapped to a specified resource.
 void writeResource(CmsDbContext dbc, CmsProject project, CmsResource resource, int changed)
          Writes the structure and/or resource record(s) of an existing file.
 void writeResourceState(CmsDbContext dbc, CmsProject project, CmsResource resource, int changed)
          Writes file state in either the structure or resource record, or both of them.
 

Field Detail

DRIVER_TYPE_ID

public static final int DRIVER_TYPE_ID
The type ID to identify user driver implementations.

See Also:
Constant Field Values
Method Detail

createContent

public void createContent(CmsDbContext dbc,
                          CmsProject project,
                          CmsUUID resourceId,
                          byte[] content,
                          int versionId)
                   throws CmsDataAccessException
Creates a resource content with the specified id.

Parameters:
dbc - the current database context
project - the current project
resourceId - the resource id to create the content for
content - the content to write
versionId - for the content of a backup file you need to insert the versionId of the backup
Throws:
CmsDataAccessException - if something goes wrong

createFile

public CmsFile createFile(java.sql.ResultSet res,
                          int projectId)
                   throws java.sql.SQLException
Creates a CmsFile instance from a JDBC ResultSet.

Parameters:
res - the JDBC ResultSet
projectId - the project id
Returns:
the created file
Throws:
java.sql.SQLException - in case the result set does not include a requested table attribute

createFile

public CmsFile createFile(java.sql.ResultSet res,
                          int projectId,
                          boolean hasFileContentInResultSet)
                   throws java.sql.SQLException
Creates a CmsFile instance from a JDBC ResultSet.

Parameters:
res - the JDBC ResultSet
projectId - the project id
hasFileContentInResultSet - flag to include the file content
Returns:
the created file
Throws:
java.sql.SQLException - in case the result set does not include a requested table attribute

createFolder

public CmsFolder createFolder(java.sql.ResultSet res,
                              int projectId,
                              boolean hasProjectIdInResultSet)
                       throws java.sql.SQLException
Creates a CmsFolder instance from a JDBC ResultSet.

Parameters:
res - the JDBC ResultSet
projectId - the ID of the current project
hasProjectIdInResultSet - true if the SQL select query includes the PROJECT_ID table attribute
Returns:
the created folder
Throws:
java.sql.SQLException - in case the result set does not include a requested table attribute

createPropertyDefinition

public CmsPropertyDefinition createPropertyDefinition(CmsDbContext dbc,
                                                      int projectId,
                                                      java.lang.String name)
                                               throws CmsDataAccessException
Creates a new property defintion in the database.

Parameters:
dbc - the current database context
projectId - the project in which the propertydefinition is created
name - the name of the propertydefinitions to overwrite
Returns:
the new propertydefinition
Throws:
CmsDataAccessException - if something goes wrong

createResource

public CmsResource createResource(CmsDbContext dbc,
                                  CmsProject project,
                                  CmsResource resource,
                                  byte[] content)
                           throws CmsDataAccessException
Creates a new resource from a given CmsResource object.

This method works for both files and folders. Existing resources get overwritten.

Parameters:
dbc - the current database context
project - the current project
resource - the resource to be created
content - the file content, or null in case of a folder
Returns:
the created Cms resource
Throws:
CmsDataAccessException - if somethong goes wrong
See Also:
I_CmsResourceType.createResource(org.opencms.file.CmsObject, CmsSecurityManager, String, byte[], List), I_CmsResourceType.importResource(org.opencms.file.CmsObject, CmsSecurityManager, String, CmsResource, byte[], List), CmsObject.createResource(String, int, byte[], List), CmsObject.importResource(String, CmsResource, byte[], List)

createResource

public CmsResource createResource(java.sql.ResultSet res,
                                  int projectId)
                           throws java.sql.SQLException
Creates a CmsResource instance from a JDBC ResultSet.

Parameters:
res - the JDBC ResultSet
projectId - the ID of the current project to adjust the modification date in case the resource is a VFS link
Returns:
the created resource
Throws:
java.sql.SQLException - in case the result set does not include a requested table attribute

createSibling

public void createSibling(CmsDbContext dbc,
                          CmsProject project,
                          CmsResource resource)
                   throws CmsDataAccessException
Creates a new sibling for a specified resource.

Parameters:
dbc - the current database context
project - the project where to create the link
resource - the link prototype
Throws:
CmsDataAccessException - if something goes wrong

deletePropertyDefinition

public void deletePropertyDefinition(CmsDbContext dbc,
                                     CmsPropertyDefinition name)
                              throws CmsDataAccessException
Deletes a property defintion.

Parameters:
dbc - the current database context
name - the property definitions to be deleted
Throws:
CmsDataAccessException - if something goes wrong

deletePropertyObjects

public void deletePropertyObjects(CmsDbContext dbc,
                                  int projectId,
                                  CmsResource resource,
                                  int deleteOption)
                           throws CmsDataAccessException
Deletes all property values of a file or folder.

You may specify which whether just structure or resource property values should be deleted, or both of them.

Parameters:
dbc - the current database context
projectId - the id of the project
resource - the resource
deleteOption - determines which property values should be deleted
Throws:
CmsDataAccessException - if something goes wrong
See Also:
CmsProperty.DELETE_OPTION_DELETE_STRUCTURE_AND_RESOURCE_VALUES, CmsProperty.DELETE_OPTION_DELETE_STRUCTURE_VALUES, CmsProperty.DELETE_OPTION_DELETE_RESOURCE_VALUES

destroy

public void destroy()
             throws java.lang.Throwable
Destroys this driver.

Throws:
java.lang.Throwable - if something goes wrong

getSqlManager

public CmsSqlManager getSqlManager()
Returns the SqlManager of this driver.

Returns:
the SqlManager of this driver

initSqlManager

public CmsSqlManager initSqlManager(java.lang.String classname)
Initializes the SQL manager for this driver.

To obtain JDBC connections from different pools, further {online|offline|backup} pool Urls have to be specified.

Parameters:
classname - the classname of the SQL manager
Returns:
the SQL manager for this driver

publishResource

public void publishResource(CmsDbContext dbc,
                            CmsProject onlineProject,
                            CmsResource onlineResource,
                            CmsResource offlineResource,
                            boolean writeFileContent)
                     throws CmsDataAccessException
Publishes the structure and resource records of an offline resource into it's online counterpart.

Parameters:
dbc - the current database context
onlineProject - the online project
onlineResource - the online resource
offlineResource - the offline resource
writeFileContent - true, if also the content record of the specified offline resource should be written to the online table; false otherwise
Throws:
CmsDataAccessException - if somethong goes wrong

readChildResources

public java.util.List readChildResources(CmsDbContext dbc,
                                         CmsProject currentProject,
                                         CmsResource resource,
                                         boolean getFolders,
                                         boolean getFiles)
                                  throws CmsDataAccessException
Reads all child-files and/or child-folders of a specified parent resource.

Parameters:
dbc - the current database context
currentProject - the current project
resource - the parent folder
getFolders - if true the child folders of the parent folder are returned in the result set
getFiles - if true the child files of the parent folder are returned in the result set
Returns:
a list of all sub folders or sub files
Throws:
CmsDataAccessException - if something goes wrong

readFile

public CmsFile readFile(CmsDbContext dbc,
                        int projectId,
                        boolean includeDeleted,
                        CmsUUID structureId)
                 throws CmsDataAccessException
Reads a file specified by it's structure ID.

Parameters:
dbc - the current database context
projectId - the ID of the current project
includeDeleted - true if should be read even if it's state is deleted
structureId - the id of the file
Returns:
the file that was read
Throws:
CmsDataAccessException - if something goes wrong

readFolder

public CmsFolder readFolder(CmsDbContext dbc,
                            int projectId,
                            CmsUUID folderId)
                     throws CmsDataAccessException
Reads a folder specified by it's structure ID.

Parameters:
dbc - the current database context
projectId - the project in which the resource will be used
folderId - the id of the folder to be read
Returns:
the read folder
Throws:
CmsDataAccessException - if something goes wrong

readFolder

public CmsFolder readFolder(CmsDbContext dbc,
                            int projectId,
                            java.lang.String foldername)
                     throws CmsDataAccessException
Reads a folder specified by it's resource name.

Parameters:
dbc - the current database context
projectId - the project in which the resource will be used
foldername - the name of the folder to be read
Returns:
the read folder
Throws:
CmsDataAccessException - if something goes wrong

readPropertyDefinition

public CmsPropertyDefinition readPropertyDefinition(CmsDbContext dbc,
                                                    java.lang.String name,
                                                    int projectId)
                                             throws CmsDataAccessException
Reads a property definition for the soecified resource type.

If no property definition with the given name is found, null is returned.

Parameters:
dbc - the current database context
name - the name of the propertydefinition to read
projectId - the id of the project
Returns:
the property definition that was read, or null if there is no property definition with the given name.
Throws:
CmsDataAccessException - if something goes wrong

readPropertyDefinitions

public java.util.List readPropertyDefinitions(CmsDbContext dbc,
                                              int projectId)
                                       throws CmsDataAccessException
Reads all property definitions for the specified mapping type.

Parameters:
dbc - the current database context
projectId - the id of the project
Returns:
a list with the CmsPropertyDefinition objects (may be empty)
Throws:
CmsDataAccessException - if something goes wrong

readPropertyObject

public CmsProperty readPropertyObject(CmsDbContext dbc,
                                      java.lang.String key,
                                      CmsProject project,
                                      CmsResource resource)
                               throws CmsDataAccessException
Reads a property object from the database specified by it's key name mapped to a resource.

The implementation must return CmsProperty.getNullProperty() if the property is not found.

Parameters:
dbc - the current database context
key - the key of the property
project - the current project
resource - the resource where the property is attached to
Returns:
a CmsProperty object containing both the structure and resource value of the property
Throws:
CmsDataAccessException - if something goes wrong

readPropertyObjects

public java.util.List readPropertyObjects(CmsDbContext dbc,
                                          CmsProject project,
                                          CmsResource resource)
                                   throws CmsDataAccessException
Reads all property objects mapped to a specified resource from the database.

The implementation must return an empty list if no properties are found at all.

Parameters:
dbc - the current database context
project - the current project
resource - the resource where the property is attached to
Returns:
a list with CmsProperty objects containing both the structure and resource value of the property
Throws:
CmsDataAccessException - if something goes wrong

readResource

public CmsResource readResource(CmsDbContext dbc,
                                int projectId,
                                CmsUUID structureId,
                                boolean includeDeleted)
                         throws CmsDataAccessException
Reads a resource specified by it's structure ID.

Parameters:
dbc - the current database context
projectId - the Id of the project
structureId - the Id of the resource
includeDeleted - true if already deleted files are included
Returns:
the resource that was read
Throws:
CmsDataAccessException - if something goes wrong

readResource

public CmsResource readResource(CmsDbContext dbc,
                                int projectId,
                                java.lang.String filename,
                                boolean includeDeleted)
                         throws CmsDataAccessException
Reads a resource specified by it's resource name.

Parameters:
dbc - the current database context
projectId - the Id of the project in which the resource will be used
filename - the name of the file
includeDeleted - true if already deleted files are included
Returns:
the resource that was read
Throws:
CmsDataAccessException - if something goes wrong

readResources

public java.util.List readResources(CmsDbContext dbc,
                                    int currentProject,
                                    int state,
                                    int mode)
                             throws CmsDataAccessException
Reads all resources inside a given project and with a given state.

Parameters:
dbc - the current database context
currentProject - the current project
state - the state to match
mode - flag signaling the read mode
Returns:
a list with all resources that where read
Throws:
CmsDataAccessException - if somethong goes wrong

readResourcesForPrincipalACE

public java.util.List readResourcesForPrincipalACE(CmsDbContext dbc,
                                                   CmsProject project,
                                                   CmsUUID principalId)
                                            throws CmsDataAccessException
Returns all resources associated to a given principal via an ACE.

Parameters:
dbc - the current database context
project - the to read the entries from
principalId - the id of the principal
Returns:
a list of CmsResource objects
Throws:
CmsDataAccessException - if something goes wrong

readResourcesForPrincipalAttr

public java.util.List readResourcesForPrincipalAttr(CmsDbContext dbc,
                                                    CmsProject project,
                                                    CmsUUID principalId)
                                             throws CmsDataAccessException
Returns all resources associated to a given principal through some of following attributes.

Parameters:
dbc - the current database context
project - the to read the entries from
principalId - the id of the principal
Returns:
a list of CmsResource objects
Throws:
CmsDataAccessException - if something goes wrong

readResourcesWithProperty

public java.util.List readResourcesWithProperty(CmsDbContext dbc,
                                                int projectId,
                                                CmsUUID propertyDefinition,
                                                java.lang.String path)
                                         throws CmsDataAccessException
Reads all resources that have a value set for the specified property (definition), in the given path.

Both individual and shared properties of a resource are checked.

Parameters:
dbc - the current database context
projectId - the id of the project
propertyDefinition - the id of the property definition
path - the folder to get the resources with the property from
Returns:
a list of all CmsResource objects that have a value set for the specified property.
Throws:
CmsDataAccessException - if something goes wrong

readResourcesWithProperty

public java.util.List readResourcesWithProperty(CmsDbContext dbc,
                                                int projectId,
                                                CmsUUID propertyDefinition,
                                                java.lang.String path,
                                                java.lang.String value)
                                         throws CmsDataAccessException
Reads all resources that have a value (containing the specified value) set for the specified property (definition), in the given path.

Both individual and shared properties of a resource are checked.

Parameters:
dbc - the current database context
projectId - the id of the project
propertyDefinition - the id of the property definition
path - the folder to get the resources with the property from
value - the string to search in the value of the property
Returns:
a list of all CmsResource objects that have a value set for the specified property.
Throws:
CmsDataAccessException - if something goes wrong

readResourceTree

public java.util.List readResourceTree(CmsDbContext dbc,
                                       int projectId,
                                       java.lang.String parent,
                                       int type,
                                       int state,
                                       long startTime,
                                       long endTime,
                                       long releasedAfter,
                                       long releasedBefore,
                                       long expiredAfter,
                                       long expiredBefore,
                                       int mode)
                                throws CmsDataAccessException
Reads all resources inside a given project matching the criteria specified by parameter values.

Important: If C_READMODE_EXCLUDE_TREE is true (or C_READMODE_INCLUDE_TREE is false), the provided parent String must be the UUID of the parent folder, NOT the parent folder path.

Parameters:
dbc - the current database context
projectId - the project id for matching resources or C_READ_OFFLINE_PROJECTS
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)
type - the resource type of matching resources or C_READ_IGNORE_TYPES (meaning inverted by C_READMODE_EXCLUDE_TYPE)
state - the state of matching resources or READ_IGNORE_STATE (meaning inverted by C_READMODE_EXCLUDE_STATE)
startTime - the start of the time range for the last modification date of matching resources or READ_IGNORE_TIME
endTime - the end of the time range for the last modification date of matching resources or READ_IGNORE_TIME
releasedAfter - the start of the time range for the release date of matching resources
releasedBefore - the end of the time range for the release date of matching resources
expiredAfter - the start of the time range for the expire date of matching resources
expiredBefore - the end of the time range for the expire date of matching resources
mode - additional mode flags: C_READMODE_INCLUDE_TREE C_READMODE_EXCLUDE_TREE C_READMODE_INCLUDE_PROJECT C_READMODE_EXCLUDE_TYPE C_READMODE_EXCLUDE_STATE
Returns:
a list of CmsResource objects matching the given criteria
Throws:
CmsDataAccessException - if somethong goes wrong

readSiblings

public java.util.List readSiblings(CmsDbContext dbc,
                                   CmsProject currentProject,
                                   CmsResource resource,
                                   boolean includeDeleted)
                            throws CmsDataAccessException
Reads all siblings that point to the resource record of a specified resource.

Parameters:
dbc - the current database context
currentProject - the current project
resource - the specified resource
includeDeleted - true if deleted siblings should be included in the result list
Returns:
a list of CmsResources that are siblings to the specified resource, including the specified resource itself.
Throws:
CmsDataAccessException - if something goes wrong

removeFile

public void removeFile(CmsDbContext dbc,
                       CmsProject currentProject,
                       CmsResource resource,
                       boolean removeFileContent)
                throws CmsDataAccessException
Removes a file physically in the database.

Parameters:
dbc - the current database context
currentProject - the current project
resource - the resource
removeFileContent - if true, the content record is also removed; if false, only the structure/resource records are removed
Throws:
CmsDataAccessException - if something goes wrong

removeFolder

public void removeFolder(CmsDbContext dbc,
                         CmsProject currentProject,
                         CmsResource resource)
                  throws CmsDataAccessException
Removes a folder physically in the database.

Parameters:
dbc - the current database context
currentProject - the current project
resource - the folder
Throws:
CmsDataAccessException - if something goes wrong

replaceResource

public void replaceResource(CmsDbContext dbc,
                            CmsResource newResource,
                            byte[] newResourceContent,
                            int newResourceType)
                     throws CmsDataAccessException
Replaces the content and properties of an existing resource.

Parameters:
dbc - the current database context
newResource - the new resource
newResourceContent - the new content
newResourceType - the resource type
Throws:
CmsDataAccessException - if something goes wrong

transferResource

public void transferResource(CmsDbContext dbc,
                             CmsProject project,
                             CmsResource resource,
                             CmsUUID createdUser,
                             CmsUUID lastModifiedUser)
                      throws CmsDataAccessException
Transfers the attributes of a resource from to the given users.

Parameters:
dbc - the current database context
project - the current project
resource - the resource to modify
createdUser - the id of the user to be set as the creator of the resource
lastModifiedUser - the id of the user to be set as the las modificator of the resource
Throws:
CmsDataAccessException - if something goes wrong

validateResourceIdExists

public boolean validateResourceIdExists(CmsDbContext dbc,
                                        int projectId,
                                        CmsUUID resourceId)
                                 throws CmsDataAccessException
Validates if the specified resource ID in the tables of the specified project {offline|online} exists.

Parameters:
dbc - the current database context
projectId - the project id
resourceId - the resource id to test for
Returns:
true if a resource with the given id was found, false otherweise
Throws:
CmsDataAccessException - if something goes wrong

validateStructureIdExists

public boolean validateStructureIdExists(CmsDbContext dbc,
                                         int projectId,
                                         CmsUUID structureId)
                                  throws CmsDataAccessException
Validates if the specified structure ID in the tables of the specified project {offline|online} exists.

Parameters:
dbc - the current database context
projectId - the ID of current project
structureId - the structure id
Returns:
true, if the specified structure ID in the tables of the specified project {offline|online} exists
Throws:
CmsDataAccessException - if something goes wrong

writeContent

public void writeContent(CmsDbContext dbc,
                         CmsProject project,
                         CmsUUID resourceId,
                         byte[] content)
                  throws CmsDataAccessException
Writes the resource content with the specified content id.

Parameters:
dbc - the current database context
project - the current project
resourceId - the id of the resource used to identify the content to update
content - the new content of the file
Throws:
CmsDataAccessException - if something goes wrong

writeLastModifiedProjectId

public void writeLastModifiedProjectId(CmsDbContext dbc,
                                       CmsProject project,
                                       int projectId,
                                       CmsResource resource)
                                throws CmsDataAccessException
Writes the "last-modified-in-project" ID of a resource.

Parameters:
dbc - the current database context
project - the resource record is updated with the ID of this project
projectId - the project id to write into the reource
resource - the resource that gets updated
Throws:
CmsDataAccessException - if something goes wrong

writePropertyObject

public void writePropertyObject(CmsDbContext dbc,
                                CmsProject project,
                                CmsResource resource,
                                CmsProperty property)
                         throws CmsDataAccessException
Writes a property object to the database mapped to a specified resource.

Parameters:
dbc - the current database context
project - the current project
resource - the resource where the property should be attached to
property - a CmsProperty object containing both the structure and resource value of the property
Throws:
CmsDataAccessException - if something goes wrong

writePropertyObjects

public void writePropertyObjects(CmsDbContext dbc,
                                 CmsProject project,
                                 CmsResource resource,
                                 java.util.List properties)
                          throws CmsDataAccessException
Writes a list of property objects to the database mapped to a specified resource.

Parameters:
dbc - the current database context
project - the current project
resource - the resource where the property should be attached to
properties - a list of CmsProperty objects
Throws:
CmsDataAccessException - if something goes wrong

writeResource

public void writeResource(CmsDbContext dbc,
                          CmsProject project,
                          CmsResource resource,
                          int changed)
                   throws CmsDataAccessException
Writes the structure and/or resource record(s) of an existing file.

Common usages of this method are saving the resource information after creating, importing or restoring complete files where all file header attribs are changed. Both the structure and resource records get written. Thus, using this method affects all siblings of a resource! Use writeResourceState(CmsDbContext, CmsProject, CmsResource, int) instead if you just want to update the file state, e.g. of a single sibling.

The file state is set to "changed", unless the current state is "new" or "deleted". The "changed" argument allows to choose whether the structure or resource state, or none of them, is set to "changed".

The rating of the file state values is as follows:
unchanged < changed < new < deleted

Second, the "state" of the resource is the structure state, if the structure state has a higher file state value than the resource state. Otherwise the file state is the resource state.

Parameters:
dbc - the current database context
project - the current project
resource - the resource to be updated
changed - determines whether the structure or resource state, or none of them, is set to "changed"
Throws:
CmsDataAccessException - if something goes wrong
See Also:
CmsDriverManager.UPDATE_RESOURCE_STATE, CmsDriverManager.UPDATE_STRUCTURE_STATE, CmsDriverManager.NOTHING_CHANGED, writeResourceState(CmsDbContext, CmsProject, CmsResource, int)

writeResourceState

public void writeResourceState(CmsDbContext dbc,
                               CmsProject project,
                               CmsResource resource,
                               int changed)
                        throws CmsDataAccessException
Writes file state in either the structure or resource record, or both of them.

This method allows to change the resource state to any state by setting the desired state value in the specified CmsResource instance.

This method is frequently used while resources are published to set the file state back to "unchanged".

Only file state attribs. get updated here. Use writeResource(CmsDbContext, CmsProject, CmsResource, int) instead to write the complete file header.

Please refer to the javadoc of writeResource(CmsDbContext, CmsProject, CmsResource, int) to read how setting resource state values affects the file state.

Parameters:
dbc - the current database context
project - the current project
resource - the resource to be updated
changed - determines whether the structure or resource state, or none of them, is set to "changed"
Throws:
CmsDataAccessException - if somethong goes wrong
See Also:
CmsDriverManager.UPDATE_RESOURCE_STATE, CmsDriverManager.UPDATE_STRUCTURE_STATE, CmsDriverManager.UPDATE_ALL