org.opencms.db.generic
public class CmsVfsDriver extends java.lang.Object implements I_CmsDriver, I_CmsVfsDriver
Modifier and Type | Field and Description |
---|---|
protected CmsDriverManager |
m_driverManager
The driver manager.
|
protected java.util.List<CmsUUID> |
m_resOp
This field is temporarily used to compute the versions during publishing.
|
protected CmsSqlManager |
m_sqlManager
The sql manager.
|
protected static java.lang.String |
OFFLINE
Contains the macro replacement value for the offline project.
|
protected static java.lang.String |
ONLINE
Contains the macro replacement value for the online project.
|
AND_CONDITION, BEGIN_CONDITION, BEGIN_EXCLUDE_CONDITION, BEGIN_INCLUDE_CONDITION, END_CONDITION, OR_CONDITION
DRIVER_TYPE_ID, REQ_ATTR_CHECK_PERMISSIONS, REQ_ATTR_RESOURCE_OUS
Constructor and Description |
---|
CmsVfsDriver() |
Modifier and Type | Method and Description |
---|---|
void |
addUrlNameMappingEntry(CmsDbContext dbc,
boolean online,
CmsUrlNameMappingEntry entry)
Adds a new URL name mapping entry.
|
protected void |
checkWritePermissionsInFolder(CmsDbContext dbc,
CmsResource folder)
Checks that the current user has write permissions for all subresources of the given folder.
|
int |
countSiblings(CmsDbContext dbc,
CmsUUID projectId,
CmsUUID resourceId)
Counts the number of siblings of a resource.
|
void |
createContent(CmsDbContext dbc,
CmsUUID projectId,
CmsUUID resourceId,
byte[] content)
Creates a content entry for the resource identified by the specified resource id.
|
CmsFile |
createFile(java.sql.ResultSet res,
CmsUUID projectId)
Creates a
CmsFile instance from a JDBC ResultSet. |
CmsFile |
createFile(java.sql.ResultSet res,
CmsUUID projectId,
boolean hasFileContentInResultSet)
Creates a
CmsFile instance from a JDBC ResultSet. |
CmsFolder |
createFolder(java.sql.ResultSet res,
CmsUUID projectId,
boolean hasProjectIdInResultSet)
Creates a
CmsFolder instance from a JDBC ResultSet. |
void |
createOnlineContent(CmsDbContext dbc,
CmsUUID resourceId,
byte[] contents,
int publishTag,
boolean keepOnline,
boolean needToUpdateContent)
Creates a new content in the offline project.
|
CmsPropertyDefinition |
createPropertyDefinition(CmsDbContext dbc,
CmsUUID projectId,
java.lang.String name,
CmsPropertyDefinition.CmsPropertyType type)
Creates a new property definition in the database.
|
void |
createRelation(CmsDbContext dbc,
CmsUUID projectId,
CmsRelation relation)
Creates a new
CmsRelation object in the database. |
CmsResource |
createResource(CmsDbContext dbc,
CmsUUID projectId,
CmsResource resource,
byte[] content)
Creates a new resource from a given
CmsResource object. |
CmsResource |
createResource(java.sql.ResultSet res,
CmsUUID 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 |
deleteAliases(CmsDbContext dbc,
CmsProject project,
CmsAliasFilter filter)
Deletes the aliases matching a given filter.
|
void |
deletePropertyDefinition(CmsDbContext dbc,
CmsPropertyDefinition metadef)
Deletes a property definition.
|
void |
deletePropertyObjects(CmsDbContext dbc,
CmsUUID projectId,
CmsResource resource,
int deleteOption)
Deletes all property values of a file or folder.
|
void |
deleteRelations(CmsDbContext dbc,
CmsUUID projectId,
CmsResource resource,
CmsRelationFilter filter)
Deletes all relations with the given filter for the given resource.
|
void |
deleteRewriteAliases(CmsDbContext dbc,
CmsRewriteAliasFilter filter)
Deletes rewrite aliases matching a given filter.
|
void |
deleteUrlNameMappingEntries(CmsDbContext dbc,
boolean online,
CmsUrlNameMappingFilter filter)
Deletes the URL name mapping entries which match a given filter.
|
void |
destroy()
Destroys this driver.
|
protected static java.lang.String |
escapeDbWildcard(java.lang.String path)
Escapes the database wildcards within the resource path.
|
java.util.List<CmsOrganizationalUnit> |
getResourceOus(CmsDbContext dbc,
CmsUUID projectId,
CmsResource resource)
Returns all organizational units for the given resource.
|
CmsSqlManager |
getSqlManager()
Returns the SqlManager of this driver.
|
int |
incrementCounter(CmsDbContext dbc,
java.lang.String name)
Gets the current value of a counter, creates it if it doesn't already exist, and increments it.
|
void |
init(CmsDbContext dbc,
CmsConfigurationManager configurationManager,
java.util.List<java.lang.String> successiveDrivers,
CmsDriverManager driverManager)
Initializes the driver.
|
CmsSqlManager |
initSqlManager(java.lang.String classname)
Initializes the SQL manager for this driver.
|
void |
insertAlias(CmsDbContext dbc,
CmsProject project,
CmsAlias alias)
Adds an alias to the database.
|
void |
insertRewriteAliases(CmsDbContext dbc,
java.util.Collection<CmsRewriteAlias> rewriteAliases)
Adds a list of rewrite aliases.
|
protected int |
internalCountProperties(CmsDbContext dbc,
CmsPropertyDefinition propertyDefinition,
CmsUUID projectId)
Returns the count of properties for a property definition.
|
protected void |
internalCreateCounter(CmsDbContext dbc,
java.lang.String name,
int value)
Creates a new counter.
|
protected CmsUrlNameMappingEntry |
internalCreateUrlNameMappingEntry(java.sql.ResultSet resultSet)
Creates an URL name mapping entry from a result set.
|
protected void |
internalIncrementCounter(CmsDbContext dbc,
java.lang.String name)
Increments a counter.
|
protected CmsAlias |
internalReadAlias(java.sql.ResultSet resultset)
Helper method to create an alias object from a result set.
|
protected java.lang.Integer |
internalReadCounter(CmsDbContext dbc,
java.lang.String name)
Reads the current value of a counter.
|
protected java.lang.String |
internalReadParentId(CmsDbContext dbc,
CmsUUID projectId,
java.lang.String resourcename)
Returns the parent id of the given resource.
|
protected CmsRelation |
internalReadRelation(java.sql.ResultSet res)
Creates a new
CmsRelation object from the given result set entry. |
protected CmsResourceState |
internalReadResourceState(CmsDbContext dbc,
CmsUUID projectId,
CmsResource resource)
Returns the resource state of the given resource.
|
protected CmsResourceState |
internalReadStructureState(CmsDbContext dbc,
CmsUUID projectId,
CmsResource resource)
Returns the structure state of the given resource.
|
protected void |
internalRemoveFolder(CmsDbContext dbc,
CmsProject currentProject,
CmsResource resource)
Removes a resource physically in the database.
|
protected void |
internalUpdateVersions(CmsDbContext dbc,
CmsResource resource)
Updates the offline version numbers.
|
protected void |
internalValidateResourceLength(CmsResource resource)
Validates that the length setting of a resource is always correct.
|
protected void |
moveRelations(CmsDbContext dbc,
CmsUUID projectId,
CmsUUID structureId,
java.lang.String rootPath)
Moves all relations of a resource to the new path.
|
void |
moveResource(CmsDbContext dbc,
CmsUUID projectId,
CmsResource source,
java.lang.String destinationPath)
Moves the given resource to the specified destination path.
|
protected void |
prepareExpiredTimeRangeCondition(CmsUUID projectId,
long startTime,
long endTime,
java.lang.StringBuffer conditions,
java.util.List<java.lang.Object> params)
Appends the appropriate selection criteria related with the expiration date.
|
protected void |
preparePathCondition(CmsUUID projectId,
java.lang.String parent,
int mode,
java.lang.StringBuffer conditions,
java.util.List<java.lang.Object> params)
Appends the appropriate selection criteria related with the parentPath.
|
protected void |
prepareProjectCondition(CmsUUID projectId,
int mode,
java.lang.StringBuffer conditions,
java.util.List<java.lang.Object> params)
Appends the appropriate selection criteria related with the projectId.
|
protected java.lang.String |
prepareRelationConditions(CmsUUID projectId,
CmsRelationFilter filter,
CmsResource resource,
java.util.List<java.lang.Object> params,
boolean checkSource)
Build the whole WHERE sql statement part for the given relation filter.
|
protected void |
prepareReleasedTimeRangeCondition(CmsUUID projectId,
long startTime,
long endTime,
java.lang.StringBuffer conditions,
java.util.List<java.lang.Object> params)
Appends the appropriate selection criteria related with the released date.
|
protected void |
prepareResourceCondition(CmsUUID projectId,
int mode,
java.lang.StringBuffer conditions)
Appends the appropriate selection criteria related with the read mode.
|
protected void |
prepareStateCondition(CmsUUID projectId,
CmsResourceState state,
int mode,
java.lang.StringBuffer conditions,
java.util.List<java.lang.Object> params)
Appends the appropriate selection criteria related with the resource state.
|
protected void |
prepareTimeRangeCondition(CmsUUID projectId,
long startTime,
long endTime,
java.lang.StringBuffer conditions,
java.util.List<java.lang.Object> params)
Appends the appropriate selection criteria related with the date of the last modification.
|
protected void |
prepareTypeCondition(CmsUUID projectId,
int type,
int mode,
java.lang.StringBuffer conditions,
java.util.List<java.lang.Object> params)
Appends the appropriate selection criteria related with the resource type.
|
protected void |
prepareTypesCondition(CmsUUID projectId,
java.util.List<java.lang.Integer> types,
int mode,
java.lang.StringBuffer conditions,
java.util.List<java.lang.Object> params)
Appends the appropriate selection criteria related with the resource type.
|
static CmsPair<java.lang.String,java.util.List<I_CmsPreparedStatementParameter>> |
prepareUrlNameMappingConditions(CmsUrlNameMappingFilter filter)
This method prepares the SQL conditions for mapping entries for a given URL name mapping filter.
|
void |
publishResource(CmsDbContext dbc,
CmsProject onlineProject,
CmsResource onlineResource,
CmsResource offlineResource)
Publishes the structure and resource records of an
offline resource into it's online counterpart.
|
void |
publishVersions(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.
|
java.util.List<CmsAlias> |
readAliases(CmsDbContext dbc,
CmsProject project,
CmsAliasFilter filter)
Reads the aliases matching a given filter.
|
java.util.List<CmsResource> |
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.
|
CmsFolder |
readFolder(CmsDbContext dbc,
CmsUUID projectId,
CmsUUID folderId)
Reads a folder specified by it's structure ID.
|
CmsFolder |
readFolder(CmsDbContext dbc,
CmsUUID projectId,
java.lang.String folderPath)
Reads a folder specified by it's resource name.
|
CmsFolder |
readParentFolder(CmsDbContext dbc,
CmsUUID projectId,
CmsUUID structureId)
Reads the parent folder of a resource specified by it's structure ID.
|
CmsPropertyDefinition |
readPropertyDefinition(CmsDbContext dbc,
java.lang.String name,
CmsUUID projectId)
Reads a property definition for the specified resource type.
|
java.util.List<CmsPropertyDefinition> |
readPropertyDefinitions(CmsDbContext dbc,
CmsUUID 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<CmsProperty> |
readPropertyObjects(CmsDbContext dbc,
CmsProject project,
CmsResource resource)
Reads all property objects mapped to a specified resource from the database.
|
java.util.List<CmsRelation> |
readRelations(CmsDbContext dbc,
CmsUUID projectId,
CmsResource resource,
CmsRelationFilter filter)
Reads all relations with the given filter for the given resource.
|
CmsResource |
readResource(CmsDbContext dbc,
CmsUUID projectId,
CmsUUID structureId,
boolean includeDeleted)
Reads a resource specified by it's structure ID.
|
CmsResource |
readResource(CmsDbContext dbc,
CmsUUID projectId,
java.lang.String path,
boolean includeDeleted)
Reads a resource specified by it's resource name.
|
java.util.List<CmsResource> |
readResources(CmsDbContext dbc,
CmsUUID projectId,
CmsResourceState state,
int mode)
Reads all resources inside a given project and with a given state.
|
java.util.List<CmsResource> |
readResourcesForPrincipalACE(CmsDbContext dbc,
CmsProject project,
CmsUUID principalId)
Returns all resources associated to a given principal via an ACE.
|
java.util.List<CmsResource> |
readResourcesForPrincipalAttr(CmsDbContext dbc,
CmsProject project,
CmsUUID principalId)
Returns all resources associated to a given principal through some of following attributes.
|
java.util.List<CmsResource> |
readResourcesWithProperty(CmsDbContext dbc,
CmsUUID projectId,
CmsUUID propertyDef,
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<CmsResource> |
readResourceTree(CmsDbContext dbc,
CmsUUID projectId,
java.lang.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.
|
java.util.List<CmsRewriteAlias> |
readRewriteAliases(CmsDbContext dbc,
CmsRewriteAliasFilter filter)
Reads the rewrite aliases matching a given filter.
|
java.util.List<CmsResource> |
readSiblings(CmsDbContext dbc,
CmsUUID projectId,
CmsResource resource,
boolean includeDeleted)
Reads all siblings that point to the resource record of a specified resource.
|
protected java.util.List<CmsResource> |
readTypesInResourceTree(CmsDbContext dbc,
CmsUUID projectId,
java.lang.String parentPath,
java.util.List<java.lang.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.
|
java.util.List<CmsUrlNameMappingEntry> |
readUrlNameMappingEntries(CmsDbContext dbc,
boolean online,
CmsUrlNameMappingFilter filter)
Reads the URL name mapping entries which match a given filter.
|
java.util.Map<java.lang.String,java.lang.Integer> |
readVersions(CmsDbContext dbc,
CmsUUID projectId,
CmsUUID resourceId,
CmsUUID structureId)
Reads a resource version numbers.
|
void |
removeFile(CmsDbContext dbc,
CmsUUID projectId,
CmsResource resource)
Removes a file physically in the database.
|
void |
removeFolder(CmsDbContext dbc,
CmsProject currentProject,
CmsResource resource)
Removes a folder physically in the database.
|
protected void |
repairBrokenRelations(CmsDbContext dbc,
CmsUUID projectId,
CmsUUID structureId,
java.lang.String rootPath)
Repairs broken links.
|
void |
replaceResource(CmsDbContext dbc,
CmsResource newResource,
byte[] resContent,
int newResourceType)
Replaces the content and properties of an existing resource.
|
void |
setDriverManager(CmsDriverManager driverManager)
Sets the driver manager for this driver if possible.
|
void |
setSqlManager(CmsSqlManager sqlManager)
Sets the SQL manager for this driver if possible.
|
void |
transferResource(CmsDbContext dbc,
CmsProject project,
CmsResource resource,
CmsUUID createdUser,
CmsUUID lastModifiedUser)
Transfers the attributes of a resource from to the given users.
|
protected void |
updateBrokenRelations(CmsDbContext dbc,
CmsUUID projectId,
java.lang.String rootPath)
Updates broken links.
|
void |
updateRelations(CmsDbContext dbc,
CmsProject onlineProject,
CmsResource offlineResource)
Updates the relations on the online project copying the relations from the offline project.
|
boolean |
validateResourceIdExists(CmsDbContext dbc,
CmsUUID projectId,
CmsUUID resourceId)
Validates if the specified resource ID in the tables of the specified project {offline|online} exists.
|
boolean |
validateStructureIdExists(CmsDbContext dbc,
CmsUUID projectId,
CmsUUID structureId)
Validates if the specified structure ID in the tables of the specified project {offline|online} exists.
|
protected CmsDbSqlException |
wrapException(java.sql.PreparedStatement stmt,
java.sql.SQLException e)
Wrap a SQL exception into a CmsDbSqlException.
|
void |
writeContent(CmsDbContext dbc,
CmsUUID resourceId,
byte[] content)
Writes the resource content with the specified resource id.
|
void |
writeLastModifiedProjectId(CmsDbContext dbc,
CmsProject project,
CmsUUID 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<CmsProperty> properties)
Writes a list of property objects to the database mapped to a specified resource.
|
void |
writeResource(CmsDbContext dbc,
CmsUUID projectId,
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,
boolean isPublishing)
Writes file state in either the structure or resource record, or both of them.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
toString
protected static final java.lang.String OFFLINE
protected static final java.lang.String ONLINE
protected CmsDriverManager m_driverManager
protected java.util.List<CmsUUID> m_resOp
protected CmsSqlManager m_sqlManager
public static CmsPair<java.lang.String,java.util.List<I_CmsPreparedStatementParameter>> prepareUrlNameMappingConditions(CmsUrlNameMappingFilter filter)
filter
- the filter from which the SQL conditions should be generatedprotected static java.lang.String escapeDbWildcard(java.lang.String 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:
path
- the resource pathpublic void addUrlNameMappingEntry(CmsDbContext dbc, boolean online, CmsUrlNameMappingEntry entry) throws CmsDataAccessException
I_CmsVfsDriver
addUrlNameMappingEntry
in interface I_CmsVfsDriver
dbc
- the current database contextonline
- if true, writes to the online tables, else to the offline tablesentry
- the entry to addCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.addUrlNameMappingEntry(org.opencms.db.CmsDbContext, boolean, org.opencms.db.urlname.CmsUrlNameMappingEntry)
public int countSiblings(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId) throws CmsDataAccessException
countSiblings
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the current project idresourceId
- the resource id to count the number of siblings fromCmsDataAccessException
- if something goes wrongpublic void createContent(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId, byte[] content) throws CmsDataAccessException
I_CmsVfsDriver
createContent
in interface I_CmsVfsDriver
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 writeCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.createContent(CmsDbContext, CmsUUID, CmsUUID, byte[])
public CmsFile createFile(java.sql.ResultSet res, CmsUUID projectId) throws java.sql.SQLException
I_CmsVfsDriver
CmsFile
instance from a JDBC ResultSet.createFile
in interface I_CmsVfsDriver
res
- the JDBC ResultSetprojectId
- the project idjava.sql.SQLException
- in case the result set does not include a requested table attributeI_CmsVfsDriver.createFile(java.sql.ResultSet, CmsUUID)
public CmsFile createFile(java.sql.ResultSet res, CmsUUID projectId, boolean hasFileContentInResultSet) throws java.sql.SQLException
I_CmsVfsDriver
CmsFile
instance from a JDBC ResultSet.createFile
in interface I_CmsVfsDriver
res
- the JDBC ResultSetprojectId
- the project idhasFileContentInResultSet
- flag to include the file contentjava.sql.SQLException
- in case the result set does not include a requested table attributeI_CmsVfsDriver.createFile(java.sql.ResultSet, CmsUUID, boolean)
public CmsFolder createFolder(java.sql.ResultSet res, CmsUUID projectId, boolean hasProjectIdInResultSet) throws java.sql.SQLException
I_CmsVfsDriver
CmsFolder
instance from a JDBC ResultSet.createFolder
in interface I_CmsVfsDriver
res
- the JDBC ResultSetprojectId
- the ID of the current projecthasProjectIdInResultSet
- true if the SQL select query includes the PROJECT_ID table attributejava.sql.SQLException
- in case the result set does not include a requested table attributeI_CmsVfsDriver.createFolder(java.sql.ResultSet, CmsUUID, boolean)
public void createOnlineContent(CmsDbContext dbc, CmsUUID resourceId, byte[] contents, int publishTag, boolean keepOnline, boolean needToUpdateContent) throws CmsDataAccessException
I_CmsVfsDriver
createOnlineContent
in interface I_CmsVfsDriver
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 updatedCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.createOnlineContent(org.opencms.db.CmsDbContext, org.opencms.util.CmsUUID, byte[], int, boolean, boolean)
public CmsPropertyDefinition createPropertyDefinition(CmsDbContext dbc, CmsUUID projectId, java.lang.String name, CmsPropertyDefinition.CmsPropertyType type) throws CmsDataAccessException
I_CmsVfsDriver
createPropertyDefinition
in interface I_CmsVfsDriver
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 definitionCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.createPropertyDefinition(org.opencms.db.CmsDbContext, org.opencms.util.CmsUUID, java.lang.String, org.opencms.file.CmsPropertyDefinition.CmsPropertyType)
public void createRelation(CmsDbContext dbc, CmsUUID projectId, CmsRelation relation) throws CmsDataAccessException
I_CmsVfsDriver
CmsRelation
object in the database.createRelation
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the id of the project to execute the query inrelation
- the relation to createCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.createRelation(org.opencms.db.CmsDbContext, CmsUUID, org.opencms.relations.CmsRelation)
public CmsResource createResource(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, byte[] content) throws CmsDataAccessException
I_CmsVfsDriver
CmsResource
object.This method works for both files and folders. Existing resources get overwritten.
createResource
in interface I_CmsVfsDriver
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 folderCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.createResource(org.opencms.db.CmsDbContext, CmsUUID, org.opencms.file.CmsResource, byte[])
public CmsResource createResource(java.sql.ResultSet res, CmsUUID projectId) throws java.sql.SQLException
I_CmsVfsDriver
createResource
in interface I_CmsVfsDriver
res
- the JDBC ResultSetprojectId
- the ID of the current project to adjust the modification date in case the resource is a VFS linkjava.sql.SQLException
- in case the result set does not include a requested table attributeI_CmsVfsDriver.createResource(java.sql.ResultSet, CmsUUID)
public void createSibling(CmsDbContext dbc, CmsProject project, CmsResource resource) throws CmsDataAccessException
I_CmsVfsDriver
createSibling
in interface I_CmsVfsDriver
dbc
- the current database contextproject
- the project where to create the linkresource
- the link prototypeCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.createSibling(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.file.CmsResource)
public void deleteAliases(CmsDbContext dbc, CmsProject project, CmsAliasFilter filter) throws CmsDataAccessException
I_CmsVfsDriver
deleteAliases
in interface I_CmsVfsDriver
dbc
- the database contextproject
- the current projectfilter
- the alias filterCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.deleteAliases(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.db.CmsAliasFilter)
public void deletePropertyDefinition(CmsDbContext dbc, CmsPropertyDefinition metadef) throws CmsDataAccessException
I_CmsVfsDriver
deletePropertyDefinition
in interface I_CmsVfsDriver
dbc
- the current database contextmetadef
- the property definitions to be deletedCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.deletePropertyDefinition(org.opencms.db.CmsDbContext, org.opencms.file.CmsPropertyDefinition)
public void deletePropertyObjects(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, int deleteOption) throws CmsDataAccessException
I_CmsVfsDriver
You may specify which whether just structure or resource property values should be deleted, or both of them.
deletePropertyObjects
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the id of the projectresource
- the resourcedeleteOption
- determines which property values should be deletedCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.deletePropertyObjects(org.opencms.db.CmsDbContext, CmsUUID, org.opencms.file.CmsResource, int)
public void deleteRelations(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, CmsRelationFilter filter) throws CmsDataAccessException
I_CmsVfsDriver
deleteRelations
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the id of the project to execute the query inresource
- the base resource. May be null
for allfilter
- the filter to restrict the relations to removeCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.deleteRelations(org.opencms.db.CmsDbContext, CmsUUID, CmsResource, org.opencms.relations.CmsRelationFilter)
public void deleteRewriteAliases(CmsDbContext dbc, CmsRewriteAliasFilter filter) throws CmsDataAccessException
I_CmsVfsDriver
deleteRewriteAliases
in interface I_CmsVfsDriver
dbc
- the current database contextfilter
- the filter describing which rewrite aliases to deleteCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.deleteRewriteAliases(org.opencms.db.CmsDbContext, org.opencms.db.CmsRewriteAliasFilter)
public void deleteUrlNameMappingEntries(CmsDbContext dbc, boolean online, CmsUrlNameMappingFilter filter) throws CmsDataAccessException
I_CmsVfsDriver
deleteUrlNameMappingEntries
in interface I_CmsVfsDriver
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 deleteCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.deleteUrlNameMappingEntries(org.opencms.db.CmsDbContext, boolean, org.opencms.db.urlname.CmsUrlNameMappingFilter)
public void destroy() throws java.lang.Throwable
I_CmsVfsDriver
destroy
in interface I_CmsVfsDriver
java.lang.Throwable
- if something goes wrongI_CmsVfsDriver.destroy()
public java.util.List<CmsOrganizationalUnit> getResourceOus(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) throws CmsDbSqlException
getResourceOus
in interface I_CmsVfsDriver
dbc
- the database contextprojectId
- the id of the projectresource
- the resourceCmsOrganizationalUnit
objectsCmsDbSqlException
- if something goes wrongpublic CmsSqlManager getSqlManager()
I_CmsVfsDriver
getSqlManager
in interface I_CmsVfsDriver
I_CmsVfsDriver.getSqlManager()
public int incrementCounter(CmsDbContext dbc, java.lang.String name) throws CmsDataAccessException
I_CmsVfsDriver
incrementCounter
in interface I_CmsVfsDriver
dbc
- the database contextname
- the name of the counterCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.incrementCounter(org.opencms.db.CmsDbContext, java.lang.String)
public void init(CmsDbContext dbc, CmsConfigurationManager configurationManager, java.util.List<java.lang.String> successiveDrivers, CmsDriverManager driverManager)
I_CmsDriver
init
in interface I_CmsDriver
dbc
- the current database contextconfigurationManager
- the configuration managersuccessiveDrivers
- a list of successive drivers to be initializeddriverManager
- the initialized OpenCms driver managerI_CmsDriver.init(org.opencms.db.CmsDbContext, org.opencms.configuration.CmsConfigurationManager, java.util.List, org.opencms.db.CmsDriverManager)
public CmsSqlManager initSqlManager(java.lang.String classname)
I_CmsVfsDriver
To obtain JDBC connections from different pools, further {online|offline|history} pool Urls have to be specified.
initSqlManager
in interface I_CmsVfsDriver
classname
- the class name of the SQL managerI_CmsVfsDriver.initSqlManager(String)
public void insertAlias(CmsDbContext dbc, CmsProject project, CmsAlias alias) throws CmsDataAccessException
I_CmsVfsDriver
insertAlias
in interface I_CmsVfsDriver
dbc
- the current database contextproject
- the current projectalias
- the alias to writeCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.insertAlias(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.db.CmsAlias)
public void insertRewriteAliases(CmsDbContext dbc, java.util.Collection<CmsRewriteAlias> rewriteAliases) throws CmsDataAccessException
I_CmsVfsDriver
When adding a rewrite alias, make sure that no alias with the same id is present in the database.
insertRewriteAliases
in interface I_CmsVfsDriver
dbc
- the current database contextrewriteAliases
- the rewrite aliases to saveCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.insertRewriteAliases(org.opencms.db.CmsDbContext, java.util.Collection)
public void moveResource(CmsDbContext dbc, CmsUUID projectId, CmsResource source, java.lang.String destinationPath) throws CmsDataAccessException
I_CmsVfsDriver
moveResource
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the Id of the projectsource
- the resource to movedestinationPath
- the root path of the destination resourceCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.moveResource(CmsDbContext, CmsUUID, CmsResource, String)
public void publishResource(CmsDbContext dbc, CmsProject onlineProject, CmsResource onlineResource, CmsResource offlineResource) throws CmsDataAccessException
I_CmsVfsDriver
publishResource
in interface I_CmsVfsDriver
dbc
- the current database contextonlineProject
- the online projectonlineResource
- the online resourceofflineResource
- the offline resourceCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.publishResource(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.file.CmsResource, org.opencms.file.CmsResource)
public void publishVersions(CmsDbContext dbc, CmsResource resource, boolean firstSibling) throws CmsDataAccessException
I_CmsVfsDriver
publishVersions
in interface I_CmsVfsDriver
dbc
- the current database contextresource
- the resource that has been publishfirstSibling
- if this is the first sibling to be publishCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.publishVersions(org.opencms.db.CmsDbContext, org.opencms.file.CmsResource, boolean)
public java.util.List<CmsAlias> readAliases(CmsDbContext dbc, CmsProject project, CmsAliasFilter filter) throws CmsDataAccessException
I_CmsVfsDriver
readAliases
in interface I_CmsVfsDriver
dbc
- the database contextproject
- the current projectfilter
- the alias filterCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readAliases(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.db.CmsAliasFilter)
public java.util.List<CmsResource> readChildResources(CmsDbContext dbc, CmsProject currentProject, CmsResource resource, boolean getFolders, boolean getFiles) throws CmsDataAccessException
I_CmsVfsDriver
readChildResources
in interface I_CmsVfsDriver
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 setCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readChildResources(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.file.CmsResource, boolean, boolean)
public byte[] readContent(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId) throws CmsDataAccessException
I_CmsVfsDriver
readContent
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the ID of the current projectresourceId
- the id of the resourceCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readContent(org.opencms.db.CmsDbContext, CmsUUID, org.opencms.util.CmsUUID)
public CmsFolder readFolder(CmsDbContext dbc, CmsUUID projectId, CmsUUID folderId) throws CmsDataAccessException
I_CmsVfsDriver
readFolder
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the project in which the resource will be usedfolderId
- the structure id of the folder to be readCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readFolder(org.opencms.db.CmsDbContext, CmsUUID, org.opencms.util.CmsUUID)
public CmsFolder readFolder(CmsDbContext dbc, CmsUUID projectId, java.lang.String folderPath) throws CmsDataAccessException
I_CmsVfsDriver
readFolder
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the project in which the resource will be usedfolderPath
- the name of the folder to be readCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readFolder(org.opencms.db.CmsDbContext, CmsUUID, java.lang.String)
public CmsFolder readParentFolder(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId) throws CmsDataAccessException
I_CmsVfsDriver
The parent folder for the root '/' is defined as null
.
readParentFolder
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the project in which the resource will be usedstructureId
- the id of the resource to read the parent folder fornull
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readParentFolder(org.opencms.db.CmsDbContext, CmsUUID, org.opencms.util.CmsUUID)
public CmsPropertyDefinition readPropertyDefinition(CmsDbContext dbc, java.lang.String name, CmsUUID projectId) throws CmsDataAccessException
I_CmsVfsDriver
If no property definition with the given name is found,
null
is returned.
readPropertyDefinition
in interface I_CmsVfsDriver
dbc
- the current database contextname
- the name of the property definition to readprojectId
- the id of the projectCmsDataAccessException
- a CmsDbEntryNotFoundException is thrown if the property definition does not existI_CmsVfsDriver.readPropertyDefinition(org.opencms.db.CmsDbContext, java.lang.String, CmsUUID)
public java.util.List<CmsPropertyDefinition> readPropertyDefinitions(CmsDbContext dbc, CmsUUID projectId) throws CmsDataAccessException
I_CmsVfsDriver
readPropertyDefinitions
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the id of the projectCmsPropertyDefinition
objects (may be empty)CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readPropertyDefinitions(org.opencms.db.CmsDbContext, CmsUUID)
public CmsProperty readPropertyObject(CmsDbContext dbc, java.lang.String key, CmsProject project, CmsResource resource) throws CmsDataAccessException
I_CmsVfsDriver
The implementation must return CmsProperty.getNullProperty()
if the property is not found.
TODO: change project parameter to project id
readPropertyObject
in interface I_CmsVfsDriver
dbc
- the current database contextkey
- the key of the propertyproject
- the current projectresource
- the resource where the property is attached toCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readPropertyObject(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.file.CmsProject, org.opencms.file.CmsResource)
public java.util.List<CmsProperty> readPropertyObjects(CmsDbContext dbc, CmsProject project, CmsResource resource) throws CmsDataAccessException
I_CmsVfsDriver
The implementation must return an empty list if no properties are found at all.
TODO: change project parameter to project id
readPropertyObjects
in interface I_CmsVfsDriver
dbc
- the current database contextproject
- the current projectresource
- the resource where the property is attached toCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readPropertyObjects(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.file.CmsResource)
public java.util.List<CmsRelation> readRelations(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, CmsRelationFilter filter) throws CmsDataAccessException
I_CmsVfsDriver
readRelations
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the id of the project to execute the query inresource
- the resource to read the relations for, may be null
for allfilter
- the filter to restrict the relations to retrieveCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readRelations(org.opencms.db.CmsDbContext, CmsUUID, CmsResource, org.opencms.relations.CmsRelationFilter)
public CmsResource readResource(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId, boolean includeDeleted) throws CmsDataAccessException
I_CmsVfsDriver
readResource
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the Id of the projectstructureId
- the Id of the resourceincludeDeleted
- true if already deleted files are includedCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readResource(org.opencms.db.CmsDbContext, CmsUUID, org.opencms.util.CmsUUID, boolean)
public CmsResource readResource(CmsDbContext dbc, CmsUUID projectId, java.lang.String path, boolean includeDeleted) throws CmsDataAccessException
I_CmsVfsDriver
readResource
in interface I_CmsVfsDriver
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 includedCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readResource(org.opencms.db.CmsDbContext, CmsUUID, java.lang.String, boolean)
public java.util.List<CmsResource> readResources(CmsDbContext dbc, CmsUUID projectId, CmsResourceState state, int mode) throws CmsDataAccessException
I_CmsVfsDriver
readResources
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the current projectstate
- the state to matchmode
- flag signaling the read modeCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readResources(org.opencms.db.CmsDbContext, CmsUUID, CmsResourceState, int)
public java.util.List<CmsResource> readResourcesForPrincipalACE(CmsDbContext dbc, CmsProject project, CmsUUID principalId) throws CmsDataAccessException
I_CmsVfsDriver
readResourcesForPrincipalACE
in interface I_CmsVfsDriver
dbc
- the current database contextproject
- the to read the entries fromprincipalId
- the id of the principalCmsResource
objectsCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readResourcesForPrincipalACE(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.util.CmsUUID)
public java.util.List<CmsResource> readResourcesForPrincipalAttr(CmsDbContext dbc, CmsProject project, CmsUUID principalId) throws CmsDataAccessException
I_CmsVfsDriver
readResourcesForPrincipalAttr
in interface I_CmsVfsDriver
dbc
- the current database contextproject
- the to read the entries fromprincipalId
- the id of the principalCmsResource
objectsCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readResourcesForPrincipalAttr(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.util.CmsUUID)
public java.util.List<CmsResource> readResourcesWithProperty(CmsDbContext dbc, CmsUUID projectId, CmsUUID propertyDef, java.lang.String path, java.lang.String value) throws CmsDataAccessException
I_CmsVfsDriver
Both individual and shared properties of a resource are checked.
If the value
parameter is null
, all resources having the
given property set are returned.
readResourcesWithProperty
in interface I_CmsVfsDriver
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 propertyCmsResource
objects
that have a value set for the specified property.CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readResourcesWithProperty(org.opencms.db.CmsDbContext, CmsUUID, org.opencms.util.CmsUUID, String, String)
public java.util.List<CmsResource> readResourceTree(CmsDbContext dbc, CmsUUID projectId, java.lang.String parentPath, int type, CmsResourceState state, long lastModifiedAfter, long lastModifiedBefore, long releasedAfter, long releasedBefore, long expiredAfter, long expiredBefore, int mode) throws CmsDataAccessException
I_CmsVfsDriver
Important: If CmsDriverManager.READMODE_EXCLUDE_TREE
is true (or CmsDriverManager.READMODE_INCLUDE_TREE
is false),
the provided parent String must be the UUID of the parent folder, NOT the parent folder path.
readResourceTree
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the project id for matching resourcesparentPath
- the path to the resource used as root of the searched subtree or CmsDriverManager.READ_IGNORE_PARENT
,
CmsDriverManager.READMODE_EXCLUDE_TREE
means to read immediate children onlytype
- the resource type of matching resources or CmsDriverManager.READ_IGNORE_TYPE
(meaning inverted by CmsDriverManager.READMODE_EXCLUDE_TYPE
state
- the state of matching resources (meaning inverted by CmsDriverManager.READMODE_EXCLUDE_STATE
or null
to 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:
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readResourceTree(org.opencms.db.CmsDbContext, CmsUUID, java.lang.String, int, CmsResourceState, long, long, long, long, long, long, int)
public java.util.List<CmsRewriteAlias> readRewriteAliases(CmsDbContext dbc, CmsRewriteAliasFilter filter) throws CmsDataAccessException
I_CmsVfsDriver
readRewriteAliases
in interface I_CmsVfsDriver
dbc
- the current database contextfilter
- the filter describing which rewrite aliases should be returnedCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readRewriteAliases(org.opencms.db.CmsDbContext, org.opencms.db.CmsRewriteAliasFilter)
public java.util.List<CmsResource> readSiblings(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, boolean includeDeleted) throws CmsDataAccessException
I_CmsVfsDriver
readSiblings
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the id of the current projectresource
- the specified resourceincludeDeleted
- true
if deleted siblings should be included in the result listCmsResource
s that
are siblings to the specified resource,
including the specified resource itself.CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readSiblings(org.opencms.db.CmsDbContext, CmsUUID, org.opencms.file.CmsResource, boolean)
public java.util.List<CmsUrlNameMappingEntry> readUrlNameMappingEntries(CmsDbContext dbc, boolean online, CmsUrlNameMappingFilter filter) throws CmsDataAccessException
readUrlNameMappingEntries
in interface I_CmsVfsDriver
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 matchCmsDataAccessException
- if something goes wrongpublic java.util.Map<java.lang.String,java.lang.Integer> readVersions(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId, CmsUUID structureId) throws CmsDataAccessException
I_CmsVfsDriver
readVersions
in interface I_CmsVfsDriver
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 fromInteger
objects and may be -1
if an entry could be foundCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readVersions(org.opencms.db.CmsDbContext, org.opencms.util.CmsUUID, org.opencms.util.CmsUUID, org.opencms.util.CmsUUID)
public void removeFile(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) throws CmsDataAccessException
I_CmsVfsDriver
removeFile
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the id of the current projectresource
- the resourceCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.removeFile(org.opencms.db.CmsDbContext, CmsUUID, org.opencms.file.CmsResource)
public void removeFolder(CmsDbContext dbc, CmsProject currentProject, CmsResource resource) throws CmsDataAccessException
I_CmsVfsDriver
removeFolder
in interface I_CmsVfsDriver
dbc
- the current database contextcurrentProject
- the current projectresource
- the folderCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.removeFolder(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.file.CmsResource)
public void replaceResource(CmsDbContext dbc, CmsResource newResource, byte[] resContent, int newResourceType) throws CmsDataAccessException
I_CmsVfsDriver
replaceResource
in interface I_CmsVfsDriver
dbc
- the current database contextnewResource
- the new resourceresContent
- the new contentnewResourceType
- the resource typeCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.replaceResource(org.opencms.db.CmsDbContext, org.opencms.file.CmsResource, byte[], int)
public void setDriverManager(CmsDriverManager driverManager)
I_CmsVfsDriver
setDriverManager
in interface I_CmsVfsDriver
driverManager
- the new driver managerI_CmsVfsDriver.setDriverManager(org.opencms.db.CmsDriverManager)
public void setSqlManager(CmsSqlManager sqlManager)
I_CmsVfsDriver
setSqlManager
in interface I_CmsVfsDriver
sqlManager
- the new SQL managerI_CmsVfsDriver.setSqlManager(org.opencms.db.CmsSqlManager)
public void transferResource(CmsDbContext dbc, CmsProject project, CmsResource resource, CmsUUID createdUser, CmsUUID lastModifiedUser) throws CmsDataAccessException
I_CmsVfsDriver
transferResource
in interface I_CmsVfsDriver
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 resourceCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.transferResource(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.file.CmsResource, org.opencms.util.CmsUUID, org.opencms.util.CmsUUID)
public void updateRelations(CmsDbContext dbc, CmsProject onlineProject, CmsResource offlineResource) throws CmsDataAccessException
I_CmsVfsDriver
TODO: add offlineProject parameter
updateRelations
in interface I_CmsVfsDriver
dbc
- the current database contextonlineProject
- the online projectofflineResource
- the resource to update the relations forCmsDataAccessException
- is something goes wrongI_CmsVfsDriver.updateRelations(CmsDbContext, CmsProject, CmsResource)
public boolean validateResourceIdExists(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId) throws CmsDataAccessException
I_CmsVfsDriver
validateResourceIdExists
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the project idresourceId
- the resource id to test forCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.validateResourceIdExists(org.opencms.db.CmsDbContext, CmsUUID, org.opencms.util.CmsUUID)
public boolean validateStructureIdExists(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId) throws CmsDataAccessException
I_CmsVfsDriver
validateStructureIdExists
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the ID of current projectstructureId
- the structure idCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.validateStructureIdExists(org.opencms.db.CmsDbContext, CmsUUID, org.opencms.util.CmsUUID)
public void writeContent(CmsDbContext dbc, CmsUUID resourceId, byte[] content) throws CmsDataAccessException
I_CmsVfsDriver
writeContent
in interface I_CmsVfsDriver
dbc
- the current database contextresourceId
- the id of the resource used to identify the content to updatecontent
- the new content of the fileCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.writeContent(org.opencms.db.CmsDbContext, org.opencms.util.CmsUUID, byte[])
public void writeLastModifiedProjectId(CmsDbContext dbc, CmsProject project, CmsUUID projectId, CmsResource resource) throws CmsDataAccessException
I_CmsVfsDriver
writeLastModifiedProjectId
in interface I_CmsVfsDriver
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 updatedCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.writeLastModifiedProjectId(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, CmsUUID, org.opencms.file.CmsResource)
public void writePropertyObject(CmsDbContext dbc, CmsProject project, CmsResource resource, CmsProperty property) throws CmsDataAccessException
I_CmsVfsDriver
writePropertyObject
in interface I_CmsVfsDriver
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 propertyCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.writePropertyObject(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.file.CmsResource, org.opencms.file.CmsProperty)
public void writePropertyObjects(CmsDbContext dbc, CmsProject project, CmsResource resource, java.util.List<CmsProperty> properties) throws CmsDataAccessException
I_CmsVfsDriver
writePropertyObjects
in interface I_CmsVfsDriver
dbc
- the current database contextproject
- the current projectresource
- the resource where the property should be attached toproperties
- a list of CmsProperty objectsCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.writePropertyObjects(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.file.CmsResource, java.util.List)
public void writeResource(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, int changed) throws CmsDataAccessException
I_CmsVfsDriver
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 < 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.
writeResource
in interface I_CmsVfsDriver
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"CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.writeResource(org.opencms.db.CmsDbContext, CmsUUID, org.opencms.file.CmsResource, int)
public void writeResourceState(CmsDbContext dbc, CmsProject project, CmsResource resource, int changed, boolean isPublishing) throws CmsDataAccessException
I_CmsVfsDriver
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.
writeResourceState
in interface I_CmsVfsDriver
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 updatedCmsDataAccessException
- if something goes wrongI_CmsVfsDriver.writeResourceState(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.file.CmsResource, int, boolean)
protected void checkWritePermissionsInFolder(CmsDbContext dbc, CmsResource folder) throws CmsDataAccessException
dbc
- the current database contextfolder
- the folder to checkCmsDataAccessException
- if something goes wrongprotected int internalCountProperties(CmsDbContext dbc, CmsPropertyDefinition propertyDefinition, CmsUUID projectId) throws CmsDataAccessException
dbc
- the current database contextpropertyDefinition
- the property definition to testprojectId
- the ID of the current projectCmsDataAccessException
- if something goes wrongprotected void internalCreateCounter(CmsDbContext dbc, java.lang.String name, int value) throws CmsDbSqlException
dbc
- the database contextname
- the name of the counter to createvalue
- the inital value of the counterCmsDbSqlException
- if something goes wrongprotected CmsUrlNameMappingEntry internalCreateUrlNameMappingEntry(java.sql.ResultSet resultSet) throws java.sql.SQLException
resultSet
- a result setjava.sql.SQLException
- if something goes wrongprotected void internalIncrementCounter(CmsDbContext dbc, java.lang.String name) throws CmsDbSqlException
dbc
- the current db contextname
- the name of the counter which should be incrementedCmsDbSqlException
- if something goes wrongprotected CmsAlias internalReadAlias(java.sql.ResultSet resultset) throws java.sql.SQLException
resultset
- the result setjava.sql.SQLException
- if something goes wrongprotected java.lang.Integer internalReadCounter(CmsDbContext dbc, java.lang.String name) throws CmsDbSqlException
dbc
- the database contextname
- the name of the counterCmsDbSqlException
- if something goes wrongprotected java.lang.String internalReadParentId(CmsDbContext dbc, CmsUUID projectId, java.lang.String resourcename) throws CmsDataAccessException
dbc
- the current database contextprojectId
- the current project idresourcename
- the resource name to read the parent id forCmsDataAccessException
- if something goes wrongprotected CmsRelation internalReadRelation(java.sql.ResultSet res) throws java.sql.SQLException
CmsRelation
object from the given result set entry.res
- the result setCmsRelation
objectjava.sql.SQLException
- if something goes wrongprotected CmsResourceState internalReadResourceState(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) throws CmsDbSqlException
dbc
- the database contextprojectId
- the id of the projectresource
- the resource to read the resource state forCmsDbSqlException
- if something goes wrongprotected CmsResourceState internalReadStructureState(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) throws CmsDbSqlException
dbc
- the database contextprojectId
- the id of the projectresource
- the resource to read the structure state forCmsDbSqlException
- if something goes wrongprotected void internalRemoveFolder(CmsDbContext dbc, CmsProject currentProject, CmsResource resource) throws CmsDataAccessException
dbc
- the current database contextcurrentProject
- the current projectresource
- the folder to removeCmsDataAccessException
- if something goes wrongprotected void internalUpdateVersions(CmsDbContext dbc, CmsResource resource) throws CmsDataAccessException
dbc
- the current database contextresource
- the resource to update the version number forCmsDataAccessException
- if something goes wrongprotected void internalValidateResourceLength(CmsResource resource) throws CmsDataAccessException
Files need to have a resource length of >= 0, while folders require a resource length of -1.
resource
- the resource to check the length forCmsDataAccessException
- if the resource length is not correctprotected void moveRelations(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId, java.lang.String rootPath) throws CmsDataAccessException
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 pathCmsDataAccessException
- if something goes wrongprotected void prepareExpiredTimeRangeCondition(CmsUUID projectId, long startTime, long endTime, java.lang.StringBuffer conditions, java.util.List<java.lang.Object> params)
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 parametersprotected void preparePathCondition(CmsUUID projectId, java.lang.String parent, int mode, java.lang.StringBuffer conditions, java.util.List<java.lang.Object> params)
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 parametersprotected void prepareProjectCondition(CmsUUID projectId, int mode, java.lang.StringBuffer conditions, java.util.List<java.lang.Object> params)
projectId
- the id of the project of the resourcesmode
- the selection modeconditions
- buffer to append the selection criteriaparams
- list to append the selection parametersprotected java.lang.String prepareRelationConditions(CmsUUID projectId, CmsRelationFilter filter, CmsResource resource, java.util.List<java.lang.Object> params, boolean checkSource)
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 relationsprotected void prepareReleasedTimeRangeCondition(CmsUUID projectId, long startTime, long endTime, java.lang.StringBuffer conditions, java.util.List<java.lang.Object> params)
projectId
- the id of the projectstartTime
- the start timeendTime
- the stop timeconditions
- buffer to append the selection criteriaparams
- list to append the selection parametersprotected void prepareResourceCondition(CmsUUID projectId, int mode, java.lang.StringBuffer conditions)
projectId
- the id of the project of the resourcesmode
- the selection modeconditions
- buffer to append the selection criteriaprotected void prepareStateCondition(CmsUUID projectId, CmsResourceState state, int mode, java.lang.StringBuffer conditions, java.util.List<java.lang.Object> params)
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 parametersprotected void prepareTimeRangeCondition(CmsUUID projectId, long startTime, long endTime, java.lang.StringBuffer conditions, java.util.List<java.lang.Object> params)
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 parametersprotected void prepareTypeCondition(CmsUUID projectId, int type, int mode, java.lang.StringBuffer conditions, java.util.List<java.lang.Object> params)
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 parametersprotected void prepareTypesCondition(CmsUUID projectId, java.util.List<java.lang.Integer> types, int mode, java.lang.StringBuffer conditions, java.util.List<java.lang.Object> params)
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 parametersprotected java.util.List<CmsResource> readTypesInResourceTree(CmsDbContext dbc, CmsUUID projectId, java.lang.String parentPath, java.util.List<java.lang.Integer> types, CmsResourceState state, long lastModifiedAfter, long lastModifiedBefore, long releasedAfter, long releasedBefore, long expiredAfter, long expiredBefore, int mode) throws CmsDataAccessException
Important: If CmsDriverManager.READMODE_EXCLUDE_TREE
is true (or CmsDriverManager.READMODE_INCLUDE_TREE
is false),
the provided parent String must be the UUID of the parent folder, NOT the parent folder path.
dbc
- the current database contextprojectId
- the project id for matching resourcesparentPath
- the path to the resource used as root of the searched subtree or CmsDriverManager.READ_IGNORE_PARENT
,
CmsDriverManager.READMODE_EXCLUDE_TREE
means to read immediate children onlytypes
- the resource types of matching resources or null
(meaning inverted by CmsDriverManager.READMODE_EXCLUDE_TYPE
state
- the state of matching resources (meaning inverted by CmsDriverManager.READMODE_EXCLUDE_STATE
or null
to 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:
CmsDataAccessException
- if something goes wrongprotected void repairBrokenRelations(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId, java.lang.String rootPath) throws CmsDataAccessException
When a resource is created any relation pointing to it is updated to use the right id.
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 linksCmsDataAccessException
- if something goes wrongprotected void updateBrokenRelations(CmsDbContext dbc, CmsUUID projectId, java.lang.String rootPath) throws CmsDataAccessException
When a resource is deleted, then the relations pointing to the deleted resource are set to the null uuid.
dbc
- the current database contextprojectId
- the project idrootPath
- the root path of the resource that has been deletedCmsDataAccessException
- if something goes wrongprotected CmsDbSqlException wrapException(java.sql.PreparedStatement stmt, java.sql.SQLException e)
stmt
- the used statemente
- the exception