org.opencms.db
public interface I_CmsVfsDriver
Modifier and Type | Field and Description |
---|---|
static int |
DRIVER_TYPE_ID
The type ID to identify user driver implementations.
|
static java.lang.String |
REQ_ATTR_CHECK_PERMISSIONS
The internal request attribute to indicate that the permissions have to be checked.
|
static java.lang.String |
REQ_ATTR_RESOURCE_OUS
The internal request attribute to indicate that resource organizational units have to be retrieved.
|
Modifier and Type | Method and Description |
---|---|
void |
addUrlNameMappingEntry(CmsDbContext dbc,
boolean online,
CmsUrlNameMappingEntry entry)
Adds a new URL name mapping entry.
|
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 name)
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.
|
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.
|
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.
|
void |
moveResource(CmsDbContext dbc,
CmsUUID projectId,
CmsResource source,
java.lang.String destinationPath)
Moves the given resource to the specified destination path.
|
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 foldername)
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 filename,
boolean includeDeleted)
Reads a resource specified by it's resource name.
|
java.util.List<CmsResource> |
readResources(CmsDbContext dbc,
CmsUUID currentProject,
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 propertyDefinition,
java.lang.String path,
java.lang.String value)
Reads all resources that have a value (containing the specified value)
set for the specified property (definition), in the given path.
|
java.util.List<CmsResource> |
readResourceTree(CmsDbContext dbc,
CmsUUID projectId,
java.lang.String parent,
int type,
CmsResourceState state,
long startTime,
long endTime,
long releasedAfter,
long releasedBefore,
long expiredAfter,
long expiredBefore,
int mode)
Reads all resources inside a given project matching the criteria specified by parameter values.
|
java.util.List<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.
|
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.
|
void |
replaceResource(CmsDbContext dbc,
CmsResource newResource,
byte[] newResourceContent,
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.
|
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.
|
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.
|
static final int DRIVER_TYPE_ID
static final java.lang.String REQ_ATTR_CHECK_PERMISSIONS
static final java.lang.String REQ_ATTR_RESOURCE_OUS
void addUrlNameMappingEntry(CmsDbContext dbc, boolean online, CmsUrlNameMappingEntry entry) throws CmsDataAccessException
dbc
- the current database contextonline
- if true, writes to the online tables, else to the offline tablesentry
- the entry to addCmsDataAccessException
- if something goes wrongint countSiblings(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId) throws CmsDataAccessException
dbc
- the current database contextprojectId
- the current project idresourceId
- the resource id to count the number of siblings fromCmsDataAccessException
- if something goes wrongvoid createContent(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId, byte[] content) throws CmsDataAccessException
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 wrongCmsFile createFile(java.sql.ResultSet res, CmsUUID projectId) throws java.sql.SQLException
CmsFile
instance from a JDBC ResultSet.res
- the JDBC ResultSetprojectId
- the project idjava.sql.SQLException
- in case the result set does not include a requested table attributeCmsFile createFile(java.sql.ResultSet res, CmsUUID projectId, boolean hasFileContentInResultSet) throws java.sql.SQLException
CmsFile
instance from a JDBC ResultSet.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 attributeCmsFolder createFolder(java.sql.ResultSet res, CmsUUID projectId, boolean hasProjectIdInResultSet) throws java.sql.SQLException
CmsFolder
instance from a JDBC ResultSet.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 attributevoid createOnlineContent(CmsDbContext dbc, CmsUUID resourceId, byte[] contents, int publishTag, boolean keepOnline, boolean needToUpdateContent) throws CmsDataAccessException
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 wrongCmsPropertyDefinition createPropertyDefinition(CmsDbContext dbc, CmsUUID projectId, java.lang.String name, CmsPropertyDefinition.CmsPropertyType type) throws CmsDataAccessException
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 wrongvoid createRelation(CmsDbContext dbc, CmsUUID projectId, CmsRelation relation) throws CmsDataAccessException
CmsRelation
object in the database.dbc
- the current database contextprojectId
- the id of the project to execute the query inrelation
- the relation to createCmsDataAccessException
- if something goes wrongCmsResource createResource(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, byte[] content) throws CmsDataAccessException
CmsResource
object.This method works for both files and folders. Existing resources get overwritten.
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_CmsResourceType.createResource(org.opencms.file.CmsObject, CmsSecurityManager, String, byte[], List)
,
I_CmsResourceType.importResource(org.opencms.file.CmsObject, CmsSecurityManager, String, CmsResource, byte[], List)
,
CmsObject.createResource(String, int, byte[], List)
,
CmsObject.importResource(String, CmsResource, byte[], List)
CmsResource createResource(java.sql.ResultSet res, CmsUUID projectId) throws java.sql.SQLException
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 attributevoid createSibling(CmsDbContext dbc, CmsProject project, CmsResource resource) throws CmsDataAccessException
dbc
- the current database contextproject
- the project where to create the linkresource
- the link prototypeCmsDataAccessException
- if something goes wrongvoid deleteAliases(CmsDbContext dbc, CmsProject project, CmsAliasFilter filter) throws CmsDataAccessException
dbc
- the database contextproject
- the current projectfilter
- the alias filterCmsDataAccessException
- if something goes wrongvoid deletePropertyDefinition(CmsDbContext dbc, CmsPropertyDefinition name) throws CmsDataAccessException
dbc
- the current database contextname
- the property definitions to be deletedCmsDataAccessException
- if something goes wrongvoid deletePropertyObjects(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, int deleteOption) throws CmsDataAccessException
You may specify which whether just structure or resource property values should be deleted, or both of them.
dbc
- the current database contextprojectId
- the id of the projectresource
- the resourcedeleteOption
- determines which property values should be deletedCmsDataAccessException
- if something goes wrongCmsProperty.DELETE_OPTION_DELETE_STRUCTURE_AND_RESOURCE_VALUES
,
CmsProperty.DELETE_OPTION_DELETE_STRUCTURE_VALUES
,
CmsProperty.DELETE_OPTION_DELETE_RESOURCE_VALUES
void deleteRelations(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, CmsRelationFilter filter) throws CmsDataAccessException
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 wrongvoid deleteRewriteAliases(CmsDbContext dbc, CmsRewriteAliasFilter filter) throws CmsDataAccessException
dbc
- the current database contextfilter
- the filter describing which rewrite aliases to deleteCmsDataAccessException
- if something goes wrongvoid deleteUrlNameMappingEntries(CmsDbContext dbc, boolean online, CmsUrlNameMappingFilter filter) throws CmsDataAccessException
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 wrongvoid destroy() throws java.lang.Throwable
java.lang.Throwable
- if something goes wrongjava.util.List<CmsOrganizationalUnit> getResourceOus(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) throws CmsDataAccessException
dbc
- the database contextprojectId
- the id of the projectresource
- the resourceCmsOrganizationalUnit
objectsCmsDataAccessException
- if something goes wrongCmsSqlManager getSqlManager()
int incrementCounter(CmsDbContext dbc, java.lang.String name) throws CmsDataAccessException
dbc
- the database contextname
- the name of the counterCmsDataAccessException
- if something goes wrongCmsSqlManager initSqlManager(java.lang.String classname)
To obtain JDBC connections from different pools, further {online|offline|history} pool Urls have to be specified.
classname
- the class name of the SQL managervoid insertAlias(CmsDbContext dbc, CmsProject project, CmsAlias alias) throws CmsDataAccessException
dbc
- the current database contextproject
- the current projectalias
- the alias to writeCmsDataAccessException
- if something goes wrongvoid insertRewriteAliases(CmsDbContext dbc, java.util.Collection<CmsRewriteAlias> rewriteAliases) throws CmsDataAccessException
When adding a rewrite alias, make sure that no alias with the same id is present in the database.
dbc
- the current database contextrewriteAliases
- the rewrite aliases to saveCmsDataAccessException
- if something goes wrongvoid moveResource(CmsDbContext dbc, CmsUUID projectId, CmsResource source, java.lang.String destinationPath) throws CmsDataAccessException
dbc
- the current database contextprojectId
- the Id of the projectsource
- the resource to movedestinationPath
- the root path of the destination resourceCmsDataAccessException
- if something goes wrongvoid publishResource(CmsDbContext dbc, CmsProject onlineProject, CmsResource onlineResource, CmsResource offlineResource) throws CmsDataAccessException
dbc
- the current database contextonlineProject
- the online projectonlineResource
- the online resourceofflineResource
- the offline resourceCmsDataAccessException
- if something goes wrongvoid publishVersions(CmsDbContext dbc, CmsResource resource, boolean firstSibling) throws CmsDataAccessException
dbc
- the current database contextresource
- the resource that has been publishfirstSibling
- if this is the first sibling to be publishCmsDataAccessException
- if something goes wrongjava.util.List<CmsAlias> readAliases(CmsDbContext dbc, CmsProject project, CmsAliasFilter filter) throws CmsDataAccessException
dbc
- the database contextproject
- the current projectfilter
- the alias filterCmsDataAccessException
- if something goes wrongjava.util.List<CmsResource> readChildResources(CmsDbContext dbc, CmsProject currentProject, CmsResource resource, boolean getFolders, boolean getFiles) throws CmsDataAccessException
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 wrongbyte[] readContent(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId) throws CmsDataAccessException
dbc
- the current database contextprojectId
- the ID of the current projectresourceId
- the id of the resourceCmsDataAccessException
- if something goes wrongCmsFolder readFolder(CmsDbContext dbc, CmsUUID projectId, CmsUUID folderId) throws CmsDataAccessException
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 wrongCmsFolder readFolder(CmsDbContext dbc, CmsUUID projectId, java.lang.String foldername) throws CmsDataAccessException
dbc
- the current database contextprojectId
- the project in which the resource will be usedfoldername
- the name of the folder to be readCmsDataAccessException
- if something goes wrongCmsFolder readParentFolder(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId) throws CmsDataAccessException
The parent folder for the root '/' is defined as null
.
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 wrongCmsPropertyDefinition readPropertyDefinition(CmsDbContext dbc, java.lang.String name, CmsUUID projectId) throws CmsDataAccessException
If no property definition with the given name is found,
null
is returned.
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 existjava.util.List<CmsPropertyDefinition> readPropertyDefinitions(CmsDbContext dbc, CmsUUID projectId) throws CmsDataAccessException
dbc
- the current database contextprojectId
- the id of the projectCmsPropertyDefinition
objects (may be empty)CmsDataAccessException
- if something goes wrongCmsProperty readPropertyObject(CmsDbContext dbc, java.lang.String key, CmsProject project, CmsResource resource) throws CmsDataAccessException
The implementation must return CmsProperty.getNullProperty()
if the property is not found.
TODO: change project parameter to project id
dbc
- the current database contextkey
- the key of the propertyproject
- the current projectresource
- the resource where the property is attached toCmsDataAccessException
- if something goes wrongjava.util.List<CmsProperty> readPropertyObjects(CmsDbContext dbc, CmsProject project, CmsResource resource) throws CmsDataAccessException
The implementation must return an empty list if no properties are found at all.
TODO: change project parameter to project id
dbc
- the current database contextproject
- the current projectresource
- the resource where the property is attached toCmsDataAccessException
- if something goes wrongjava.util.List<CmsRelation> readRelations(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, CmsRelationFilter filter) throws CmsDataAccessException
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 wrongCmsResource readResource(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId, boolean includeDeleted) throws CmsDataAccessException
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 wrongCmsResource readResource(CmsDbContext dbc, CmsUUID projectId, java.lang.String filename, boolean includeDeleted) throws CmsDataAccessException
dbc
- the current database contextprojectId
- the Id of the project in which the resource will be usedfilename
- the name of the fileincludeDeleted
- true if already deleted files are includedCmsDataAccessException
- if something goes wrongjava.util.List<CmsResource> readResources(CmsDbContext dbc, CmsUUID currentProject, CmsResourceState state, int mode) throws CmsDataAccessException
dbc
- the current database contextcurrentProject
- the current projectstate
- the state to matchmode
- flag signaling the read modeCmsDataAccessException
- if something goes wrongjava.util.List<CmsResource> readResourcesForPrincipalACE(CmsDbContext dbc, CmsProject project, CmsUUID principalId) throws CmsDataAccessException
dbc
- the current database contextproject
- the to read the entries fromprincipalId
- the id of the principalCmsResource
objectsCmsDataAccessException
- if something goes wrongjava.util.List<CmsResource> readResourcesForPrincipalAttr(CmsDbContext dbc, CmsProject project, CmsUUID principalId) throws CmsDataAccessException
dbc
- the current database contextproject
- the to read the entries fromprincipalId
- the id of the principalCmsResource
objectsCmsDataAccessException
- if something goes wrongjava.util.List<CmsResource> readResourcesWithProperty(CmsDbContext dbc, CmsUUID projectId, CmsUUID propertyDefinition, java.lang.String path, java.lang.String value) throws CmsDataAccessException
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.
dbc
- the current database contextprojectId
- the id of the projectpropertyDefinition
- 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 wrongjava.util.List<CmsResource> readResourceTree(CmsDbContext dbc, CmsUUID projectId, java.lang.String parent, int type, CmsResourceState state, long startTime, long endTime, 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 resourcesparent
- 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 ignorestartTime
- the start of the time range for the last modification date of matching resources or READ_IGNORE_TIMEendTime
- 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 wrongjava.util.List<CmsRewriteAlias> readRewriteAliases(CmsDbContext dbc, CmsRewriteAliasFilter filter) throws CmsDataAccessException
dbc
- the current database contextfilter
- the filter describing which rewrite aliases should be returnedCmsDataAccessException
- if something goes wrongjava.util.List<CmsResource> readSiblings(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, boolean includeDeleted) throws CmsDataAccessException
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 wrongjava.util.List<CmsUrlNameMappingEntry> readUrlNameMappingEntries(CmsDbContext dbc, boolean online, CmsUrlNameMappingFilter filter) throws CmsDataAccessException
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 wrongjava.util.Map<java.lang.String,java.lang.Integer> readVersions(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId, CmsUUID structureId) throws CmsDataAccessException
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 wrongvoid removeFile(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) throws CmsDataAccessException
dbc
- the current database contextprojectId
- the id of the current projectresource
- the resourceCmsDataAccessException
- if something goes wrongvoid removeFolder(CmsDbContext dbc, CmsProject currentProject, CmsResource resource) throws CmsDataAccessException
dbc
- the current database contextcurrentProject
- the current projectresource
- the folderCmsDataAccessException
- if something goes wrongvoid replaceResource(CmsDbContext dbc, CmsResource newResource, byte[] newResourceContent, int newResourceType) throws CmsDataAccessException
dbc
- the current database contextnewResource
- the new resourcenewResourceContent
- the new contentnewResourceType
- the resource typeCmsDataAccessException
- if something goes wrongvoid setDriverManager(CmsDriverManager driverManager)
driverManager
- the new driver managervoid setSqlManager(CmsSqlManager sqlManager)
sqlManager
- the new SQL managervoid transferResource(CmsDbContext dbc, CmsProject project, CmsResource resource, CmsUUID createdUser, CmsUUID lastModifiedUser) throws CmsDataAccessException
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 wrongvoid updateRelations(CmsDbContext dbc, CmsProject onlineProject, CmsResource offlineResource) throws CmsDataAccessException
TODO: add offlineProject parameter
dbc
- the current database contextonlineProject
- the online projectofflineResource
- the resource to update the relations forCmsDataAccessException
- is something goes wrongboolean validateResourceIdExists(CmsDbContext dbc, CmsUUID projectId, CmsUUID resourceId) throws CmsDataAccessException
dbc
- the current database contextprojectId
- the project idresourceId
- the resource id to test forCmsDataAccessException
- if something goes wrongboolean validateStructureIdExists(CmsDbContext dbc, CmsUUID projectId, CmsUUID structureId) throws CmsDataAccessException
dbc
- the current database contextprojectId
- the ID of current projectstructureId
- the structure idCmsDataAccessException
- if something goes wrongvoid writeContent(CmsDbContext dbc, CmsUUID resourceId, byte[] content) throws CmsDataAccessException
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 wrongvoid writeLastModifiedProjectId(CmsDbContext dbc, CmsProject project, CmsUUID projectId, CmsResource resource) throws CmsDataAccessException
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 wrongvoid writePropertyObject(CmsDbContext dbc, CmsProject project, CmsResource resource, CmsProperty property) throws CmsDataAccessException
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 wrongvoid writePropertyObjects(CmsDbContext dbc, CmsProject project, CmsResource resource, java.util.List<CmsProperty> properties) throws CmsDataAccessException
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 wrongvoid writeResource(CmsDbContext dbc, CmsUUID projectId, CmsResource resource, int changed) throws CmsDataAccessException
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 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.
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 wrongCmsDriverManager.UPDATE_RESOURCE_STATE
,
CmsDriverManager.UPDATE_STRUCTURE_STATE
,
CmsDriverManager.NOTHING_CHANGED
,
writeResourceState(CmsDbContext, CmsProject, CmsResource, int, boolean)
void writeResourceState(CmsDbContext dbc, CmsProject project, CmsResource resource, int changed, boolean isPublishing) throws CmsDataAccessException
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 writeResource(CmsDbContext, CmsUUID, CmsResource, int)
instead to write the complete file header.
Please refer to the javadoc of writeResource(CmsDbContext, CmsUUID, CmsResource, int)
to read
how setting resource state values affects the file state.
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 wrongCmsDriverManager.UPDATE_RESOURCE_STATE
,
CmsDriverManager.UPDATE_STRUCTURE_STATE
,
CmsDriverManager.UPDATE_ALL