public interface I_CmsHistoryDriver
A history driver is a driver to write projects, resources and properties of resources optionally to a second set of history database tables while resources get published. A unique publish tag ID is used to identify a set of resource that were saved during one publish process.
限定符和类型 | 字段和说明 |
---|---|
static int |
DRIVER_TYPE_ID
The type ID to identify history driver implementations.
|
限定符和类型 | 方法和说明 |
---|---|
CmsPropertyDefinition |
createPropertyDefinition(CmsDbContext dbc,
java.lang.String name,
CmsPropertyDefinition.CmsPropertyType type)
Creates a new property defintion in the database.
|
int |
deleteEntries(CmsDbContext dbc,
I_CmsHistoryResource histResource,
int versionsToKeep,
long time)
Deletes all historical versions of a resource
keeping maximal
versionsToKeep versions. |
void |
deletePropertyDefinition(CmsDbContext dbc,
CmsPropertyDefinition propertyDef)
Deletes a property definition.
|
void |
destroy()
Destroys this driver.
|
java.util.List<I_CmsHistoryResource> |
getAllDeletedEntries(CmsDbContext dbc)
Returns all historical resources (of deleted resources).
|
java.util.List<I_CmsHistoryResource> |
getAllNotDeletedEntries(CmsDbContext dbc)
Returns all historical resources (of not deleted resources).
|
CmsSqlManager |
getSqlManager()
Returns the SqlManager of this driver.
|
CmsSqlManager |
initSqlManager(java.lang.String classname)
Initializes the SQL manager for this driver.
|
java.util.List<I_CmsHistoryResource> |
readAllAvailableVersions(CmsDbContext dbc,
CmsUUID structureId)
Reads all file headers of the resource with the given structure id.
|
byte[] |
readContent(CmsDbContext dbc,
CmsUUID resourceId,
int publishTag)
Reads the content of the historical version of the resource
identified by its structure id.
|
java.util.List<I_CmsHistoryResource> |
readDeletedResources(CmsDbContext dbc,
CmsUUID structureId,
CmsUUID userId)
Reads all deleted (historical) resources below the given path, that the given user deleted by itself.
|
int |
readLastVersion(CmsDbContext dbc,
CmsUUID structureId)
Returns the last historical version of a resource.
|
int |
readMaxPublishTag(CmsDbContext dbc,
CmsUUID resourceId)
Reads the maximal publish tag for a specified resource id.
|
int |
readNextPublishTag(CmsDbContext dbc)
Returns the next available history publish tag.
|
CmsHistoryPrincipal |
readPrincipal(CmsDbContext dbc,
CmsUUID principalId)
Reads an historical principal entry.
|
CmsHistoryProject |
readProject(CmsDbContext dbc,
CmsUUID projectId)
Reads the latest historical project version with the given id.
|
CmsHistoryProject |
readProject(CmsDbContext dbc,
int publishTag)
Reads an historical project version.
|
java.util.List<java.lang.String> |
readProjectResources(CmsDbContext dbc,
int publishTag)
Reads all resources that belong to the historical project identified by the given publish tag.
|
java.util.List<CmsHistoryProject> |
readProjects(CmsDbContext dbc)
Returns all projects from the history.
|
java.util.List<CmsProperty> |
readProperties(CmsDbContext dbc,
I_CmsHistoryResource historicalResource)
Returns a list of all properties of a historical file or folder.
|
CmsPropertyDefinition |
readPropertyDefinition(CmsDbContext dbc,
java.lang.String name)
Reads a property definition with the given name.
|
int |
readPublishTag(CmsDbContext dbc,
long maxdate)
Gets the publish tag of the first historical project after a given date.
|
I_CmsHistoryResource |
readResource(CmsDbContext dbc,
CmsUUID structureId,
int version)
Reads a historical resource version without including the file content.
|
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 |
writePrincipal(CmsDbContext dbc,
I_CmsPrincipal principal)
Writes an historical entry for the given principal.
|
void |
writeProject(CmsDbContext dbc,
int publishTag,
long publishDate)
Creates an historical entry for the current project.
|
void |
writeProperties(CmsDbContext dbc,
CmsResource resource,
java.util.List<CmsProperty> properties,
int publishTag)
Writes the properties of a resource to the history.
|
void |
writeResource(CmsDbContext dbc,
CmsResource resource,
java.util.List<CmsProperty> properties,
int publishTag)
Writes a resource to the history.
|
static final int DRIVER_TYPE_ID
CmsPropertyDefinition createPropertyDefinition(CmsDbContext dbc, java.lang.String name, CmsPropertyDefinition.CmsPropertyType type) throws CmsDataAccessException
dbc
- the current database contextname
- the name of the property definitiontype
- the type of the property definitionCmsDataAccessException
- if something goes wrongint deleteEntries(CmsDbContext dbc, I_CmsHistoryResource histResource, int versionsToKeep, long time) throws CmsDataAccessException
versionsToKeep
versions.dbc
- the current database contexthistResource
- the historical resource to delete versions forversionsToKeep
- the number of versions to keeptime
- deleted resources older than this will also be deleted, is ignored if negativeCmsDataAccessException
- if something goes wrongvoid deletePropertyDefinition(CmsDbContext dbc, CmsPropertyDefinition propertyDef) throws CmsDataAccessException
dbc
- the current database contextpropertyDef
- the property definition to be deletedCmsDataAccessException
- if something goes wrongvoid destroy() throws java.lang.Throwable
java.lang.Throwable
- if something goes wrongjava.util.List<I_CmsHistoryResource> getAllDeletedEntries(CmsDbContext dbc) throws CmsDataAccessException
dbc
- the current database contextI_CmsHistoryResource
objectsCmsDataAccessException
- if something goes wrongjava.util.List<I_CmsHistoryResource> getAllNotDeletedEntries(CmsDbContext dbc) throws CmsDataAccessException
dbc
- the current database contextI_CmsHistoryResource
objectsCmsDataAccessException
- if something goes wrongCmsSqlManager getSqlManager()
CmsSqlManager initSqlManager(java.lang.String classname)
classname
- the classname of the SQL managerjava.util.List<I_CmsHistoryResource> readAllAvailableVersions(CmsDbContext dbc, CmsUUID structureId) throws CmsDataAccessException
This method returns a list with the history of the resource, i.e.
the historical resources, independent of the project they were attached to.
The reading excludes the file content.
dbc
- the current database contextstructureId
- the structure idI_CmsHistoryResource
objectsCmsDataAccessException
- if something goes wrongbyte[] readContent(CmsDbContext dbc, CmsUUID resourceId, int publishTag) throws CmsDataAccessException
dbc
- the current database contextresourceId
- the resource id of the resource to read the content forpublishTag
- the publish tag of the versionCmsDataAccessException
- if something goes wrongjava.util.List<I_CmsHistoryResource> readDeletedResources(CmsDbContext dbc, CmsUUID structureId, CmsUUID userId) throws CmsDataAccessException
dbc
- the current db contextstructureId
- the structure id of the parent resource to read the deleted resources fromuserId
- the id of the user that deleted the resources, or null
to retrieve them allI_CmsHistoryResource
objectsCmsDataAccessException
- if something goes wrongint readLastVersion(CmsDbContext dbc, CmsUUID structureId) throws CmsDataAccessException
dbc
- the current database contextstructureId
- the structure ID of the resourceCmsDataAccessException
- if something goes wrongint readMaxPublishTag(CmsDbContext dbc, CmsUUID resourceId) throws CmsDataAccessException
dbc
- the current database contextresourceId
- the id of the resource the get the publish tag forCmsDataAccessException
- if something goes wrongint readNextPublishTag(CmsDbContext dbc)
dbc
- the current database contextCmsHistoryPrincipal readPrincipal(CmsDbContext dbc, CmsUUID principalId) throws CmsDataAccessException
dbc
- the current database contextprincipalId
- the id of the principal to retrieveCmsDataAccessException
- if something goes wrongCmsHistoryProject readProject(CmsDbContext dbc, CmsUUID projectId) throws CmsDataAccessException
dbc
- the current database contextprojectId
- the project idCmsDataAccessException
- is something goes wrongCmsHistoryProject readProject(CmsDbContext dbc, int publishTag) throws CmsDataAccessException
dbc
- the current database contextpublishTag
- the publish tagCmsDataAccessException
- is something goes wrongjava.util.List<java.lang.String> readProjectResources(CmsDbContext dbc, int publishTag) throws CmsDataAccessException
dbc
- the current database contextpublishTag
- the publish tagCmsDataAccessException
- if something goes wrongjava.util.List<CmsHistoryProject> readProjects(CmsDbContext dbc) throws CmsDataAccessException
dbc
- the current database contextCmsHistoryProject
objects
with all projects from history.CmsDataAccessException
- if an error occursjava.util.List<CmsProperty> readProperties(CmsDbContext dbc, I_CmsHistoryResource historicalResource) throws CmsDataAccessException
dbc
- the current database contexthistoricalResource
- the resource to read the properties fromCmsProperty
objectsCmsDataAccessException
- if something goes wrongCmsPropertyDefinition readPropertyDefinition(CmsDbContext dbc, java.lang.String name) throws CmsDataAccessException
dbc
- the current database contextname
- the name of the property definition to readnull
if not foundCmsDataAccessException
- if something goes wrongint readPublishTag(CmsDbContext dbc, long maxdate) throws CmsDataAccessException
This method is used during the deletion process of older historical data.
dbc
- the current database contextmaxdate
- the date to compare the historical projects withCmsDataAccessException
- if something goes wrongI_CmsHistoryResource readResource(CmsDbContext dbc, CmsUUID structureId, int version) throws CmsDataAccessException
dbc
- the current database contextstructureId
- the structure id of the resource to readversion
- the desired version numberCmsDataAccessException
- if something goes wrongvoid setDriverManager(CmsDriverManager driverManager)
driverManager
- the new driver managervoid setSqlManager(CmsSqlManager sqlManager)
sqlManager
- the new SQL managervoid writePrincipal(CmsDbContext dbc, I_CmsPrincipal principal) throws CmsDataAccessException
dbc
- the current database contextprincipal
- the principal to writeCmsDataAccessException
- if something goes wrongvoid writeProject(CmsDbContext dbc, int publishTag, long publishDate) throws CmsDataAccessException
dbc
- the current database contextpublishTag
- the publish tagpublishDate
- long timestamp when the current project was publishedCmsDataAccessException
- if something goes wrongvoid writeProperties(CmsDbContext dbc, CmsResource resource, java.util.List<CmsProperty> properties, int publishTag) throws CmsDataAccessException
dbc
- the current database contextresource
- the resource of the propertiesproperties
- the properties to writepublishTag
- the publish tagCmsDataAccessException
- if something goes wrongvoid writeResource(CmsDbContext dbc, CmsResource resource, java.util.List<CmsProperty> properties, int publishTag) throws CmsDataAccessException
dbc
- the current database contextresource
- the resource that is written to the historyproperties
- the properties of the resourcepublishTag
- the publish tagCmsDataAccessException
- if something goes wrong