| java.lang.Object org.opencms.db.generic.CmsVfsDriver
All known Subclasses: org.opencms.db.oracle.CmsVfsDriver, org.opencms.db.hsqldb.CmsVfsDriver, org.opencms.db.mssql.CmsVfsDriver, org.opencms.db.db2.CmsVfsDriver, org.opencms.db.postgresql.CmsVfsDriver, org.opencms.db.mysql.CmsVfsDriver, org.opencms.db.as400.CmsVfsDriver,
CmsVfsDriver | public class CmsVfsDriver implements I_CmsDriver,I_CmsVfsDriver(Code) | | Generic (ANSI-SQL) database server implementation of the VFS driver methods.
author: Thomas Weckert author: Michael Emmerich version: $Revision: 1.276 $ since: 6.0.0 |
Method Summary | |
protected void | checkWritePermissionsInFolder(CmsDbContext dbc, CmsResource folder) | public int | countSiblings(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId) | public void | createContent(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId, byte[] content) | public CmsFile | createFile(ResultSet res, CmsUUID projectId) | public CmsFile | createFile(ResultSet res, CmsUUID projectId, boolean hasFileContentInResultSet) | public CmsFolder | createFolder(ResultSet res, CmsUUID projectId, boolean hasProjectIdInResultSet) | public void | createOnlineContent(CmsDbContext dbc, CmsUUID resourceId, byte[] contents, int publishTag, boolean keepOnline, boolean needToUpdateContent) | public CmsPropertyDefinition | createPropertyDefinition(CmsDbContext dbc, CmsUUID projectId, String name, CmsPropertyDefinition.CmsPropertyType type) | public void | createRelation(CmsDbContext dbc, CmsUUID projectId, CmsRelation relation) | public CmsResource | createResource(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, byte[] content) | public CmsResource | createResource(ResultSet res, CmsUUID projectId) | public void | createSibling(CmsDbContext dbc, CmsProject project, CmsResource resource) | public void | deletePropertyDefinition(CmsDbContext dbc, CmsPropertyDefinition metadef) | public void | deletePropertyObjects(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, int deleteOption) | public void | deleteRelations(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, CmsRelationFilter filter) | public void | destroy() | protected String | escapeDbWildcard(String path) | public CmsSqlManager | getSqlManager() | public void | init(CmsDbContext dbc, CmsConfigurationManager configurationManager, List successiveDrivers, CmsDriverManager driverManager) | public org.opencms.db.generic.CmsSqlManager | initSqlManager(String classname) | protected int | internalCountProperties(CmsDbContext dbc, CmsPropertyDefinition propertyDefinition, CmsUUID projectId) | protected String | internalReadParentId(CmsDbContext dbc, CmsUUID projectId, String resourcename) | protected CmsRelation | internalReadRelation(ResultSet res) | protected CmsResourceState | internalReadResourceState(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) | protected CmsResourceState | internalReadStructureState(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) | protected void | internalRemoveFolder(CmsDbContext dbc, CmsProject currentProject, CmsResource resource) | protected void | internalUpdateVersions(CmsDbContext dbc, CmsResource resource) | protected void | internalValidateResourceLength(CmsResource resource) | protected void | moveRelations(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId, String rootPath) | public void | moveResource(CmsDbContext dbc, CmsUUID projectId, CmsResource source, String destinationPath) | protected void | prepareExpiredTimeRangeCondition(CmsUUID projectId, long startTime, long endTime, StringBuffer conditions, List params) | protected void | preparePathCondition(CmsUUID projectId, String parent, int mode, StringBuffer conditions, List params) | protected void | prepareProjectCondition(CmsUUID projectId, int mode, StringBuffer conditions, List params) | protected String | prepareRelationConditions(CmsUUID projectId, CmsRelationFilter filter, CmsResource resource, List params, boolean checkSource) | protected void | prepareReleasedTimeRangeCondition(CmsUUID projectId, long startTime, long endTime, StringBuffer conditions, List params) | protected void | prepareResourceCondition(CmsUUID projectId, int mode, StringBuffer conditions) | protected void | prepareStateCondition(CmsUUID projectId, CmsResourceState state, int mode, StringBuffer conditions, List params) | protected void | prepareTimeRangeCondition(CmsUUID projectId, long startTime, long endTime, StringBuffer conditions, List params) | protected void | prepareTypeCondition(CmsUUID projectId, int type, int mode, StringBuffer conditions, List params) | public void | publishResource(CmsDbContext dbc, CmsProject onlineProject, CmsResource onlineResource, CmsResource offlineResource) | public void | publishVersions(CmsDbContext dbc, CmsResource resource, boolean firstSibling) | public List | readChildResources(CmsDbContext dbc, CmsProject currentProject, CmsResource resource, boolean getFolders, boolean getFiles) | public byte[] | readContent(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId) | public CmsFolder | readFolder(CmsDbContext dbc, CmsUUID projectId, CmsUUID folderId) | public CmsFolder | readFolder(CmsDbContext dbc, CmsUUID projectId, String folderPath) | public CmsFolder | readParentFolder(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId) | public CmsPropertyDefinition | readPropertyDefinition(CmsDbContext dbc, String name, CmsUUID projectId) | public List | readPropertyDefinitions(CmsDbContext dbc, CmsUUID projectId) | public CmsProperty | readPropertyObject(CmsDbContext dbc, String key, CmsProject project, CmsResource resource) | public List | readPropertyObjects(CmsDbContext dbc, CmsProject project, CmsResource resource) | public List | readRelations(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, CmsRelationFilter filter) | public CmsResource | readResource(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId, boolean includeDeleted) | public CmsResource | readResource(CmsDbContext dbc, CmsUUID projectId, String path, boolean includeDeleted) | public List | 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) | public List | readResources(CmsDbContext dbc, CmsUUID projectId, CmsResourceState state, int mode) | public List | readResourcesForPrincipalACE(CmsDbContext dbc, CmsProject project, CmsUUID principalId) | public List | readResourcesForPrincipalAttr(CmsDbContext dbc, CmsProject project, CmsUUID principalId) | public List | readResourcesWithProperty(CmsDbContext dbc, CmsUUID projectId, CmsUUID propertyDef, String path, String value) | public List | readSiblings(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, boolean includeDeleted) | public Map | readVersions(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId, CmsUUID structureId) | public void | removeFile(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) | public void | removeFolder(CmsDbContext dbc, CmsProject currentProject, CmsResource resource) | protected void | repairBrokenRelations(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId, String rootPath) | public void | replaceResource(CmsDbContext dbc, CmsResource newResource, byte[] resContent, int newResourceType) | public void | transferResource(CmsDbContext dbc, CmsProject project, CmsResource resource, CmsUUID createdUser, CmsUUID lastModifiedUser) | protected void | updateBrokenRelations(CmsDbContext dbc, CmsUUID projectId, String rootPath) | public void | updateRelations(CmsDbContext dbc, CmsProject onlineProject, CmsResource offlineResource) | public boolean | validateResourceIdExists(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId) | public boolean | validateStructureIdExists(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId) | public void | writeContent(CmsDbContext dbc, CmsUUID resourceId, byte[] content) | public void | writeLastModifiedProjectId(CmsDbContext dbc, CmsProject project, CmsUUID projectId, CmsResource resource) | public void | writePropertyObject(CmsDbContext dbc, CmsProject project, CmsResource resource, CmsProperty property) | public void | writePropertyObjects(CmsDbContext dbc, CmsProject project, CmsResource resource, List properties) | public void | writeResource(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, int changed) | public void | writeResourceState(CmsDbContext dbc, CmsProject project, CmsResource resource, int changed, boolean isPublishing) |
checkWritePermissionsInFolder | protected void checkWritePermissionsInFolder(CmsDbContext dbc, CmsResource folder) throws CmsDataAccessException(Code) | | Checks that the current user has write permissions for all subresources of the given folder.
Parameters: dbc - the current database context Parameters: folder - the folder to check throws: CmsDataAccessException - if something goes wrong |
countSiblings | public int countSiblings(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId) throws CmsDataAccessException(Code) | | Counts the number of siblings of a resource.
Parameters: dbc - the current database context Parameters: projectId - the current project id Parameters: resourceId - the resource id to count the number of siblings from number of siblings throws: CmsDataAccessException - if something goes wrong |
escapeDbWildcard | protected String escapeDbWildcard(String path)(Code) | | 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:
Parameters: path - the resource path the escaped resource path |
internalCountProperties | protected int internalCountProperties(CmsDbContext dbc, CmsPropertyDefinition propertyDefinition, CmsUUID projectId) throws CmsDataAccessException(Code) | | Returns the count of properties for a property definition.
Parameters: dbc - the current database context Parameters: propertyDefinition - the property definition to test Parameters: projectId - the ID of the current project the amount of properties for a property definition throws: CmsDataAccessException - if something goes wrong |
internalReadParentId | protected String internalReadParentId(CmsDbContext dbc, CmsUUID projectId, String resourcename) throws CmsDataAccessException(Code) | | Returns the parent id of the given resource.
Parameters: dbc - the current database context Parameters: projectId - the current project id Parameters: resourcename - the resource name to read the parent id for the parent id of the given resource throws: CmsDataAccessException - if something goes wrong |
internalReadResourceState | protected CmsResourceState internalReadResourceState(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) throws CmsDbSqlException(Code) | | Returns the resource state of the given resource.
Parameters: dbc - the database context Parameters: projectId - the id of the project Parameters: resource - the resource to read the resource state for 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(Code) | | Returns the structure state of the given resource.
Parameters: dbc - the database context Parameters: projectId - the id of the project Parameters: resource - the resource to read the structure state for the structure state of the given resource throws: CmsDbSqlException - if something goes wrong |
internalValidateResourceLength | protected void internalValidateResourceLength(CmsResource resource) throws CmsDataAccessException(Code) | | 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(Code) | | Moves all relations of a resource to the new path.
Parameters: dbc - the current database context Parameters: projectId - the id of the project to apply the changes Parameters: structureId - the structure id of the resource to apply the changes to Parameters: rootPath - the new root path throws: CmsDataAccessException - if something goes wrong |
prepareExpiredTimeRangeCondition | protected void prepareExpiredTimeRangeCondition(CmsUUID projectId, long startTime, long endTime, StringBuffer conditions, List params)(Code) | | Appends the appropriate selection criteria related with the expiration date.
Parameters: projectId - the id of the project of the resources Parameters: startTime - the start time Parameters: endTime - the end time Parameters: conditions - buffer to append the selection criteria Parameters: params - list to append the selection parameters |
preparePathCondition | protected void preparePathCondition(CmsUUID projectId, String parent, int mode, StringBuffer conditions, List params)(Code) | | Appends the appropriate selection criteria related with the parentPath.
Parameters: projectId - the id of the project of the resources Parameters: parent - the parent path or UUID (if mode is C_READMODE_EXCLUDE_TREE) Parameters: mode - the selection mode Parameters: conditions - buffer to append the selection criteria Parameters: params - list to append the selection parameters |
prepareProjectCondition | protected void prepareProjectCondition(CmsUUID projectId, int mode, StringBuffer conditions, List params)(Code) | | Appends the appropriate selection criteria related with the projectId.
Parameters: projectId - the id of the project of the resources Parameters: mode - the selection mode Parameters: conditions - buffer to append the selection criteria Parameters: params - list to append the selection parameters |
prepareRelationConditions | protected String prepareRelationConditions(CmsUUID projectId, CmsRelationFilter filter, CmsResource resource, List params, boolean checkSource)(Code) | | Build the whole WHERE sql statement part for the given relation filter.
Parameters: projectId - the current project id Parameters: filter - the filter Parameters: resource - the resource (may be null, if you want to delete all relations for the resource in the filter) Parameters: params - the parameter values (return parameter) Parameters: checkSource - if the query is for the source relations the WHERE sql statement part string |
prepareReleasedTimeRangeCondition | protected void prepareReleasedTimeRangeCondition(CmsUUID projectId, long startTime, long endTime, StringBuffer conditions, List params)(Code) | | Appends the appropriate selection criteria related with the released date.
Parameters: projectId - the id of the project Parameters: startTime - the start time Parameters: endTime - the stop time Parameters: conditions - buffer to append the selection criteria Parameters: params - list to append the selection parameters |
prepareResourceCondition | protected void prepareResourceCondition(CmsUUID projectId, int mode, StringBuffer conditions)(Code) | | Appends the appropriate selection criteria related with the read mode.
Parameters: projectId - the id of the project of the resources Parameters: mode - the selection mode Parameters: conditions - buffer to append the selection criteria |
prepareStateCondition | protected void prepareStateCondition(CmsUUID projectId, CmsResourceState state, int mode, StringBuffer conditions, List params)(Code) | | Appends the appropriate selection criteria related with the resource state.
Parameters: projectId - the id of the project of the resources Parameters: state - the resource state Parameters: mode - the selection mode Parameters: conditions - buffer to append the selection criteria Parameters: params - list to append the selection parameters |
prepareTimeRangeCondition | protected void prepareTimeRangeCondition(CmsUUID projectId, long startTime, long endTime, StringBuffer conditions, List params)(Code) | | Appends the appropriate selection criteria related with the date of the last modification.
Parameters: projectId - the id of the project of the resources Parameters: startTime - start of the time range Parameters: endTime - end of the time range Parameters: conditions - buffer to append the selection criteria Parameters: params - list to append the selection parameters |
prepareTypeCondition | protected void prepareTypeCondition(CmsUUID projectId, int type, int mode, StringBuffer conditions, List params)(Code) | | Appends the appropriate selection criteria related with the resource type.
Parameters: projectId - the id of the project of the resources Parameters: type - the resource type Parameters: mode - the selection mode Parameters: conditions - buffer to append the selection criteria Parameters: params - list to append the selection parameters |
readResourceTree | public List 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(Code) | | See Also: org.opencms.db.I_CmsVfsDriver.readResourceTree(org.opencms.db.CmsDbContextCmsUUIDjava.lang.StringintCmsResourceStatelonglonglonglonglonglongint) |
repairBrokenRelations | protected void repairBrokenRelations(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId, String rootPath) throws CmsDataAccessException(Code) | | 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 context Parameters: projectId - the project id Parameters: structureId - the structure id of the resource that may help to repair broken links Parameters: rootPath - 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(Code) | | 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 context Parameters: projectId - the project id Parameters: rootPath - the root path of the resource that has been deleted throws: CmsDataAccessException - if something goes wrong |
|
|