|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.db.generic.CmsVfsDriver
Generic (ANSI-SQL) database server implementation of the VFS driver methods.
Field Summary | |
protected static java.lang.String |
BEGIN_EXCLUDE_CONDITION
Operator to concatenate exclude conditions. |
protected static java.lang.String |
BEGIN_INCLUDE_CONDITION
Operator to concatenate include conditions. |
protected static java.lang.String |
END_CONDITION
String to end a single condition. |
protected CmsDriverManager |
m_driverManager
The driver manager. |
protected CmsSqlManager |
m_sqlManager
The sql manager. |
Fields inherited from interface org.opencms.db.I_CmsVfsDriver |
DRIVER_TYPE_ID |
Constructor Summary | |
CmsVfsDriver()
|
Method Summary | |
void |
createContent(CmsDbContext dbc,
CmsProject project,
CmsUUID resourceId,
byte[] content,
int versionId)
Creates a resource content with the specified id. |
CmsFile |
createFile(java.sql.ResultSet res,
int projectId)
Creates a CmsFile instance from a JDBC ResultSet. |
CmsFile |
createFile(java.sql.ResultSet res,
int projectId,
boolean hasFileContentInResultSet)
Creates a CmsFile instance from a JDBC ResultSet. |
CmsFolder |
createFolder(java.sql.ResultSet res,
int projectId,
boolean hasProjectIdInResultSet)
Creates a CmsFolder instance from a JDBC ResultSet. |
CmsPropertyDefinition |
createPropertyDefinition(CmsDbContext dbc,
int projectId,
java.lang.String name)
Creates a new property defintion in the database. |
CmsResource |
createResource(CmsDbContext dbc,
CmsProject project,
CmsResource resource,
byte[] content)
Creates a new resource from a given CmsResource object. |
CmsResource |
createResource(java.sql.ResultSet res,
int projectId)
Creates a CmsResource instance from a JDBC ResultSet. |
void |
createSibling(CmsDbContext dbc,
CmsProject project,
CmsResource resource)
Creates a new sibling for a specified resource. |
void |
deletePropertyDefinition(CmsDbContext dbc,
CmsPropertyDefinition metadef)
Deletes a property defintion. |
void |
deletePropertyObjects(CmsDbContext dbc,
int projectId,
CmsResource resource,
int deleteOption)
Deletes all property values of a file or folder. |
void |
destroy()
Destroys this driver. |
protected java.lang.String |
escapeDbWildcard(java.lang.String path)
Escapes the database wildcards within the resource path. |
protected void |
finalize()
|
CmsSqlManager |
getSqlManager()
Returns the SqlManager of this driver. |
void |
init(CmsDbContext dbc,
CmsConfigurationManager configurationManager,
java.util.List successiveDrivers,
CmsDriverManager driverManager)
Initializes the driver. |
CmsSqlManager |
initSqlManager(java.lang.String classname)
Initializes the SQL manager for this driver. |
protected int |
internalCountProperties(CmsDbContext dbc,
CmsPropertyDefinition propertyDefinition,
int projectId)
Returns the count of properties for a property definition. |
protected int |
internalCountSiblings(CmsDbContext dbc,
int projectId,
CmsUUID resourceId)
Counts the number of siblings of a resource. |
protected java.lang.String |
internalReadParentId(CmsDbContext dbc,
int projectId,
java.lang.String resourcename)
Returns the parent id of the given resource. |
protected void |
internalRemoveFolder(CmsDbContext dbc,
CmsProject currentProject,
CmsResource resource)
Removes a resource physically in the database. |
protected void |
internalValidateResourceLength(CmsResource resource)
Validates that the length setting of a resource is always correct. |
void |
publishResource(CmsDbContext dbc,
CmsProject onlineProject,
CmsResource onlineResource,
CmsResource offlineResource,
boolean writeFileContent)
Publishes the structure and resource records of an offline resource into it's online counterpart. |
java.util.List |
readChildResources(CmsDbContext dbc,
CmsProject currentProject,
CmsResource resource,
boolean getFolders,
boolean getFiles)
Reads all child-files and/or child-folders of a specified parent resource. |
CmsFile |
readFile(CmsDbContext dbc,
int projectId,
boolean includeDeleted,
CmsUUID structureId)
Reads a file specified by it's structure ID. |
CmsFolder |
readFolder(CmsDbContext dbc,
int projectId,
CmsUUID folderId)
Reads a folder specified by it's structure ID. |
CmsFolder |
readFolder(CmsDbContext dbc,
int projectId,
java.lang.String folderPath)
Reads a folder specified by it's resource name. |
CmsPropertyDefinition |
readPropertyDefinition(CmsDbContext dbc,
java.lang.String name,
int projectId)
Reads a property definition for the soecified resource type. |
java.util.List |
readPropertyDefinitions(CmsDbContext dbc,
int projectId)
Reads all property definitions for the specified mapping type. |
CmsProperty |
readPropertyObject(CmsDbContext dbc,
java.lang.String key,
CmsProject project,
CmsResource resource)
Reads a property object from the database specified by it's key name mapped to a resource. |
java.util.List |
readPropertyObjects(CmsDbContext dbc,
CmsProject project,
CmsResource resource)
Reads all property objects mapped to a specified resource from the database. |
CmsResource |
readResource(CmsDbContext dbc,
int projectId,
CmsUUID structureId,
boolean includeDeleted)
Reads a resource specified by it's structure ID. |
CmsResource |
readResource(CmsDbContext dbc,
int projectId,
java.lang.String path,
boolean includeDeleted)
Reads a resource specified by it's resource name. |
java.util.List |
readResources(CmsDbContext dbc,
int projectId,
int state,
int mode)
Reads all resources inside a given project and with a given state. |
java.util.List |
readResourcesForPrincipalACE(CmsDbContext dbc,
CmsProject project,
CmsUUID principalId)
Returns all resources associated to a given principal via an ACE. |
java.util.List |
readResourcesForPrincipalAttr(CmsDbContext dbc,
CmsProject project,
CmsUUID principalId)
Returns all resources associated to a given principal through some of following attributes. |
java.util.List |
readResourcesWithProperty(CmsDbContext dbc,
int projectId,
CmsUUID propertyDef,
java.lang.String path)
Reads all resources that have a value set for the specified property (definition), in the given path. |
java.util.List |
readResourcesWithProperty(CmsDbContext dbc,
int projectId,
CmsUUID 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 |
readResourceTree(CmsDbContext dbc,
int projectId,
java.lang.String parentPath,
int type,
int 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 |
readSiblings(CmsDbContext dbc,
CmsProject currentProject,
CmsResource resource,
boolean includeDeleted)
Reads all siblings that point to the resource record of a specified resource. |
void |
removeFile(CmsDbContext dbc,
CmsProject currentProject,
CmsResource resource,
boolean removeFileContent)
Removes a file physically in the database. |
void |
removeFolder(CmsDbContext dbc,
CmsProject currentProject,
CmsResource resource)
Removes a folder physically in the database. |
void |
replaceResource(CmsDbContext dbc,
CmsResource newResource,
byte[] resContent,
int newResourceType)
Replaces the content and properties of an existing resource. |
void |
transferResource(CmsDbContext dbc,
CmsProject project,
CmsResource resource,
CmsUUID createdUser,
CmsUUID lastModifiedUser)
Transfers the attributes of a resource from to the given users. |
boolean |
validateResourceIdExists(CmsDbContext dbc,
int projectId,
CmsUUID resourceId)
Validates if the specified resource ID in the tables of the specified project {offline|online} exists. |
boolean |
validateStructureIdExists(CmsDbContext dbc,
int projectId,
CmsUUID structureId)
Validates if the specified structure ID in the tables of the specified project {offline|online} exists. |
void |
writeContent(CmsDbContext dbc,
CmsProject project,
CmsUUID resourceId,
byte[] content)
Writes the resource content with the specified content id. |
void |
writeLastModifiedProjectId(CmsDbContext dbc,
CmsProject project,
int projectId,
CmsResource resource)
Writes the "last-modified-in-project" ID of a resource. |
void |
writePropertyObject(CmsDbContext dbc,
CmsProject project,
CmsResource resource,
CmsProperty property)
Writes a property object to the database mapped to a specified resource. |
void |
writePropertyObjects(CmsDbContext dbc,
CmsProject project,
CmsResource resource,
java.util.List properties)
Writes a list of property objects to the database mapped to a specified resource. |
void |
writeResource(CmsDbContext dbc,
CmsProject project,
CmsResource resource,
int changed)
Writes the structure and/or resource record(s) of an existing file. |
void |
writeResourceState(CmsDbContext dbc,
CmsProject project,
CmsResource resource,
int changed)
Writes file state in either the structure or resource record, or both of them. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.opencms.db.I_CmsDriver |
toString |
Field Detail |
protected static final java.lang.String BEGIN_EXCLUDE_CONDITION
protected static final java.lang.String BEGIN_INCLUDE_CONDITION
protected static final java.lang.String END_CONDITION
protected CmsDriverManager m_driverManager
protected CmsSqlManager m_sqlManager
Constructor Detail |
public CmsVfsDriver()
Method Detail |
public void createContent(CmsDbContext dbc, CmsProject project, CmsUUID resourceId, byte[] content, int versionId) throws CmsDataAccessException
I_CmsVfsDriver
createContent
in interface I_CmsVfsDriver
dbc
- the current database contextproject
- the current projectresourceId
- the resource id to create the content forcontent
- the content to writeversionId
- for the content of a backup file you need to insert the versionId of the backup
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.createContent(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.util.CmsUUID, byte[], int)
public CmsFile createFile(java.sql.ResultSet res, int projectId) throws java.sql.SQLException
I_CmsVfsDriver
createFile
in interface I_CmsVfsDriver
res
- the JDBC ResultSetprojectId
- the project id
java.sql.SQLException
- in case the result set does not include a requested table attributeI_CmsVfsDriver.createFile(java.sql.ResultSet, int)
public CmsFile createFile(java.sql.ResultSet res, int projectId, boolean hasFileContentInResultSet) throws java.sql.SQLException
I_CmsVfsDriver
createFile
in interface I_CmsVfsDriver
res
- the JDBC ResultSetprojectId
- the project idhasFileContentInResultSet
- flag to include the file content
java.sql.SQLException
- in case the result set does not include a requested table attributeI_CmsVfsDriver.createFile(java.sql.ResultSet, int, boolean)
public CmsFolder createFolder(java.sql.ResultSet res, int projectId, boolean hasProjectIdInResultSet) throws java.sql.SQLException
I_CmsVfsDriver
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 attribute
java.sql.SQLException
- in case the result set does not include a requested table attributeI_CmsVfsDriver.createFolder(java.sql.ResultSet, int, boolean)
public CmsPropertyDefinition createPropertyDefinition(CmsDbContext dbc, int projectId, java.lang.String name) throws CmsDataAccessException
I_CmsVfsDriver
createPropertyDefinition
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the project in which the propertydefinition is createdname
- the name of the propertydefinitions to overwrite
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.createPropertyDefinition(org.opencms.db.CmsDbContext, int, java.lang.String)
public CmsResource createResource(CmsDbContext dbc, CmsProject project, CmsResource resource, byte[] content) throws CmsDataAccessException
I_CmsVfsDriver
This method works for both files and folders. Existing resources get overwritten.
createResource
in interface I_CmsVfsDriver
dbc
- the current database contextproject
- the current projectresource
- the resource to be createdcontent
- the file content, or null in case of a folder
CmsDataAccessException
- if somethong goes wrongI_CmsVfsDriver.createResource(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.file.CmsResource, byte[])
public CmsResource createResource(java.sql.ResultSet res, int 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 link
java.sql.SQLException
- in case the result set does not include a requested table attributeI_CmsVfsDriver.createResource(java.sql.ResultSet, int)
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 prototype
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.createSibling(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.file.CmsResource)
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 deleted
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.deletePropertyDefinition(org.opencms.db.CmsDbContext, org.opencms.file.CmsPropertyDefinition)
public void deletePropertyObjects(CmsDbContext dbc, int 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 deleted
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.deletePropertyObjects(org.opencms.db.CmsDbContext, int, org.opencms.file.CmsResource, int)
public void destroy() throws java.lang.Throwable
I_CmsVfsDriver
destroy
in interface I_CmsVfsDriver
java.lang.Throwable
- if something goes wrongI_CmsVfsDriver.destroy()
public CmsSqlManager getSqlManager()
I_CmsVfsDriver
getSqlManager
in interface I_CmsVfsDriver
I_CmsVfsDriver.getSqlManager()
public void init(CmsDbContext dbc, CmsConfigurationManager configurationManager, java.util.List 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|backup} pool Urls have to be specified.
initSqlManager
in interface I_CmsVfsDriver
classname
- the classname of the SQL manager
I_CmsVfsDriver.initSqlManager(String)
public void publishResource(CmsDbContext dbc, CmsProject onlineProject, CmsResource onlineResource, CmsResource offlineResource, boolean writeFileContent) throws CmsDataAccessException
I_CmsVfsDriver
publishResource
in interface I_CmsVfsDriver
dbc
- the current database contextonlineProject
- the online projectonlineResource
- the online resourceofflineResource
- the offline resourcewriteFileContent
- true, if also the content record of the specified offline resource should be written to the online table; false otherwise
CmsDataAccessException
- if somethong goes wrongI_CmsVfsDriver.publishResource(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.file.CmsResource, org.opencms.file.CmsResource, boolean)
public java.util.List 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 set
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readChildResources(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.file.CmsResource, boolean, boolean)
public CmsFile readFile(CmsDbContext dbc, int projectId, boolean includeDeleted, CmsUUID structureId) throws CmsDataAccessException
I_CmsVfsDriver
readFile
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the ID of the current projectincludeDeleted
- true if should be read even if it's state is deletedstructureId
- the id of the file
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readFile(org.opencms.db.CmsDbContext, int, boolean, org.opencms.util.CmsUUID)
public CmsFolder readFolder(CmsDbContext dbc, int 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 id of the folder to be read
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readFolder(org.opencms.db.CmsDbContext, int, org.opencms.util.CmsUUID)
public CmsFolder readFolder(CmsDbContext dbc, int 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 read
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readFolder(org.opencms.db.CmsDbContext, int, java.lang.String)
public CmsPropertyDefinition readPropertyDefinition(CmsDbContext dbc, java.lang.String name, int 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 propertydefinition to readprojectId
- the id of the project
null
if there is no property definition with the given name.
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readPropertyDefinition(org.opencms.db.CmsDbContext, java.lang.String, int)
public java.util.List readPropertyDefinitions(CmsDbContext dbc, int projectId) throws CmsDataAccessException
I_CmsVfsDriver
readPropertyDefinitions
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the id of the project
CmsPropertyDefinition
objects (may be empty)
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readPropertyDefinitions(org.opencms.db.CmsDbContext, int)
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.
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 to
CmsDataAccessException
- 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 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.
readPropertyObjects
in interface I_CmsVfsDriver
dbc
- the current database contextproject
- the current projectresource
- the resource where the property is attached to
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readPropertyObjects(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.file.CmsResource)
public CmsResource readResource(CmsDbContext dbc, int 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 included
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readResource(org.opencms.db.CmsDbContext, int, org.opencms.util.CmsUUID, boolean)
public CmsResource readResource(CmsDbContext dbc, int 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 included
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readResource(org.opencms.db.CmsDbContext, int, java.lang.String, boolean)
public java.util.List readResources(CmsDbContext dbc, int projectId, int 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 mode
CmsDataAccessException
- if somethong goes wrongI_CmsVfsDriver.readResources(org.opencms.db.CmsDbContext, int, int, int)
public java.util.List 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 principal
CmsResource
objects
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readResourcesForPrincipalACE(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.util.CmsUUID)
public java.util.List 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 principal
CmsResource
objects
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readResourcesForPrincipalAttr(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.util.CmsUUID)
public java.util.List readResourcesWithProperty(CmsDbContext dbc, int projectId, CmsUUID propertyDef, java.lang.String path) throws CmsDataAccessException
I_CmsVfsDriver
Both individual and shared properties of a resource are checked.
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 from
CmsResource
objects
that have a value set for the specified property.
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readResourcesWithProperty(org.opencms.db.CmsDbContext, int, org.opencms.util.CmsUUID, String)
public java.util.List readResourcesWithProperty(CmsDbContext dbc, int 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.
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 property
CmsResource
objects
that have a value set for the specified property.
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readResourcesWithProperty(org.opencms.db.CmsDbContext, int, org.opencms.util.CmsUUID, String, String)
public java.util.List readResourceTree(CmsDbContext dbc, int projectId, java.lang.String parentPath, int type, int state, long lastModifiedAfter, long lastModifiedBefore, long releasedAfter, long releasedBefore, long expiredAfter, long expiredBefore, int mode) throws CmsDataAccessException
I_CmsVfsDriver
Important: If C_READMODE_EXCLUDE_TREE is true (or C_READMODE_INCLUDE_TREE is false), the provided parent String must be the UUID of the parent folder, NOT the parent folder path.
readResourceTree
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the project id for matching resources or C_READ_OFFLINE_PROJECTSparentPath
- the path to the resource used as root of the searched subtree or READ_IGNORE_PARENT (C_READMODE_EXCLUDE_TREE means to read immidiate children only)type
- the resource type of matching resources or C_READ_IGNORE_TYPES (meaning inverted by C_READMODE_EXCLUDE_TYPE)state
- the state of matching resources or READ_IGNORE_STATE (meaning inverted by C_READMODE_EXCLUDE_STATE)lastModifiedAfter
- 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:
C_READMODE_INCLUDE_TREE
C_READMODE_EXCLUDE_TREE
C_READMODE_INCLUDE_PROJECT
C_READMODE_EXCLUDE_TYPE
C_READMODE_EXCLUDE_STATE
CmsDataAccessException
- if somethong goes wrongI_CmsVfsDriver.readResourceTree(org.opencms.db.CmsDbContext, int, java.lang.String, int, int, long, long, long, long, long, long, int)
public java.util.List readSiblings(CmsDbContext dbc, CmsProject currentProject, CmsResource resource, boolean includeDeleted) throws CmsDataAccessException
I_CmsVfsDriver
readSiblings
in interface I_CmsVfsDriver
dbc
- the current database contextcurrentProject
- the current projectresource
- the specified resourceincludeDeleted
- true
if deleted siblings should be included in the result list
CmsResource
s that
are siblings to the specified resource,
including the specified resource itself.
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.readSiblings(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.file.CmsResource, boolean)
public void removeFile(CmsDbContext dbc, CmsProject currentProject, CmsResource resource, boolean removeFileContent) throws CmsDataAccessException
I_CmsVfsDriver
removeFile
in interface I_CmsVfsDriver
dbc
- the current database contextcurrentProject
- the current projectresource
- the resourceremoveFileContent
- if true, the content record is also removed; if false, only the structure/resource records are removed
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.removeFile(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.file.CmsResource, boolean)
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 folder
CmsDataAccessException
- 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 type
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.replaceResource(org.opencms.db.CmsDbContext, org.opencms.file.CmsResource, byte[], int)
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 las modificator of the resource
CmsDataAccessException
- 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 boolean validateResourceIdExists(CmsDbContext dbc, int 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 for
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.validateResourceIdExists(org.opencms.db.CmsDbContext, int, org.opencms.util.CmsUUID)
public boolean validateStructureIdExists(CmsDbContext dbc, int projectId, CmsUUID structureId) throws CmsDataAccessException
I_CmsVfsDriver
validateStructureIdExists
in interface I_CmsVfsDriver
dbc
- the current database contextprojectId
- the ID of current projectstructureId
- the structure id
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.validateStructureIdExists(org.opencms.db.CmsDbContext, int, org.opencms.util.CmsUUID)
public void writeContent(CmsDbContext dbc, CmsProject project, CmsUUID resourceId, byte[] content) throws CmsDataAccessException
I_CmsVfsDriver
writeContent
in interface I_CmsVfsDriver
dbc
- the current database contextproject
- the current projectresourceId
- the id of the resource used to identify the content to updatecontent
- the new content of the file
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.writeContent(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.util.CmsUUID, byte[])
public void writeLastModifiedProjectId(CmsDbContext dbc, CmsProject project, int 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 reourceresource
- the resource that gets updated
CmsDataAccessException
- if something goes wrongI_CmsVfsDriver.writeLastModifiedProjectId(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, int, 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 property
CmsDataAccessException
- 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 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 objects
CmsDataAccessException
- 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, CmsProject project, 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 attribs 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)
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 contextproject
- 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, org.opencms.file.CmsProject, org.opencms.file.CmsResource, int)
public void writeResourceState(CmsDbContext dbc, CmsProject project, CmsResource resource, int changed) 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 attribs. get updated here. Use I_CmsVfsDriver.writeResource(CmsDbContext, CmsProject, CmsResource, int)
instead to write the complete file header.
Please refer to the javadoc of I_CmsVfsDriver.writeResource(CmsDbContext, CmsProject, 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"
CmsDataAccessException
- if somethong goes wrongI_CmsVfsDriver.writeResourceState(org.opencms.db.CmsDbContext, org.opencms.file.CmsProject, org.opencms.file.CmsResource, int)
protected 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 path
protected void finalize() throws java.lang.Throwable
java.lang.Throwable
Object.finalize()
protected int internalCountProperties(CmsDbContext dbc, CmsPropertyDefinition propertyDefinition, int projectId) throws CmsDataAccessException
dbc
- the current database contextpropertyDefinition
- the propertydefinition to testprojectId
- the ID of the current project
CmsDataAccessException
- if something goes wrongprotected int internalCountSiblings(CmsDbContext dbc, int projectId, CmsUUID resourceId) throws CmsDataAccessException
dbc
- the current database contextprojectId
- the current project idresourceId
- the resource id to count the number of siblings from
CmsDataAccessException
- if something goes wrongprotected java.lang.String internalReadParentId(CmsDbContext dbc, int projectId, java.lang.String resourcename) throws CmsDataAccessException
dbc
- the current database contextprojectId
- the current project idresourcename
- the resource name to read the parent id for
CmsDataAccessException
- 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 remove
CmsDataAccessException
- 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 for
CmsDataAccessException
- if the resource length is not correct
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |