|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Objectorg.opencms.db.generic.CmsHistoryDriver
public class CmsHistoryDriver
Generic (ANSI-SQL) database server implementation of the history driver methods.
| Field Summary | |
|---|---|
protected CmsDriverManager |
m_driverManager
The driver manager instance. |
protected CmsSqlManager |
m_sqlManager
The SQL manager instance. |
| Fields inherited from interface org.opencms.db.I_CmsDriver |
|---|
AND_CONDITION, BEGIN_CONDITION, BEGIN_EXCLUDE_CONDITION, BEGIN_INCLUDE_CONDITION, END_CONDITION, OR_CONDITION |
| Fields inherited from interface org.opencms.db.I_CmsHistoryDriver |
|---|
DRIVER_TYPE_ID |
| Constructor Summary | |
|---|---|
CmsHistoryDriver()
|
|
| Method Summary | |
|---|---|
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 resource,
int versionsToKeep,
long time)
Deletes all historical versions of a resource keeping maximal versionsToKeep versions. |
void |
deletePropertyDefinition(CmsDbContext dbc,
CmsPropertyDefinition metadef)
Deletes a property definition. |
void |
destroy()
Destroys this driver. |
java.util.List |
getAllDeletedEntries(CmsDbContext dbc)
Returns all historical resources (of deleted resources). |
java.util.List |
getAllNotDeletedEntries(CmsDbContext dbc)
Returns all historical resources (of not deleted resources). |
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 void |
internalAddToPropMap(java.util.Map propertyMap,
I_CmsHistoryResource resource,
java.lang.String propertyKey,
java.lang.String propertyValue,
int mappingType)
Updates the property map for the given resource with the given property data. |
protected void |
internalCleanup(CmsDbContext dbc,
I_CmsHistoryResource resource)
Deletes all historical entries of subresources of a folder without any historical netry left. |
protected int |
internalCountProperties(CmsDbContext dbc,
CmsPropertyDefinition metadef,
CmsUUID projectId)
Returns the amount of properties for a propertydefinition. |
protected CmsHistoryProject |
internalCreateProject(java.sql.ResultSet res,
java.util.List resources)
Creates a historical project from the given result set and resources. |
protected I_CmsHistoryResource |
internalCreateResource(java.sql.ResultSet res)
Creates a valid I_CmsHistoryResource instance from a JDBC ResultSet. |
protected I_CmsHistoryResource |
internalMergeResource(I_CmsHistoryResource histRes,
java.sql.ResultSet res,
int versionOffset)
Merges an historical entry for a sibling, based on the structure data from the given historical resource and result set for the resource entry. |
protected boolean |
internalValidateResource(CmsDbContext dbc,
CmsResource resource,
int publishTag)
Tests if a history resource does exist. |
java.util.List |
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 |
readDeletedResources(CmsDbContext dbc,
CmsUUID structureId,
CmsUUID userId)
Reads all deleted (historical) resources below the given path, that the given user deleted by itself. |
I_CmsHistoryResource |
readFile(CmsDbContext dbc,
CmsUUID structureId,
int tagId)
Deprecated. use readResource(CmsDbContext, CmsUUID, int) instead
but notice that the publishTag != version |
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 |
readProjectResources(CmsDbContext dbc,
int publishTag)
Reads all resources that belong to the historical project identified by the given publish tag. |
java.util.List |
readProjects(CmsDbContext dbc)
Returns all projects from the history. |
java.util.List |
readProperties(CmsDbContext dbc,
I_CmsHistoryResource resource)
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. |
void |
setSqlManager(CmsSqlManager sqlManager)
Sets the SQL manager of this driver. |
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 properties,
int publishTag)
Writes the properties of a resource to the history. |
void |
writeResource(CmsDbContext dbc,
CmsResource resource,
java.util.List properties,
int publishTag)
Writes a resource to the history. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.opencms.db.I_CmsDriver |
|---|
toString |
| Field Detail |
|---|
protected CmsDriverManager m_driverManager
protected CmsSqlManager m_sqlManager
| Constructor Detail |
|---|
public CmsHistoryDriver()
| Method Detail |
|---|
public CmsPropertyDefinition createPropertyDefinition(CmsDbContext dbc,
java.lang.String name,
CmsPropertyDefinition.CmsPropertyType type)
throws CmsDataAccessException
I_CmsHistoryDriver
createPropertyDefinition in interface I_CmsHistoryDriverdbc - the current database contextname - the name of the property definitiontype - the type of the property definition
CmsDataAccessException - if something goes wrongI_CmsHistoryDriver.createPropertyDefinition(org.opencms.db.CmsDbContext, java.lang.String, org.opencms.file.CmsPropertyDefinition.CmsPropertyType)
public int deleteEntries(CmsDbContext dbc,
I_CmsHistoryResource resource,
int versionsToKeep,
long time)
throws CmsDataAccessException
I_CmsHistoryDriverversionsToKeep versions.
deleteEntries in interface I_CmsHistoryDriverdbc - the current database contextresource - 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 negative
CmsDataAccessException - if something goes wrongI_CmsHistoryDriver.deleteEntries(CmsDbContext, I_CmsHistoryResource, int, long)
public void deletePropertyDefinition(CmsDbContext dbc,
CmsPropertyDefinition metadef)
throws CmsDataAccessException
I_CmsHistoryDriver
deletePropertyDefinition in interface I_CmsHistoryDriverdbc - the current database contextmetadef - the property definition to be deleted
CmsDataAccessException - if something goes wrongI_CmsHistoryDriver.deletePropertyDefinition(org.opencms.db.CmsDbContext, org.opencms.file.CmsPropertyDefinition)
public void destroy()
throws java.lang.Throwable
I_CmsHistoryDriver
destroy in interface I_CmsHistoryDriverjava.lang.Throwable - if something goes wrongI_CmsHistoryDriver.destroy()
public java.util.List getAllDeletedEntries(CmsDbContext dbc)
throws CmsDataAccessException
I_CmsHistoryDriver
getAllDeletedEntries in interface I_CmsHistoryDriverdbc - the current database context
I_CmsHistoryResource objects
CmsDataAccessException - if something goes wrongI_CmsHistoryDriver.getAllDeletedEntries(org.opencms.db.CmsDbContext)
public java.util.List getAllNotDeletedEntries(CmsDbContext dbc)
throws CmsDataAccessException
I_CmsHistoryDriver
getAllNotDeletedEntries in interface I_CmsHistoryDriverdbc - the current database context
I_CmsHistoryResource objects
CmsDataAccessException - if something goes wrongI_CmsHistoryDriver.getAllNotDeletedEntries(org.opencms.db.CmsDbContext)public CmsSqlManager getSqlManager()
I_CmsHistoryDriver
getSqlManager in interface I_CmsHistoryDriverI_CmsHistoryDriver.getSqlManager()
public void init(CmsDbContext dbc,
CmsConfigurationManager configurationManager,
java.util.List successiveDrivers,
CmsDriverManager driverManager)
I_CmsDriver
init in interface I_CmsDriverdbc - 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_CmsHistoryDriver
initSqlManager in interface I_CmsHistoryDriverclassname - the classname of the SQL manager
I_CmsHistoryDriver.initSqlManager(String)
public java.util.List readAllAvailableVersions(CmsDbContext dbc,
CmsUUID structureId)
throws CmsDataAccessException
I_CmsHistoryDriver
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.
readAllAvailableVersions in interface I_CmsHistoryDriverdbc - the current database contextstructureId - the structure id
I_CmsHistoryResource objects
CmsDataAccessException - if something goes wrongI_CmsHistoryDriver.readAllAvailableVersions(CmsDbContext, CmsUUID)
public byte[] readContent(CmsDbContext dbc,
CmsUUID resourceId,
int publishTag)
throws CmsDataAccessException
I_CmsHistoryDriver
readContent in interface I_CmsHistoryDriverdbc - the current database contextresourceId - the resource id of the resource to read the content forpublishTag - the publish tag of the version
CmsDataAccessException - if something goes wrongI_CmsHistoryDriver.readContent(org.opencms.db.CmsDbContext, org.opencms.util.CmsUUID, int)
public java.util.List readDeletedResources(CmsDbContext dbc,
CmsUUID structureId,
CmsUUID userId)
throws CmsDataAccessException
I_CmsHistoryDriver
readDeletedResources in interface I_CmsHistoryDriverdbc - 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 all
I_CmsHistoryResource objects
CmsDataAccessException - if something goes wrongI_CmsHistoryDriver.readDeletedResources(CmsDbContext, CmsUUID, CmsUUID)
public I_CmsHistoryResource readFile(CmsDbContext dbc,
CmsUUID structureId,
int tagId)
throws CmsDataAccessException
readResource(CmsDbContext, CmsUUID, int) instead
but notice that the publishTag != version
I_CmsHistoryDriver
readFile in interface I_CmsHistoryDriverdbc - the current database contextstructureId - the structure id of the file to readtagId - the desired publish tag of the file
CmsDataAccessException - if something goes wrongI_CmsHistoryDriver.readFile(CmsDbContext, CmsUUID, int)
public int readLastVersion(CmsDbContext dbc,
CmsUUID structureId)
throws CmsDataAccessException
I_CmsHistoryDriver
readLastVersion in interface I_CmsHistoryDriverdbc - the current database contextstructureId - the structure ID of the resource
CmsDataAccessException - if something goes wrongI_CmsHistoryDriver.readLastVersion(org.opencms.db.CmsDbContext, org.opencms.util.CmsUUID)
public int readMaxPublishTag(CmsDbContext dbc,
CmsUUID resourceId)
throws CmsDataAccessException
I_CmsHistoryDriver
readMaxPublishTag in interface I_CmsHistoryDriverdbc - the current database contextresourceId - the id of the resource the get the publish tag for
CmsDataAccessException - if something goes wrongI_CmsHistoryDriver.readMaxPublishTag(CmsDbContext, CmsUUID)public int readNextPublishTag(CmsDbContext dbc)
I_CmsHistoryDriver
readNextPublishTag in interface I_CmsHistoryDriverdbc - the current database context
I_CmsHistoryDriver.readNextPublishTag(org.opencms.db.CmsDbContext)
public CmsHistoryPrincipal readPrincipal(CmsDbContext dbc,
CmsUUID principalId)
throws CmsDataAccessException
I_CmsHistoryDriver
readPrincipal in interface I_CmsHistoryDriverdbc - the current database contextprincipalId - the id of the principal to retrieve
CmsDataAccessException - if something goes wrongI_CmsHistoryDriver.readPrincipal(org.opencms.db.CmsDbContext, org.opencms.util.CmsUUID)
public CmsHistoryProject readProject(CmsDbContext dbc,
CmsUUID projectId)
throws CmsDataAccessException
I_CmsHistoryDriver
readProject in interface I_CmsHistoryDriverdbc - the current database contextprojectId - the project id
CmsDataAccessException - is something goes wrongI_CmsHistoryDriver.readProject(org.opencms.db.CmsDbContext, CmsUUID)
public CmsHistoryProject readProject(CmsDbContext dbc,
int publishTag)
throws CmsDataAccessException
I_CmsHistoryDriver
readProject in interface I_CmsHistoryDriverdbc - the current database contextpublishTag - the publish tag
CmsDataAccessException - is something goes wrongI_CmsHistoryDriver.readProject(org.opencms.db.CmsDbContext, int)
public java.util.List readProjectResources(CmsDbContext dbc,
int publishTag)
throws CmsDataAccessException
I_CmsHistoryDriver
readProjectResources in interface I_CmsHistoryDriverdbc - the current database contextpublishTag - the publish tag
CmsDataAccessException - if something goes wrongI_CmsHistoryDriver.readProjectResources(org.opencms.db.CmsDbContext, int)
public java.util.List readProjects(CmsDbContext dbc)
throws CmsDataAccessException
I_CmsHistoryDriver
readProjects in interface I_CmsHistoryDriverdbc - the current database context
CmsHistoryProject objects
with all projects from history.
CmsDataAccessException - if an error occursI_CmsHistoryDriver.readProjects(org.opencms.db.CmsDbContext)
public java.util.List readProperties(CmsDbContext dbc,
I_CmsHistoryResource resource)
throws CmsDataAccessException
I_CmsHistoryDriver
readProperties in interface I_CmsHistoryDriverdbc - the current database contextresource - the resource to read the properties from
CmsProperty objects
CmsDataAccessException - if something goes wrongI_CmsHistoryDriver.readProperties(org.opencms.db.CmsDbContext, org.opencms.file.history.I_CmsHistoryResource)
public CmsPropertyDefinition readPropertyDefinition(CmsDbContext dbc,
java.lang.String name)
throws CmsDataAccessException
I_CmsHistoryDriver
readPropertyDefinition in interface I_CmsHistoryDriverdbc - the current database contextname - the name of the property definition to read
null if not found
CmsDataAccessException - if something goes wrongI_CmsHistoryDriver.readPropertyDefinition(org.opencms.db.CmsDbContext, java.lang.String)
public int readPublishTag(CmsDbContext dbc,
long maxdate)
throws CmsDataAccessException
I_CmsHistoryDriverThis method is used during the deletion process of older historical data.
readPublishTag in interface I_CmsHistoryDriverdbc - the current database contextmaxdate - the date to compare the historical projects with
CmsDataAccessException - if something goes wrongI_CmsHistoryDriver.readPublishTag(org.opencms.db.CmsDbContext, long)
public I_CmsHistoryResource readResource(CmsDbContext dbc,
CmsUUID structureId,
int version)
throws CmsDataAccessException
I_CmsHistoryDriver
readResource in interface I_CmsHistoryDriverdbc - the current database contextstructureId - the structure id of the resource to readversion - the desired version number
CmsDataAccessException - if something goes wrongI_CmsHistoryDriver.readResource(CmsDbContext, CmsUUID, int)public void setDriverManager(CmsDriverManager driverManager)
driverManager - the new driver managerpublic void setSqlManager(CmsSqlManager sqlManager)
sqlManager - the new SQL manager
public void writePrincipal(CmsDbContext dbc,
I_CmsPrincipal principal)
throws CmsDataAccessException
I_CmsHistoryDriver
writePrincipal in interface I_CmsHistoryDriverdbc - the current database contextprincipal - the principal to write
CmsDataAccessException - if something goes wrongI_CmsHistoryDriver.writePrincipal(CmsDbContext, org.opencms.security.I_CmsPrincipal)
public void writeProject(CmsDbContext dbc,
int publishTag,
long publishDate)
throws CmsDataAccessException
I_CmsHistoryDriver
writeProject in interface I_CmsHistoryDriverdbc - the current database contextpublishTag - the publish tagpublishDate - long timestamp when the current project was published
CmsDataAccessException - if something goes wrongI_CmsHistoryDriver.writeProject(org.opencms.db.CmsDbContext, int, long)
public void writeProperties(CmsDbContext dbc,
CmsResource resource,
java.util.List properties,
int publishTag)
throws CmsDataAccessException
I_CmsHistoryDriver
writeProperties in interface I_CmsHistoryDriverdbc - the current database contextresource - the resource of the propertiesproperties - the properties to writepublishTag - the publish tag
CmsDataAccessException - if something goes wrongI_CmsHistoryDriver.writeProperties(org.opencms.db.CmsDbContext, org.opencms.file.CmsResource, java.util.List, int)
public void writeResource(CmsDbContext dbc,
CmsResource resource,
java.util.List properties,
int publishTag)
throws CmsDataAccessException
I_CmsHistoryDriver
writeResource in interface I_CmsHistoryDriverdbc - the current database contextresource - the resource that is written to the historyproperties - the properties of the resourcepublishTag - the publish tag
CmsDataAccessException - if something goes wrongI_CmsHistoryDriver.writeResource(org.opencms.db.CmsDbContext, org.opencms.file.CmsResource, java.util.List, int)
protected void internalAddToPropMap(java.util.Map propertyMap,
I_CmsHistoryResource resource,
java.lang.String propertyKey,
java.lang.String propertyValue,
int mappingType)
throws CmsDbConsistencyException
propertyMap - the map to updateresource - the resource the properties belong topropertyKey - the property keypropertyValue - the property valuemappingType - the mapping type
CmsDbConsistencyException - if the mapping type is wrong
protected void internalCleanup(CmsDbContext dbc,
I_CmsHistoryResource resource)
throws CmsDataAccessException
dbc - the current database contextresource - the resource to check
CmsDataAccessException - if something goes wrong
protected int internalCountProperties(CmsDbContext dbc,
CmsPropertyDefinition metadef,
CmsUUID projectId)
throws CmsDataAccessException
dbc - the current database contextmetadef - the propertydefinition to testprojectId - the ID of the current project
CmsDataAccessException - if something goes wrong
protected CmsHistoryProject internalCreateProject(java.sql.ResultSet res,
java.util.List resources)
throws java.sql.SQLException
res - the resource setresources - the historical resources
java.sql.SQLException - if something goes wrong
protected I_CmsHistoryResource internalCreateResource(java.sql.ResultSet res)
throws java.sql.SQLException
I_CmsHistoryResource instance from a JDBC ResultSet.
res - the JDBC result set
java.sql.SQLException - if a requested attribute was not found in the result set
protected I_CmsHistoryResource internalMergeResource(I_CmsHistoryResource histRes,
java.sql.ResultSet res,
int versionOffset)
throws java.sql.SQLException
histRes - the original historical entryres - the result set of the resource entryversionOffset - the offset for the structure version
java.sql.SQLException - if something goes wrong
protected boolean internalValidateResource(CmsDbContext dbc,
CmsResource resource,
int publishTag)
throws CmsDataAccessException
dbc - the current database contextresource - the resource to testpublishTag - the publish tag of the resource to test
true if the resource already exists, false otherwise
CmsDataAccessException - if something goes wrong
|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||