Class CmsDriverManager
- All Implemented Interfaces:
I_CmsEventListener
- Since:
- 6.0.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enum for distinguishing between login modes.static class
Resource list which additionally knows whether it should be cacheable in the resource list cache or not.static class
Special key class for caching the resource OU data with a Guava LoadingCache.static class
Helper class used to store information about resources assigned to OUs in a cache. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Request context attribute used to override the time used for time-based exclusive access checks.static final String
Attribute for signaling to the user driver that a specific OU should be initialized by fillDefaults.static final String
DB context attribute used to communicate information about resource cacheability between various methods.static final String
Attribute login.static final String
Cache key for all properties.static final int
Value to indicate a change in access control entries of a resource.static final int
Value to indicate a content change.static final int
Value to indicate a change in the lastmodified settings of a resource.static final int
Value to indicate a project change.static final int
Value to indicate a change in the resource data.static final int
Value to indicate a change in the availability timeframe.static final String
"cache" string in the configuration-file.static final String
"db" string in the configuration-file.static final String
"driver.history" string in the configuration-file.static final String
"driver.project" string in the configuration-file.static final String
"subscription.vfs" string in the configuration file.static final String
"driver.user" string in the configuration-file.static final String
"driver.vfs" string in the configuration-file.static final String
DBC attribute key needed to fix publishing behavior involving siblings.static final String
The vfs path of the loast and found folder.protected static ConcurrentMap<String,
CmsDbPoolV11> Map of pools defined in opencms.properties.static final int
The maximum length of a VFS resource path.static final int
Key for indicating no changes.static final String
Name of the configuration parameter to enable/disable logging to the CMS_LOG table.static final String
Indicates to ignore the resource path when matching resources.static final long
Indicates to ignore the time value.static final int
Indicates to ignore the resource type when matching resources.static final int
Indicates to match resources NOT having the given state.static final int
Indicates to match immediate children only.static final int
Indicates to match resources NOT having the given type.static final int
Mode for reading project resources from the db.static final int
Indicates to match resources in given project only.static final int
Indicates to match all successors.static final int
Mode for reading project resources from the db.static final int
Indicates if only file resources should be read.static final int
Indicates if only folder resources should be read.static final int
Mode for reading project resources from the db.static boolean
Flag that can be used to disable the resource OU caching if necessary.static final String
Prefix char for temporary files in the VFS.static final int
Key to indicate complete update.static final int
Key to indicate update of resource record.static final int
Key to indicate update of last modified project reference.static final int
Key to indicate update of resource state.static final int
Key to indicate update of resource state including the content date.static final int
Key to indicate update of structure record.static final int
Key to indicate update of structure state.Fields inherited from interface org.opencms.main.I_CmsEventListener
EVENT_BEFORE_PUBLISH_PROJECT, EVENT_CLEAR_CACHES, EVENT_CLEAR_OFFLINE_CACHES, EVENT_CLEAR_ONLINE_CACHES, EVENT_CLEAR_PRINCIPAL_CACHES, EVENT_FLEX_CACHE_CLEAR, EVENT_FLEX_PURGE_JSP_REPOSITORY, EVENT_FULLSTATIC_EXPORT, EVENT_GROUP_MODIFIED, EVENT_LOGIN_USER, EVENT_OU_MODIFIED, EVENT_PROJECT_MODIFIED, EVENT_PROPERTY_DEFINITION_CREATED, EVENT_PROPERTY_DEFINITION_MODIFIED, EVENT_PROPERTY_MODIFIED, EVENT_PUBLISH_PROJECT, EVENT_REBUILD_SEARCHINDEXES, EVENT_REINDEX_OFFLINE, EVENT_REINDEX_ONLINE, EVENT_RESOURCE_AND_PROPERTIES_MODIFIED, EVENT_RESOURCE_COPIED, EVENT_RESOURCE_CREATED, EVENT_RESOURCE_DELETED, EVENT_RESOURCE_MODIFIED, EVENT_RESOURCE_MOVED, EVENT_RESOURCES_AND_PROPERTIES_MODIFIED, EVENT_RESOURCES_MODIFIED, EVENT_SITEMAP_CHANGED, EVENT_UPDATE_EXPORTS, EVENT_USER_MODIFIED, KEY_CHANGE, KEY_DBCONTEXT, KEY_GROUP_ID, KEY_GROUP_NAME, KEY_INDEX_NAMES, KEY_IS_ONLINE, KEY_OU_ID, KEY_OU_NAME, KEY_PROJECTID, KEY_PUBLISHID, KEY_PUBLISHLIST, KEY_REINDEX_RELATED, KEY_REPORT, KEY_RESOURCE, KEY_RESOURCES, KEY_SKIPINDEX, KEY_USER_ACTION, KEY_USER_CHANGES, KEY_USER_ID, KEY_USER_NAME, LISTENERS_FOR_ALL_EVENTS, VALUE_CREATE_SIBLING, VALUE_GROUP_MODIFIED_ACTION_CREATE, VALUE_GROUP_MODIFIED_ACTION_DELETE, VALUE_GROUP_MODIFIED_ACTION_WRITE, VALUE_OU_MODIFIED_ACTION_CREATE, VALUE_OU_MODIFIED_ACTION_DELETE, VALUE_USER_MODIFIED_ACTION_ADD_USER_TO_GROUP, VALUE_USER_MODIFIED_ACTION_CREATE_USER, VALUE_USER_MODIFIED_ACTION_DELETE_USER, VALUE_USER_MODIFIED_ACTION_REMOVE_USER_FROM_GROUP, VALUE_USER_MODIFIED_ACTION_RESET_PASSWORD, VALUE_USER_MODIFIED_ACTION_SET_OU, VALUE_USER_MODIFIED_ACTION_WRITE_USER
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAlias
(CmsDbContext dbc, CmsProject project, CmsAlias alias) Adds an alias entry.protected void
addOrReplaceUrlNameMapping
(CmsDbContext dbc, String name, CmsUUID structureId, String locale, boolean replaceOnPublish) Adds or replaces a new url name mapping in the offline project.void
addRelationToResource
(CmsDbContext dbc, CmsResource resource, CmsResource target, CmsRelationType type, boolean importCase) Adds a new relation to the given resource.void
addResourceToOrgUnit
(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, CmsResource resource) Adds a resource to the given organizational unit.void
addUserToGroup
(CmsDbContext dbc, String username, String groupname, boolean readRoles) Adds a user to a group.void
changeLock
(CmsDbContext dbc, CmsResource resource, CmsLockType lockType) Changes the lock of a resource to the current user, that is "steals" the lock from another user.changeResourcesInFolderWithProperty
(CmsDbContext dbc, CmsResource resource, String propertyDefinition, String oldValue, String newValue, boolean recursive) Returns a list with all sub resources of a given folder that have set the given property, matching the current property's value with the given old value and replacing it by a given new value.void
chflags
(CmsDbContext dbc, CmsResource resource, int flags) Changes the resource flags of a resource.void
chtype
(CmsDbContext dbc, CmsResource resource, int type) Changes the resource type of a resource.int
Cleans up the publish history entries according to the given filter.void
Acknowledge the occurrence of the specified event, implement this method to check for CmsEvents in your class.protected CmsFolder
convertResourceToFolder
(CmsResource resource) Converts a resource to a folder (if possible).void
copyAccessControlEntries
(CmsDbContext dbc, CmsResource source, CmsResource destination, boolean updateLastModifiedInfo) Copies the access control entries of a given resource to a destination resource.void
copyResource
(CmsDbContext dbc, CmsResource source, String destination, CmsResource.CmsResourceCopyMode siblingMode) Copies a resource.void
copyResourceToProject
(CmsDbContext dbc, CmsResource resource) Copies a resource to the current project of the user.int
countLockedResources
(CmsProject project) Counts the locked resources in this project.protected Object
createDriver
(CmsDbContext dbc, CmsConfigurationManager configManager, CmsParameterConfiguration config, String driverChainKey, String suffix) Helper method for creating a driver from configuration data.createGroup
(CmsDbContext dbc, CmsUUID id, String name, String description, int flags, String parent) Add a new group to the Cms.createOrganizationalUnit
(CmsDbContext dbc, String ouFqn, String description, int flags, CmsResource resource) Creates a new organizational unit.createProject
(CmsDbContext dbc, String name, String description, String groupname, String managergroupname, CmsProject.CmsProjectType projecttype) Creates a project.createPropertyDefinition
(CmsDbContext dbc, String name) Creates a property definition.void
createPublishJob
(CmsDbContext dbc, CmsPublishJobInfoBean publishJob) Creates a new publish job.createResource
(CmsDbContext dbc, String resourcename, int type, byte[] content, List<CmsProperty> properties) Creates a new resource of the given resource type with the provided content and properties.createResource
(CmsDbContext dbc, String resourcePath, CmsResource resource, byte[] content, List<CmsProperty> properties, boolean importCase) Creates a new resource with the provided content and properties.createSibling
(CmsDbContext dbc, CmsResource source, String destination, List<CmsProperty> properties) Creates a new sibling of the source resource.Creates the project for the temporary workplace files.createUser
(CmsDbContext dbc, String name, String password, String description, Map<String, Object> additionalInfos) Creates a new user.void
deleteAliases
(CmsDbContext dbc, CmsProject project, CmsAliasFilter filter) Deletes aliases indicated by a filter.void
deleteAllProperties
(CmsDbContext dbc, String resourcename) Deletes all property values of a file or folder.void
deleteAllStaticExportPublishedResources
(CmsDbContext dbc, int linkType) Deletes all entries in the published resource table.void
deleteGroup
(CmsDbContext dbc, CmsGroup group, CmsUUID replacementId) Deletes a group, where all permissions, users and children of the group are transfered to a replacement group.void
deleteHistoricalVersions
(CmsDbContext dbc, int versionsToKeep, int versionsDeleted, long timeDeleted, I_CmsReport report) Deletes the versions from the history tables, keeping the given number of versions per resource.void
deleteLogEntries
(CmsDbContext dbc, CmsLogFilter filter) Deletes all log entries matching the given filter.void
deleteOrganizationalUnit
(CmsDbContext dbc, CmsOrganizationalUnit organizationalUnit) Deletes an organizational unit.void
deleteProject
(CmsDbContext dbc, CmsProject deleteProject) Deletes a project.void
deleteProject
(CmsDbContext dbc, CmsProject deleteProject, boolean resetResources) Deletes a project.void
deletePropertyDefinition
(CmsDbContext dbc, String name) Deletes a property definition.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
deleteRelationsForResource
(CmsDbContext dbc, CmsResource resource, CmsRelationFilter filter) Deletes all relations for the given resource matching the given filter.protected void
deleteRelationsWithSiblings
(CmsDbContext dbc, CmsResource resource) Deletes all relations for the given resource and all its siblings.void
deleteResource
(CmsDbContext dbc, CmsResource resource, CmsResource.CmsResourceDeleteMode siblingMode) Deletes a resource.void
deleteStaticExportPublishedResource
(CmsDbContext dbc, String resourceName, int linkType, String linkParameter) Deletes an entry in the published resource table.void
deleteUser
(CmsDbContext dbc, CmsProject project, String username, String replacementUsername) Deletes a user, where all permissions and resources attributes of the user were transfered to a replacement user, if given.void
destroy()
Destroys this driver manager and releases all allocated resources.protected void
ensureSubResourcesOfMovedFoldersPublished
(CmsObject cms, CmsDbContext dbc, CmsPublishList pubList) Tries to add sub-resources of moved folders to the publish list and throws an exception if the publish list still does not contain some sub-resources of the moved folders.boolean
existsResourceId
(CmsDbContext dbc, CmsUUID resourceId) Tests if a resource with the given resourceId does already exist in the Database.void
fillPublishList
(CmsDbContext dbc, CmsPublishList publishList) Fills the given publish list with the the VFS resources that actually get published.protected String
findBestNameForUrlNameMapping
(CmsDbContext dbc, String name, CmsUUID structureId) Helper method for finding the 'best' URL name to use for a new URL name mapping.protected String
findBestNameForUrlNameMapping
(CmsDbContext dbc, Iterator<String> nameSeq, CmsUUID structureId, String locale) Tries to find the best name for an URL name mapping for the given structure id.getAccessControlEntries
(CmsDbContext dbc, CmsResource resource, boolean getInherited) Returns the list of access control entries of a resource given its name.getAccessControlList
(CmsDbContext dbc, CmsResource resource) Returns the full access control list of a given resource.getAccessControlList
(CmsDbContext dbc, CmsResource resource, boolean inheritedOnly) Returns the access control list of a given resource.int
getActiveConnections
(String dbPoolUrl) Returns the number of active connections managed by a pool.Reads all access control entries.getAllAccessibleProjects
(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean includeSubOus) Returns all projects which are owned by the current user or which are accessible by the current user.Returns a list with all projects from history.getAllManageableProjects
(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean includeSubOus) Returns all projects which are owned by the current user or which are manageable for the group of the user.getChildren
(CmsDbContext dbc, CmsGroup group, boolean includeSubChildren) Returns all child groups of a group.long
getDateLastVisitedBy
(CmsDbContext dbc, String poolName, CmsUser user, CmsResource resource) Returns the date when the resource was last visited by the user.getGroups
(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean includeSubOus, boolean readRoles) Returns all groups of the given organizational unit.getGroupsOfUser
(CmsDbContext dbc, String username, boolean readRoles) Returns the groups of an user filtered by the specified IP address.getGroupsOfUser
(CmsDbContext dbc, String username, String ouFqn, boolean includeChildOus, boolean readRoles, boolean directGroupsOnly, String remoteAddress) Returns the groups of an user filtered by the specified IP address.Returns the history driver.Returns the history driver for a given database context.int
getIdleConnections
(String dbPoolUrl) Returns the number of idle connections managed by a pool.getLock
(CmsDbContext dbc, CmsResource resource) Returns the lock state of a resource.getLockedResources
(CmsDbContext dbc, CmsResource resource, CmsLockFilter filter) Returns all locked resources in a given folder.getLockedResourcesObjects
(CmsDbContext dbc, CmsResource resource, CmsLockFilter filter) Returns all locked resources in a given folder.getLockedResourcesObjectsWithCache
(CmsDbContext dbc, CmsResource resource, CmsLockFilter filter, Map<String, CmsResource> cache) Returns all locked resources in a given folder, but uses a cache for resource lookups.protected CmsLockManager
Returns the lock manager instance.getLogEntries
(CmsDbContext dbc, CmsLogFilter filter) Returns all log entries matching the given filter.int
Returns the next publish tag for the published historical resources.protected String
getNumberedName
(String name, int number) Adds a numeric suffix to the end of a string, unless the number passed as a parameter is 0.getOrganizationalUnits
(CmsDbContext dbc, CmsOrganizationalUnit parent, boolean includeChildren) Returns all child organizational units of the given parent organizational unit including hierarchical deeper organization units if needed.getOrgUnitsForRole
(CmsDbContext dbc, CmsRole role, boolean includeSubOus) Returns all the organizational units for which the current user has the given role.getParent
(CmsDbContext dbc, String groupname) Returns the parent group of a group.getPermissions
(CmsDbContext dbc, CmsResource resource, CmsUser user) Returns the set of permissions of the current user for a given resource.Returns the project driver.Returns the project driver for a given DB context.getProjectDriver
(CmsDbContext dbc, I_CmsProjectDriver defaultDriver) Returns either the project driver for the DB context (if it has one) or a default project driver.getProjectId
(CmsDbContext dbc, int id) Returns the uuid id for the given id.Returns the configuration read from theopencms.properties
file.getRelatedResourcesToPublish
(CmsDbContext dbc, CmsPublishList publishList, CmsRelationFilter filter) Returns a new publish list that contains the unpublished resources related to all resources in the given publish list, the related resources exclude all resources in the given publish list and also locked (by other users) resources.getRelationsForResource
(CmsDbContext dbc, CmsResource resource, CmsRelationFilter filter) Returns all relations for the given resource matching the given filter.getResourceOrgUnits
(CmsDbContext dbc, CmsResource resource) Returns the list of organizational units the given resource belongs to.Returns all resources of the given organizational unit.getResourcesForPrincipal
(CmsDbContext dbc, CmsProject project, CmsUUID principalId, CmsPermissionSet permissions, boolean includeAttr) Returns all resources associated to a given principal via an ACE with the given permissions.getRewriteAliases
(CmsDbContext dbc, CmsRewriteAliasFilter filter) Gets the rewrite aliases matching a given filter.getRoleGroups
(CmsDbContext dbc, String roleGroupName, boolean directUsersOnly) Collects the groups which constitute a given role.getRoleGroupsImpl
(CmsDbContext dbc, String roleGroupName, boolean directUsersOnly, Map<String, Set<CmsGroup>> accumulator) Collects the groups which constitute a given role.getRolesForResource
(CmsDbContext dbc, CmsUser user, CmsResource resource) Returns all roles the given user has for the given resource.getRolesForUser
(CmsDbContext dbc, CmsUser user) Returns all roles the given user has independent of the resource.Returns the security manager this driver manager belongs to.Returns an instance of the common sql manager.Returns the subscription driver of this driver manager.Returns the user driver.Returns the user driver for a given database context.getUserDriver
(CmsDbContext dbc, I_CmsUserDriver defaultDriver) Returns either the user driver for the given DB context (if it has one) or a default value instead.getUsers
(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean recursive) Returns all direct users of the given organizational unit.getUsersOfGroup
(CmsDbContext dbc, String groupname, boolean includeOtherOuUsers, boolean directUsersOnly, boolean readRoles) Returns a list of users in a group.getUsersPubList
(CmsDbContext dbc, CmsUUID userId) Returns the given user's publish list.getUsersWithoutAdditionalInfo
(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean recursive) Returns all direct users of the given organizational unit, without their additional info.Returns the VFS driver.getVfsDriver
(CmsDbContext dbc) Returns the VFS driver for the given database context.void
importAccessControlEntries
(CmsDbContext dbc, CmsResource resource, List<CmsAccessControlEntry> acEntries) Writes a vector of access control entries as new access control entries of a given resource.importRewriteAlias
(CmsDbContext dbc, String siteRoot, String source, String target, CmsAliasMode mode) Imports a rewrite alias.importUser
(CmsDbContext dbc, String id, String name, String password, String firstname, String lastname, String email, int flags, long dateCreated, Map<String, Object> additionalInfos) Creates a new user by import.int
incrementCounter
(CmsDbContext dbc, String name) Increments a counter and returns its value before incrementing.void
init
(CmsConfigurationManager configurationManager, I_CmsDbContextFactory dbContextFactory) Initializes the driver and sets up all required modules and connections.void
initOrgUnit
(CmsDbContext dbc, CmsOrganizationalUnit ou) Initializes the organizational unit.boolean
isInsideCurrentProject
(CmsDbContext dbc, String resourcename) Checks if the specified resource is inside the current project.boolean
Checks whether the subscription driver is available.boolean
isTempfileProject
(CmsProject project) Checks if a project is the tempfile project.boolean
labelResource
(CmsDbContext dbc, CmsResource resource, String newResource, int action) Checks if one of the resources (except the resource itself) is a sibling in a "labeled" site folder.lockedBy
(CmsDbContext dbc, CmsResource resource) Returns the user, who had locked the resource.void
lockResource
(CmsDbContext dbc, CmsResource resource, CmsLockType type) Locks a resource.void
log
(CmsDbContext dbc, CmsLogEntry logEntry, boolean force) Adds the given log entry to the current user's log.loginUser
(CmsDbContext dbc, String userName, String password, CmsSecondFactorInfo secondFactorInfo, String remoteAddress, CmsDriverManager.LoginUserMode mode) Attempts to authenticate a user into OpenCms with the given password.lookupPrincipal
(CmsDbContext dbc, String principalName) Lookup and read the user or group with the given name.lookupPrincipal
(CmsDbContext dbc, CmsUUID principalId) Lookup and read the user or group with the given UUID.void
markResourceAsVisitedBy
(CmsDbContext dbc, String poolName, CmsResource resource, CmsUser user) Mark the given resource as visited by the user.void
moveResource
(CmsDbContext dbc, CmsResource source, String destination, boolean internal) Moves a resource.moveToLostAndFound
(CmsDbContext dbc, CmsResource resource, boolean returnNameOnly) Moves a resource to the "lost and found" folder.newDriverInstance
(CmsParameterConfiguration configuration, String driverName, String driverPoolUrl) Method to create a new instance of a driver.newDriverInstance
(CmsDbContext dbc, CmsConfigurationManager configurationManager, String driverName, List<String> successiveDrivers) Gets a new driver instance.static CmsDriverManager
newInstance
(CmsConfigurationManager configurationManager, CmsSecurityManager securityManager, I_CmsDbContextFactory runtimeInfoFactory, CmsPublishEngine publishEngine) Reads the required configurations from the opencms.properties file and creates the various drivers to access the cms resources.void
newPoolInstance
(CmsParameterConfiguration configuration, String poolName) Method to create a new instance of a pool.void
publishJob
(CmsObject cms, CmsDbContext dbc, CmsPublishList publishList, I_CmsReport report) Publishes the given publish job.void
publishProject
(CmsObject cms, CmsDbContext dbc, CmsPublishList publishList, I_CmsReport report) Publishes the resources of a specified publish list.void
publishUrlNameMapping
(CmsDbContext dbc, CmsResource res) Transfers the new URL name mappings (if any) for a given resource to the online project.readAccessControlEntry
(CmsDbContext dbc, CmsResource resource, CmsUUID principal) Reads an access control entry from the cms.readAliasByPath
(CmsDbContext dbc, CmsProject project, String siteRoot, String path) Finds the alias with a given path.readAliasesBySite
(CmsDbContext dbc, CmsProject currentProject, String siteRoot) Reads the aliases for a given site root.readAliasesByStructureId
(CmsDbContext dbc, CmsProject project, CmsUUID structureId) Reads the aliases which point to a given structure id.readAllAvailableVersions
(CmsDbContext dbc, CmsResource resource) Reads all versions of the given resource.
This method returns a list with the history of the given resource, i.e.Reads all property definitions for the given mapping type.readAllSubscribedResources
(CmsDbContext dbc, String poolName, CmsPrincipal principal) Returns all resources subscribed by the given user or group.readBestUrlName
(CmsDbContext dbc, CmsUUID id, Locale locale, List<Locale> defaultLocales) Selects the best url name for a given resource and locale.readChildResources
(CmsDbContext dbc, CmsResource resource, CmsResourceFilter filter, boolean getFolders, boolean getFiles, boolean checkPermissions) Returns the child resources of a resource, that is the resources contained in a folder.readDefaultFile
(CmsDbContext dbc, CmsResource resource, CmsResourceFilter resourceFilter) Returns the default file for the given folder.readDeletedResources
(CmsDbContext dbc, CmsResource resource, boolean readTree, boolean isVfsManager) Reads all deleted (historical) resources below the given path, including the full tree below the path, if required.readFile
(CmsDbContext dbc, CmsResource resource) Reads a file resource (including it's binary content) from the VFS, using the specified resource filter.readFolder
(CmsDbContext dbc, String resourcename, CmsResourceFilter filter) Reads a folder from the VFS, using the specified resource filter.readGroup
(CmsDbContext dbc, String groupname) Reads a group based on its name.readGroup
(CmsDbContext dbc, CmsProject project) Reads the group of a project.readGroup
(CmsDbContext dbc, CmsUUID groupId) Reads a group based on its id.readHistoricalPrincipal
(CmsDbContext dbc, CmsUUID principalId) Reads a principal (an user or group) from the historical archive based on its ID.readHistoryProject
(CmsDbContext dbc, int publishTag) Returns a historical project entry.readHistoryProject
(CmsDbContext dbc, CmsUUID projectId) Returns the latest historical project entry with the given id.readHistoryPropertyObjects
(CmsDbContext dbc, I_CmsHistoryResource historyResource) Reads the list of all
objects that belongs to the given historical resource.CmsProperty
readIdForUrlName
(CmsDbContext dbc, String name) Reads the structure id which is mapped to a given URL name.void
readLocks
(CmsDbContext dbc) Reads the locks that were saved to the database in the previous run of OpenCms.readManagerGroup
(CmsDbContext dbc, CmsProject project) Reads the manager group of a project.readNewestUrlNameForId
(CmsDbContext dbc, CmsUUID id) Reads the URL name which has been most recently mapped to the given structure id, or null if no URL name is mapped to the id.readOrganizationalUnit
(CmsDbContext dbc, String ouFqn) Reads an organizational Unit based on its fully qualified name.readOwner
(CmsDbContext dbc, CmsProject project) Reads the owner of a project.readParentFolder
(CmsDbContext dbc, CmsUUID structureId) Reads the parent folder to a given structure id.readPath
(CmsDbContext dbc, String path, CmsResourceFilter filter) Builds a list of resources for a given path.readProject
(CmsDbContext dbc, String name) Reads a project.readProject
(CmsDbContext dbc, CmsUUID id) Reads a project given the projects id.readProjectResources
(CmsDbContext dbc, CmsProject project) Returns the list of all resource names that define the "view" of the given project.readProjectView
(CmsDbContext dbc, CmsUUID projectId, CmsResourceState state) Reads all resources of a project that match a given state from the VFS.readPropertyDefinition
(CmsDbContext dbc, String name) Reads a property definition.readPropertyObject
(CmsDbContext dbc, CmsResource resource, String key, boolean search) Reads a property object from a resource specified by a property name.readPropertyObject
(CmsDbContext dbc, CmsResource resource, String key, boolean search, Locale locale) Reads a property object from a resource specified by a property name.readPropertyObjects
(CmsDbContext dbc, CmsResource resource, boolean search) Reads all property objects mapped to a specified resource from the database.readPublishedResources
(CmsDbContext dbc, CmsUUID publishHistoryId) Reads the resources that were published in a publish task 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 available publish jobs.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.readResource
(CmsDbContext dbc, String resourcePath, CmsResourceFilter filter) Reads a resource from the VFS, using the specified resource filter.readResource
(CmsDbContext dbc, CmsResource resource, int version) Reads an historical resource entry for the given resource and with the given version number.readResource
(CmsDbContext dbc, CmsUUID structureID, CmsResourceFilter filter) Reads a resource from the VFS, using the specified resource filter.readResources
(CmsDbContext dbc, CmsResource parent, CmsResourceFilter filter, boolean readTree) Reads all resources below the given path matching the filter criteria, including the full tree below the path only in case thereadTree
parameter istrue
.readResourcesVisitedBy
(CmsDbContext dbc, String poolName, CmsVisitedByFilter filter) Returns the resources that were visited by a user set in the filter.readResourcesWithProperty
(CmsDbContext dbc, CmsResource folder, String propertyDefinition, String value, CmsResourceFilter filter) Reads all resources that have a value (containing the given value string) set for the specified property (definition) in the given path.readResponsiblePrincipals
(CmsDbContext dbc, CmsResource resource) Returns the set of users that are responsible for a specific resource.readResponsibleUsers
(CmsDbContext dbc, CmsResource resource) Returns the set of users that are responsible for a specific resource.readSiblings
(CmsDbContext dbc, CmsResource resource, CmsResourceFilter filter) Returns a List of all siblings of the specified resource, the specified resource being always part of the result set.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.readSubscribedDeletedResources
(CmsDbContext dbc, String poolName, CmsUser user, List<CmsGroup> groups, CmsResource parent, boolean includeSubFolders, long deletedFrom) Returns the subscribed history resources that were deleted.readSubscribedResources
(CmsDbContext dbc, String poolName, CmsSubscriptionFilter filter) Returns the resources that were subscribed by a user or group set in the filter.readUrlNameMappingEntries
(CmsDbContext dbc, boolean online, CmsUrlNameMappingFilter filter) Reads URL name mapping entries which match the given filter.readUrlNameMappings
(CmsDbContext dbc, CmsUrlNameMappingFilter filter) Reads the URL name mappings matching the given filter.readUrlNamesForAllLocales
(CmsDbContext dbc, CmsUUID id) Reads the newest URL names of a resource for all locales.readUser
(CmsDbContext dbc, String username) Returns a user object.readUser
(CmsDbContext dbc, String username, String password) Returns a user object if the password for the user is correct.readUser
(CmsDbContext dbc, CmsUUID id) Returns a user object based on the id of a user.void
removeAccessControlEntry
(CmsDbContext dbc, CmsResource resource, CmsUUID principal) Removes an access control entry for a given resource and principal.void
removeResourceFromOrgUnit
(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, CmsResource resource) Removes a resource from the given organizational unit.void
removeResourceFromProject
(CmsDbContext dbc, CmsResource resource) Removes a resource from the current project of the user.void
removeResourceFromUsersPubList
(CmsDbContext dbc, CmsUUID userId, Collection<CmsUUID> structureIds) Removes the given resource to the given user's publish list.void
removeUserFromGroup
(CmsDbContext dbc, String username, String groupname, boolean readRoles) Removes a user from a group.void
repairCategories
(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) Repairs broken categories.void
replaceResource
(CmsDbContext dbc, CmsResource resource, int type, byte[] content, List<CmsProperty> properties) Replaces the content, type and properties of a resource.void
resetPassword
(CmsDbContext dbc, String username, String oldPassword, CmsSecondFactorInfo secondFactor, String newPassword) Resets the password for a specified user.protected void
resetResourcesInProject
(CmsDbContext dbc, CmsUUID projectId, List<CmsResource> modifiedFiles, List<CmsResource> modifiedFolders) Resets the resources in a project to their online state.void
restoreDeletedResource
(CmsDbContext dbc, CmsUUID structureId) Restores a deleted resource identified by its structure id from the historical archive.void
restoreResource
(CmsDbContext dbc, CmsResource resource, int version) Restores a resource in the current project with a version from the historical archive.void
saveAliases
(CmsDbContext dbc, CmsProject project, CmsUUID structureId, List<CmsAlias> aliases) Saves a list of aliases for the same structure id, replacing any aliases for the same structure id.void
saveRewriteAliases
(CmsDbContext dbc, String siteRoot, List<CmsRewriteAlias> newAliases) Replaces the complete list of rewrite aliases for a given site root.searchUsers
(CmsDbContext dbc, CmsUserSearchParameters searchParams) Searches for users which fit the given criteria.void
setDateExpired
(CmsDbContext dbc, CmsResource resource, long dateExpired) Changes the "expire" date of a resource.void
setDateLastModified
(CmsDbContext dbc, CmsResource resource, long dateLastModified) Changes the "last modified" timestamp of a resource.void
setDateReleased
(CmsDbContext dbc, CmsResource resource, long dateReleased) Changes the "release" date of a resource.void
setParentGroup
(CmsDbContext dbc, String groupName, String parentGroupName) Sets a new parent group for an already existing group.void
setPassword
(CmsDbContext dbc, String username, String newPassword) Sets the password for a user.void
setSubscribedResourceAsDeleted
(CmsDbContext dbc, String poolName, CmsResource resource) Marks a subscribed resource as deleted.void
setUsersOrganizationalUnit
(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, CmsUser user) Moves an user to the given organizational unit.void
subscribeResourceFor
(CmsDbContext dbc, String poolName, CmsPrincipal principal, CmsResource resource) Subscribes the user or group to the resource.void
undelete
(CmsDbContext dbc, CmsResource resource) Undelete the resource.void
undoChanges
(CmsDbContext dbc, CmsResource resource, CmsResource.CmsResourceUndoMode mode) Undos all changes in the resource by restoring the version from the online project to the current offline project.void
unlockProject
(CmsProject project) Unlocks all resources in the given project.void
unlockResource
(CmsDbContext dbc, CmsResource resource, boolean force, boolean removeSystemLock) Unlocks a resource.void
unsubscribeAllDeletedResources
(CmsDbContext dbc, String poolName, long deletedTo) Unsubscribes all deleted resources that were deleted before the specified time stamp.void
unsubscribeAllResourcesFor
(CmsDbContext dbc, String poolName, CmsPrincipal principal) Unsubscribes the principal from all resources.void
unsubscribeResourceFor
(CmsDbContext dbc, String poolName, CmsPrincipal principal, CmsResource resource) Unsubscribes the principal from the resource.void
unsubscribeResourceForAll
(CmsDbContext dbc, String poolName, CmsResource resource) Unsubscribes all groups and users from the resource.void
Update the export points.void
updateLastLoginDate
(CmsDbContext dbc, CmsUser user) Updates the last login date on the given user to the current time.void
updateLog
(CmsDbContext dbc) Logs everything that has not been written to DB jet.void
updateRelationsForResource
(CmsDbContext dbc, CmsResource resource, List<CmsLink> links, boolean updateSiblingState) Updates/Creates the given relations for the given resource.boolean
userInGroup
(CmsDbContext dbc, String username, String groupname, boolean readRoles) Returnstrue
if a user is member of the given group.void
validatePassword
(String password) This method checks if a new password follows the rules for new passwords, which are defined by a Class implementing the
interface and configured in the opencms.properties file.I_CmsPasswordHandler
validateRelations
(CmsDbContext dbc, CmsPublishList publishList, I_CmsReport report) Validates the relations for the given resources.void
writeAccessControlEntry
(CmsDbContext dbc, CmsResource resource, CmsAccessControlEntry ace) Writes an access control entries to a given resource.void
writeExportPoints
(CmsDbContext dbc, I_CmsReport report, CmsUUID publishHistoryId) Writes all export points into the file system for the publish task specified by trhe given publish history ID.writeFile
(CmsDbContext dbc, CmsFile resource) Writes a resource to the OpenCms VFS, including it's content.void
writeGroup
(CmsDbContext dbc, CmsGroup group) Writes an already existing group.void
writeHistoryProject
(CmsDbContext dbc, int publishTag, long publishDate) Creates an historical entry of the current project.void
writeLocks
(CmsDbContext dbc) Writes the locks that are currently stored in-memory to the database to allow restoring them in future server startups.void
writeOrganizationalUnit
(CmsDbContext dbc, CmsOrganizationalUnit organizationalUnit) Writes an already existing organizational unit.void
writeProject
(CmsDbContext dbc, CmsProject project) Writes an already existing project.void
writeProjectLastModified
(CmsDbContext dbc, CmsResource resource, CmsUUID projectId) Writes a new project into the PROJECT_LASTMODIFIED field of a resource record.void
writePropertyObject
(CmsDbContext dbc, CmsResource resource, CmsProperty property) Writes a property for a specified resource.void
writePropertyObjects
(CmsDbContext dbc, CmsResource resource, List<CmsProperty> properties, boolean updateState) Writes a list of properties for a specified resource.void
writePublishJob
(CmsDbContext dbc, CmsPublishJobInfoBean publishJob) Updates a publish job.void
writePublishReport
(CmsDbContext dbc, CmsPublishJobInfoBean publishJob) Writes the publish report for a publish job.void
writeResource
(CmsDbContext dbc, CmsResource resource) Writes a resource to the OpenCms VFS.void
writeStaticExportPublishedResource
(CmsDbContext dbc, String resourceName, int linkType, String linkParameter, long timestamp) Inserts an entry in the published resource table.writeUrlNameMapping
(CmsDbContext dbc, Iterator<String> nameSeq, CmsUUID structureId, String locale, boolean replaceOnPublish) Adds a new url name mapping for a structure id.void
writeUser
(CmsDbContext dbc, CmsUser user) Updates the user information.
-
Field Details
-
ATTR_EXCLUSIVE_ACCESS_CLOCK
Request context attribute used to override the time used for time-based exclusive access checks.- See Also:
-
ATTR_INIT_OU
Attribute for signaling to the user driver that a specific OU should be initialized by fillDefaults.- See Also:
-
ATTR_PERMISSION_NOCACHE
DB context attribute used to communicate information about resource cacheability between various methods.- See Also:
-
ATTRIBUTE_LOGIN
Attribute login.- See Also:
-
CACHE_ALL_PROPERTIES
Cache key for all properties.- See Also:
-
CHANGED_ACCESSCONTROL
Value to indicate a change in access control entries of a resource.- See Also:
-
CHANGED_CONTENT
Value to indicate a content change.- See Also:
-
CHANGED_LASTMODIFIED
Value to indicate a change in the lastmodified settings of a resource.- See Also:
-
CHANGED_PROJECT
Value to indicate a project change.- See Also:
-
CHANGED_RESOURCE
Value to indicate a change in the resource data.- See Also:
-
CHANGED_TIMEFRAME
Value to indicate a change in the availability timeframe.- See Also:
-
CONFIGURATION_CACHE
"cache" string in the configuration-file.- See Also:
-
CONFIGURATION_DB
"db" string in the configuration-file.- See Also:
-
CONFIGURATION_HISTORY
"driver.history" string in the configuration-file.- See Also:
-
CONFIGURATION_PROJECT
"driver.project" string in the configuration-file.- See Also:
-
CONFIGURATION_SUBSCRIPTION
"subscription.vfs" string in the configuration file.- See Also:
-
CONFIGURATION_USER
"driver.user" string in the configuration-file.- See Also:
-
CONFIGURATION_VFS
"driver.vfs" string in the configuration-file.- See Also:
-
KEY_CHANGED_AND_DELETED
DBC attribute key needed to fix publishing behavior involving siblings.- See Also:
-
LOST_AND_FOUND_FOLDER
The vfs path of the loast and found folder.- See Also:
-
MAX_VFS_RESOURCE_PATH_LENGTH
The maximum length of a VFS resource path.- See Also:
-
NOTHING_CHANGED
Key for indicating no changes.- See Also:
-
PARAM_LOG_TABLE_ENABLED
Name of the configuration parameter to enable/disable logging to the CMS_LOG table.- See Also:
-
READ_IGNORE_PARENT
Indicates to ignore the resource path when matching resources. -
READ_IGNORE_TIME
Indicates to ignore the time value.- See Also:
-
READ_IGNORE_TYPE
Indicates to ignore the resource type when matching resources.- See Also:
-
READMODE_EXCLUDE_STATE
Indicates to match resources NOT having the given state.- See Also:
-
READMODE_EXCLUDE_TREE
Indicates to match immediate children only.- See Also:
-
READMODE_EXCLUDE_TYPE
Indicates to match resources NOT having the given type.- See Also:
-
READMODE_IGNORESTATE
Mode for reading project resources from the db.- See Also:
-
READMODE_INCLUDE_PROJECT
Indicates to match resources in given project only.- See Also:
-
READMODE_INCLUDE_TREE
Indicates to match all successors.- See Also:
-
READMODE_MATCHSTATE
Mode for reading project resources from the db.- See Also:
-
READMODE_ONLY_FILES
Indicates if only file resources should be read.- See Also:
-
READMODE_ONLY_FOLDERS
Indicates if only folder resources should be read.- See Also:
-
READMODE_UNMATCHSTATE
Mode for reading project resources from the db.- See Also:
-
resourceOrgUnitCachingEnabled
Flag that can be used to disable the resource OU caching if necessary. -
TEMP_FILE_PREFIX
Prefix char for temporary files in the VFS.- See Also:
-
UPDATE_ALL
Key to indicate complete update.- See Also:
-
UPDATE_RESOURCE
Key to indicate update of resource record.- See Also:
-
UPDATE_RESOURCE_PROJECT
Key to indicate update of last modified project reference.- See Also:
-
UPDATE_RESOURCE_STATE
Key to indicate update of resource state.- See Also:
-
UPDATE_RESOURCE_STATE_CONTENT
Key to indicate update of resource state including the content date.- See Also:
-
UPDATE_STRUCTURE
Key to indicate update of structure record.- See Also:
-
UPDATE_STRUCTURE_STATE
Key to indicate update of structure state.- See Also:
-
m_pools
Map of pools defined in opencms.properties.
-
-
Method Details
-
newInstance
public static CmsDriverManager newInstance(CmsConfigurationManager configurationManager, CmsSecurityManager securityManager, I_CmsDbContextFactory runtimeInfoFactory, CmsPublishEngine publishEngine) throws CmsInitException Reads the required configurations from the opencms.properties file and creates the various drivers to access the cms resources.The initialization process of the driver manager and its drivers is split into the following phases:
- the database pool configuration is read
- a plain and empty driver manager instance is created
- an instance of each driver is created
- the driver manager is passed to each driver during initialization
- finally, the driver instances are passed to the driver manager during initialization
- Parameters:
configurationManager
- the configuration managersecurityManager
- the security managerruntimeInfoFactory
- the initialized OpenCms runtime info factorypublishEngine
- the publish engine- Returns:
- CmsDriverManager the instantiated driver manager
- Throws:
CmsInitException
- if the driver manager couldn't be instantiated
-
addAlias
Adds an alias entry.- Parameters:
dbc
- the database contextproject
- the current projectalias
- the alias to add- Throws:
CmsException
- if something goes wrong
-
addRelationToResource
public void addRelationToResource(CmsDbContext dbc, CmsResource resource, CmsResource target, CmsRelationType type, boolean importCase) throws CmsException Adds a new relation to the given resource.- Parameters:
dbc
- the database contextresource
- the resource to add the relation totarget
- the target of the relationtype
- the type of the relationimportCase
- if importing relations- Throws:
CmsException
- if something goes wrong
-
addResourceToOrgUnit
public void addResourceToOrgUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, CmsResource resource) throws CmsException Adds a resource to the given organizational unit.- Parameters:
dbc
- the current db contextorgUnit
- the organizational unit to add the resource toresource
- the resource that is to be added to the organizational unit- Throws:
CmsException
- if something goes wrong- See Also:
-
addUserToGroup
public void addUserToGroup(CmsDbContext dbc, String username, String groupname, boolean readRoles) throws CmsException, CmsDbEntryNotFoundException Adds a user to a group.- Parameters:
dbc
- the current database contextusername
- the name of the user that is to be added to the groupgroupname
- the name of the groupreadRoles
- if reading roles or groups- Throws:
CmsException
- if operation was not successfulCmsDbEntryNotFoundException
- if the given user or the given group was not found- See Also:
-
changeLock
public void changeLock(CmsDbContext dbc, CmsResource resource, CmsLockType lockType) throws CmsException, CmsSecurityException Changes the lock of a resource to the current user, that is "steals" the lock from another user.- Parameters:
dbc
- the current database contextresource
- the resource to change the lock forlockType
- the new lock type to set- Throws:
CmsException
- if something goes wrongCmsSecurityException
- if something goes wrong- See Also:
-
changeResourcesInFolderWithProperty
public List<CmsResource> changeResourcesInFolderWithProperty(CmsDbContext dbc, CmsResource resource, String propertyDefinition, String oldValue, String newValue, boolean recursive) throws CmsVfsException, CmsException Returns a list with all sub resources of a given folder that have set the given property, matching the current property's value with the given old value and replacing it by a given new value.- Parameters:
dbc
- the current database contextresource
- the resource on which property definition values are changedpropertyDefinition
- the name of the propertydefinition to change the valueoldValue
- the old value of the propertydefinitionnewValue
- the new value of the propertydefinitionrecursive
- if true, change the property value on the resource and recursively all property values on sub-resources (only for folders)- Returns:
- a list with the
's where the property value has been changedCmsResource
- Throws:
CmsVfsException
- for now only when the search for the oldvalue failed.CmsException
- if operation was not successful
-
chflags
Changes the resource flags of a resource.The resource flags are used to indicate various "special" conditions for a resource. Most notably, the "internal only" setting which signals that a resource can not be directly requested with it's URL.
- Parameters:
dbc
- the current database contextresource
- the resource to change the flags forflags
- the new resource flags for this resource- Throws:
CmsException
- if something goes wrong- See Also:
-
chtype
Changes the resource type of a resource.OpenCms handles resources according to the resource type, not the file suffix. This is e.g. why a JSP in OpenCms can have the suffix ".html" instead of ".jsp" only. Changing the resource type makes sense e.g. if you want to make a plain text file a JSP resource, or a binary file an image, etc.
- Parameters:
dbc
- the current database contextresource
- the resource to change the type fortype
- the new resource type for this resource- Throws:
CmsException
- if something goes wrong- See Also:
-
cleanupPublishHistory
public int cleanupPublishHistory(CmsDbContext dbc, CmsPublishHistoryCleanupFilter filter) throws CmsDataAccessException Cleans up the publish history entries according to the given filter.- Parameters:
dbc
- the database contextfilter
- the filter- Returns:
- the number of cleaned up rows
- Throws:
CmsDataAccessException
- if something goes wrong
-
cmsEvent
Description copied from interface:I_CmsEventListener
Acknowledge the occurrence of the specified event, implement this method to check for CmsEvents in your class.- Specified by:
cmsEvent
in interfaceI_CmsEventListener
- Parameters:
event
- CmsEvent that has occurred- See Also:
-
copyAccessControlEntries
public void copyAccessControlEntries(CmsDbContext dbc, CmsResource source, CmsResource destination, boolean updateLastModifiedInfo) throws CmsException Copies the access control entries of a given resource to a destination resource.Already existing access control entries of the destination resource are removed.
- Parameters:
dbc
- the current database contextsource
- the resource to copy the access control entries fromdestination
- the resource to which the access control entries are copiedupdateLastModifiedInfo
- if true, user and date "last modified" information on the target resource will be updated- Throws:
CmsException
- if something goes wrong
-
copyResource
public void copyResource(CmsDbContext dbc, CmsResource source, String destination, CmsResource.CmsResourceCopyMode siblingMode) throws CmsException, CmsIllegalArgumentException Copies a resource.You must ensure that the destination path is an absolute, valid and existing VFS path. Relative paths from the source are currently not supported.
In case the target resource already exists, it is overwritten with the source resource.
The
siblingMode
parameter controls how to handle siblings during the copy operation. Possible values for this parameter are:- Parameters:
dbc
- the current database contextsource
- the resource to copydestination
- the name of the copy destination with complete pathsiblingMode
- indicates how to handle siblings during copy- Throws:
CmsException
- if something goes wrongCmsIllegalArgumentException
- if thesource
argument isnull
- See Also:
-
copyResourceToProject
Copies a resource to the current project of the user.- Parameters:
dbc
- the current database contextresource
- the resource to apply this operation to- Throws:
CmsException
- if something goes wrong- See Also:
-
countLockedResources
Counts the locked resources in this project.- Parameters:
project
- the project to count the locked resources in- Returns:
- the amount of locked resources in this project
-
createGroup
public CmsGroup createGroup(CmsDbContext dbc, CmsUUID id, String name, String description, int flags, String parent) throws CmsIllegalArgumentException, CmsException Add a new group to the Cms.Only the admin can do this. Only users, which are in the group "administrators" are granted.
- Parameters:
dbc
- the current database contextid
- the id of the new groupname
- the name of the new groupdescription
- the description for the new groupflags
- the flags for the new groupparent
- the name of the parent group (ornull
)- Returns:
- new created group
- Throws:
CmsException
- if the creation of the group failedCmsIllegalArgumentException
- if the length of the given name was below 1
-
createOrganizationalUnit
public CmsOrganizationalUnit createOrganizationalUnit(CmsDbContext dbc, String ouFqn, String description, int flags, CmsResource resource) throws CmsException Creates a new organizational unit.- Parameters:
dbc
- the current db contextouFqn
- the fully qualified name of the new organizational unitdescription
- the description of the new organizational unitflags
- the flags for the new organizational unitresource
- the first associated resource- Returns:
- a
object representing the newly created organizational unitCmsOrganizationalUnit
- Throws:
CmsException
- if operation was not successful- See Also:
-
createProject
public CmsProject createProject(CmsDbContext dbc, String name, String description, String groupname, String managergroupname, CmsProject.CmsProjectType projecttype) throws CmsIllegalArgumentException, CmsException Creates a project.- Parameters:
dbc
- the current database contextname
- the name of the project to createdescription
- the description of the projectgroupname
- the project user group to be setmanagergroupname
- the project manager group to be setprojecttype
- the type of the project- Returns:
- the created project
- Throws:
CmsIllegalArgumentException
- if the chosenname
is already used by the online project, or if the name is not validCmsException
- if something goes wrong
-
createPropertyDefinition
public CmsPropertyDefinition createPropertyDefinition(CmsDbContext dbc, String name) throws CmsException Creates a property definition.Property definitions are valid for all resource types.
- Parameters:
dbc
- the current database contextname
- the name of the property definition to create- Returns:
- the created property definition
- Throws:
CmsException
- if something goes wrong
-
createPublishJob
public void createPublishJob(CmsDbContext dbc, CmsPublishJobInfoBean publishJob) throws CmsException Creates a new publish job.- Parameters:
dbc
- the current database contextpublishJob
- the publish job to create- Throws:
CmsException
- if something goes wrong
-
createResource
public CmsResource createResource(CmsDbContext dbc, String resourcePath, CmsResource resource, byte[] content, List<CmsProperty> properties, boolean importCase) throws CmsException Creates a new resource with the provided content and properties.The
content
parameter may benull
if the resource id already exists. If so, the created resource will be a sibling of the existing resource, the existing content will remain unchanged.This is used during file import for import of siblings as the
manifest.xml
only contains one binary copy per file.If the resource id exists but the
content
is notnull
, the created resource will be made a sibling of the existing resource, and both will share the new content.- Parameters:
dbc
- the current database contextresourcePath
- the name of the resource to create (full path)resource
- the new resource to createcontent
- the content for the new resourceproperties
- the properties for the new resourceimportCase
- iftrue
, signals that this operation is done while importing resource, causing different lock behavior and potential "lost and found" usage- Returns:
- the created resource
- Throws:
CmsException
- if something goes wrong
-
createResource
public CmsResource createResource(CmsDbContext dbc, String resourcename, int type, byte[] content, List<CmsProperty> properties) throws CmsException, CmsIllegalArgumentException Creates a new resource of the given resource type with the provided content and properties.If the provided content is null and the resource is not a folder, the content will be set to an empty byte array.
- Parameters:
dbc
- the current database contextresourcename
- the name of the resource to create (full path)type
- the type of the resource to createcontent
- the content for the new resourceproperties
- the properties for the new resource- Returns:
- the created resource
- Throws:
CmsException
- if something goes wrongCmsIllegalArgumentException
- if theresourcename
argument is null or of length 0- See Also:
-
createSibling
public CmsResource createSibling(CmsDbContext dbc, CmsResource source, String destination, List<CmsProperty> properties) throws CmsException Creates a new sibling of the source resource.- Parameters:
dbc
- the current database contextsource
- the resource to create a sibling fordestination
- the name of the sibling to create with complete pathproperties
- the individual properties for the new sibling- Returns:
- the new created sibling
- Throws:
CmsException
- if something goes wrong- See Also:
-
createTempfileProject
Creates the project for the temporary workplace files.- Parameters:
dbc
- the current database context- Returns:
- the created project for the temporary workplace files
- Throws:
CmsException
- if something goes wrong
-
createUser
public CmsUser createUser(CmsDbContext dbc, String name, String password, String description, Map<String, Object> additionalInfos) throws CmsException, CmsIllegalArgumentExceptionCreates a new user.- Parameters:
dbc
- the current database contextname
- the name for the new userpassword
- the password for the new userdescription
- the description for the new useradditionalInfos
- the additional infos for the user- Returns:
- the created user
- Throws:
CmsException
- if something goes wrongCmsIllegalArgumentException
- if the name for the user is not valid- See Also:
-
deleteAliases
public void deleteAliases(CmsDbContext dbc, CmsProject project, CmsAliasFilter filter) throws CmsException Deletes aliases indicated by a filter.- Parameters:
dbc
- the current database contextproject
- the current projectfilter
- the filter which describes which aliases to delete- Throws:
CmsException
- if something goes wrong
-
deleteAllProperties
Deletes all property values of a file or folder.If there are no other siblings than the specified resource, both the structure and resource property values get deleted. If the specified resource has siblings, only the structure property values get deleted.
- Parameters:
dbc
- the current database contextresourcename
- the name of the resource for which all properties should be deleted- Throws:
CmsException
- if operation was not successful
-
deleteAllStaticExportPublishedResources
public void deleteAllStaticExportPublishedResources(CmsDbContext dbc, int linkType) throws CmsException Deletes all entries in the published resource table.- Parameters:
dbc
- the current database contextlinkType
- the type of resource deleted (0= non-paramter, 1=parameter)- Throws:
CmsException
- if something goes wrong
-
deleteGroup
public void deleteGroup(CmsDbContext dbc, CmsGroup group, CmsUUID replacementId) throws CmsDataAccessException, CmsException Deletes a group, where all permissions, users and children of the group are transfered to a replacement group.- Parameters:
dbc
- the current request contextgroup
- the id of the group to be deletedreplacementId
- the id of the group to be transfered, can benull
- Throws:
CmsException
- if operation was not successfulCmsDataAccessException
- if group to be deleted contains user
-
deleteHistoricalVersions
public void deleteHistoricalVersions(CmsDbContext dbc, int versionsToKeep, int versionsDeleted, long timeDeleted, I_CmsReport report) throws CmsException Deletes the versions from the history tables, keeping the given number of versions per resource.if the
cleanUp
option is set, additionally versions of deleted resources will be removed.- Parameters:
dbc
- the current database contextversionsToKeep
- number of versions to keep, is ignored if negativeversionsDeleted
- number of versions to keep for deleted resources, is ignored if negativetimeDeleted
- deleted resources older than this will also be deleted, is ignored if negativereport
- the report for output logging- Throws:
CmsException
- if operation was not successful
-
deleteLogEntries
Deletes all log entries matching the given filter.- Parameters:
dbc
- the current db contextfilter
- the filter to use for deletion- Throws:
CmsException
- if something goes wrong- See Also:
-
deleteOrganizationalUnit
public void deleteOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit organizationalUnit) throws CmsException Deletes an organizational unit.Only organizational units that contain no suborganizational unit can be deleted.
The organizational unit can not be delete if it is used in the request context, or if the current user belongs to it.
All users and groups in the given organizational unit will be deleted.
- Parameters:
dbc
- the current db contextorganizationalUnit
- the organizational unit to delete- Throws:
CmsException
- if operation was not successful- See Also:
-
deleteProject
Deletes a project.Only the admin or the owner of the project can do this.
- Parameters:
dbc
- the current database contextdeleteProject
- the project to be deleted- Throws:
CmsException
- if something goes wrong
-
deleteProject
public void deleteProject(CmsDbContext dbc, CmsProject deleteProject, boolean resetResources) throws CmsException Deletes a project.Only the admin or the owner of the project can do this.
- Parameters:
dbc
- the current database contextdeleteProject
- the project to be deletedresetResources
- if true, the resources of the project to delete will be reset to their online state, or deleted if they have no online state- Throws:
CmsException
- if something goes wrong
-
deletePropertyDefinition
Deletes a property definition.- Parameters:
dbc
- the current database contextname
- the name of the property definition to delete- Throws:
CmsException
- if something goes wrong
-
deletePublishJob
Deletes a publish job identified by its history id.- Parameters:
dbc
- the current database contextpublishHistoryId
- the history id identifying the publish job- Throws:
CmsException
- if something goes wrong
-
deletePublishList
Deletes the publish list assigned to a publish job.- Parameters:
dbc
- the current database contextpublishHistoryId
- the history id identifying the publish job- Throws:
CmsException
- if something goes wrong
-
deleteRelationsForResource
public void deleteRelationsForResource(CmsDbContext dbc, CmsResource resource, CmsRelationFilter filter) throws CmsException Deletes all relations for the given resource matching the given filter.- Parameters:
dbc
- the current db contextresource
- the resource to delete the relations forfilter
- the filter to use for deletion- Throws:
CmsException
- if something goes wrong- See Also:
-
deleteResource
public void deleteResource(CmsDbContext dbc, CmsResource resource, CmsResource.CmsResourceDeleteMode siblingMode) throws CmsException Deletes a resource.The
siblingMode
parameter controls how to handle siblings during the delete operation. Possible values for this parameter are:- Parameters:
dbc
- the current database contextresource
- the name of the resource to delete (full path)siblingMode
- indicates how to handle siblings of the deleted resource- Throws:
CmsException
- if something goes wrong- See Also:
-
deleteStaticExportPublishedResource
public void deleteStaticExportPublishedResource(CmsDbContext dbc, String resourceName, int linkType, String linkParameter) throws CmsException Deletes an entry in the published resource table.- 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-parameter, 1=parameter)linkParameter
- the parameters of the resource- Throws:
CmsException
- if something goes wrong
-
deleteUser
public void deleteUser(CmsDbContext dbc, CmsProject project, String username, String replacementUsername) throws CmsException Deletes a user, where all permissions and resources attributes of the user were transfered to a replacement user, if given.Only users, which are in the group "administrators" are granted.
- Parameters:
dbc
- the current database contextproject
- the current projectusername
- the name of the user to be deletedreplacementUsername
- the name of the user to be transfered, can benull
- Throws:
CmsException
- if operation was not successful
-
destroy
Destroys this driver manager and releases all allocated resources. -
existsResourceId
Tests if a resource with the given resourceId does already exist in the Database.- Parameters:
dbc
- the current database contextresourceId
- the resource id to test for- Returns:
- true if a resource with the given id was found, false otherweise
- Throws:
CmsException
- if something goes wrong
-
fillPublishList
Fills the given publish list with the the VFS resources that actually get published.Please refer to the source code of this method for the rules on how to decide whether a new/changed/deleted
object can be published or not.CmsResource
- Parameters:
dbc
- the current database contextpublishList
- must be initialized with basic publish information (Project or direct publish operation), the given publish list will be filled with all new/changed/deleted files from the current (offline) project that will be actually published- Throws:
CmsException
- if something goes wrong- See Also:
-
getAccessControlEntries
public List<CmsAccessControlEntry> getAccessControlEntries(CmsDbContext dbc, CmsResource resource, boolean getInherited) throws CmsException Returns the list of access control entries of a resource given its name.- Parameters:
dbc
- the current database contextresource
- the resource to read the access control entries forgetInherited
- true if the result should include all access control entries inherited by parent folders- Returns:
- a list of
objects defining all permissions for the given resourceCmsAccessControlEntry
- Throws:
CmsException
- if something goes wrong
-
getAccessControlList
public CmsAccessControlList getAccessControlList(CmsDbContext dbc, CmsResource resource) throws CmsException Returns the full access control list of a given resource.- Parameters:
dbc
- the current database contextresource
- the resource- Returns:
- the access control list of the resource
- Throws:
CmsException
- if something goes wrong
-
getAccessControlList
public CmsAccessControlList getAccessControlList(CmsDbContext dbc, CmsResource resource, boolean inheritedOnly) throws CmsException Returns the access control list of a given resource.If
inheritedOnly
is set, only inherited access control entries are returned.Note: For file resources, *all* permissions set at the immediate parent folder are inherited, not only these marked to inherit.
- Parameters:
dbc
- the current database contextresource
- the resourceinheritedOnly
- skip non-inherited entries if set- Returns:
- the access control list of the resource
- Throws:
CmsException
- if something goes wrong
-
getActiveConnections
Returns the number of active connections managed by a pool.- Parameters:
dbPoolUrl
- the url of a pool- Returns:
- the number of active connections
- Throws:
CmsDbException
- if something goes wrong
-
getAllAccessControlEntries
Reads all access control entries.- Parameters:
dbc
- the current database context- Returns:
- all access control entries for the current project (offline/online)
- Throws:
CmsException
- if something goes wrong
-
getAllAccessibleProjects
public List<CmsProject> getAllAccessibleProjects(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean includeSubOus) throws CmsException Returns all projects which are owned by the current user or which are accessible by the current user.- Parameters:
dbc
- the current database contextorgUnit
- the organizational unit to search project inincludeSubOus
- if to include sub organizational units- Returns:
- a list of objects of type
CmsProject
- Throws:
CmsException
- if something goes wrong
-
getAllHistoricalProjects
Returns a list with all projects from history.- Parameters:
dbc
- the current database context- Returns:
- list of
objects with all projects from history.CmsHistoryProject
- Throws:
CmsException
- if operation was not successful
-
getAllManageableProjects
public List<CmsProject> getAllManageableProjects(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean includeSubOus) throws CmsException Returns all projects which are owned by the current user or which are manageable for the group of the user.- Parameters:
dbc
- the current database contextorgUnit
- the organizational unit to search project inincludeSubOus
- if to include sub organizational units- Returns:
- a list of objects of type
CmsProject
- Throws:
CmsException
- if operation was not successful
-
getChildren
public List<CmsGroup> getChildren(CmsDbContext dbc, CmsGroup group, boolean includeSubChildren) throws CmsException Returns all child groups of a group.- Parameters:
dbc
- the current database contextgroup
- the group to get the child forincludeSubChildren
- if set also returns all sub-child groups of the given group- Returns:
- a list of all child
objectsCmsGroup
- Throws:
CmsException
- if operation was not successful
-
getDateLastVisitedBy
public long getDateLastVisitedBy(CmsDbContext dbc, String poolName, CmsUser user, CmsResource resource) throws CmsException Returns the date when the resource was last visited by the user.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to useuser
- the user to check the dateresource
- the resource to check the date- Returns:
- the date when the resource was last visited by the user
- Throws:
CmsException
- if something goes wrong
-
getGroups
public List<CmsGroup> getGroups(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean includeSubOus, boolean readRoles) throws CmsException Returns all groups of the given organizational unit.- Parameters:
dbc
- the current db contextorgUnit
- the organizational unit to get the groups forincludeSubOus
- if all groups of sub-organizational units should be retrieved tooreadRoles
- if to read roles or groups- Returns:
- all
objects in the organizational unitCmsGroup
- Throws:
CmsException
- if operation was not successful- See Also:
-
getGroupsOfUser
public List<CmsGroup> getGroupsOfUser(CmsDbContext dbc, String username, boolean readRoles) throws CmsException Returns the groups of an user filtered by the specified IP address.- Parameters:
dbc
- the current database contextusername
- the name of the userreadRoles
- if to read roles or groups- Returns:
- the groups of the given user, as a list of
CmsGroup
objects - Throws:
CmsException
- if something goes wrong
-
getGroupsOfUser
public List<CmsGroup> getGroupsOfUser(CmsDbContext dbc, String username, String ouFqn, boolean includeChildOus, boolean readRoles, boolean directGroupsOnly, String remoteAddress) throws CmsException Returns the groups of an user filtered by the specified IP address.- Parameters:
dbc
- the current database contextusername
- the name of the userouFqn
- the fully qualified name of the organizational unit to restrict the result set forincludeChildOus
- include groups of child organizational unitsreadRoles
- if to read roles or groupsdirectGroupsOnly
- if set only the direct assigned groups will be returned, if not also indirect groupsremoteAddress
- the IP address to filter the groups in the result list- Returns:
- a list of
objectsCmsGroup
- Throws:
CmsException
- if operation was not successful
-
getHistoryDriver
Returns the history driver.- Returns:
- the history driver
-
getHistoryDriver
Returns the history driver for a given database context.- Parameters:
dbc
- the database context- Returns:
- the history driver for the database context
-
getIdleConnections
Returns the number of idle connections managed by a pool.- Parameters:
dbPoolUrl
- the url of a pool- Returns:
- the number of idle connections
- Throws:
CmsDbException
- if something goes wrong
-
getLock
Returns the lock state of a resource.- Parameters:
dbc
- the current database contextresource
- the resource to return the lock state for- Returns:
- the lock state of the resource
- Throws:
CmsException
- if something goes wrong
-
getLockedResources
public List<String> getLockedResources(CmsDbContext dbc, CmsResource resource, CmsLockFilter filter) throws CmsException Returns all locked resources in a given folder.- Parameters:
dbc
- the current database contextresource
- the folder to search infilter
- the lock filter- Returns:
- a list of locked resource paths (relative to current site)
- Throws:
CmsException
- if the current project is locked
-
getLockedResourcesObjects
public List<CmsResource> getLockedResourcesObjects(CmsDbContext dbc, CmsResource resource, CmsLockFilter filter) throws CmsException Returns all locked resources in a given folder.- Parameters:
dbc
- the current database contextresource
- the folder to search infilter
- the lock filter- Returns:
- a list of locked resources
- Throws:
CmsException
- if the current project is locked
-
getLockedResourcesObjectsWithCache
public List<CmsResource> getLockedResourcesObjectsWithCache(CmsDbContext dbc, CmsResource resource, CmsLockFilter filter, Map<String, CmsResource> cache) throws CmsExceptionReturns all locked resources in a given folder, but uses a cache for resource lookups.- Parameters:
dbc
- the current database contextresource
- the folder to search infilter
- the lock filtercache
- the cache to use for resource lookups- Returns:
- a list of locked resources
- Throws:
CmsException
- if the current project is locked
-
getLogEntries
Returns all log entries matching the given filter.- Parameters:
dbc
- the current db contextfilter
- the filter to match the log entries- Returns:
- all log entries matching the given filter
- Throws:
CmsException
- if something goes wrong- See Also:
-
getNextPublishTag
Returns the next publish tag for the published historical resources.- Parameters:
dbc
- the current database context- Returns:
- the next available publish tag
-
getOrganizationalUnits
public List<CmsOrganizationalUnit> getOrganizationalUnits(CmsDbContext dbc, CmsOrganizationalUnit parent, boolean includeChildren) throws CmsException Returns all child organizational units of the given parent organizational unit including hierarchical deeper organization units if needed.- Parameters:
dbc
- the current db contextparent
- the parent organizational unit, ornull
for the rootincludeChildren
- if hierarchical deeper organization units should also be returned- Returns:
- a list of
objectsCmsOrganizationalUnit
- Throws:
CmsException
- if operation was not successful- See Also:
-
getOrgUnitsForRole
public List<CmsOrganizationalUnit> getOrgUnitsForRole(CmsDbContext dbc, CmsRole role, boolean includeSubOus) throws CmsException Returns all the organizational units for which the current user has the given role.- Parameters:
dbc
- the current database contextrole
- the role to checkincludeSubOus
- if sub organizational units should be included in the search- Returns:
- a list of
CmsOrganizationalUnit
objects - Throws:
CmsException
- if something goes wrong
-
getParent
Returns the parent group of a group.- Parameters:
dbc
- the current database contextgroupname
- the name of the group- Returns:
- group the parent group or
null
- Throws:
CmsException
- if operation was not successful
-
getPermissions
public CmsPermissionSetCustom getPermissions(CmsDbContext dbc, CmsResource resource, CmsUser user) throws CmsException Returns the set of permissions of the current user for a given resource.- Parameters:
dbc
- the current database contextresource
- the resourceuser
- the user- Returns:
- bit set with allowed permissions
- Throws:
CmsException
- if something goes wrong
-
getProjectDriver
Returns the project driver.- Returns:
- the project driver
-
getProjectDriver
Returns the project driver for a given DB context.- Parameters:
dbc
- the database context- Returns:
- the project driver for the database context
-
getProjectDriver
Returns either the project driver for the DB context (if it has one) or a default project driver.- Parameters:
dbc
- the DB contextdefaultDriver
- the driver which should be returned if there is no project driver for the DB context- Returns:
- either the project driver for the DB context, or the default driver
-
getProjectId
Returns the uuid id for the given id.TODO: remove this method as soon as possible
- Parameters:
dbc
- the current database contextid
- the old project id- Returns:
- the new uuid for the given id
- Throws:
CmsException
- if something goes wrong
-
getPropertyConfiguration
Returns the configuration read from theopencms.properties
file.- Returns:
- the configuration read from the
opencms.properties
file
-
getRelatedResourcesToPublish
public CmsPublishList getRelatedResourcesToPublish(CmsDbContext dbc, CmsPublishList publishList, CmsRelationFilter filter) throws CmsException Returns a new publish list that contains the unpublished resources related to all resources in the given publish list, the related resources exclude all resources in the given publish list and also locked (by other users) resources.- Parameters:
dbc
- the current database contextpublishList
- the publish list to exclude from resultfilter
- the relation filter to use to get the related resources- Returns:
- a new publish list that contains the related resources
- Throws:
CmsException
- if something goes wrong- See Also:
-
getRelationsForResource
public List<CmsRelation> getRelationsForResource(CmsDbContext dbc, CmsResource resource, CmsRelationFilter filter) throws CmsException Returns all relations for the given resource matching the given filter.- Parameters:
dbc
- the current db contextresource
- the resource to retrieve the relations forfilter
- the filter to match the relation- Returns:
- all relations for the given resource matching the given filter
- Throws:
CmsException
- if something goes wrong- See Also:
-
getResourceOrgUnits
public List<CmsOrganizationalUnit> getResourceOrgUnits(CmsDbContext dbc, CmsResource resource) throws CmsException Returns the list of organizational units the given resource belongs to.- Parameters:
dbc
- the current database contextresource
- the resource- Returns:
- list of
CmsOrganizationalUnit
objects - Throws:
CmsException
- if something goes wrong
-
getResourcesForOrganizationalUnit
public List<CmsResource> getResourcesForOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit) throws CmsException Returns all resources of the given organizational unit.- Parameters:
dbc
- the current db contextorgUnit
- the organizational unit to get all resources for- Returns:
- all
objects in the organizational unitCmsResource
- Throws:
CmsException
- if operation was not successful- See Also:
-
getResourcesForPrincipal
public Set<CmsResource> getResourcesForPrincipal(CmsDbContext dbc, CmsProject project, CmsUUID principalId, CmsPermissionSet permissions, boolean includeAttr) throws CmsException Returns all resources associated to a given principal via an ACE with the given permissions.If the
includeAttr
flag is set it returns also all resources associated to a given principal through some of following attributes.- User Created
- User Last Modified
- Parameters:
dbc
- the current database contextproject
- the to read the entries fromprincipalId
- the id of the principalpermissions
- a set of permissions to match, can benull
for all ACEsincludeAttr
- a flag to include resources associated by attributes- Returns:
- a set of
objectsCmsResource
- Throws:
CmsException
- if something goes wrong
-
getRewriteAliases
public List<CmsRewriteAlias> getRewriteAliases(CmsDbContext dbc, CmsRewriteAliasFilter filter) throws CmsException Gets the rewrite aliases matching a given filter.- Parameters:
dbc
- the current database contextfilter
- the filter used for filtering rewrite aliases- Returns:
- the rewrite aliases matching the given filter
- Throws:
CmsException
- if something goes wrong
-
getRoleGroups
public Set<CmsGroup> getRoleGroups(CmsDbContext dbc, String roleGroupName, boolean directUsersOnly) throws CmsException Collects the groups which constitute a given role.- Parameters:
dbc
- the database contextroleGroupName
- the group related to the roledirectUsersOnly
- if true, only the group belonging to the entry itself wil- Returns:
- the set of groups which constitute the role
- Throws:
CmsException
- if something goes wrong
-
getRoleGroupsImpl
public Set<CmsGroup> getRoleGroupsImpl(CmsDbContext dbc, String roleGroupName, boolean directUsersOnly, Map<String, Set<CmsGroup>> accumulator) throws CmsExceptionCollects the groups which constitute a given role.- Parameters:
dbc
- the database contextroleGroupName
- the group related to the roledirectUsersOnly
- if true, only the group belonging to the entry itself wilaccumulator
- a map for memoizing return values of recursive calls- Returns:
- the set of groups which constitute the role
- Throws:
CmsException
- if something goes wrong
-
getRolesForResource
public List<CmsRole> getRolesForResource(CmsDbContext dbc, CmsUser user, CmsResource resource) throws CmsException Returns all roles the given user has for the given resource.- Parameters:
dbc
- the current database contextuser
- the user to checkresource
- the resource to check the roles for- Returns:
- a list of
CmsRole
objects - Throws:
CmsException
- if something goes wrong
-
getRolesForUser
Returns all roles the given user has independent of the resource.- Parameters:
dbc
- the current database contextuser
- the user to check- Returns:
- a list of
CmsRole
objects - Throws:
CmsException
- if something goes wrong
-
getSecurityManager
Returns the security manager this driver manager belongs to.- Returns:
- the security manager this driver manager belongs to
-
getSqlManager
Returns an instance of the common sql manager.- Returns:
- an instance of the common sql manager
-
getSubscriptionDriver
Returns the subscription driver of this driver manager.- Returns:
- a subscription driver
-
getUserDriver
Returns the user driver.- Returns:
- the user driver
-
getUserDriver
Returns the user driver for a given database context.- Parameters:
dbc
- the database context- Returns:
- the user driver for the database context
-
getUserDriver
Returns either the user driver for the given DB context (if it has one) or a default value instead.- Parameters:
dbc
- the DB contextdefaultDriver
- the driver that should be returned if no driver for the DB context was found- Returns:
- either the user driver for the DB context, or
defaultDriver
if none were found
-
getUsers
public List<CmsUser> getUsers(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean recursive) throws CmsException Returns all direct users of the given organizational unit.- Parameters:
dbc
- the current db contextorgUnit
- the organizational unit to get all users forrecursive
- if all groups of sub-organizational units should be retrieved too- Returns:
- all
objects in the organizational unitCmsUser
- Throws:
CmsException
- if operation was not successful- See Also:
-
getUsersOfGroup
public List<CmsUser> getUsersOfGroup(CmsDbContext dbc, String groupname, boolean includeOtherOuUsers, boolean directUsersOnly, boolean readRoles) throws CmsException Returns a list of users in a group.- Parameters:
dbc
- the current database contextgroupname
- the name of the group to list users fromincludeOtherOuUsers
- include users of other organizational unitsdirectUsersOnly
- if set only the direct assigned users will be returned, if not also indirect users, ie. members of parent roles, this parameter only works with rolesreadRoles
- if to read roles or groups- Returns:
- all
objects in the groupCmsUser
- Throws:
CmsException
- if operation was not successful
-
getUsersPubList
public List<CmsResource> getUsersPubList(CmsDbContext dbc, CmsUUID userId) throws CmsDataAccessException Returns the given user's publish list.- Parameters:
dbc
- the database contextuserId
- the user's id- Returns:
- the given user's publish list
- Throws:
CmsDataAccessException
- if something goes wrong
-
getUsersWithoutAdditionalInfo
public List<CmsUser> getUsersWithoutAdditionalInfo(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean recursive) throws CmsException Returns all direct users of the given organizational unit, without their additional info.- Parameters:
dbc
- the current db contextorgUnit
- the organizational unit to get all users forrecursive
- if all groups of sub-organizational units should be retrieved too- Returns:
- all
objects in the organizational unitCmsUser
- Throws:
CmsException
- if operation was not successful- See Also:
-
getVfsDriver
Returns the VFS driver.- Returns:
- the VFS driver
-
getVfsDriver
Returns the VFS driver for the given database context.- Parameters:
dbc
- the database context- Returns:
- a VFS driver
-
importAccessControlEntries
public void importAccessControlEntries(CmsDbContext dbc, CmsResource resource, List<CmsAccessControlEntry> acEntries) throws CmsException Writes a vector of access control entries as new access control entries of a given resource.Already existing access control entries of this resource are removed before. Access is granted, if:
- the current user has control permission on the resource
- Parameters:
dbc
- the current database contextresource
- the resourceacEntries
- a list of
objectsCmsAccessControlEntry
- Throws:
CmsException
- if something goes wrong
-
importUser
public CmsUser importUser(CmsDbContext dbc, String id, String name, String password, String firstname, String lastname, String email, int flags, long dateCreated, Map<String, Object> additionalInfos) throws CmsExceptionCreates a new user by import.- Parameters:
dbc
- the current database contextid
- the id of the username
- the new name for the userpassword
- the new password for the user (already encrypted)firstname
- the firstname of the userlastname
- the lastname of the useremail
- the email of the userflags
- the flags for a user (for example
)I_CmsPrincipal.FLAG_ENABLED
dateCreated
- the creation dateadditionalInfos
- the additional user infos- Returns:
- the imported user
- Throws:
CmsException
- if something goes wrong
-
incrementCounter
Increments a counter and returns its value before incrementing.- Parameters:
dbc
- the current database contextname
- the name of the counter which should be incremented- Returns:
- the value of the counter
- Throws:
CmsException
- if something goes wrong
-
init
public void init(CmsConfigurationManager configurationManager, I_CmsDbContextFactory dbContextFactory) throws CmsException, Exception Initializes the driver and sets up all required modules and connections.- Parameters:
configurationManager
- the configuration managerdbContextFactory
- the db context factory- Throws:
CmsException
- if something goes wrongException
- if something goes wrong
-
initOrgUnit
Initializes the organizational unit.- Parameters:
dbc
- the DB contextou
- the organizational unit
-
isInsideCurrentProject
Checks if the specified resource is inside the current project.The project "view" is determined by a set of path prefixes. If the resource starts with any one of this prefixes, it is considered to be "inside" the project.
- Parameters:
dbc
- the current database contextresourcename
- the specified resource name (full path)- Returns:
true
, if the specified resource is inside the current project
-
isSubscriptionDriverAvailable
Checks whether the subscription driver is available.- Returns:
- true if the subscription driver is available
-
isTempfileProject
Checks if a project is the tempfile project.- Parameters:
project
- the project to test- Returns:
- true if the project is the tempfile project
-
labelResource
public boolean labelResource(CmsDbContext dbc, CmsResource resource, String newResource, int action) throws CmsDataAccessException Checks if one of the resources (except the resource itself) is a sibling in a "labeled" site folder.This method is used when creating a new sibling (use the
newResource
parameter &action = 1
) or deleting/importing a resource (call withaction = 2
).- Parameters:
dbc
- the current database contextresource
- the resourcenewResource
- absolute path for a resource sibling which will be createdaction
- the action which has to be performed (1: create VFS link, 2: all other actions)- Returns:
true
if the flag should be set for the resource, otherwisefalse
- Throws:
CmsDataAccessException
- if something goes wrong
-
lockedBy
Returns the user, who had locked the resource.A user can lock a resource, so he is the only one who can write this resource. This methods checks, if a resource was locked.
- Parameters:
dbc
- the current database contextresource
- the resource- Returns:
- the user, who had locked the resource
- Throws:
CmsException
- will be thrown, if the user has not the rights for this resource
-
lockResource
public void lockResource(CmsDbContext dbc, CmsResource resource, CmsLockType type) throws CmsException Locks a resource.The
type
parameter controls what kind of lock is used.
Possible values for this parameter are:
- Parameters:
dbc
- the current database contextresource
- the resource to locktype
- type of the lock- Throws:
CmsException
- if something goes wrong- See Also:
-
log
Adds the given log entry to the current user's log.This operation works only on memory, to get the log entries actually written to DB you have to call the
updateLog(CmsDbContext)
method.- Parameters:
dbc
- the current database contextlogEntry
- the log entry to createforce
- forces the log entry to be counted, if not only the first log entry in a transaction will be taken into account
-
loginUser
public CmsUser loginUser(CmsDbContext dbc, String userName, String password, CmsSecondFactorInfo secondFactorInfo, String remoteAddress, CmsDriverManager.LoginUserMode mode) throws CmsAuthentificationException, CmsDataAccessException, CmsPasswordEncryptionException Attempts to authenticate a user into OpenCms with the given password.The method can be used in multiple modes (see the CmsDriverManager.LoginUserMode enum): Standard mode is the mode for actually logging in a user, while check mode merely checks the login details without firing the events normally fired during login, and without modifying the user. However, in the case an incorrect password is given, the invalid login counter is still incremented.
- Parameters:
dbc
- the current database contextuserName
- the name of the user to be logged inpassword
- the password of the usersecondFactorInfo
- the second factor information for 2FA (may be null)remoteAddress
- the ip address of the requestmode
- the mode to use (real login or check only)- Returns:
- the logged in user
- Throws:
CmsAuthentificationException
- if the login was not successfulCmsDataAccessException
- in case of errors accessing the databaseCmsPasswordEncryptionException
- in case of errors encrypting the users password
-
lookupPrincipal
Lookup and read the user or group with the given UUID.- Parameters:
dbc
- the current database contextprincipalId
- the UUID of the principal to lookup- Returns:
- the principal (group or user) if found, otherwise
null
-
lookupPrincipal
Lookup and read the user or group with the given name.- Parameters:
dbc
- the current database contextprincipalName
- the name of the principal to lookup- Returns:
- the principal (group or user) if found, otherwise
null
-
markResourceAsVisitedBy
public void markResourceAsVisitedBy(CmsDbContext dbc, String poolName, CmsResource resource, CmsUser user) throws CmsException Mark the given resource as visited by the user.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to useresource
- the resource to mark as visiteduser
- the user that visited the resource- Throws:
CmsException
- if something goes wrong
-
moveResource
public void moveResource(CmsDbContext dbc, CmsResource source, String destination, boolean internal) throws CmsException Moves a resource.You must ensure that the parent of the destination path is an absolute, valid and existing VFS path. Relative paths from the source are not supported.
The moved resource will always be locked to the current user after the move operation.
In case the target resource already exists, it will be overwritten with the source resource if possible.
- Parameters:
dbc
- the current database contextsource
- the resource to movedestination
- the name of the move destination with complete pathinternal
- if set nothing more than the path is modified- Throws:
CmsException
- if something goes wrong- See Also:
-
moveToLostAndFound
public String moveToLostAndFound(CmsDbContext dbc, CmsResource resource, boolean returnNameOnly) throws CmsException, CmsIllegalArgumentException Moves a resource to the "lost and found" folder.The method can also be used to check get the name of a resource in the "lost and found" folder only without actually moving the the resource. To do this, the
returnNameOnly
flag must be set totrue
.- Parameters:
dbc
- the current database contextresource
- the resource to apply this operation toreturnNameOnly
- iftrue
, only the name of the resource in the "lost and found" folder is returned, the move operation is not really performed- Returns:
- the name of the resource inside the "lost and found" folder
- Throws:
CmsException
- if something goes wrongCmsIllegalArgumentException
- if theresourcename
argument is null or of length 0- See Also:
-
newDriverInstance
public Object newDriverInstance(CmsDbContext dbc, CmsConfigurationManager configurationManager, String driverName, List<String> successiveDrivers) throws CmsInitException Gets a new driver instance.- Parameters:
dbc
- the database contextconfigurationManager
- the configuration managerdriverName
- the driver namesuccessiveDrivers
- the list of successive drivers- Returns:
- the driver object
- Throws:
CmsInitException
- if the selected driver could not be initialized
-
newDriverInstance
public Object newDriverInstance(CmsParameterConfiguration configuration, String driverName, String driverPoolUrl) throws CmsException Method to create a new instance of a driver.- Parameters:
configuration
- the configurations from the propertyfiledriverName
- the class name of the driverdriverPoolUrl
- the pool url for the driver- Returns:
- an initialized instance of the driver
- Throws:
CmsException
- if something goes wrong
-
newPoolInstance
public void newPoolInstance(CmsParameterConfiguration configuration, String poolName) throws CmsInitException Method to create a new instance of a pool.- Parameters:
configuration
- the configurations from the propertyfilepoolName
- the configuration name of the pool- Throws:
CmsInitException
- if the pools could not be initialized
-
publishJob
public void publishJob(CmsObject cms, CmsDbContext dbc, CmsPublishList publishList, I_CmsReport report) throws CmsException Publishes the given publish job.- Parameters:
cms
- the cms contextdbc
- the db contextpublishList
- the list of resources to publishreport
- the report to write to- Throws:
CmsException
- if something goes wrong
-
publishProject
public void publishProject(CmsObject cms, CmsDbContext dbc, CmsPublishList publishList, I_CmsReport report) throws CmsException Publishes the resources of a specified publish list.- Parameters:
cms
- the current request contextdbc
- the current database contextpublishList
- a publish listreport
- an instance of
to print messagesI_CmsReport
- Throws:
CmsException
- if something goes wrong- See Also:
-
publishUrlNameMapping
Transfers the new URL name mappings (if any) for a given resource to the online project.- Parameters:
dbc
- the current database contextres
- the resource whose new URL name mappings should be transferred to the online project- Throws:
CmsDataAccessException
- if something goes wrong
-
readAccessControlEntry
public CmsAccessControlEntry readAccessControlEntry(CmsDbContext dbc, CmsResource resource, CmsUUID principal) throws CmsException Reads an access control entry from the cms.The access control entries of a resource are readable by everyone.
- Parameters:
dbc
- the current database contextresource
- the resourceprincipal
- the id of a group or a user any other entity- Returns:
- an access control entry that defines the permissions of the entity for the given resource
- Throws:
CmsException
- if something goes wrong
-
readAliasByPath
public CmsAlias readAliasByPath(CmsDbContext dbc, CmsProject project, String siteRoot, String path) throws CmsException Finds the alias with a given path.If no alias is found, null is returned.
- Parameters:
dbc
- the current database contextproject
- the current projectsiteRoot
- the site rootpath
- the path of the alias- Returns:
- the alias with the given path
- Throws:
CmsException
- if something goes wrong
-
readAliasesBySite
public List<CmsAlias> readAliasesBySite(CmsDbContext dbc, CmsProject currentProject, String siteRoot) throws CmsException Reads the aliases for a given site root.- Parameters:
dbc
- the current database contextcurrentProject
- the current projectsiteRoot
- the site root- Returns:
- the list of aliases for the given site root
- Throws:
CmsException
- if something goes wrong
-
readAliasesByStructureId
public List<CmsAlias> readAliasesByStructureId(CmsDbContext dbc, CmsProject project, CmsUUID structureId) throws CmsException Reads the aliases which point to a given structure id.- Parameters:
dbc
- the current database contextproject
- the current projectstructureId
- the structure id for which we want to read the aliases- Returns:
- the list of aliases pointing to the structure id
- Throws:
CmsException
- if something goes wrong
-
readAllAvailableVersions
public List<I_CmsHistoryResource> readAllAvailableVersions(CmsDbContext dbc, CmsResource resource) throws CmsException Reads all versions of the given resource.
This method returns a list with the history of the given resource, i.e. the historical resource entries, independent of the project they were attached to.
The reading excludes the file content.- Parameters:
dbc
- the current database contextresource
- the resource to read the history for- Returns:
- a list of file headers, as
objectsI_CmsHistoryResource
- Throws:
CmsException
- if something goes wrong
-
readAllPropertyDefinitions
Reads all property definitions for the given mapping type.- Parameters:
dbc
- the current database context- Returns:
- a list with the
objects (may be empty)CmsPropertyDefinition
- Throws:
CmsException
- if something goes wrong
-
readAllSubscribedResources
public List<CmsResource> readAllSubscribedResources(CmsDbContext dbc, String poolName, CmsPrincipal principal) throws CmsException Returns all resources subscribed by the given user or group.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to useprincipal
- the principal to read the subscribed resources- Returns:
- all resources subscribed by the given user or group
- Throws:
CmsException
- if something goes wrong
-
readBestUrlName
public String readBestUrlName(CmsDbContext dbc, CmsUUID id, Locale locale, List<Locale> defaultLocales) throws CmsDataAccessException Selects the best url name for a given resource and locale.- Parameters:
dbc
- the database contextid
- the resource's structure idlocale
- the requested localedefaultLocales
- the default locales to use if the locale isn't available- Returns:
- the URL name which was found
- Throws:
CmsDataAccessException
- if the database operation failed
-
readChildResources
public List<CmsResource> readChildResources(CmsDbContext dbc, CmsResource resource, CmsResourceFilter filter, boolean getFolders, boolean getFiles, boolean checkPermissions) throws CmsException Returns the child resources of a resource, that is the resources contained in a folder.With the parameters
getFolders
andgetFiles
you can control what type of resources you want in the result list: files, folders, or both.This method is mainly used by the workplace explorer.
- Parameters:
dbc
- the current database contextresource
- the resource to return the child resources forfilter
- the resource filter to usegetFolders
- if true the child folders are included in the resultgetFiles
- if true the child files are included in the resultcheckPermissions
- if the resources should be filtered with the current user permissions- Returns:
- a list of all child resources
- Throws:
CmsException
- if something goes wrong
-
readDefaultFile
public CmsResource readDefaultFile(CmsDbContext dbc, CmsResource resource, CmsResourceFilter resourceFilter) Returns the default file for the given folder.If the given resource is a file, then this file is returned.
Otherwise, in case of a folder:
- the
CmsPropertyDefinition.PROPERTY_DEFAULT_FILE
is checked, and - if still no file could be found, the configured default files in the
opencms-vfs.xml
configuration are iterated until a match is found, and - if still no file could be found,
null
is retuned
- Parameters:
dbc
- the database contextresource
- the folder to get the default file forresourceFilter
- the resource filter- Returns:
- the default file for the given folder
- the
-
readDeletedResources
public List<I_CmsHistoryResource> readDeletedResources(CmsDbContext dbc, CmsResource resource, boolean readTree, boolean isVfsManager) throws CmsException Reads all deleted (historical) resources below the given path, including the full tree below the path, if required.- Parameters:
dbc
- the current db contextresource
- the parent resource to read the resources fromreadTree
-true
to read all subresourcesisVfsManager
-true
if the current user has the vfs manager role- Returns:
- a list of
objectsI_CmsHistoryResource
- Throws:
CmsException
- if something goes wrong- See Also:
-
readFile
Reads a file resource (including it's binary content) from the VFS, using the specified resource filter.In case you do not need the file content, use
instead.readResource(CmsDbContext, String, CmsResourceFilter)
The specified filter controls what kind of resources should be "found" during the read operation. This will depend on the application. For example, using
will only return currently "valid" resources, while usingCmsResourceFilter.DEFAULT
will ignore the date release / date expired information of the resource.CmsResourceFilter.IGNORE_EXPIRATION
- Parameters:
dbc
- the current database contextresource
- the base file resource (without content)- Returns:
- the file read from the VFS
- Throws:
CmsException
- if operation was not successful
-
readFolder
public CmsFolder readFolder(CmsDbContext dbc, String resourcename, CmsResourceFilter filter) throws CmsDataAccessException Reads a folder from the VFS, using the specified resource filter.- Parameters:
dbc
- the current database contextresourcename
- the name of the folder to read (full path)filter
- the resource filter to use while reading- Returns:
- the folder that was read
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
readGroup
Reads the group of a project.- Parameters:
dbc
- the current database contextproject
- the project to read from- Returns:
- the group of a resource
-
readGroup
Reads a group based on its id.- Parameters:
dbc
- the current database contextgroupId
- the id of the group that is to be read- Returns:
- the requested group
- Throws:
CmsException
- if operation was not successful
-
readGroup
Reads a group based on its name.- Parameters:
dbc
- the current database contextgroupname
- the name of the group that is to be read- Returns:
- the requested group
- Throws:
CmsDataAccessException
- if operation was not successful
-
readHistoricalPrincipal
public CmsHistoryPrincipal readHistoricalPrincipal(CmsDbContext dbc, CmsUUID principalId) throws CmsException Reads a principal (an user or group) from the historical archive based on its ID.- Parameters:
dbc
- the current database contextprincipalId
- the id of the principal to read- Returns:
- the historical principal entry with the given id
- Throws:
CmsException
- if something goes wrong, ie.CmsDbEntryNotFoundException
- See Also:
-
readHistoryProject
public CmsHistoryProject readHistoryProject(CmsDbContext dbc, CmsUUID projectId) throws CmsException Returns the latest historical project entry with the given id.- Parameters:
dbc
- the current database contextprojectId
- the project id- Returns:
- the requested historical project entry
- Throws:
CmsException
- if something goes wrong
-
readHistoryProject
Returns a historical project entry.- Parameters:
dbc
- the current database contextpublishTag
- the publish tag of the project- Returns:
- the requested historical project entry
- Throws:
CmsException
- if something goes wrong
-
readHistoryPropertyObjects
public List<CmsProperty> readHistoryPropertyObjects(CmsDbContext dbc, I_CmsHistoryResource historyResource) throws CmsException Reads the list of all
objects that belongs to the given historical resource.CmsProperty
- Parameters:
dbc
- the current database contexthistoryResource
- the historical resource to read the properties for- Returns:
- the list of
objectsCmsProperty
- Throws:
CmsException
- if something goes wrong
-
readIdForUrlName
Reads the structure id which is mapped to a given URL name.- Parameters:
dbc
- the current database contextname
- the name for which the mapped structure id should be looked up- Returns:
- the structure id which is mapped to the given name, or null if there is no such id
- Throws:
CmsDataAccessException
- if something goes wrong
-
readLocks
Reads the locks that were saved to the database in the previous run of OpenCms.- Parameters:
dbc
- the current database context- Throws:
CmsException
- if something goes wrong
-
readManagerGroup
Reads the manager group of a project.- Parameters:
dbc
- the current database contextproject
- the project to read from- Returns:
- the group of a resource
-
readNewestUrlNameForId
Reads the URL name which has been most recently mapped to the given structure id, or null if no URL name is mapped to the id.- Parameters:
dbc
- the current database contextid
- a structure id- Returns:
- the name which has been most recently mapped to the given structure id
- Throws:
CmsDataAccessException
- if something goes wrong
-
readOrganizationalUnit
public CmsOrganizationalUnit readOrganizationalUnit(CmsDbContext dbc, String ouFqn) throws CmsException Reads an organizational Unit based on its fully qualified name.- Parameters:
dbc
- the current db contextouFqn
- the fully qualified name of the organizational Unit to be read- Returns:
- the organizational Unit that with the provided fully qualified name
- Throws:
CmsException
- if something goes wrong
-
readOwner
Reads the owner of a project.- Parameters:
dbc
- the current database contextproject
- the project to get the owner from- Returns:
- the owner of a resource
- Throws:
CmsException
- if something goes wrong
-
readParentFolder
public CmsResource readParentFolder(CmsDbContext dbc, CmsUUID structureId) throws CmsDataAccessException Reads the parent folder to a given structure id.- Parameters:
dbc
- the current database contextstructureId
- the structure id of the child- Returns:
- the parent folder resource
- Throws:
CmsDataAccessException
- if something goes wrong
-
readPath
public List<CmsResource> readPath(CmsDbContext dbc, String path, CmsResourceFilter filter) throws CmsException Builds a list of resources for a given path.- Parameters:
dbc
- the current database contextpath
- the requested pathfilter
- a filter object (only "includeDeleted" information is used!)- Returns:
- list of
sCmsResource
- Throws:
CmsException
- if something goes wrong
-
readProject
Reads a project given the projects id.- Parameters:
dbc
- the current database contextid
- the id of the project- Returns:
- the project read
- Throws:
CmsDataAccessException
- if something goes wrong
-
readProject
Reads a project.Important: Since a project name can be used multiple times, this is NOT the most efficient way to read the project. This is only a convenience for front end developing. Reading a project by name will return the first project with that name. All core classes must use the id version
readProject(CmsDbContext, CmsUUID)
to ensure the right project is read.- Parameters:
dbc
- the current database contextname
- the name of the project- Returns:
- the project read
- Throws:
CmsException
- if something goes wrong
-
readProjectResources
Returns the list of all resource names that define the "view" of the given project.- Parameters:
dbc
- the current database contextproject
- the project to get the project resources for- Returns:
- the list of all resources, as
objects that define the "view" of the given project.String
- Throws:
CmsException
- if something goes wrong
-
readProjectView
public List<CmsResource> readProjectView(CmsDbContext dbc, CmsUUID projectId, CmsResourceState state) throws CmsException Reads all resources of a project that match a given state from the VFS.Possible values for the
state
parameter are:
: Read all "changed" resources in the projectCmsResource.STATE_CHANGED
: Read all "new" resources in the projectCmsResource.STATE_NEW
: Read all "deleted" resources in the projectCmsResource.STATE_DELETED
: Read all resources either "changed", "new" or "deleted" in the projectCmsResource.STATE_KEEP
- Parameters:
dbc
- the current database contextprojectId
- the id of the project to read the file resources forstate
- the resource state to match- Returns:
- a list of
objects matching the filter criteriaCmsResource
- Throws:
CmsException
- if something goes wrong- See Also:
-
readPropertyDefinition
public CmsPropertyDefinition readPropertyDefinition(CmsDbContext dbc, String name) throws CmsException Reads a property definition.If no property definition with the given name is found,
null
is returned.- Parameters:
dbc
- the current database contextname
- the name of the property definition to read- Returns:
- the property definition that was read
- Throws:
CmsException
- a CmsDbEntryNotFoundException is thrown if the property definition does not exist
-
readPropertyObject
public CmsProperty readPropertyObject(CmsDbContext dbc, CmsResource resource, String key, boolean search) throws CmsException Reads a property object from a resource specified by a property name.Returns
if the property is not found.CmsProperty.getNullProperty()
- Parameters:
dbc
- the current database contextresource
- the resource where the property is read fromkey
- the property key namesearch
- iftrue
, the property is searched on all parent folders of the resource. if it's not found attached directly to the resource.- Returns:
- the required property, or
if the property was not foundCmsProperty.getNullProperty()
- Throws:
CmsException
- if something goes wrong
-
readPropertyObject
public CmsProperty readPropertyObject(CmsDbContext dbc, CmsResource resource, String key, boolean search, Locale locale) throws CmsException Reads a property object from a resource specified by a property name.Returns
if the property is not found.CmsProperty.getNullProperty()
- Parameters:
dbc
- the current database contextresource
- the resource where the property is read fromkey
- the property key namesearch
- iftrue
, the property is searched on all parent folders of the resource. if it's not found attached directly to the resource.locale
- the locale for which the property should be read.- Returns:
- the required property, or
if the property was not foundCmsProperty.getNullProperty()
- Throws:
CmsException
- if something goes wrong
-
readPropertyObjects
public List<CmsProperty> readPropertyObjects(CmsDbContext dbc, CmsResource resource, boolean search) throws CmsException Reads all property objects mapped to a specified resource from the database.All properties in the result List will be in frozen (read only) state, so you can't change the values.
Returns an empty list if no properties are found at all.
- Parameters:
dbc
- the current database contextresource
- the resource where the properties are read fromsearch
- true, if the properties should be searched on all parent folders if not found on the resource- Returns:
- a list of CmsProperty objects containing the structure and/or resource value
- Throws:
CmsException
- if something goes wrong- See Also:
-
readPublishedResources
public List<CmsPublishedResource> readPublishedResources(CmsDbContext dbc, CmsUUID publishHistoryId) throws CmsException Reads the resources that were published in a publish task for a given publish history ID.- Parameters:
dbc
- the current database contextpublishHistoryId
- unique int ID to identify each publish task in the publish history- Returns:
- a list of
objectsCmsPublishedResource
- Throws:
CmsException
- if something goes wrong
-
readPublishJob
public CmsPublishJobInfoBean readPublishJob(CmsDbContext dbc, CmsUUID publishHistoryId) throws CmsException Reads a single publish job identified by its publish history id.- Parameters:
dbc
- the current database contextpublishHistoryId
- unique id to identify the publish job in the publish history- Returns:
- an object of type
CmsPublishJobInfoBean
- Throws:
CmsException
- if something goes wrong
-
readPublishJobs
public List<CmsPublishJobInfoBean> readPublishJobs(CmsDbContext dbc, long startTime, long endTime) throws CmsException Reads all available publish jobs.- 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:
CmsException
- if something goes wrong
-
readPublishList
public CmsPublishList readPublishList(CmsDbContext dbc, CmsUUID publishHistoryId) throws CmsException Reads the publish list assigned to a publish job.- Parameters:
dbc
- the current database contextpublishHistoryId
- the history id identifying the publish job- Returns:
- the assigned publish list
- Throws:
CmsException
- if something goes wrong
-
readPublishReportContents
public byte[] readPublishReportContents(CmsDbContext dbc, CmsUUID publishHistoryId) throws CmsException Reads the publish report assigned to a publish job.- Parameters:
dbc
- the current database contextpublishHistoryId
- the history id identifying the publish job- Returns:
- the content of the assigned publish report
- Throws:
CmsException
- if something goes wrong
-
readResource
public I_CmsHistoryResource readResource(CmsDbContext dbc, CmsResource resource, int version) throws CmsException Reads an historical resource entry for the given resource and with the given version number.- Parameters:
dbc
- the current db contextresource
- the resource to be readversion
- the version number to retrieve- Returns:
- the resource that was read
- Throws:
CmsException
- if the resource could not be read for any reason- See Also:
-
readResource
public CmsResource readResource(CmsDbContext dbc, CmsUUID structureID, CmsResourceFilter filter) throws CmsDataAccessException Reads a resource from the VFS, using the specified resource filter.- Parameters:
dbc
- the current database contextstructureID
- the structure id of the resource to readfilter
- the resource filter to use while reading- Returns:
- the resource that was read
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
readResource
public CmsResource readResource(CmsDbContext dbc, String resourcePath, CmsResourceFilter filter) throws CmsDataAccessException Reads a resource from the VFS, using the specified resource filter.- Parameters:
dbc
- the current database contextresourcePath
- the name of the resource to read (full path)filter
- the resource filter to use while reading- Returns:
- the resource that was read
- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
readResources
public List<CmsResource> readResources(CmsDbContext dbc, CmsResource parent, CmsResourceFilter filter, boolean readTree) throws CmsException, CmsDataAccessException Reads all resources below the given path matching the filter criteria, including the full tree below the path only in case thereadTree
parameter istrue
.- Parameters:
dbc
- the current database contextparent
- the parent path to read the resources fromfilter
- the filterreadTree
-true
to read all subresources- Returns:
- a list of
objects matching the filter criteriaCmsResource
- Throws:
CmsDataAccessException
- if the bare reading of the resources failsCmsException
- if security and permission checks for the resources read fail
-
readResourcesVisitedBy
public List<CmsResource> readResourcesVisitedBy(CmsDbContext dbc, String poolName, CmsVisitedByFilter filter) throws CmsException Returns the resources that were visited by a user set in the filter.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to usefilter
- the filter that is used to get the visited resources- Returns:
- the resources that were visited by a user set in the filter
- Throws:
CmsException
- if something goes wrong
-
readResourcesWithProperty
public List<CmsResource> readResourcesWithProperty(CmsDbContext dbc, CmsResource folder, String propertyDefinition, String value, CmsResourceFilter filter) throws CmsException Reads all resources that have a value (containing the given value string) set for the specified property (definition) in the given path.Both individual and shared properties of a resource are checked.
If the
value
parameter isnull
, all resources having the given property set are returned.- Parameters:
dbc
- the current database contextfolder
- the folder to get the resources with the property frompropertyDefinition
- the name of the property (definition) to check forvalue
- the string to search in the value of the propertyfilter
- the resource filter to apply to the result set- Returns:
- a list of all
objects that have a value set for the specified property.CmsResource
- Throws:
CmsException
- if something goes wrong
-
readResponsiblePrincipals
public Set<I_CmsPrincipal> readResponsiblePrincipals(CmsDbContext dbc, CmsResource resource) throws CmsException Returns the set of users that are responsible for a specific resource.- Parameters:
dbc
- the current database contextresource
- the resource to get the responsible users from- Returns:
- the set of users that are responsible for a specific resource
- Throws:
CmsException
- if something goes wrong
-
readResponsibleUsers
public Set<CmsUser> readResponsibleUsers(CmsDbContext dbc, CmsResource resource) throws CmsException Returns the set of users that are responsible for a specific resource.- Parameters:
dbc
- the current database contextresource
- the resource to get the responsible users from- Returns:
- the set of users that are responsible for a specific resource
- Throws:
CmsException
- if something goes wrong
-
readSiblings
public List<CmsResource> readSiblings(CmsDbContext dbc, CmsResource resource, CmsResourceFilter filter) throws CmsException Returns a List of all siblings of the specified resource, the specified resource being always part of the result set.The result is a list of
objects.CmsResource
- Parameters:
dbc
- the current database contextresource
- the resource to read the siblings forfilter
- a filter object- Returns:
- a list of
Objects that are siblings to the specified resource, including the specified resource itselfCmsResource
- Throws:
CmsException
- if something goes wrong
-
readStaticExportPublishedResourceParameters
public String readStaticExportPublishedResourceParameters(CmsDbContext dbc, String rfsName) throws CmsException Returns the parameters of a resource in the table of all published template resources.- Parameters:
dbc
- the current database contextrfsName
- the rfs name of the resource- Returns:
- the parameter string of the requested resource
- Throws:
CmsException
- if something goes wrong
-
readStaticExportResources
public List<String> readStaticExportResources(CmsDbContext dbc, int parameterResources, long timestamp) throws CmsException Returns a list of all template resources which must be processed during a static export.- Parameters:
dbc
- the current database contextparameterResources
- flag for reading resources with parameters (1) or without (0)timestamp
- for reading the data from the db- Returns:
- a list of template resources as
objectsString
- Throws:
CmsException
- if something goes wrong
-
readSubscribedDeletedResources
public List<I_CmsHistoryResource> readSubscribedDeletedResources(CmsDbContext dbc, String poolName, CmsUser user, List<CmsGroup> groups, CmsResource parent, boolean includeSubFolders, long deletedFrom) throws CmsException Returns the subscribed history resources that were deleted.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to useuser
- the user that subscribed to the resourcegroups
- the groups to check subscribed resources forparent
- the parent resource (folder) of the deleted resources, ifnull
all deleted resources will be returnedincludeSubFolders
- indicates if the sub folders of the specified folder path should be considered, toodeletedFrom
- the time stamp from which the resources should have been deleted- Returns:
- the subscribed history resources that were deleted
- Throws:
CmsException
- if something goes wrong
-
readSubscribedResources
public List<CmsResource> readSubscribedResources(CmsDbContext dbc, String poolName, CmsSubscriptionFilter filter) throws CmsException Returns the resources that were subscribed by a user or group set in the filter.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to usefilter
- the filter that is used to get the subscribed resources- Returns:
- the resources that were subscribed by a user or group set in the filter
- Throws:
CmsException
- if something goes wrong
-
readUrlNameMappingEntries
public List<CmsUrlNameMappingEntry> readUrlNameMappingEntries(CmsDbContext dbc, boolean online, CmsUrlNameMappingFilter filter) throws CmsDataAccessException Reads URL name mapping entries which match the given filter.- Parameters:
dbc
- the database contextonline
- if true, read online URL name mappings, else offline onesfilter
- the filter for matching the URL name entries- Returns:
- the list of URL name mapping entries which match the given filter
- Throws:
CmsDataAccessException
- if something goes wrong
-
readUrlNameMappings
public List<CmsUrlNameMappingEntry> readUrlNameMappings(CmsDbContext dbc, CmsUrlNameMappingFilter filter) throws CmsDataAccessException Reads the URL name mappings matching the given filter.- Parameters:
dbc
- the DB context to usefilter
- the filter used to select the mapping entries- Returns:
- the entries matching the given filter
- Throws:
CmsDataAccessException
- if something goes wrong
-
readUrlNamesForAllLocales
public List<String> readUrlNamesForAllLocales(CmsDbContext dbc, CmsUUID id) throws CmsDataAccessException Reads the newest URL names of a resource for all locales.- Parameters:
dbc
- the database contextid
- the resource's structure id- Returns:
- the url names for the locales
- Throws:
CmsDataAccessException
- if the database operation failed
-
readUser
Returns a user object based on the id of a user.- Parameters:
dbc
- the current database contextid
- the id of the user to read- Returns:
- the user read
- Throws:
CmsException
- if something goes wrong
-
readUser
Returns a user object.- Parameters:
dbc
- the current database contextusername
- the name of the user that is to be read- Returns:
- user read
- Throws:
CmsDataAccessException
- if operation was not successful
-
readUser
Returns a user object if the password for the user is correct.If the user/pwd pair is not valid a
is thrown.CmsException
- Parameters:
dbc
- the current database contextusername
- the username of the user that is to be readpassword
- the password of the user that is to be read- Returns:
- user read
- Throws:
CmsException
- if operation was not successful
-
removeAccessControlEntry
public void removeAccessControlEntry(CmsDbContext dbc, CmsResource resource, CmsUUID principal) throws CmsException Removes an access control entry for a given resource and principal.- Parameters:
dbc
- the current database contextresource
- the resourceprincipal
- the id of the principal to remove the the access control entry for- Throws:
CmsException
- if something goes wrong
-
removeResourceFromOrgUnit
public void removeResourceFromOrgUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, CmsResource resource) throws CmsException Removes a resource from the given organizational unit.- Parameters:
dbc
- the current db contextorgUnit
- the organizational unit to remove the resource fromresource
- the resource that is to be removed from the organizational unit- Throws:
CmsException
- if something goes wrong- See Also:
-
removeResourceFromProject
Removes a resource from the current project of the user.- Parameters:
dbc
- the current database contextresource
- the resource to apply this operation to- Throws:
CmsException
- if something goes wrong- See Also:
-
removeResourceFromUsersPubList
public void removeResourceFromUsersPubList(CmsDbContext dbc, CmsUUID userId, Collection<CmsUUID> structureIds) throws CmsDataAccessException Removes the given resource to the given user's publish list.- Parameters:
dbc
- the database contextuserId
- the user's idstructureIds
- the collection of structure IDs to remove- Throws:
CmsDataAccessException
- if something goes wrong
-
removeUserFromGroup
public void removeUserFromGroup(CmsDbContext dbc, String username, String groupname, boolean readRoles) throws CmsException, CmsIllegalArgumentException, CmsDbEntryNotFoundException, CmsSecurityException Removes a user from a group.- Parameters:
dbc
- the current database contextusername
- the name of the user that is to be removed from the groupgroupname
- the name of the groupreadRoles
- if to read roles or groups- Throws:
CmsException
- if operation was not successfulCmsIllegalArgumentException
- if the given user was not member in the given groupCmsDbEntryNotFoundException
- if the given group was not foundCmsSecurityException
- if the given user was read as 'null' from the database- See Also:
-
repairCategories
public void repairCategories(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) throws CmsException Repairs broken categories.- Parameters:
dbc
- the database contextprojectId
- the project idresource
- the resource to repair the categories for- Throws:
CmsException
- if something goes wrong
-
replaceResource
public void replaceResource(CmsDbContext dbc, CmsResource resource, int type, byte[] content, List<CmsProperty> properties) throws CmsException Replaces the content, type and properties of a resource.- Parameters:
dbc
- the current database contextresource
- the name of the resource to apply this operation totype
- the new type of the resourcecontent
- the new content of the resourceproperties
- the new properties of the resource- Throws:
CmsException
- if something goes wrong- See Also:
-
resetPassword
public void resetPassword(CmsDbContext dbc, String username, String oldPassword, CmsSecondFactorInfo secondFactor, String newPassword) throws CmsException, CmsSecurityException Resets the password for a specified user.- Parameters:
dbc
- the current database contextusername
- the name of the useroldPassword
- the old passwordsecondFactor
- the second factor data used for 2FAnewPassword
- the new password- Throws:
CmsException
- if the user data could not be read from the databaseCmsSecurityException
- if the specified username and old password could not be verified
-
restoreDeletedResource
Restores a deleted resource identified by its structure id from the historical archive.- Parameters:
dbc
- the current database contextstructureId
- the structure id of the resource to restore- Throws:
CmsException
- if something goes wrong- See Also:
-
restoreResource
public void restoreResource(CmsDbContext dbc, CmsResource resource, int version) throws CmsException Restores a resource in the current project with a version from the historical archive.- Parameters:
dbc
- the current database contextresource
- the resource to restore from the archiveversion
- the version number to restore from the archive- Throws:
CmsException
- if something goes wrong- See Also:
-
saveAliases
public void saveAliases(CmsDbContext dbc, CmsProject project, CmsUUID structureId, List<CmsAlias> aliases) throws CmsException Saves a list of aliases for the same structure id, replacing any aliases for the same structure id.- Parameters:
dbc
- the current database contextproject
- the current projectstructureId
- the structure id for which the aliases should be savedaliases
- the list of aliases to save- Throws:
CmsException
- if something goes wrong
-
saveRewriteAliases
public void saveRewriteAliases(CmsDbContext dbc, String siteRoot, List<CmsRewriteAlias> newAliases) throws CmsException Replaces the complete list of rewrite aliases for a given site root.- Parameters:
dbc
- the current database contextsiteRoot
- the site root for which the rewrite aliases should be replacednewAliases
- the new aliases for the given site root- Throws:
CmsException
- if something goes wrong
-
searchUsers
public List<CmsUser> searchUsers(CmsDbContext dbc, CmsUserSearchParameters searchParams) throws CmsDataAccessException Searches for users which fit the given criteria.- Parameters:
dbc
- the database contextsearchParams
- the search criteria- Returns:
- the users which fit the search criteria
- Throws:
CmsDataAccessException
- if something goes wrong
-
setDateExpired
public void setDateExpired(CmsDbContext dbc, CmsResource resource, long dateExpired) throws CmsDataAccessException Changes the "expire" date of a resource.- Parameters:
dbc
- the current database contextresource
- the resource to touchdateExpired
- the new expire date of the resource- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
setDateLastModified
public void setDateLastModified(CmsDbContext dbc, CmsResource resource, long dateLastModified) throws CmsDataAccessException Changes the "last modified" timestamp of a resource.- Parameters:
dbc
- the current database contextresource
- the resource to touchdateLastModified
- the new last modified date of the resource- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
setDateReleased
public void setDateReleased(CmsDbContext dbc, CmsResource resource, long dateReleased) throws CmsDataAccessException Changes the "release" date of a resource.- Parameters:
dbc
- the current database contextresource
- the resource to touchdateReleased
- the new release date of the resource- Throws:
CmsDataAccessException
- if something goes wrong- See Also:
-
setParentGroup
public void setParentGroup(CmsDbContext dbc, String groupName, String parentGroupName) throws CmsException, CmsDataAccessException Sets a new parent group for an already existing group.- Parameters:
dbc
- the current database contextgroupName
- the name of the group that should be writtenparentGroupName
- the name of the parent group to set, ornull
if the parent group should be deleted.- Throws:
CmsException
- if operation was not successfulCmsDataAccessException
- if the group withgroupName
could not be read from VFS
-
setPassword
public void setPassword(CmsDbContext dbc, String username, String newPassword) throws CmsException, CmsIllegalArgumentException Sets the password for a user.- Parameters:
dbc
- the current database contextusername
- the name of the usernewPassword
- the new password- Throws:
CmsException
- if operation was not successfulCmsIllegalArgumentException
- if the user with theusername
was not found
-
setSubscribedResourceAsDeleted
public void setSubscribedResourceAsDeleted(CmsDbContext dbc, String poolName, CmsResource resource) throws CmsException Marks a subscribed resource as deleted.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to useresource
- the subscribed resource to mark as deleted- Throws:
CmsException
- if something goes wrong
-
setUsersOrganizationalUnit
public void setUsersOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, CmsUser user) throws CmsException Moves an user to the given organizational unit.- Parameters:
dbc
- the current db contextorgUnit
- the organizational unit to add the resource touser
- the user that is to be moved to the organizational unit- Throws:
CmsException
- if something goes wrong- See Also:
-
subscribeResourceFor
public void subscribeResourceFor(CmsDbContext dbc, String poolName, CmsPrincipal principal, CmsResource resource) throws CmsException Subscribes the user or group to the resource.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to useprincipal
- the principal that subscribes to the resourceresource
- the resource to subscribe to- Throws:
CmsException
- if something goes wrong
-
undelete
Undelete the resource.- Parameters:
dbc
- the current database contextresource
- the name of the resource to apply this operation to- Throws:
CmsException
- if something goes wrong- See Also:
-
undoChanges
public void undoChanges(CmsDbContext dbc, CmsResource resource, CmsResource.CmsResourceUndoMode mode) throws CmsException Undos all changes in the resource by restoring the version from the online project to the current offline project.- Parameters:
dbc
- the current database contextresource
- the name of the resource to apply this operation tomode
- the undo mode, one of the
constants please note that the recursive flag is ignored at this levelCmsResource.CmsResourceUndoMode
#UNDO_XXX- Throws:
CmsException
- if something goes wrong- See Also:
-
unlockProject
Unlocks all resources in the given project.- Parameters:
project
- the project to unlock the resources in
-
unlockResource
public void unlockResource(CmsDbContext dbc, CmsResource resource, boolean force, boolean removeSystemLock) throws CmsException Unlocks a resource.- Parameters:
dbc
- the current database contextresource
- the resource to unlockforce
-true
, if a resource is forced to get unlocked, no matter by which user and in which project the resource is currently lockedremoveSystemLock
-true
, if you also want to remove system locks- Throws:
CmsException
- if something goes wrong- See Also:
-
unsubscribeAllDeletedResources
public void unsubscribeAllDeletedResources(CmsDbContext dbc, String poolName, long deletedTo) throws CmsException Unsubscribes all deleted resources that were deleted before the specified time stamp.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to usedeletedTo
- the time stamp to which the resources have been deleted- Throws:
CmsException
- if something goes wrong
-
unsubscribeAllResourcesFor
public void unsubscribeAllResourcesFor(CmsDbContext dbc, String poolName, CmsPrincipal principal) throws CmsException Unsubscribes the principal from all resources.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to useprincipal
- the principal that unsubscribes from all resources- Throws:
CmsException
- if something goes wrong
-
unsubscribeResourceFor
public void unsubscribeResourceFor(CmsDbContext dbc, String poolName, CmsPrincipal principal, CmsResource resource) throws CmsException Unsubscribes the principal from the resource.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to useprincipal
- the principal that unsubscribes from the resourceresource
- the resource to unsubscribe from- Throws:
CmsException
- if something goes wrong
-
unsubscribeResourceForAll
public void unsubscribeResourceForAll(CmsDbContext dbc, String poolName, CmsResource resource) throws CmsException Unsubscribes all groups and users from the resource.- Parameters:
dbc
- the database contextpoolName
- the name of the database pool to useresource
- the resource to unsubscribe all groups and users from- Throws:
CmsException
- if something goes wrong
-
updateExportPoints
Update the export points.All files and folders "inside" an export point are written.
- Parameters:
dbc
- the current database context
-
updateLastLoginDate
Updates the last login date on the given user to the current time.- Parameters:
dbc
- the current database contextuser
- the user to be updated- Throws:
CmsException
- if operation was not successful
-
updateLog
Logs everything that has not been written to DB jet.- Parameters:
dbc
- the current db context- Throws:
CmsDataAccessException
- if something goes wrong
-
updateRelationsForResource
public void updateRelationsForResource(CmsDbContext dbc, CmsResource resource, List<CmsLink> links, boolean updateSiblingState) throws CmsException Updates/Creates the given relations for the given resource.- Parameters:
dbc
- the db contextresource
- the resource to update the relations forlinks
- the links to consider for updatingupdateSiblingState
- if true, sets the state of siblings whose relations have changed to 'changed' (unless they are new or deleted)- Throws:
CmsException
- if something goes wrong- See Also:
-
CmsSecurityManager#updateRelationsForResource(CmsRequestContext, CmsResource, List)
-
userInGroup
public boolean userInGroup(CmsDbContext dbc, String username, String groupname, boolean readRoles) throws CmsException Returnstrue
if a user is member of the given group.- Parameters:
dbc
- the current database contextusername
- the name of the user to checkgroupname
- the name of the group to checkreadRoles
- if to read roles or groups- Returns:
true
, if the user is in the group,false
otherwise- Throws:
CmsException
- if something goes wrong
-
validatePassword
This method checks if a new password follows the rules for new passwords, which are defined by a Class implementing the
interface and configured in the opencms.properties file.I_CmsPasswordHandler
If this method throws no exception the password is valid.
- Parameters:
password
- the new password that has to be checked- Throws:
CmsSecurityException
- if the password is not valid
-
validateRelations
public Map<String,List<CmsRelation>> validateRelations(CmsDbContext dbc, CmsPublishList publishList, I_CmsReport report) throws Exception Validates the relations for the given resources.- Parameters:
dbc
- the database contextpublishList
- the resources to validate during publishingreport
- a report to write the messages to- Returns:
- a map with lists of invalid links
(
objects) keyed by root pathsCmsRelation
} - Throws:
Exception
- if something goes wrong
-
writeAccessControlEntry
public void writeAccessControlEntry(CmsDbContext dbc, CmsResource resource, CmsAccessControlEntry ace) throws CmsException Writes an access control entries to a given resource.- Parameters:
dbc
- the current database contextresource
- the resourceace
- the entry to write- Throws:
CmsException
- if something goes wrong
-
writeExportPoints
Writes all export points into the file system for the publish task specified by trhe given publish history ID.- Parameters:
dbc
- the current database contextreport
- an I_CmsReport instance to print output message, or null to write messages to the log filepublishHistoryId
- ID to identify the publish task in the publish history
-
writeFile
Writes a resource to the OpenCms VFS, including it's content.Applies only to resources of type
i.e. resources that have a binary content attached.CmsFile
Certain resource types might apply content validation or transformation rules before the resource is actually written to the VFS. The returned result might therefore be a modified version from the provided original.
- Parameters:
dbc
- the current database contextresource
- the resource to apply this operation to- Returns:
- the written resource (may have been modified)
- Throws:
CmsException
- if something goes wrong- See Also:
-
writeGroup
Writes an already existing group.The group id has to be a valid OpenCms group id.
The group with the given id will be completely overridden by the given data.- Parameters:
dbc
- the current database contextgroup
- the group that should be written- Throws:
CmsException
- if operation was not successful
-
writeHistoryProject
public void writeHistoryProject(CmsDbContext dbc, int publishTag, long publishDate) throws CmsDataAccessException Creates an historical entry of the current project.- Parameters:
dbc
- the current database contextpublishTag
- the versionpublishDate
- the date of publishing- Throws:
CmsDataAccessException
- if operation was not successful
-
writeLocks
Writes the locks that are currently stored in-memory to the database to allow restoring them in future server startups.This overwrites the locks previously stored in the underlying database table.
- Parameters:
dbc
- the current database context- Throws:
CmsException
- if something goes wrong
-
writeOrganizationalUnit
public void writeOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit organizationalUnit) throws CmsException Writes an already existing organizational unit.The organizational unit id has to be a valid OpenCms organizational unit id.
The organizational unit with the given id will be completely overridden by the given data.- Parameters:
dbc
- the current db contextorganizationalUnit
- the organizational unit that should be written- Throws:
CmsException
- if operation was not successful- See Also:
-
writeProject
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 overridden by the given data.- Parameters:
dbc
- the current database contextproject
- the project that should be written- Throws:
CmsException
- if operation was not successful
-
writeProjectLastModified
public void writeProjectLastModified(CmsDbContext dbc, CmsResource resource, CmsUUID projectId) throws CmsDataAccessException Writes a new project into the PROJECT_LASTMODIFIED field of a resource record.- Parameters:
dbc
- the current database contextresource
- the resource which should be modifiedprojectId
- the project id to write- Throws:
CmsDataAccessException
- if the database access fails
-
writePropertyObject
public void writePropertyObject(CmsDbContext dbc, CmsResource resource, CmsProperty property) throws CmsException Writes a property for a specified resource.- Parameters:
dbc
- the current database contextresource
- the resource to write the property forproperty
- the property to write- Throws:
CmsException
- if something goes wrong- See Also:
-
writePropertyObjects
public void writePropertyObjects(CmsDbContext dbc, CmsResource resource, List<CmsProperty> properties, boolean updateState) throws CmsException Writes a list of properties for a specified resource.Code calling this method has to ensure that the no properties
a, b
are contained in the specified list so thata.equals(b)
, otherwise an exception is thrown.- Parameters:
dbc
- the current database contextresource
- the resource to write the properties forproperties
- the list of properties to writeupdateState
- iftrue
the state of the resource will be updated- Throws:
CmsException
- if something goes wrong- See Also:
-
writePublishJob
Updates a publish job.- Parameters:
dbc
- the current database contextpublishJob
- the publish job to update- Throws:
CmsException
- if something goes wrong
-
writePublishReport
public void writePublishReport(CmsDbContext dbc, CmsPublishJobInfoBean publishJob) throws CmsException Writes the publish report for a publish job.- Parameters:
dbc
- the current database contextpublishJob
- the publish job- Throws:
CmsException
- if something goes wrong
-
writeResource
Writes a resource to the OpenCms VFS.- Parameters:
dbc
- the current database contextresource
- the resource to write- Throws:
CmsException
- if something goes wrong
-
writeStaticExportPublishedResource
public void writeStaticExportPublishedResource(CmsDbContext dbc, String resourceName, int linkType, String linkParameter, long timestamp) throws CmsException Inserts an entry in the published resource table.This is done during static export.
- 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-parameter, 1=parameter)linkParameter
- the parameters added to the resourcetimestamp
- a time stamp for writing the data into the db- Throws:
CmsException
- if something goes wrong
-
writeUrlNameMapping
public String writeUrlNameMapping(CmsDbContext dbc, Iterator<String> nameSeq, CmsUUID structureId, String locale, boolean replaceOnPublish) throws CmsDataAccessException Adds a new url name mapping for a structure id.Instead of taking the name directly, this method takes an iterator of strings which generates candidate URL names on-the-fly. The first generated name which is not already mapped to another structure id will be chosen for the new URL name mapping.
- Parameters:
dbc
- the current database contextnameSeq
- the sequence of URL name candidatesstructureId
- the structure id to which the url name should be mappedlocale
- the locale for which the mapping should be writtenreplaceOnPublish
- name mappings for which this is set will replace all other mappings for the same resource on publishing- Returns:
- the actual name which was mapped to the structure id
- Throws:
CmsDataAccessException
- if something goes wrong
-
writeUser
Updates the user information.The user id has to be a valid OpenCms user id.
The user with the given id will be completely overridden by the given data.- Parameters:
dbc
- the current database contextuser
- the user to be updated- Throws:
CmsException
- if operation was not successful
-
addOrReplaceUrlNameMapping
protected void addOrReplaceUrlNameMapping(CmsDbContext dbc, String name, CmsUUID structureId, String locale, boolean replaceOnPublish) throws CmsDataAccessException Adds or replaces a new url name mapping in the offline project.- Parameters:
dbc
- the current database contextname
- the URL name of the mappingstructureId
- the structure id of the mappinglocale
- the locale of the mappingreplaceOnPublish
- if the mapping shoudl replace previous URL name mappings when published- Throws:
CmsDataAccessException
- if something goes wrong
-
convertResourceToFolder
protected CmsFolder convertResourceToFolder(CmsResource resource) throws CmsVfsResourceNotFoundException Converts a resource to a folder (if possible).- Parameters:
resource
- the resource to convert- Returns:
- the converted resource
- Throws:
CmsVfsResourceNotFoundException
- if the resource is not a folder
-
createDriver
protected Object createDriver(CmsDbContext dbc, CmsConfigurationManager configManager, CmsParameterConfiguration config, String driverChainKey, String suffix) Helper method for creating a driver from configuration data.- Parameters:
dbc
- the db contextconfigManager
- the configuration managerconfig
- the configurationdriverChainKey
- the configuration key under which the driver chain is storedsuffix
- the suffix to append to a driver chain entry to get the key for the driver class- Returns:
- the newly created driver
-
deleteRelationsWithSiblings
protected void deleteRelationsWithSiblings(CmsDbContext dbc, CmsResource resource) throws CmsException Deletes all relations for the given resource and all its siblings.- Parameters:
dbc
- the current database contextresource
- the resource to delete the resource for- Throws:
CmsException
- if something goes wrong
-
ensureSubResourcesOfMovedFoldersPublished
protected void ensureSubResourcesOfMovedFoldersPublished(CmsObject cms, CmsDbContext dbc, CmsPublishList pubList) throws CmsException Tries to add sub-resources of moved folders to the publish list and throws an exception if the publish list still does not contain some sub-resources of the moved folders.- Parameters:
cms
- the current CMS contextdbc
- the current database contextpubList
- the publish list- Throws:
CmsException
- if something goes wrong
-
findBestNameForUrlNameMapping
protected String findBestNameForUrlNameMapping(CmsDbContext dbc, Iterator<String> nameSeq, CmsUUID structureId, String locale) throws CmsDataAccessException Tries to find the best name for an URL name mapping for the given structure id.- Parameters:
dbc
- the database contextnameSeq
- the sequence of name candidatesstructureId
- the structure id to which an URL name should be mappedlocale
- the locale for which the URL name should be mapped- Returns:
- the selected URL name candidate
- Throws:
CmsDataAccessException
- if something goes wrong
-
findBestNameForUrlNameMapping
protected String findBestNameForUrlNameMapping(CmsDbContext dbc, String name, CmsUUID structureId) throws CmsDataAccessException Helper method for finding the 'best' URL name to use for a new URL name mapping.Since the name given as a parameter may be already used, this method will try to append numeric suffixes to the name to find a mapping name which is not used.
- Parameters:
dbc
- the current database contextname
- the name of the mappingstructureId
- the structure id to which the name is mapped- Returns:
- the best name which was found for the new mapping
- Throws:
CmsDataAccessException
- if something goes wrong
-
getLockManager
Returns the lock manager instance.- Returns:
- the lock manager instance
-
getNumberedName
Adds a numeric suffix to the end of a string, unless the number passed as a parameter is 0.- Parameters:
name
- the base namenumber
- the number from which to form the suffix- Returns:
- the concatenation of the base name and possibly the numeric suffix
-
resetResourcesInProject
protected void resetResourcesInProject(CmsDbContext dbc, CmsUUID projectId, List<CmsResource> modifiedFiles, List<CmsResource> modifiedFolders) throws CmsException, CmsSecurityException, CmsDataAccessException Resets the resources in a project to their online state.- Parameters:
dbc
- the database contextprojectId
- the project idmodifiedFiles
- the modified filesmodifiedFolders
- the modified folders- Throws:
CmsException
- if something goes wrongCmsSecurityException
- if we don't have the permissionsCmsDataAccessException
- if something goes wrong with the database
-