Class CmsProjectDriver
- All Implemented Interfaces:
I_CmsDriver
,I_CmsProjectDriver
- Direct Known Subclasses:
CmsProjectDriver
,CmsProjectDriver
,CmsProjectDriver
,CmsProjectDriver
,CmsProjectDriver
,CmsProjectDriver
,CmsProjectDriver
- Since:
- 6.0.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Attribute name for reading the project of a resource.protected CmsDriverManager
The driver manager.protected CmsSqlManager
The SQL manager.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_CmsProjectDriver
DRIVER_TYPE_ID, SETUP_PROJECT_NAME, TEMP_FILE_PROJECT_NAME
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Cleans up the publish history entries according to the given filter.createProject
(CmsDbContext dbc, CmsUUID id, CmsUser owner, CmsGroup group, CmsGroup managergroup, String projectFqn, String description, int flags, CmsProject.CmsProjectType type) Creates a new project.void
createProjectResource
(CmsDbContext dbc, CmsUUID projectId, String resourcePath) Creates a new projectResource from a given CmsResource object.void
createPublishJob
(CmsDbContext dbc, CmsPublishJobInfoBean publishJob) Inserts an entry for a publish job .protected CmsPublishJobInfoBean
Creates aCmsPublishJobInfoBean
from a result set.void
deleteAllStaticExportPublishedResources
(CmsDbContext dbc, int linkType) Deletes all entries in the published resource table.void
deleteLog
(CmsDbContext dbc, CmsLogFilter filter) Deletes log entries matching the given filter.void
deleteProject
(CmsDbContext dbc, CmsProject project) Deletes a project from the cms.void
deleteProjectResource
(CmsDbContext dbc, CmsUUID projectId, String resourceName) Delete a projectResource from an given CmsResource object.void
deleteProjectResources
(CmsDbContext dbc, CmsProject project) Deletes a specified project.void
deletePublishHistory
(CmsDbContext dbc, CmsUUID projectId, int maxpublishTag) Deletes all publish history entries with publish tags >=0 and < the specified max.void
deletePublishHistoryEntry
(CmsDbContext dbc, CmsUUID publishHistoryId, CmsPublishedResource publishedResource) Deletes a publish history entry with publish tags >=0 and < the specified max.void
deletePublishJob
(CmsDbContext dbc, CmsUUID publishHistoryId) Deletes a publish job identified by its history id.void
deletePublishList
(CmsDbContext dbc, CmsUUID publishHistoryId) Deletes the publish list assigned to a publish job.void
deleteStaticExportPublishedResource
(CmsDbContext dbc, String resourceName, int linkType, String linkParameter) Deletes an entry in the published resource table.void
deleteUserPublishListEntries
(CmsDbContext dbc, List<CmsUserPublishListEntry> publishListDeletions) Deletes multiple publish list entries from the database.void
destroy()
Destroys this driver.void
fillDefaults
(CmsDbContext dbc) Fills the OpenCms database tables with default values.protected CmsResourceState
fixMovedResource
(CmsDbContext dbc, CmsProject onlineProject, CmsResource offlineResource, CmsUUID publishHistoryId, int publishTag) Checks if the given resource (by id) is available in the online project, if there exists a resource with a different path (a moved file), then the online entry is moved to the right (new) location before publishing.protected String
getParameterString
(Collection<?> data) Returns a SQL parameter string for the given data.Returns the SqlManager of this driver.getUsersPubList
(CmsDbContext dbc, CmsUUID userId) Returns the given user's publish list.protected List<CmsResource>
getUsersPubListFromLog
(CmsDbContext dbc, CmsUUID userId) Implementation of reading the user publish list which uses the log table.void
init
(CmsDbContext dbc, CmsConfigurationManager configurationManager, List<String> successiveDrivers, CmsDriverManager driverManager) Initializes the driver.initSqlManager
(String classname) Initializes the SQL manager for this driver.protected CmsProject
Creates a new project from the current row of the given result set.protected CmsPublishList
internalDeserializePublishList
(byte[] bytes) Builds a publish list from serialized data.protected CmsLogEntry
Creates a newCmsLogEntry
object from the given result set entry.protected void
internalResetResourceState
(CmsDbContext dbc, CmsResource resource) Resets the state to UNCHANGED for a specified resource.protected byte[]
internalSerializePublishList
(CmsPublishList publishList) Serialize publish list to write it as byte array to the database.protected void
internalWriteHistory
(CmsDbContext dbc, CmsResource resource, CmsResourceState state, List<CmsProperty> properties, CmsUUID publishHistoryId, int publishTag) Writes the needed history entries.void
log
(CmsDbContext dbc, List<CmsLogEntry> logEntries) Logs the given log entries.protected CmsPair<String,
List<I_CmsPreparedStatementParameter>> prepareLogConditions
(CmsLogFilter filter) Build the whole WHERE SQL statement part for the given log entry filter.protected void
publishChangedFile
(CmsDbContext dbc, CmsProject onlineProject, CmsResource offlineResource, Set<CmsUUID> publishedResourceIds, CmsUUID publishHistoryId, int publishTag) Publishes a changed file.protected void
publishDeletedFile
(CmsDbContext dbc, CmsProject onlineProject, CmsResource offlineResource, CmsUUID publishHistoryId, int publishTag) Publishes a deleted file.void
publishDeletedFolder
(CmsDbContext dbc, I_CmsReport report, int m, int n, CmsProject onlineProject, CmsFolder currentFolder, CmsUUID publishHistoryId, int publishTag) Publishes a deleted folder.void
publishFile
(CmsDbContext dbc, I_CmsReport report, int m, int n, CmsProject onlineProject, CmsResource offlineResource, Set<CmsUUID> publishedContentIds, CmsUUID publishHistoryId, int publishTag) Publishes a new, changed or deleted file.publishFileContent
(CmsDbContext dbc, CmsProject offlineProject, CmsProject onlineProject, CmsResource offlineResource, Set<CmsUUID> publishedResourceIds, boolean needToUpdateContent, int publishTag) Publishes the content record of a file.void
publishFolder
(CmsDbContext dbc, I_CmsReport report, int m, int n, CmsProject onlineProject, CmsFolder offlineFolder, CmsUUID publishHistoryId, int publishTag) Publishes a new or changed folder.protected void
publishNewFile
(CmsDbContext dbc, CmsProject onlineProject, CmsResource offlineResource, Set<CmsUUID> publishedContentIds, CmsUUID publishHistoryId, int publishTag) Publishes a new file.void
publishProject
(CmsDbContext dbc, I_CmsReport report, CmsProject onlineProject, CmsPublishList publishList, int publishTag) Publishes a specified project to the online project.readLocks
(CmsDbContext dbc) readLog
(CmsDbContext dbc, CmsLogFilter filter) Reads log entries matching the given filter.readProject
(CmsDbContext dbc, String projectFqn) Reads a project.readProject
(CmsDbContext dbc, CmsUUID id) Reads a project given the projects id.readProjectResource
(CmsDbContext dbc, CmsUUID projectId, String resourcePath) Reads the project resource path for a given project and resource path, to validate if a resource path for a given project already exists.readProjectResources
(CmsDbContext dbc, CmsProject project) Reads the project resources for a specified project.readProjects
(CmsDbContext dbc, String ouFqn) Returns all projects in the given organizational unit.readProjectsForGroup
(CmsDbContext dbc, CmsGroup group) Returns all projects, which are accessible by a group.readProjectsForManagerGroup
(CmsDbContext dbc, CmsGroup group) Returns all projects, which are manageable by a group.readProjectsForResource
(CmsDbContext dbc, String rootPath) Returns the projects of a given resource.readProjectsForUser
(CmsDbContext dbc, CmsUser user) Reads all projects which are owned by a specified user.readPublishedResources
(CmsDbContext dbc, CmsUUID publishHistoryId) Reads the resources that were published during a publish process for a given publish history ID.readPublishJob
(CmsDbContext dbc, CmsUUID publishHistoryId) Reads a single publish job identified by its publish history id.readPublishJobs
(CmsDbContext dbc, long startTime, long endTime) Reads all publish jobs finished in the given time range.readPublishList
(CmsDbContext dbc, CmsUUID publishHistoryId) Reads the publish list assigned to a publish job.byte[]
readPublishReportContents
(CmsDbContext dbc, CmsUUID publishHistoryId) Reads the publish report assigned to a publish job.readStaticExportPublishedResourceParameters
(CmsDbContext dbc, String rfsName) Returns the parameters of a resource in the table of all published template resources.readStaticExportResources
(CmsDbContext dbc, int parameterResources, long timestamp) Returns a list of all template resources which must be processed during a static export.void
setDriverManager
(CmsDriverManager driverManager) Sets the driver manager for this driver if possible.void
setSqlManager
(CmsSqlManager manager) Sets the SQL manager for this driver if possible.void
unmarkProjectResources
(CmsDbContext dbc, CmsProject project) Removes the project id from all resources within a project.void
writeLocks
(CmsDbContext dbc, List<CmsLock> locks) void
writeProject
(CmsDbContext dbc, CmsProject project) Writes an already existing project.void
writePublishHistory
(CmsDbContext dbc, CmsUUID publishId, CmsPublishedResource resource) Inserts an entry in the publish history for a published VFS resource.void
writePublishJob
(CmsDbContext dbc, CmsPublishJobInfoBean publishJob) Writes a publish job.void
writePublishReport
(CmsDbContext dbc, CmsUUID publishId, byte[] content) Writes a publish report for a publish job.void
writeStaticExportPublishedResource
(CmsDbContext dbc, String resourceName, int linkType, String linkParameter, long timestamp) Inserts an entry in the published resource table.void
writeUserPublishListEntries
(CmsDbContext dbc, List<CmsUserPublishListEntry> publishListAdditions) Writes multiple user publish list entries to the database.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 Details
-
DBC_ATTR_READ_PROJECT_FOR_RESOURCE
Attribute name for reading the project of a resource.- See Also:
-
m_driverManager
The driver manager. -
m_sqlManager
The SQL manager.
-
-
Constructor Details
-
CmsProjectDriver
public CmsProjectDriver()
-
-
Method Details
-
cleanupPublishHistory
public int cleanupPublishHistory(CmsDbContext dbc, CmsPublishHistoryCleanupFilter filter) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Cleans up the publish history entries according to the given filter.- Specified by:
cleanupPublishHistory
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the DB contextfilter
- the filter to describe what to clean up- Returns:
- the number of removed entries
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
createProject
public CmsProject createProject(CmsDbContext dbc, CmsUUID id, CmsUser owner, CmsGroup group, CmsGroup managergroup, String projectFqn, String description, int flags, CmsProject.CmsProjectType type) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Creates a new project.- Specified by:
createProject
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextid
- the project idowner
- the owner of the projectgroup
- the group for the projectmanagergroup
- the manager group for the projectprojectFqn
- the name of the project to createdescription
- the description for the projectflags
- the flags for the projecttype
- the type for the project- Returns:
- the created
instanceCmsProject
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
createProjectResource
public void createProjectResource(CmsDbContext dbc, CmsUUID projectId, String resourcePath) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Creates a new projectResource from a given CmsResource object.- Specified by:
createProjectResource
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextprojectId
- The project in which the resource will be usedresourcePath
- The resource to be written to the Cms- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
createPublishJob
public void createPublishJob(CmsDbContext dbc, CmsPublishJobInfoBean publishJob) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Inserts an entry for a publish job .- Specified by:
createPublishJob
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextpublishJob
- the publish job data- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
deleteAllStaticExportPublishedResources
public void deleteAllStaticExportPublishedResources(CmsDbContext dbc, int linkType) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Deletes all entries in the published resource table.- Specified by:
deleteAllStaticExportPublishedResources
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextlinkType
- the type of resource deleted (0= non-paramter, 1=parameter)- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
deleteLog
Description copied from interface:I_CmsProjectDriver
Deletes log entries matching the given filter.- Specified by:
deleteLog
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the database contextfilter
- the log entry filter- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
deleteProject
Description copied from interface:I_CmsProjectDriver
Deletes a project from the cms.Therefore it deletes all files, resources and properties.
- Specified by:
deleteProject
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextproject
- the project to delete- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
deleteProjectResource
public void deleteProjectResource(CmsDbContext dbc, CmsUUID projectId, String resourceName) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Delete a projectResource from an given CmsResource object.- Specified by:
deleteProjectResource
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextprojectId
- id of the project in which the resource is usedresourceName
- name of the resource to be deleted from the Cms- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
deleteProjectResources
public void deleteProjectResources(CmsDbContext dbc, CmsProject project) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Deletes a specified project.- Specified by:
deleteProjectResources
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextproject
- the project to be deleted- Throws:
CmsDataAccessException
- if operation was not succesful- See Also:
-
deletePublishHistory
public void deletePublishHistory(CmsDbContext dbc, CmsUUID projectId, int maxpublishTag) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Deletes all publish history entries with publish tags >=0 and < the specified max. publish tag.- Specified by:
deletePublishHistory
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextprojectId
- the ID of the current projectmaxpublishTag
- entries with publish tags >=0 and < this max. publish tag get deleted- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
deletePublishHistoryEntry
public void deletePublishHistoryEntry(CmsDbContext dbc, CmsUUID publishHistoryId, CmsPublishedResource publishedResource) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Deletes a publish history entry with publish tags >=0 and < the specified max. publish tag.- Specified by:
deletePublishHistoryEntry
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextpublishHistoryId
- the id of the history to delete the entry frompublishedResource
- the entry to delete- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
deletePublishJob
public void deletePublishJob(CmsDbContext dbc, CmsUUID publishHistoryId) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Deletes a publish job identified by its history id.- Specified by:
deletePublishJob
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextpublishHistoryId
- the history id identifying the publish job- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
deletePublishList
public void deletePublishList(CmsDbContext dbc, CmsUUID publishHistoryId) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Deletes the publish list assigned to a publish job.- Specified by:
deletePublishList
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextpublishHistoryId
- the history id identifying the publish job- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
deleteStaticExportPublishedResource
public void deleteStaticExportPublishedResource(CmsDbContext dbc, String resourceName, int linkType, String linkParameter) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Deletes an entry in the published resource table.- Specified by:
deleteStaticExportPublishedResource
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextresourceName
- The name of the resource to be deleted in the static exportlinkType
- the type of resource deleted (0= non-paramter, 1=parameter)linkParameter
- the parameters of the resource- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
deleteUserPublishListEntries
public void deleteUserPublishListEntries(CmsDbContext dbc, List<CmsUserPublishListEntry> publishListDeletions) throws CmsDbSqlException Description copied from interface:I_CmsProjectDriver
Deletes multiple publish list entries from the database.- Specified by:
deleteUserPublishListEntries
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextpublishListDeletions
- the publish list entries to remove from the database- Throws:
CmsDbSqlException
- See Also:
-
destroy
Description copied from interface:I_CmsProjectDriver
Destroys this driver.- Specified by:
destroy
in interfaceI_CmsProjectDriver
- Throws:
Throwable
- if something goes wrong- See Also:
-
fillDefaults
Description copied from interface:I_CmsProjectDriver
Fills the OpenCms database tables with default values.- Specified by:
fillDefaults
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database context- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
getSqlManager
Description copied from interface:I_CmsProjectDriver
Returns the SqlManager of this driver.- Specified by:
getSqlManager
in interfaceI_CmsProjectDriver
- Returns:
- the SqlManager of this driver
- See Also:
-
getUsersPubList
public List<CmsResource> getUsersPubList(CmsDbContext dbc, CmsUUID userId) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Returns the given user's publish list.- Specified by:
getUsersPubList
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the database contextuserId
- the user's id- Returns:
- the given user's publish list
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
init
public void init(CmsDbContext dbc, CmsConfigurationManager configurationManager, List<String> successiveDrivers, CmsDriverManager driverManager) Description copied from interface:I_CmsDriver
Initializes the driver.- Specified by:
init
in interfaceI_CmsDriver
- Parameters:
dbc
- the current database contextconfigurationManager
- the configuration managersuccessiveDrivers
- a list of successive drivers to be initializeddriverManager
- the initialized OpenCms driver manager- See Also:
-
initSqlManager
Description copied from interface:I_CmsProjectDriver
Initializes the SQL manager for this driver.To obtain JDBC connections from different pools, further {online|offline|history} pool Urls have to be specified.
- Specified by:
initSqlManager
in interfaceI_CmsProjectDriver
- Parameters:
classname
- the classname of the SQL manager- Returns:
- the SQL manager for this driver
- See Also:
-
log
Description copied from interface:I_CmsProjectDriver
Logs the given log entries.- Specified by:
log
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the database contextlogEntries
- the log entries to write- Throws:
CmsDbSqlException
- See Also:
-
publishDeletedFolder
public void publishDeletedFolder(CmsDbContext dbc, I_CmsReport report, int m, int n, CmsProject onlineProject, CmsFolder currentFolder, CmsUUID publishHistoryId, int publishTag) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Publishes a deleted folder.- Specified by:
publishDeletedFolder
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextreport
- the report to log the output tom
- the number of the folder to publishn
- the number of all folders to publishonlineProject
- the online projectcurrentFolder
- the offline folder to publishpublishHistoryId
- the publish history idpublishTag
- the publish tag- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
publishFile
public void publishFile(CmsDbContext dbc, I_CmsReport report, int m, int n, CmsProject onlineProject, CmsResource offlineResource, Set<CmsUUID> publishedContentIds, CmsUUID publishHistoryId, int publishTag) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Publishes a new, changed or deleted file.- Specified by:
publishFile
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextreport
- the report to log the output tom
- the number of the file to publishn
- the number of all files to publishonlineProject
- the online projectofflineResource
- the offline file to publishpublishedContentIds
- contains the UUIDs of already published content recordspublishHistoryId
- the publish history idpublishTag
- the publish tag- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
publishFileContent
public CmsFile publishFileContent(CmsDbContext dbc, CmsProject offlineProject, CmsProject onlineProject, CmsResource offlineResource, Set<CmsUUID> publishedResourceIds, boolean needToUpdateContent, int publishTag) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Publishes the content record of a file.The content record is only published unless it's UUID is not contained in publishedContentIds. The calling method has to take care about whether an existing content record has to be deleted before or not.
The intention of this method is to get overloaded in a project driver for a specific DB server to shift the binary content from the offline into the online table in a more sophisticated way than in the generic ANSI-SQL implementation of this interface.
- Specified by:
publishFileContent
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextofflineProject
- the offline project to read dataonlineProject
- the online project to write dataofflineResource
- the offline header of the file of which the content gets publishedpublishedResourceIds
- a Set with the UUIDs of the already published content recordsneedToUpdateContent
-true
if the content record has to be updatedpublishTag
- the publish tag- Returns:
- the published file (online)
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
publishFolder
public void publishFolder(CmsDbContext dbc, I_CmsReport report, int m, int n, CmsProject onlineProject, CmsFolder offlineFolder, CmsUUID publishHistoryId, int publishTag) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Publishes a new or changed folder.- Specified by:
publishFolder
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextreport
- the report to log the output tom
- the number of the folder to publishn
- the number of all folders to publishonlineProject
- the online projectofflineFolder
- the offline folder to publishpublishHistoryId
- the publish history idpublishTag
- the publish tag- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
publishProject
public void publishProject(CmsDbContext dbc, I_CmsReport report, CmsProject onlineProject, CmsPublishList publishList, int publishTag) throws CmsException Description copied from interface:I_CmsProjectDriver
Publishes a specified project to the online project.- Specified by:
publishProject
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextreport
- an I_CmsReport instance to print output messagesonlineProject
- the online projectpublishList
- a Cms publish listpublishTag
- the publish tag- Throws:
CmsException
- if something goes wrong- See Also:
-
readLocks
Description copied from interface:I_CmsProjectDriver
- Specified by:
readLocks
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database context- Returns:
- the
that were saved to the database in the previous run of OpenCms.List
<CmsLock
;> - Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
readLog
public List<CmsLogEntry> readLog(CmsDbContext dbc, CmsLogFilter filter) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Reads log entries matching the given filter.- Specified by:
readLog
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the database contextfilter
- the log entry filter- Returns:
- the list of log entries
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
readProject
Description copied from interface:I_CmsProjectDriver
Reads a project given the projects id.- Specified by:
readProject
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextid
- the id of the project- Returns:
- the project read
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
readProject
Description copied from interface:I_CmsProjectDriver
Reads a project.- Specified by:
readProject
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextprojectFqn
- the name of the project- Returns:
- the project with the given name
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
readProjectResource
public String readProjectResource(CmsDbContext dbc, CmsUUID projectId, String resourcePath) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Reads the project resource path for a given project and resource path, to validate if a resource path for a given project already exists.- Specified by:
readProjectResource
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextprojectId
- the ID of the project for which the resource path is readresourcePath
- the project's resource path- Returns:
- String the project's resource path
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
readProjectResources
public List<String> readProjectResources(CmsDbContext dbc, CmsProject project) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Reads the project resources for a specified project.- Specified by:
readProjectResources
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextproject
- the project for which the resource path is read- Returns:
- a list of all project resource paths
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
readProjects
Description copied from interface:I_CmsProjectDriver
Returns all projects in the given organizational unit.- Specified by:
readProjects
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextouFqn
- the fully qualified name of the organizational unit to get the projects for- Returns:
- a list of objects of type
CmsProject
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
readProjectsForGroup
public List<CmsProject> readProjectsForGroup(CmsDbContext dbc, CmsGroup group) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Returns all projects, which are accessible by a group.- Specified by:
readProjectsForGroup
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextgroup
- the requesting group- Returns:
- a Vector of projects
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
readProjectsForManagerGroup
public List<CmsProject> readProjectsForManagerGroup(CmsDbContext dbc, CmsGroup group) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Returns all projects, which are manageable by a group.- Specified by:
readProjectsForManagerGroup
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextgroup
- The requesting group- Returns:
- a Vector of projects
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
readProjectsForResource
public List<CmsProject> readProjectsForResource(CmsDbContext dbc, String rootPath) throws CmsDataAccessException Returns the projects of a given resource.- Parameters:
dbc
- the database contextrootPath
- the resource root path- Returns:
- the projects of the resource, as a list of projects
- Throws:
CmsDataAccessException
- if something goes wrong
-
readProjectsForUser
public List<CmsProject> readProjectsForUser(CmsDbContext dbc, CmsUser user) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Reads all projects which are owned by a specified user.- Specified by:
readProjectsForUser
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextuser
- the user- Returns:
- a list of objects of type
CmsProject
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
readPublishedResources
public List<CmsPublishedResource> readPublishedResources(CmsDbContext dbc, CmsUUID publishHistoryId) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Reads the resources that were published during a publish process for a given publish history ID.- Specified by:
readPublishedResources
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextpublishHistoryId
- unique int ID to identify the publish process in the publish history- Returns:
- a list of
objectsCmsPublishedResource
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
readPublishJob
public CmsPublishJobInfoBean readPublishJob(CmsDbContext dbc, CmsUUID publishHistoryId) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Reads a single publish job identified by its publish history id.- Specified by:
readPublishJob
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextpublishHistoryId
- unique id to identify the publish job in the publish history- Returns:
- an object of type
CmsPublishJobInfoBean
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
readPublishJobs
public List<CmsPublishJobInfoBean> readPublishJobs(CmsDbContext dbc, long startTime, long endTime) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Reads all publish jobs finished in the given time range.If
(0L, 0L)
is passed as time range, all pending jobs are returned.- Specified by:
readPublishJobs
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextstartTime
- the start of the time range for finish timeendTime
- the end of the time range for finish time- Returns:
- a list of objects of type
CmsPublishJobInfoBean
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
readPublishList
public CmsPublishList readPublishList(CmsDbContext dbc, CmsUUID publishHistoryId) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Reads the publish list assigned to a publish job.- Specified by:
readPublishList
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextpublishHistoryId
- the history id identifying the publish job- Returns:
- the assigned publish list
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
readPublishReportContents
public byte[] readPublishReportContents(CmsDbContext dbc, CmsUUID publishHistoryId) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Reads the publish report assigned to a publish job.- Specified by:
readPublishReportContents
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextpublishHistoryId
- the history id identifying the publish job- Returns:
- the content of the assigned publish report
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
readStaticExportPublishedResourceParameters
public String readStaticExportPublishedResourceParameters(CmsDbContext dbc, String rfsName) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Returns the parameters of a resource in the table of all published template resources.- Specified by:
readStaticExportPublishedResourceParameters
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextrfsName
- the rfs name of the resource- Returns:
- the paramter string of the requested resource
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
readStaticExportResources
public List<String> readStaticExportResources(CmsDbContext dbc, int parameterResources, long timestamp) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Returns a list of all template resources which must be processed during a static export.- Specified by:
readStaticExportResources
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextparameterResources
- flag for reading resources with parameters (1) or without (0)timestamp
- the time stamp information- Returns:
- a list of template resources as
objectsString
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
setDriverManager
Description copied from interface:I_CmsProjectDriver
Sets the driver manager for this driver if possible.- Specified by:
setDriverManager
in interfaceI_CmsProjectDriver
- Parameters:
driverManager
- the new driver manager- See Also:
-
setSqlManager
Description copied from interface:I_CmsProjectDriver
Sets the SQL manager for this driver if possible.- Specified by:
setSqlManager
in interfaceI_CmsProjectDriver
- Parameters:
manager
- the new SQL manager- See Also:
-
unmarkProjectResources
public void unmarkProjectResources(CmsDbContext dbc, CmsProject project) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Removes the project id from all resources within a project.This must be done when a project will deleted
- Specified by:
unmarkProjectResources
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextproject
- the project to delete- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
writeLocks
Description copied from interface:I_CmsProjectDriver
Writes the
to the database for reuse in the next run of OpenCms.List
<CmsLock
;>This method must only be called at startup or the in-memory locking will overwritten.
- Specified by:
writeLocks
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextlocks
- the
that currently exist in OpenCms (List
<CmsLock
;>CmsLockManager
)- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
writeProject
Description copied from interface:I_CmsProjectDriver
Writes an already existing project.The project id has to be a valid OpenCms project id.
The project with the given id will be completely overriden by the given data.- Specified by:
writeProject
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextproject
- the project that should be written- Throws:
CmsDataAccessException
- if operation was not successful- See Also:
-
writePublishHistory
public void writePublishHistory(CmsDbContext dbc, CmsUUID publishId, CmsPublishedResource resource) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Inserts an entry in the publish history for a published VFS resource.- Specified by:
writePublishHistory
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextpublishId
- the ID of the current publishing processresource
- the state of the resource *before* it was published- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
writePublishJob
public void writePublishJob(CmsDbContext dbc, CmsPublishJobInfoBean publishJob) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Writes a publish job.- Specified by:
writePublishJob
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextpublishJob
- the publish job to write- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
writePublishReport
public void writePublishReport(CmsDbContext dbc, CmsUUID publishId, byte[] content) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Writes a publish report for a publish job.- Specified by:
writePublishReport
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextpublishId
- the ID of the current publishing processcontent
- the report output- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
writeStaticExportPublishedResource
public void writeStaticExportPublishedResource(CmsDbContext dbc, String resourceName, int linkType, String linkParameter, long timestamp) throws CmsDataAccessException Description copied from interface:I_CmsProjectDriver
Inserts an entry in the published resource table.This is done during static export.
- Specified by:
writeStaticExportPublishedResource
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextresourceName
- The name of the resource to be added to the static exportlinkType
- the type of resource exported (0= non-paramter, 1=parameter)linkParameter
- the parameters added to the resourcetimestamp
- a timestamp for writing the data into the db- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
writeUserPublishListEntries
public void writeUserPublishListEntries(CmsDbContext dbc, List<CmsUserPublishListEntry> publishListAdditions) throws CmsDbSqlException Description copied from interface:I_CmsProjectDriver
Writes multiple user publish list entries to the database.- Specified by:
writeUserPublishListEntries
in interfaceI_CmsProjectDriver
- Parameters:
dbc
- the current database contextpublishListAdditions
- the user publish list entries to write- Throws:
CmsDbSqlException
- See Also:
-
createPublishJobInfoBean
Creates aCmsPublishJobInfoBean
from a result set.- Parameters:
res
- the result set- Returns:
- an initialized
CmsPublishJobInfoBean
- Throws:
SQLException
- if something goes wrong
-
fixMovedResource
protected CmsResourceState fixMovedResource(CmsDbContext dbc, CmsProject onlineProject, CmsResource offlineResource, CmsUUID publishHistoryId, int publishTag) throws CmsDataAccessException Checks if the given resource (by id) is available in the online project, if there exists a resource with a different path (a moved file), then the online entry is moved to the right (new) location before publishing.- Parameters:
dbc
- the db contextonlineProject
- the online projectofflineResource
- the offline resource to checkpublishHistoryId
- the publish history idpublishTag
- the publish tag- Returns:
true
if the resource has actually been moved- Throws:
CmsDataAccessException
- if something goes wrong
-
getParameterString
Returns a SQL parameter string for the given data.- Parameters:
data
- the data- Returns:
- the SQL parameter
-
getUsersPubListFromLog
protected List<CmsResource> getUsersPubListFromLog(CmsDbContext dbc, CmsUUID userId) throws CmsDataAccessException Implementation of reading the user publish list which uses the log table.This is the old implementation of the user publish list and can get pretty slow.
- Parameters:
dbc
- the current database contextuserId
- the id of the user for which we want the user publish list- Returns:
- the publish list for the given user
- Throws:
CmsDataAccessException
- if something goes wrong
-
internalCreateProject
Creates a new project from the current row of the given result set.- Parameters:
res
- the result set- Returns:
- the new project
- Throws:
SQLException
- is something goes wrong
-
internalDeserializePublishList
protected CmsPublishList internalDeserializePublishList(byte[] bytes) throws IOException, ClassNotFoundException Builds a publish list from serialized data.- Parameters:
bytes
- the byte array containing the serailized data for the publish list- Returns:
- the initialized publish list
- Throws:
IOException
- if deserialization failsClassNotFoundException
- if deserialization fails
-
internalReadLogEntry
Creates a newCmsLogEntry
object from the given result set entry.- Parameters:
res
- the result set- Returns:
- the new
CmsLogEntry
object - Throws:
SQLException
- if something goes wrong
-
internalResetResourceState
protected void internalResetResourceState(CmsDbContext dbc, CmsResource resource) throws CmsDataAccessException Resets the state to UNCHANGED for a specified resource.- Parameters:
dbc
- the current database contextresource
- the Cms resource- Throws:
CmsDataAccessException
- if something goes wrong
-
internalSerializePublishList
Serialize publish list to write it as byte array to the database.- Parameters:
publishList
- the publish list- Returns:
- byte array containing the publish list data
- Throws:
IOException
- if something goes wrong
-
internalWriteHistory
protected void internalWriteHistory(CmsDbContext dbc, CmsResource resource, CmsResourceState state, List<CmsProperty> properties, CmsUUID publishHistoryId, int publishTag) throws CmsDataAccessException Writes the needed history entries.- Parameters:
dbc
- the current database contextresource
- the offline resourcestate
- the state to store in the publish history entryproperties
- the offline propertiespublishHistoryId
- the current publish process idpublishTag
- the current publish process tag- Throws:
CmsDataAccessException
- if something goes wrong
-
prepareLogConditions
protected CmsPair<String,List<I_CmsPreparedStatementParameter>> prepareLogConditions(CmsLogFilter filter) Build the whole WHERE SQL statement part for the given log entry filter.- Parameters:
filter
- the filter- Returns:
- a pair containing both the SQL and the parameters for it
-
publishChangedFile
protected void publishChangedFile(CmsDbContext dbc, CmsProject onlineProject, CmsResource offlineResource, Set<CmsUUID> publishedResourceIds, CmsUUID publishHistoryId, int publishTag) throws CmsDataAccessException Publishes a changed file.- Parameters:
dbc
- the current database contextonlineProject
- the online projectofflineResource
- the resource to publishpublishedResourceIds
- contains the UUIDs of already published content recordspublishHistoryId
- the publish history idpublishTag
- the publish tag- Throws:
CmsDataAccessException
- is something goes wrong
-
publishDeletedFile
protected void publishDeletedFile(CmsDbContext dbc, CmsProject onlineProject, CmsResource offlineResource, CmsUUID publishHistoryId, int publishTag) throws CmsDataAccessException Publishes a deleted file.- Parameters:
dbc
- the current database contextonlineProject
- the online projectofflineResource
- the resource to publishpublishHistoryId
- the publish history idpublishTag
- the publish tag- Throws:
CmsDataAccessException
- is something goes wrong
-
publishNewFile
protected void publishNewFile(CmsDbContext dbc, CmsProject onlineProject, CmsResource offlineResource, Set<CmsUUID> publishedContentIds, CmsUUID publishHistoryId, int publishTag) throws CmsDataAccessException Publishes a new file.- Parameters:
dbc
- the current database contextonlineProject
- the online projectofflineResource
- the resource to publishpublishedContentIds
- contains the UUIDs of already published content recordspublishHistoryId
- the publish history idpublishTag
- the publish tag- Throws:
CmsDataAccessException
- is something goes wrong
-