Class CmsVfsDriver
- All Implemented Interfaces:
I_CmsDriver,I_CmsVfsDriver
- Direct Known Subclasses:
CmsVfsDriver,CmsVfsDriver,CmsVfsDriver,CmsVfsDriver,CmsVfsDriver,CmsVfsDriver,CmsVfsDriver
- Since:
- 6.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CmsDriverManagerThe driver manager.This field is temporarily used to compute the versions during publishing.protected CmsSqlManagerThe sql manager.protected static final StringContains the macro replacement value for the offline project.protected static final StringContains the macro replacement value for the online project.Fields inherited from interface org.opencms.db.I_CmsDriver
AND_CONDITION, BEGIN_CONDITION, BEGIN_EXCLUDE_CONDITION, BEGIN_INCLUDE_CONDITION, END_CONDITION, OR_CONDITIONFields inherited from interface org.opencms.db.I_CmsVfsDriver
DRIVER_TYPE_ID, REQ_ATTR_CHECK_PERMISSIONS, REQ_ATTR_RESOURCE_OUS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddUrlNameMappingEntry(CmsDbContext dbc, boolean online, CmsUrlNameMappingEntry entry) Adds a new URL name mapping entry.protected voidcheckWritePermissionsInFolder(CmsDbContext dbc, CmsResource folder) Checks that the current user has write permissions for all subresources of the given folder.intcountSiblings(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId) Counts the number of siblings of a resource.voidcreateContent(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId, byte[] content) Creates a content entry for the resource identified by the specified resource id.createFile(ResultSet res, CmsUUID projectId) Creates aCmsFileinstance from a JDBC ResultSet.createFile(ResultSet res, CmsUUID projectId, boolean hasFileContentInResultSet) Creates aCmsFileinstance from a JDBC ResultSet.createFolder(ResultSet res, CmsUUID projectId, boolean hasProjectIdInResultSet) Creates aCmsFolderinstance from a JDBC ResultSet.voidcreateOnlineContent(CmsDbContext dbc, CmsUUID resourceId, byte[] contents, int publishTag, boolean keepOnline, boolean needToUpdateContent) Creates a new content in the offline project.createPropertyDefinition(CmsDbContext dbc, CmsUUID projectId, String name, CmsPropertyDefinition.CmsPropertyType type) Creates a new property definition in the database.voidcreateRelation(CmsDbContext dbc, CmsUUID projectId, CmsRelation relation) Creates a newCmsRelationobject in the database.createResource(ResultSet res, CmsUUID projectId) Creates a CmsResource instance from a JDBC ResultSet.createResource(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, byte[] content) Creates a new resource from a givenCmsResourceobject.voidcreateSibling(CmsDbContext dbc, CmsProject project, CmsResource resource) Creates a new sibling for a specified resource.voiddeleteAliases(CmsDbContext dbc, CmsProject project, CmsAliasFilter filter) Deletes the aliases matching a given filter.voiddeletePropertyDefinition(CmsDbContext dbc, CmsPropertyDefinition metadef) Deletes a property definition.voiddeletePropertyObjects(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, int deleteOption) Deletes all property values of a file or folder.voiddeleteRelations(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, CmsRelationFilter filter) Deletes all relations with the given filter for the given resource.voiddeleteRewriteAliases(CmsDbContext dbc, CmsRewriteAliasFilter filter) Deletes rewrite aliases matching a given filter.voiddeleteUrlNameMappingEntries(CmsDbContext dbc, boolean online, CmsUrlNameMappingFilter filter) Deletes the URL name mapping entries which match a given filter.voiddestroy()Destroys this driver.protected static StringescapeDbWildcard(String path) Escapes the database wildcards within the resource path.getResourceOus(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) Returns all organizational units for the given resource.Returns the SqlManager of this driver.intincrementCounter(CmsDbContext dbc, String name) Gets the current value of a counter, creates it if it doesn't already exist, and increments it.voidinit(CmsDbContext dbc, CmsConfigurationManager configurationManager, List<String> successiveDrivers, CmsDriverManager driverManager) Initializes the driver.initSqlManager(String classname) Initializes the SQL manager for this driver.voidinsertAlias(CmsDbContext dbc, CmsProject project, CmsAlias alias) Adds an alias to the database.voidinsertRewriteAliases(CmsDbContext dbc, Collection<CmsRewriteAlias> rewriteAliases) Adds a list of rewrite aliases.protected intinternalCountProperties(CmsDbContext dbc, CmsPropertyDefinition propertyDefinition, CmsUUID projectId) Returns the count of properties for a property definition.protected voidinternalCreateCounter(CmsDbContext dbc, String name, int value) Creates a new counter.protected CmsUrlNameMappingEntryinternalCreateUrlNameMappingEntry(ResultSet resultSet) Creates an URL name mapping entry from a result set.protected voidinternalIncrementCounter(CmsDbContext dbc, String name) Increments a counter.protected CmsAliasinternalReadAlias(ResultSet resultset) Helper method to create an alias object from a result set.protected IntegerinternalReadCounter(CmsDbContext dbc, String name) Reads the current value of a counter.protected StringinternalReadParentId(CmsDbContext dbc, CmsUUID projectId, String resourcename) Returns the parent id of the given resource.protected CmsRelationCreates a newCmsRelationobject from the given result set entry.protected CmsResourceStateinternalReadResourceState(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) Returns the resource state of the given resource.protected CmsResourceStateinternalReadStructureState(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) Returns the structure state of the given resource.protected voidinternalRemoveFolder(CmsDbContext dbc, CmsProject currentProject, CmsResource resource) Removes a resource physically in the database.protected voidinternalUpdateVersions(CmsDbContext dbc, CmsResource resource) Updates the offline version numbers.protected voidinternalValidateResourceLength(CmsResource resource) Validates that the length setting of a resource is always correct.protected voidmoveRelations(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId, String rootPath) Moves all relations of a resource to the new path.voidmoveResource(CmsDbContext dbc, CmsUUID projectId, CmsResource source, String destinationPath) Moves the given resource to the specified destination path.protected voidprepareExpiredTimeRangeCondition(CmsUUID projectId, long startTime, long endTime, StringBuffer conditions, List<Object> params) Appends the appropriate selection criteria related with the expiration date.protected voidpreparePathCondition(CmsUUID projectId, String parent, int mode, StringBuffer conditions, List<Object> params) Appends the appropriate selection criteria related with the parentPath.protected voidprepareProjectCondition(CmsUUID projectId, int mode, StringBuffer conditions, List<Object> params) Appends the appropriate selection criteria related with the projectId.protected StringprepareRelationConditions(CmsUUID projectId, CmsRelationFilter filter, CmsResource resource, List<Object> params, boolean checkSource) Build the whole WHERE sql statement part for the given relation filter.protected voidprepareReleasedTimeRangeCondition(CmsUUID projectId, long startTime, long endTime, StringBuffer conditions, List<Object> params) Appends the appropriate selection criteria related with the released date.protected voidprepareResourceCondition(CmsUUID projectId, int mode, StringBuffer conditions) Appends the appropriate selection criteria related with the read mode.protected voidprepareStateCondition(CmsUUID projectId, CmsResourceState state, int mode, StringBuffer conditions, List<Object> params) Appends the appropriate selection criteria related with the resource state.protected voidprepareTimeRangeCondition(CmsUUID projectId, long startTime, long endTime, StringBuffer conditions, List<Object> params) Appends the appropriate selection criteria related with the date of the last modification.protected voidprepareTypeCondition(CmsUUID projectId, int type, int mode, StringBuffer conditions, List<Object> params) Appends the appropriate selection criteria related with the resource type.protected voidprepareTypesCondition(CmsUUID projectId, List<Integer> types, int mode, StringBuffer conditions, List<Object> params) Appends the appropriate selection criteria related with the resource type.static CmsPair<String, List<I_CmsPreparedStatementParameter>> This method prepares the SQL conditions for mapping entries for a given URL name mapping filter.voidpublishResource(CmsDbContext dbc, CmsProject onlineProject, CmsResource onlineResource, CmsResource offlineResource) Publishes the structure and resource records of an offline resource into it's online counterpart.voidpublishVersions(CmsDbContext dbc, CmsResource resource, boolean firstSibling) Copies the version number from the offline resource to the online resource, this has to be done during publishing, direct after copying the resource itself.readAliases(CmsDbContext dbc, CmsProject project, CmsAliasFilter filter) Reads the aliases matching a given filter.readChildResources(CmsDbContext dbc, CmsProject currentProject, CmsResource resource, boolean getFolders, boolean getFiles) Reads all child-files and/or child-folders of a specified parent resource.byte[]readContent(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId) Reads the content of a file specified by it's resource ID.readFolder(CmsDbContext dbc, CmsUUID projectId, String folderPath) Reads a folder specified by it's resource name.readFolder(CmsDbContext dbc, CmsUUID projectId, CmsUUID folderId) Reads a folder specified by it's structure ID.readFolderSizeStats(CmsDbContext dbc, boolean online, CmsFolderSizeOptions options) Reads folder size statistics for the subtree at a given root path.readParentFolder(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId) Reads the parent folder of a resource specified by it's structure ID.readPropertyDefinition(CmsDbContext dbc, String name, CmsUUID projectId) Reads a property definition for the specified resource type.readPropertyDefinitions(CmsDbContext dbc, CmsUUID projectId) Reads all property definitions for the specified mapping type.readPropertyObject(CmsDbContext dbc, String key, CmsProject project, CmsResource resource) Reads a property object from the database specified by it's key name mapped to a resource.readPropertyObjects(CmsDbContext dbc, CmsProject project, CmsResource resource) Reads all property objects mapped to a specified resource from the database.readRelations(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, CmsRelationFilter filter) Reads all relations with the given filter for the given resource.readResource(CmsDbContext dbc, CmsUUID projectId, String path, boolean includeDeleted) Reads a resource specified by it's resource name.readResource(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId, boolean includeDeleted) Reads a resource specified by it's structure ID.readResources(CmsDbContext dbc, CmsUUID projectId, CmsResourceState state, int mode) Reads all resources inside a given project and with a given state.readResourcesForPrincipalACE(CmsDbContext dbc, CmsProject project, CmsUUID principalId) Returns all resources associated to a given principal via an ACE.readResourcesForPrincipalAttr(CmsDbContext dbc, CmsProject project, CmsUUID principalId) Returns all resources associated to a given principal through some of following attributes.readResourcesWithProperty(CmsDbContext dbc, CmsUUID projectId, CmsUUID propertyDef, String path, String value) Reads all resources that have a value (containing the specified value) set for the specified property (definition), in the given path.readResourceTree(CmsDbContext dbc, CmsUUID projectId, String parentPath, int type, CmsResourceState state, long lastModifiedAfter, long lastModifiedBefore, long releasedAfter, long releasedBefore, long expiredAfter, long expiredBefore, int mode) Reads all resources inside a given project matching the criteria specified by parameter values.readRewriteAliases(CmsDbContext dbc, CmsRewriteAliasFilter filter) Reads the rewrite aliases matching a given filter.readSiblings(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, boolean includeDeleted) Reads all siblings that point to the resource record of a specified resource.protected List<CmsResource> readTypesInResourceTree(CmsDbContext dbc, CmsUUID projectId, String parentPath, List<Integer> types, CmsResourceState state, long lastModifiedAfter, long lastModifiedBefore, long releasedAfter, long releasedBefore, long expiredAfter, long expiredBefore, int mode) Reads all resources inside a given project matching the criteria specified by parameter values.readUrlNameMappingEntries(CmsDbContext dbc, boolean online, CmsUrlNameMappingFilter filter) Reads the URL name mapping entries which match a given filter.readVersions(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId, CmsUUID structureId) Reads a resource version numbers.voidremoveFile(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) Removes a file physically in the database.voidremoveFolder(CmsDbContext dbc, CmsProject currentProject, CmsResource resource) Removes a folder physically in the database.protected voidrepairBrokenRelations(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId, String rootPath) Repairs broken links.voidreplaceResource(CmsDbContext dbc, CmsResource newResource, byte[] resContent, int newResourceType) Replaces the content and properties of an existing resource.voidsetDriverManager(CmsDriverManager driverManager) Sets the driver manager for this driver if possible.voidsetSqlManager(CmsSqlManager sqlManager) Sets the SQL manager for this driver if possible.voidtransferResource(CmsDbContext dbc, CmsProject project, CmsResource resource, CmsUUID createdUser, CmsUUID lastModifiedUser) Transfers the attributes of a resource from to the given users.protected voidupdateBrokenRelations(CmsDbContext dbc, CmsUUID projectId, String rootPath) Updates broken links.voidupdateRelations(CmsDbContext dbc, CmsProject onlineProject, CmsResource offlineResource) Updates the relations on the online project copying the relations from the offline project.booleanvalidateResourceIdExists(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId) Validates if the specified resource ID in the tables of the specified project {offline|online} exists.booleanvalidateStructureIdExists(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId) Validates if the specified structure ID in the tables of the specified project {offline|online} exists.protected CmsDbSqlExceptionwrapException(PreparedStatement stmt, SQLException e) Wrap a SQL exception into a CmsDbSqlException.voidwriteContent(CmsDbContext dbc, CmsUUID resourceId, byte[] content) Writes the resource content with the specified resource id.voidwriteLastModifiedProjectId(CmsDbContext dbc, CmsProject project, CmsUUID projectId, CmsResource resource) Writes the "last-modified-in-project" ID of a resource.voidwritePropertyObject(CmsDbContext dbc, CmsProject project, CmsResource resource, CmsProperty property) Writes a property object to the database mapped to a specified resource.voidwritePropertyObjects(CmsDbContext dbc, CmsProject project, CmsResource resource, List<CmsProperty> properties) Writes a list of property objects to the database mapped to a specified resource.voidwriteResource(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, int changed) Writes the structure and/or resource record(s) of an existing file.voidwriteResourceState(CmsDbContext dbc, CmsProject project, CmsResource resource, int changed, boolean isPublishing) Writes file state in either the structure or resource record, or both of them.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opencms.db.I_CmsDriver
toString
-
Field Details
-
OFFLINE
Contains the macro replacement value for the offline project.- See Also:
-
ONLINE
Contains the macro replacement value for the online project.- See Also:
-
m_driverManager
The driver manager. -
m_resOp
This field is temporarily used to compute the versions during publishing.- See Also:
-
m_sqlManager
The sql manager.
-
-
Constructor Details
-
CmsVfsDriver
public CmsVfsDriver()
-
-
Method Details
-
prepareUrlNameMappingConditions
public static CmsPair<String,List<I_CmsPreparedStatementParameter>> prepareUrlNameMappingConditions(CmsUrlNameMappingFilter filter) This method prepares the SQL conditions for mapping entries for a given URL name mapping filter.- Parameters:
filter- the filter from which the SQL conditions should be generated- Returns:
- a pair consisting of an SQL string and a list of the prepared statement parameters for the SQL
-
escapeDbWildcard
Escapes the database wildcards within the resource path.This method is required to ensure chars in the resource path that have a special meaning in SQL (for example "_", which is the "any char" operator) are escaped.
It will escape the following chars:
- "_" to "|_"
- Parameters:
path- the resource path- Returns:
- the escaped resource path
-
addUrlNameMappingEntry
public void addUrlNameMappingEntry(CmsDbContext dbc, boolean online, CmsUrlNameMappingEntry entry) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverAdds a new URL name mapping entry.- Specified by:
addUrlNameMappingEntryin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextonline- if true, writes to the online tables, else to the offline tablesentry- the entry to add- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
countSiblings
public int countSiblings(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId) throws CmsDataAccessException Counts the number of siblings of a resource.- Specified by:
countSiblingsin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the current project idresourceId- the resource id to count the number of siblings from- Returns:
- number of siblings
- Throws:
CmsDataAccessException- if something goes wrong
-
createContent
public void createContent(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId, byte[] content) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverCreates a content entry for the resource identified by the specified resource id.- Specified by:
createContentin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the id of the current projectresourceId- the resource id of the resource to create the content forcontent- the content to write- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
createFile
Description copied from interface:I_CmsVfsDriverCreates aCmsFileinstance from a JDBC ResultSet.- Specified by:
createFilein interfaceI_CmsVfsDriver- Parameters:
res- the JDBC ResultSetprojectId- the project id- Returns:
- the created file
- Throws:
SQLException- in case the result set does not include a requested table attribute- See Also:
-
createFile
public CmsFile createFile(ResultSet res, CmsUUID projectId, boolean hasFileContentInResultSet) throws SQLException Description copied from interface:I_CmsVfsDriverCreates aCmsFileinstance from a JDBC ResultSet.- Specified by:
createFilein interfaceI_CmsVfsDriver- Parameters:
res- the JDBC ResultSetprojectId- the project idhasFileContentInResultSet- flag to include the file content- Returns:
- the created file
- Throws:
SQLException- in case the result set does not include a requested table attribute- See Also:
-
createFolder
public CmsFolder createFolder(ResultSet res, CmsUUID projectId, boolean hasProjectIdInResultSet) throws SQLException Description copied from interface:I_CmsVfsDriverCreates aCmsFolderinstance from a JDBC ResultSet.- Specified by:
createFolderin interfaceI_CmsVfsDriver- Parameters:
res- the JDBC ResultSetprojectId- the ID of the current projecthasProjectIdInResultSet- true if the SQL select query includes the PROJECT_ID table attribute- Returns:
- the created folder
- Throws:
SQLException- in case the result set does not include a requested table attribute- See Also:
-
createOnlineContent
public void createOnlineContent(CmsDbContext dbc, CmsUUID resourceId, byte[] contents, int publishTag, boolean keepOnline, boolean needToUpdateContent) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverCreates a new content in the offline project.- Specified by:
createOnlineContentin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextresourceId- the resource id of the content to writecontents- the content to publishpublishTag- the publish tagkeepOnline- if the content is online or has to be put in the historyneedToUpdateContent- if the content blob has to be updated- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
createPropertyDefinition
public CmsPropertyDefinition createPropertyDefinition(CmsDbContext dbc, CmsUUID projectId, String name, CmsPropertyDefinition.CmsPropertyType type) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverCreates a new property definition in the database.- Specified by:
createPropertyDefinitionin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the project in which the property definition is createdname- the name of the property definitiontype- the type of the property definition- Returns:
- the new property definition
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
createRelation
public void createRelation(CmsDbContext dbc, CmsUUID projectId, CmsRelation relation) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverCreates a newCmsRelationobject in the database.- Specified by:
createRelationin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the id of the project to execute the query inrelation- the relation to create- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
createResource
public CmsResource createResource(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, byte[] content) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverCreates a new resource from a givenCmsResourceobject.This method works for both files and folders. Existing resources get overwritten.
- Specified by:
createResourcein interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the id of the current projectresource- the resource to be createdcontent- the file content, or null in case of a folder- Returns:
- the created Cms resource
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
createResource
Description copied from interface:I_CmsVfsDriverCreates a CmsResource instance from a JDBC ResultSet.- Specified by:
createResourcein interfaceI_CmsVfsDriver- Parameters:
res- the JDBC ResultSetprojectId- the ID of the current project to adjust the modification date in case the resource is a VFS link- Returns:
- the created resource
- Throws:
SQLException- in case the result set does not include a requested table attribute- See Also:
-
createSibling
public void createSibling(CmsDbContext dbc, CmsProject project, CmsResource resource) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverCreates a new sibling for a specified resource.- Specified by:
createSiblingin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextproject- the project where to create the linkresource- the link prototype- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
deleteAliases
public void deleteAliases(CmsDbContext dbc, CmsProject project, CmsAliasFilter filter) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverDeletes the aliases matching a given filter.- Specified by:
deleteAliasesin interfaceI_CmsVfsDriver- Parameters:
dbc- the database contextproject- the current projectfilter- the alias filter- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
deletePropertyDefinition
public void deletePropertyDefinition(CmsDbContext dbc, CmsPropertyDefinition metadef) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverDeletes a property definition.- Specified by:
deletePropertyDefinitionin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextmetadef- the property definitions to be deleted- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
deletePropertyObjects
public void deletePropertyObjects(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, int deleteOption) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverDeletes 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.
- Specified by:
deletePropertyObjectsin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the id of the projectresource- the resourcedeleteOption- determines which property values should be deleted- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
deleteRelations
public void deleteRelations(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, CmsRelationFilter filter) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverDeletes all relations with the given filter for the given resource.- Specified by:
deleteRelationsin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the id of the project to execute the query inresource- the base resource. May benullfor allfilter- the filter to restrict the relations to remove- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
deleteRewriteAliases
public void deleteRewriteAliases(CmsDbContext dbc, CmsRewriteAliasFilter filter) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverDeletes rewrite aliases matching a given filter.- Specified by:
deleteRewriteAliasesin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextfilter- the filter describing which rewrite aliases to delete- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
deleteUrlNameMappingEntries
public void deleteUrlNameMappingEntries(CmsDbContext dbc, boolean online, CmsUrlNameMappingFilter filter) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverDeletes the URL name mapping entries which match a given filter.- Specified by:
deleteUrlNameMappingEntriesin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextonline- if true, changes the online URL name mappings, else the offline URL name mappingsfilter- the URL name mapping entries to delete- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
destroy
Description copied from interface:I_CmsVfsDriverDestroys this driver.- Specified by:
destroyin interfaceI_CmsVfsDriver- Throws:
Throwable- if something goes wrong- See Also:
-
getResourceOus
public List<CmsOrganizationalUnit> getResourceOus(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) throws CmsDbSqlException Returns all organizational units for the given resource.- Specified by:
getResourceOusin interfaceI_CmsVfsDriver- Parameters:
dbc- the database contextprojectId- the id of the projectresource- the resource- Returns:
- a list of
CmsOrganizationalUnitobjects - Throws:
CmsDbSqlException- if something goes wrong
-
getSqlManager
Description copied from interface:I_CmsVfsDriverReturns the SqlManager of this driver.- Specified by:
getSqlManagerin interfaceI_CmsVfsDriver- Returns:
- the SqlManager of this driver
- See Also:
-
incrementCounter
Description copied from interface:I_CmsVfsDriverGets the current value of a counter, creates it if it doesn't already exist, and increments it.- Specified by:
incrementCounterin interfaceI_CmsVfsDriver- Parameters:
dbc- the database contextname- the name of the counter- Returns:
- the counter value before incrementing
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
init
public void init(CmsDbContext dbc, CmsConfigurationManager configurationManager, List<String> successiveDrivers, CmsDriverManager driverManager) Description copied from interface:I_CmsDriverInitializes the driver.- Specified by:
initin interfaceI_CmsDriver- Parameters:
dbc- the current database contextconfigurationManager- the configuration managersuccessiveDrivers- a list of successive drivers to be initializeddriverManager- the initialized OpenCms driver manager- See Also:
-
initSqlManager
Description copied from interface:I_CmsVfsDriverInitializes the SQL manager for this driver.To obtain JDBC connections from different pools, further {online|offline|history} pool Urls have to be specified.
- Specified by:
initSqlManagerin interfaceI_CmsVfsDriver- Parameters:
classname- the class name of the SQL manager- Returns:
- the SQL manager for this driver
- See Also:
-
insertAlias
public void insertAlias(CmsDbContext dbc, CmsProject project, CmsAlias alias) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverAdds an alias to the database.- Specified by:
insertAliasin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextproject- the current projectalias- the alias to write- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
insertRewriteAliases
public void insertRewriteAliases(CmsDbContext dbc, Collection<CmsRewriteAlias> rewriteAliases) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverAdds a list of rewrite aliases.When adding a rewrite alias, make sure that no alias with the same id is present in the database.
- Specified by:
insertRewriteAliasesin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextrewriteAliases- the rewrite aliases to save- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
moveResource
public void moveResource(CmsDbContext dbc, CmsUUID projectId, CmsResource source, String destinationPath) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverMoves the given resource to the specified destination path.- Specified by:
moveResourcein interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the Id of the projectsource- the resource to movedestinationPath- the root path of the destination resource- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
publishResource
public void publishResource(CmsDbContext dbc, CmsProject onlineProject, CmsResource onlineResource, CmsResource offlineResource) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverPublishes the structure and resource records of an offline resource into it's online counterpart.- Specified by:
publishResourcein interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextonlineProject- the online projectonlineResource- the online resourceofflineResource- the offline resource- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
publishVersions
public void publishVersions(CmsDbContext dbc, CmsResource resource, boolean firstSibling) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverCopies the version number from the offline resource to the online resource, this has to be done during publishing, direct after copying the resource itself.- Specified by:
publishVersionsin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextresource- the resource that has been publishfirstSibling- if this is the first sibling to be publish- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readAliases
public List<CmsAlias> readAliases(CmsDbContext dbc, CmsProject project, CmsAliasFilter filter) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads the aliases matching a given filter.- Specified by:
readAliasesin interfaceI_CmsVfsDriver- Parameters:
dbc- the database contextproject- the current projectfilter- the alias filter- Returns:
- the list of aliases which were read
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readChildResources
public List<CmsResource> readChildResources(CmsDbContext dbc, CmsProject currentProject, CmsResource resource, boolean getFolders, boolean getFiles) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads all child-files and/or child-folders of a specified parent resource.- Specified by:
readChildResourcesin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextcurrentProject- the current projectresource- the parent foldergetFolders- if true the child folders of the parent folder are returned in the result setgetFiles- 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- See Also:
-
readContent
public byte[] readContent(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads the content of a file specified by it's resource ID.- Specified by:
readContentin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the ID of the current projectresourceId- the id of the resource- Returns:
- the file content
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readFolder
public CmsFolder readFolder(CmsDbContext dbc, CmsUUID projectId, CmsUUID folderId) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads a folder specified by it's structure ID.- Specified by:
readFolderin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the project in which the resource will be usedfolderId- the structure id of the folder to be read- Returns:
- the read folder
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readFolder
public CmsFolder readFolder(CmsDbContext dbc, CmsUUID projectId, String folderPath) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads a folder specified by it's resource name.- Specified by:
readFolderin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the project in which the resource will be usedfolderPath- the name of the folder to be read- Returns:
- the read folder
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readFolderSizeStats
public List<CmsFolderSizeEntry> readFolderSizeStats(CmsDbContext dbc, boolean online, CmsFolderSizeOptions options) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads folder size statistics for the subtree at a given root path.- Specified by:
readFolderSizeStatsin interfaceI_CmsVfsDriver- Parameters:
dbc- tje database contextonline- true if we want the online data, false for the offline dataoptions- the options on what exactly to read- Returns:
- the list of folder size beans
- Throws:
CmsDataAccessException- if something goes wrong
-
readParentFolder
public CmsFolder readParentFolder(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads the parent folder of a resource specified by it's structure ID.The parent folder for the root '/' is defined as
null.- Specified by:
readParentFolderin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the project in which the resource will be usedstructureId- the id of the resource to read the parent folder for- Returns:
- the read folder, or
null - Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readPropertyDefinition
public CmsPropertyDefinition readPropertyDefinition(CmsDbContext dbc, String name, CmsUUID projectId) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads a property definition for the specified resource type.If no property definition with the given name is found,
nullis returned.- Specified by:
readPropertyDefinitionin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextname- the name of the property definition to readprojectId- the id of the project- Returns:
- the property definition that was read
- Throws:
CmsDataAccessException- a CmsDbEntryNotFoundException is thrown if the property definition does not exist- See Also:
-
readPropertyDefinitions
public List<CmsPropertyDefinition> readPropertyDefinitions(CmsDbContext dbc, CmsUUID projectId) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads all property definitions for the specified mapping type.- Specified by:
readPropertyDefinitionsin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the id of the project- Returns:
- a list with the
objects (may be empty)CmsPropertyDefinition - Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readPropertyObject
public CmsProperty readPropertyObject(CmsDbContext dbc, String key, CmsProject project, CmsResource resource) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads 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.TODO: change project parameter to project id
- Specified by:
readPropertyObjectin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextkey- the key of the propertyproject- the current projectresource- 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- See Also:
-
readPropertyObjects
public List<CmsProperty> readPropertyObjects(CmsDbContext dbc, CmsProject project, CmsResource resource) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads 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.
TODO: change project parameter to project id
- Specified by:
readPropertyObjectsin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextproject- the current projectresource- 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- See Also:
-
readRelations
public List<CmsRelation> readRelations(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, CmsRelationFilter filter) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads all relations with the given filter for the given resource.- Specified by:
readRelationsin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the id of the project to execute the query inresource- the resource to read the relations for, may benullfor allfilter- the filter to restrict the relations to retrieve- Returns:
- the read relations
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readResource
public CmsResource readResource(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId, boolean includeDeleted) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads a resource specified by it's structure ID.- Specified by:
readResourcein interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the Id of the projectstructureId- the Id of the resourceincludeDeleted- true if already deleted files are included- Returns:
- the resource that was read
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readResource
public CmsResource readResource(CmsDbContext dbc, CmsUUID projectId, String path, boolean includeDeleted) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads a resource specified by it's resource name.- Specified by:
readResourcein interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the Id of the project in which the resource will be usedpath- the name of the fileincludeDeleted- true if already deleted files are included- Returns:
- the resource that was read
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readResources
public List<CmsResource> readResources(CmsDbContext dbc, CmsUUID projectId, CmsResourceState state, int mode) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads all resources inside a given project and with a given state.- Specified by:
readResourcesin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the current projectstate- the state to matchmode- flag signaling the read mode- Returns:
- a list with all resources that where read
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readResourcesForPrincipalACE
public List<CmsResource> readResourcesForPrincipalACE(CmsDbContext dbc, CmsProject project, CmsUUID principalId) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReturns all resources associated to a given principal via an ACE.- Specified by:
readResourcesForPrincipalACEin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextproject- the to read the entries fromprincipalId- the id of the principal- Returns:
- a list of
objectsCmsResource - Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readResourcesForPrincipalAttr
public List<CmsResource> readResourcesForPrincipalAttr(CmsDbContext dbc, CmsProject project, CmsUUID principalId) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReturns all resources associated to a given principal through some of following attributes.- User Created
- User Last Modified
- Specified by:
readResourcesForPrincipalAttrin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextproject- the to read the entries fromprincipalId- the id of the principal- Returns:
- a list of
objectsCmsResource - Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readResourcesWithProperty
public List<CmsResource> readResourcesWithProperty(CmsDbContext dbc, CmsUUID projectId, CmsUUID propertyDef, String path, String value) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads 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.
If the
valueparameter isnull, all resources having the given property set are returned.- Specified by:
readResourcesWithPropertyin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the id of the projectpropertyDef- the id of the property definitionpath- the folder to get the resources with the property fromvalue- the string to search in the value of the property- Returns:
- a list of all
objects that have a value set for the specified property.CmsResource - Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readResourceTree
public List<CmsResource> readResourceTree(CmsDbContext dbc, CmsUUID projectId, String parentPath, int type, CmsResourceState state, long lastModifiedAfter, long lastModifiedBefore, long releasedAfter, long releasedBefore, long expiredAfter, long expiredBefore, int mode) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads all resources inside a given project matching the criteria specified by parameter values.Important: If
CmsDriverManager.READMODE_EXCLUDE_TREEis true (orCmsDriverManager.READMODE_INCLUDE_TREEis false), the provided parent String must be the UUID of the parent folder, NOT the parent folder path.- Specified by:
readResourceTreein interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the project id for matching resourcesparentPath- the path to the resource used as root of the searched subtree orCmsDriverManager.READ_IGNORE_PARENT,CmsDriverManager.READMODE_EXCLUDE_TREEmeans to read immediate children onlytype- the resource type of matching resources orCmsDriverManager.READ_IGNORE_TYPE(meaning inverted byCmsDriverManager.READMODE_EXCLUDE_TYPEstate- the state of matching resources (meaning inverted byCmsDriverManager.READMODE_EXCLUDE_STATEornullto ignorelastModifiedAfter- the start of the time range for the last modification date of matching resources or READ_IGNORE_TIMElastModifiedBefore- the end of the time range for the last modification date of matching resources or READ_IGNORE_TIMEreleasedAfter- the start of the time range for the release date of matching resourcesreleasedBefore- the end of the time range for the release date of matching resourcesexpiredAfter- the start of the time range for the expire date of matching resourcesexpiredBefore- the end of the time range for the expire date of matching resourcesmode- additional mode flags:- Returns:
- a list of CmsResource objects matching the given criteria
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readRewriteAliases
public List<CmsRewriteAlias> readRewriteAliases(CmsDbContext dbc, CmsRewriteAliasFilter filter) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads the rewrite aliases matching a given filter.- Specified by:
readRewriteAliasesin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextfilter- the filter describing which rewrite aliases should be returned- Returns:
- the rewrite aliases which were found
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readSiblings
public List<CmsResource> readSiblings(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, boolean includeDeleted) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads all siblings that point to the resource record of a specified resource.- Specified by:
readSiblingsin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the id of the current projectresource- the specified resourceincludeDeleted-trueif deleted siblings should be included in the result list- Returns:
- a list of
s that are siblings to the specified resource, including the specified resource itself.CmsResource - Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
readUrlNameMappingEntries
public List<CmsUrlNameMappingEntry> readUrlNameMappingEntries(CmsDbContext dbc, boolean online, CmsUrlNameMappingFilter filter) throws CmsDataAccessException Reads the URL name mapping entries which match a given filter.- Specified by:
readUrlNameMappingEntriesin interfaceI_CmsVfsDriver- Parameters:
dbc- the database contextonline- if true, reads from the online mapping, else from the offline mappingfilter- the filter which the entries to be read should match- Returns:
- the mapping entries which match the given filter
- Throws:
CmsDataAccessException- if something goes wrong
-
readVersions
public Map<String,Integer> readVersions(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId, CmsUUID structureId) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReads a resource version numbers.- Specified by:
readVersionsin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the project to read the versions fromresourceId- the resource id of the resource to read the versions fromstructureId- the structure id of the resource to read the versions from- Returns:
- a map with two entries with keys "structure" and "resource" for the
structure and resource version number respectively, the values are
Integerobjects and may be-1if an entry could be found - Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
removeFile
public void removeFile(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverRemoves a file physically in the database.- Specified by:
removeFilein interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the id of the current projectresource- the resource- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
removeFolder
public void removeFolder(CmsDbContext dbc, CmsProject currentProject, CmsResource resource) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverRemoves a folder physically in the database.- Specified by:
removeFolderin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextcurrentProject- the current projectresource- the folder- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
replaceResource
public void replaceResource(CmsDbContext dbc, CmsResource newResource, byte[] resContent, int newResourceType) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverReplaces the content and properties of an existing resource.- Specified by:
replaceResourcein interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextnewResource- the new resourceresContent- the new contentnewResourceType- the resource type- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
setDriverManager
Description copied from interface:I_CmsVfsDriverSets the driver manager for this driver if possible.- Specified by:
setDriverManagerin interfaceI_CmsVfsDriver- Parameters:
driverManager- the new driver manager- See Also:
-
setSqlManager
Description copied from interface:I_CmsVfsDriverSets the SQL manager for this driver if possible.- Specified by:
setSqlManagerin interfaceI_CmsVfsDriver- Parameters:
sqlManager- the new SQL manager- See Also:
-
transferResource
public void transferResource(CmsDbContext dbc, CmsProject project, CmsResource resource, CmsUUID createdUser, CmsUUID lastModifiedUser) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverTransfers the attributes of a resource from to the given users.- Specified by:
transferResourcein interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextproject- the current projectresource- the resource to modifycreatedUser- the id of the user to be set as the creator of the resourcelastModifiedUser- the id of the user to be set as the last modificator of the resource- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
updateRelations
public void updateRelations(CmsDbContext dbc, CmsProject onlineProject, CmsResource offlineResource) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverUpdates the relations on the online project copying the relations from the offline project.TODO: add offlineProject parameter
- Specified by:
updateRelationsin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextonlineProject- the online projectofflineResource- the resource to update the relations for- Throws:
CmsDataAccessException- is something goes wrong- See Also:
-
validateResourceIdExists
public boolean validateResourceIdExists(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverValidates if the specified resource ID in the tables of the specified project {offline|online} exists.- Specified by:
validateResourceIdExistsin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the project idresourceId- the resource id to test for- Returns:
- true if a resource with the given id was found, false otherwise
- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
validateStructureIdExists
public boolean validateStructureIdExists(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverValidates if the specified structure ID in the tables of the specified project {offline|online} exists.- Specified by:
validateStructureIdExistsin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the ID of current projectstructureId- 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- See Also:
-
writeContent
public void writeContent(CmsDbContext dbc, CmsUUID resourceId, byte[] content) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverWrites the resource content with the specified resource id.- Specified by:
writeContentin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextresourceId- the id of the resource used to identify the content to updatecontent- the new content of the file- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
writeLastModifiedProjectId
public void writeLastModifiedProjectId(CmsDbContext dbc, CmsProject project, CmsUUID projectId, CmsResource resource) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverWrites the "last-modified-in-project" ID of a resource.- Specified by:
writeLastModifiedProjectIdin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextproject- the resource record is updated with the ID of this projectprojectId- the project id to write into the resourceresource- the resource that gets updated- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
writePropertyObject
public void writePropertyObject(CmsDbContext dbc, CmsProject project, CmsResource resource, CmsProperty property) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverWrites a property object to the database mapped to a specified resource.- Specified by:
writePropertyObjectin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextproject- the current projectresource- the resource where the property should be attached toproperty- a CmsProperty object containing both the structure and resource value of the property- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
writePropertyObjects
public void writePropertyObjects(CmsDbContext dbc, CmsProject project, CmsResource resource, List<CmsProperty> properties) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverWrites a list of property objects to the database mapped to a specified resource.- Specified by:
writePropertyObjectsin interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextproject- the current projectresource- the resource where the property should be attached toproperties- a list of CmsProperty objects- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
writeResource
public void writeResource(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, int changed) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverWrites 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 attributes are changed. Both the structure and resource records get written. Thus, using this method affects all siblings of a resource! Use
I_CmsVfsDriver.writeResourceState(CmsDbContext, CmsProject, CmsResource, int, boolean)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 < deletedSecond, 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.
- Specified by:
writeResourcein interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextprojectId- the id of the current projectresource- the resource to be updatedchanged- determines whether the structure or resource state, or none of them, is set to "changed"- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
writeResourceState
public void writeResourceState(CmsDbContext dbc, CmsProject project, CmsResource resource, int changed, boolean isPublishing) throws CmsDataAccessException Description copied from interface:I_CmsVfsDriverWrites 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 attributes. get updated here. Use
I_CmsVfsDriver.writeResource(CmsDbContext, CmsUUID, CmsResource, int)instead to write the complete file header.Please refer to the javadoc of
I_CmsVfsDriver.writeResource(CmsDbContext, CmsUUID, CmsResource, int)to read how setting resource state values affects the file state.- Specified by:
writeResourceStatein interfaceI_CmsVfsDriver- Parameters:
dbc- the current database contextproject- the current projectresource- the resource to be updatedchanged- determines whether the structure or resource state, or none of them, is set to "changed"isPublishing- if this method is called during publishing to version numbers are updated- Throws:
CmsDataAccessException- if something goes wrong- See Also:
-
checkWritePermissionsInFolder
protected void checkWritePermissionsInFolder(CmsDbContext dbc, CmsResource folder) throws CmsDataAccessException Checks that the current user has write permissions for all subresources of the given folder.- Parameters:
dbc- the current database contextfolder- the folder to check- Throws:
CmsDataAccessException- if something goes wrong
-
internalCountProperties
protected int internalCountProperties(CmsDbContext dbc, CmsPropertyDefinition propertyDefinition, CmsUUID projectId) throws CmsDataAccessException Returns the count of properties for a property definition.- Parameters:
dbc- the current database contextpropertyDefinition- the property definition to testprojectId- the ID of the current project- Returns:
- the amount of properties for a property definition
- Throws:
CmsDataAccessException- if something goes wrong
-
internalCreateCounter
protected void internalCreateCounter(CmsDbContext dbc, String name, int value) throws CmsDbSqlException Creates a new counter.- Parameters:
dbc- the database contextname- the name of the counter to createvalue- the inital value of the counter- Throws:
CmsDbSqlException- if something goes wrong
-
internalCreateUrlNameMappingEntry
protected CmsUrlNameMappingEntry internalCreateUrlNameMappingEntry(ResultSet resultSet) throws SQLException Creates an URL name mapping entry from a result set.- Parameters:
resultSet- a result set- Returns:
- the URL name mapping entry created from the result set
- Throws:
SQLException- if something goes wrong
-
internalIncrementCounter
Increments a counter.- Parameters:
dbc- the current db contextname- the name of the counter which should be incremented- Throws:
CmsDbSqlException- if something goes wrong
-
internalReadAlias
Helper method to create an alias object from a result set.- Parameters:
resultset- the result set- Returns:
- the alias object created from the result set
- Throws:
SQLException- if something goes wrong
-
internalReadCounter
Reads the current value of a counter.- Parameters:
dbc- the database contextname- the name of the counter- Returns:
- the current value of the counter, or null if the counter was not found
- Throws:
CmsDbSqlException- if something goes wrong
-
internalReadParentId
protected String internalReadParentId(CmsDbContext dbc, CmsUUID projectId, String resourcename) throws CmsDataAccessException Returns the parent id of the given resource.- Parameters:
dbc- the current database contextprojectId- the current project idresourcename- the resource name to read the parent id for- Returns:
- the parent id of the given resource
- Throws:
CmsDataAccessException- if something goes wrong
-
internalReadRelation
Creates a newCmsRelationobject from the given result set entry.- Parameters:
res- the result set- Returns:
- the new
CmsRelationobject - Throws:
SQLException- if something goes wrong
-
internalReadResourceState
protected CmsResourceState internalReadResourceState(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) throws CmsDbSqlException Returns the resource state of the given resource.- Parameters:
dbc- the database contextprojectId- the id of the projectresource- the resource to read the resource state for- Returns:
- the resource state of the given resource
- Throws:
CmsDbSqlException- if something goes wrong
-
internalReadStructureState
protected CmsResourceState internalReadStructureState(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) throws CmsDbSqlException Returns the structure state of the given resource.- Parameters:
dbc- the database contextprojectId- the id of the projectresource- the resource to read the structure state for- Returns:
- the structure state of the given resource
- Throws:
CmsDbSqlException- if something goes wrong
-
internalRemoveFolder
protected void internalRemoveFolder(CmsDbContext dbc, CmsProject currentProject, CmsResource resource) throws CmsDataAccessException Removes a resource physically in the database.- Parameters:
dbc- the current database contextcurrentProject- the current projectresource- the folder to remove- Throws:
CmsDataAccessException- if something goes wrong
-
internalUpdateVersions
protected void internalUpdateVersions(CmsDbContext dbc, CmsResource resource) throws CmsDataAccessException Updates the offline version numbers.- Parameters:
dbc- the current database contextresource- the resource to update the version number for- Throws:
CmsDataAccessException- if something goes wrong
-
internalValidateResourceLength
Validates that the length setting of a resource is always correct.Files need to have a resource length of >= 0, while folders require a resource length of -1.
- Parameters:
resource- the resource to check the length for- Throws:
CmsDataAccessException- if the resource length is not correct
-
moveRelations
protected void moveRelations(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId, String rootPath) throws CmsDataAccessException Moves all relations of a resource to the new path.- Parameters:
dbc- the current database contextprojectId- the id of the project to apply the changesstructureId- the structure id of the resource to apply the changes torootPath- the new root path- Throws:
CmsDataAccessException- if something goes wrong
-
prepareExpiredTimeRangeCondition
protected void prepareExpiredTimeRangeCondition(CmsUUID projectId, long startTime, long endTime, StringBuffer conditions, List<Object> params) Appends the appropriate selection criteria related with the expiration date.- Parameters:
projectId- the id of the project of the resourcesstartTime- the start timeendTime- the end timeconditions- buffer to append the selection criteriaparams- list to append the selection parameters
-
preparePathCondition
protected void preparePathCondition(CmsUUID projectId, String parent, int mode, StringBuffer conditions, List<Object> params) Appends the appropriate selection criteria related with the parentPath.- Parameters:
projectId- the id of the project of the resourcesparent- the parent path or UUID (if mode is C_READMODE_EXCLUDE_TREE)mode- the selection modeconditions- buffer to append the selection criteriaparams- list to append the selection parameters
-
prepareProjectCondition
protected void prepareProjectCondition(CmsUUID projectId, int mode, StringBuffer conditions, List<Object> params) Appends the appropriate selection criteria related with the projectId.- Parameters:
projectId- the id of the project of the resourcesmode- the selection modeconditions- buffer to append the selection criteriaparams- list to append the selection parameters
-
prepareRelationConditions
protected String prepareRelationConditions(CmsUUID projectId, CmsRelationFilter filter, CmsResource resource, List<Object> params, boolean checkSource) Build the whole WHERE sql statement part for the given relation filter.- Parameters:
projectId- the current project idfilter- the filterresource- the resource (may be null, if you want to delete all relations for the resource in the filter)params- the parameter values (return parameter)checkSource- if the query is for the source relations- Returns:
- the WHERE sql statement part string
-
prepareReleasedTimeRangeCondition
protected void prepareReleasedTimeRangeCondition(CmsUUID projectId, long startTime, long endTime, StringBuffer conditions, List<Object> params) Appends the appropriate selection criteria related with the released date.- Parameters:
projectId- the id of the projectstartTime- the start timeendTime- the stop timeconditions- buffer to append the selection criteriaparams- list to append the selection parameters
-
prepareResourceCondition
Appends the appropriate selection criteria related with the read mode.- Parameters:
projectId- the id of the project of the resourcesmode- the selection modeconditions- buffer to append the selection criteria
-
prepareStateCondition
protected void prepareStateCondition(CmsUUID projectId, CmsResourceState state, int mode, StringBuffer conditions, List<Object> params) Appends the appropriate selection criteria related with the resource state.- Parameters:
projectId- the id of the project of the resourcesstate- the resource statemode- the selection modeconditions- buffer to append the selection criteriaparams- list to append the selection parameters
-
prepareTimeRangeCondition
protected void prepareTimeRangeCondition(CmsUUID projectId, long startTime, long endTime, StringBuffer conditions, List<Object> params) Appends the appropriate selection criteria related with the date of the last modification.- Parameters:
projectId- the id of the project of the resourcesstartTime- start of the time rangeendTime- end of the time rangeconditions- buffer to append the selection criteriaparams- list to append the selection parameters
-
prepareTypeCondition
protected void prepareTypeCondition(CmsUUID projectId, int type, int mode, StringBuffer conditions, List<Object> params) Appends the appropriate selection criteria related with the resource type.- Parameters:
projectId- the id of the project of the resourcestype- the resource typemode- the selection modeconditions- buffer to append the selection criteriaparams- list to append the selection parameters
-
prepareTypesCondition
protected void prepareTypesCondition(CmsUUID projectId, List<Integer> types, int mode, StringBuffer conditions, List<Object> params) Appends the appropriate selection criteria related with the resource type.- Parameters:
projectId- the id of the project of the resourcestypes- the resource type id'smode- the selection modeconditions- buffer to append the selection criteriaparams- list to append the selection parameters
-
readTypesInResourceTree
protected List<CmsResource> readTypesInResourceTree(CmsDbContext dbc, CmsUUID projectId, String parentPath, List<Integer> types, CmsResourceState state, long lastModifiedAfter, long lastModifiedBefore, 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
CmsDriverManager.READMODE_EXCLUDE_TREEis true (orCmsDriverManager.READMODE_INCLUDE_TREEis false), the provided parent String must be the UUID of the parent folder, NOT the parent folder path.- Parameters:
dbc- the current database contextprojectId- the project id for matching resourcesparentPath- the path to the resource used as root of the searched subtree orCmsDriverManager.READ_IGNORE_PARENT,CmsDriverManager.READMODE_EXCLUDE_TREEmeans to read immediate children onlytypes- the resource types of matching resources ornull(meaning inverted byCmsDriverManager.READMODE_EXCLUDE_TYPEstate- the state of matching resources (meaning inverted byCmsDriverManager.READMODE_EXCLUDE_STATEornullto ignorelastModifiedAfter- the start of the time range for the last modification date of matching resources or READ_IGNORE_TIMElastModifiedBefore- the end of the time range for the last modification date of matching resources or READ_IGNORE_TIMEreleasedAfter- the start of the time range for the release date of matching resourcesreleasedBefore- the end of the time range for the release date of matching resourcesexpiredAfter- the start of the time range for the expire date of matching resourcesexpiredBefore- the end of the time range for the expire date of matching resourcesmode- additional mode flags:- Returns:
- a list of CmsResource objects matching the given criteria
- Throws:
CmsDataAccessException- if something goes wrong
-
repairBrokenRelations
protected void repairBrokenRelations(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId, String rootPath) throws CmsDataAccessException Repairs broken links.When a resource is created any relation pointing to it is updated to use the right id.
- Parameters:
dbc- the current database contextprojectId- the project idstructureId- the structure id of the resource that may help to repair broken linksrootPath- the path of the resource that may help to repair broken links- Throws:
CmsDataAccessException- if something goes wrong
-
updateBrokenRelations
protected void updateBrokenRelations(CmsDbContext dbc, CmsUUID projectId, String rootPath) throws CmsDataAccessException Updates broken links.When a resource is deleted, then the relations pointing to the deleted resource are set to the null uuid.
- Parameters:
dbc- the current database contextprojectId- the project idrootPath- the root path of the resource that has been deleted- Throws:
CmsDataAccessException- if something goes wrong
-
wrapException
Wrap a SQL exception into a CmsDbSqlException.- Parameters:
stmt- the used statemente- the exception- Returns:
- the CmsDbSqlException
-