org.opencms.db
Class CmsDriverManager

java.lang.Object
  extended by org.opencms.db.CmsDriverManager
All Implemented Interfaces:
I_CmsEventListener

public final class CmsDriverManager
extends Object
implements I_CmsEventListener

The OpenCms driver manager.

Since:
6.0.0

Field Summary
static String ATTRIBUTE_LOGIN
          Attribute login.
static String CACHE_ALL_PROPERTIES
          Cache key for all properties.
static int CHANGED_ACCESSCONTROL
          Value to indicate a change in access control entries of a resource.
static int CHANGED_CONTENT
          Value to indicate a content change.
static int CHANGED_LASTMODIFIED
          Value to indicate a change in the lastmodified settings of a resource.
static int CHANGED_RESOURCE
          Value to indicate a change in the resource data.
static int CHANGED_TIMEFRAME
          Value to indicate a change in the availability timeframe.
static String CONFIGURATION_CACHE
          "cache" string in the configuration-file.
static String CONFIGURATION_DB
          "db" string in the configuration-file.
static String CONFIGURATION_HISTORY
          "driver.history" string in the configuration-file.
static String CONFIGURATION_PROJECT
          "driver.project" string in the configuration-file.
static String CONFIGURATION_SUBSCRIPTION
          "subscription.vfs" string in the configuration file.
static String CONFIGURATION_USER
          "driver.user" string in the configuration-file.
static String CONFIGURATION_VFS
          "driver.vfs" string in the configuration-file.
static String KEY_CHANGED_AND_DELETED
          DBC attribute key needed to fix publishing behavior involving siblings.
static String LOST_AND_FOUND_FOLDER
          The vfs path of the loast and found folder.
static int MAX_VFS_RESOURCE_PATH_LENGTH
          The maximum length of a VFS resource path.
static int NOTHING_CHANGED
          Key for indicating no changes.
static String READ_IGNORE_PARENT
          Indicates to ignore the resource path when matching resources.
static long READ_IGNORE_TIME
          Indicates to ignore the time value.
static int READ_IGNORE_TYPE
          Indicates to ignore the resource type when matching resources.
static int READMODE_EXCLUDE_STATE
          Indicates to match resources NOT having the given state.
static int READMODE_EXCLUDE_TREE
          Indicates to match immediate children only.
static int READMODE_EXCLUDE_TYPE
          Indicates to match resources NOT having the given type.
static int READMODE_IGNORESTATE
          Mode for reading project resources from the db.
static int READMODE_INCLUDE_PROJECT
          Indicates to match resources in given project only.
static int READMODE_INCLUDE_TREE
          Indicates to match all successors.
static int READMODE_MATCHSTATE
          Mode for reading project resources from the db.
static int READMODE_ONLY_FILES
          Indicates if only file resources should be read.
static int READMODE_ONLY_FOLDERS
          Indicates if only folder resources should be read.
static int READMODE_UNMATCHSTATE
          Mode for reading project resources from the db.
static String TEMP_FILE_PREFIX
          Prefix char for temporary files in the VFS.
static int UPDATE_ALL
          Key to indicate complete update.
static int UPDATE_RESOURCE
          Key to indicate update of resource record.
static int UPDATE_RESOURCE_PROJECT
          Key to indicate update of last modified project reference.
static int UPDATE_RESOURCE_STATE
          Key to indicate update of resource state.
static int UPDATE_RESOURCE_STATE_CONTENT
          Key to indicate update of resource state including the content date.
static int UPDATE_STRUCTURE
          Key to indicate update of structure record.
static int UPDATE_STRUCTURE_STATE
          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_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_OU_ID, KEY_OU_NAME, KEY_PROJECTID, KEY_PUBLISHID, KEY_PUBLISHLIST, KEY_REPORT, KEY_RESOURCE, KEY_RESOURCES, KEY_USER_ACTION, KEY_USER_ID, KEY_USER_NAME, LISTENERS_FOR_ALL_EVENTS, 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
protected  void addOrReplaceUrlNameMapping(CmsDbContext dbc, String name, CmsUUID structureId, String locale)
          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.
 List<CmsResource> 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.
 void cmsEvent(CmsEvent event)
          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.
 CmsGroup createGroup(CmsDbContext dbc, CmsUUID id, String name, String description, int flags, String parent)
          Add a new group to the Cms.
 CmsOrganizationalUnit createOrganizationalUnit(CmsDbContext dbc, String ouFqn, String description, int flags, CmsResource resource)
          Creates a new organizational unit.
 CmsProject createProject(CmsDbContext dbc, String name, String description, String groupname, String managergroupname, CmsProject.CmsProjectType projecttype)
          Creates a project.
 CmsPropertyDefinition createPropertyDefinition(CmsDbContext dbc, String name)
          Creates a property definition.
 void createPublishJob(CmsDbContext dbc, CmsPublishJobInfoBean publishJob)
          Creates a new publish job.
 CmsResource createResource(CmsDbContext dbc, String resourcePath, CmsResource resource, byte[] content, List<CmsProperty> properties, boolean importCase)
          Creates a new resource with the provided content and properties.
 CmsResource 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.
 CmsResource createSibling(CmsDbContext dbc, CmsResource source, String destination, List<CmsProperty> properties)
          Creates a new sibling of the source resource.
 CmsProject createTempfileProject(CmsDbContext dbc)
          Creates the project for the temporary workplace files.
 CmsUser createUser(CmsDbContext dbc, String name, String password, String description, Map<String,Object> additionalInfos)
          Creates a new user.
 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 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, Iterator<String> nameSeq, CmsUUID structureId, String locale)
          Tries to find the best name for an URL name mapping for the given structure id.
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.
 List<CmsAccessControlEntry> getAccessControlEntries(CmsDbContext dbc, CmsResource resource, boolean getInherited)
          Returns the list of access control entries of a resource given its name.
 CmsAccessControlList getAccessControlList(CmsDbContext dbc, CmsResource resource)
          Returns the full access control list of a given resource.
 CmsAccessControlList 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.
 List<CmsProject> 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.
 List<CmsHistoryProject> getAllHistoricalProjects(CmsDbContext dbc)
          Returns a list with all projects from history.
 List<CmsProject> 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.
 List<CmsGroup> 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.
 List<CmsGroup> getGroups(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean includeSubOus, boolean readRoles)
          Returns all groups of the given organizational unit.
 List<CmsGroup> getGroupsOfUser(CmsDbContext dbc, String username, boolean readRoles)
          Returns the groups of an user filtered by the specified IP address.
 List<CmsGroup> 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.
 I_CmsHistoryDriver getHistoryDriver()
          Returns the history driver.
 I_CmsHistoryDriver getHistoryDriver(CmsDbContext dbc)
          Returns the history driver for a given database context.
 int getIdleConnections(String dbPoolUrl)
          Returns the number of idle connections managed by a pool.
 CmsLock getLock(CmsDbContext dbc, CmsResource resource)
          Returns the lock state of a resource.
 List<String> getLockedResources(CmsDbContext dbc, CmsResource resource, CmsLockFilter filter)
          Returns all locked resources in a given folder.
 List<CmsResource> getLockedResourcesObjects(CmsDbContext dbc, CmsResource resource, CmsLockFilter filter)
          Returns all locked resources in a given folder.
 List<CmsResource> 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 getLockManager()
          Returns the lock manager instance.
 List<CmsLogEntry> getLogEntries(CmsDbContext dbc, CmsLogFilter filter)
          Returns all log entries matching the given filter.
 int getNextPublishTag(CmsDbContext dbc)
          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.
 List<CmsOrganizationalUnit> 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.
 List<CmsOrganizationalUnit> getOrgUnitsForRole(CmsDbContext dbc, CmsRole role, boolean includeSubOus)
          Returns all the organizational units for which the current user has the given role.
 CmsGroup getParent(CmsDbContext dbc, String groupname)
          Returns the parent group of a group.
 CmsPermissionSetCustom getPermissions(CmsDbContext dbc, CmsResource resource, CmsUser user)
          Returns the set of permissions of the current user for a given resource.
 I_CmsProjectDriver getProjectDriver()
          Returns the project driver.
 I_CmsProjectDriver getProjectDriver(CmsDbContext dbc)
          Returns the project driver for a given DB context.
 I_CmsProjectDriver getProjectDriver(CmsDbContext dbc, I_CmsProjectDriver defaultDriver)
          Returns either the project driver for the DB context (if it has one) or a default project driver.
 CmsUUID getProjectId(CmsDbContext dbc, int id)
          Returns the uuid id for the given id.
 CmsParameterConfiguration getPropertyConfiguration()
          Returns the configuration read from the opencms.properties file.
 CmsPublishList 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.
 List<CmsRelation> getRelationsForResource(CmsDbContext dbc, CmsResource resource, CmsRelationFilter filter)
          Returns all relations for the given resource matching the given filter.
 List<CmsOrganizationalUnit> getResourceOrgUnits(CmsDbContext dbc, CmsResource resource)
          Returns the list of organizational units the given resource belongs to.
 List<CmsResource> getResourcesForOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit)
          Returns all resources of the given organizational unit.
 Set<CmsResource> 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.
 Set<CmsGroup> getRoleGroups(CmsDbContext dbc, String roleGroupName, boolean directUsersOnly)
          Collects the groups which constitute a given role.
 Set<CmsGroup> getRoleGroupsImpl(CmsDbContext dbc, String roleGroupName, boolean directUsersOnly, Map<String,Set<CmsGroup>> accumulator)
          Collects the groups which constitute a given role.
 List<CmsRole> getRolesForResource(CmsDbContext dbc, CmsUser user, CmsResource resource)
          Returns all roles the given user has for the given resource.
 List<CmsRole> getRolesForUser(CmsDbContext dbc, CmsUser user)
          Returns all roles the given user has independent of the resource.
 CmsSecurityManager getSecurityManager()
          Returns the security manager this driver manager belongs to.
 CmsSqlManager getSqlManager()
          Returns an instance of the common sql manager.
 I_CmsSubscriptionDriver getSubscriptionDriver()
          Returns the subscription driver of this driver manager.
 I_CmsUserDriver getUserDriver()
          Returns the user driver.
 I_CmsUserDriver getUserDriver(CmsDbContext dbc)
          Returns the user driver for a given database context.
 I_CmsUserDriver 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.
 List<CmsUser> getUsers(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean recursive)
          Returns all direct users of the given organizational unit.
 List<CmsUser> getUsersOfGroup(CmsDbContext dbc, String groupname, boolean includeOtherOuUsers, boolean directUsersOnly, boolean readRoles)
          Returns a list of users in a group.
 List<CmsResource> getUsersPubList(CmsDbContext dbc, CmsUUID userId)
          Returns the given user's publish list.
 List<CmsUser> getUsersWithoutAdditionalInfo(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean recursive)
          Returns all direct users of the given organizational unit, without their additional info.
 I_CmsVfsDriver getVfsDriver()
          Returns the VFS driver.
 I_CmsVfsDriver 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.
 CmsUser 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.
 boolean isInsideCurrentProject(CmsDbContext dbc, String resourcename)
          Checks if the specified resource is inside the current project.
 boolean isSubscriptionDriverAvailable()
          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.
 CmsUser 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.
 CmsUser loginUser(CmsDbContext dbc, String userName, String password, String remoteAddress)
          Attempts to authenticate a user into OpenCms with the given password.
 I_CmsPrincipal lookupPrincipal(CmsDbContext dbc, CmsUUID principalId)
          Lookup and read the user or group with the given UUID.
 I_CmsPrincipal lookupPrincipal(CmsDbContext dbc, String principalName)
          Lookup and read the user or group with the given name.
 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.
 String moveToLostAndFound(CmsDbContext dbc, CmsResource resource, boolean returnNameOnly)
          Moves a resource to the "lost and found" folder.
 Object newDriverInstance(CmsDbContext dbc, CmsConfigurationManager configurationManager, String driverName, List<String> successiveDrivers)
          Gets a new driver instance.
 Object newDriverInstance(CmsParameterConfiguration configuration, String driverName, String driverPoolUrl)
          Method to create a new instance of a driver.
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.
 CmsAccessControlEntry readAccessControlEntry(CmsDbContext dbc, CmsResource resource, CmsUUID principal)
          Reads an access control entry from the cms.
 List<I_CmsHistoryResource> 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.
 List<CmsPropertyDefinition> readAllPropertyDefinitions(CmsDbContext dbc)
          Reads all property definitions for the given mapping type.
 List<CmsResource> readAllSubscribedResources(CmsDbContext dbc, String poolName, CmsPrincipal principal)
          Returns all resources subscribed by the given user or group.
 String readBestUrlName(CmsDbContext dbc, CmsUUID id, Locale locale, List<Locale> defaultLocales)
          Selects the best url name for a given resource and locale.
 List<CmsResource> 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.
 CmsResource readDefaultFile(CmsDbContext dbc, CmsResource resource)
          Returns the default file for the given folder.
 List<I_CmsHistoryResource> 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.
 CmsFile readFile(CmsDbContext dbc, CmsResource resource)
          Reads a file resource (including it's binary content) from the VFS, using the specified resource filter.
 CmsFolder readFolder(CmsDbContext dbc, String resourcename, CmsResourceFilter filter)
          Reads a folder from the VFS, using the specified resource filter.
 CmsGroup readGroup(CmsDbContext dbc, CmsProject project)
          Reads the group of a project.
 CmsGroup readGroup(CmsDbContext dbc, CmsUUID groupId)
          Reads a group based on its id.
 CmsGroup readGroup(CmsDbContext dbc, String groupname)
          Reads a group based on its name.
 CmsHistoryPrincipal readHistoricalPrincipal(CmsDbContext dbc, CmsUUID principalId)
          Reads a principal (an user or group) from the historical archive based on its ID.
 CmsHistoryProject readHistoryProject(CmsDbContext dbc, CmsUUID projectId)
          Returns the latest historical project entry with the given id.
 CmsHistoryProject readHistoryProject(CmsDbContext dbc, int publishTag)
          Returns a historical project entry.
 List<CmsProperty> readHistoryPropertyObjects(CmsDbContext dbc, I_CmsHistoryResource historyResource)
          Reads the list of all CmsProperty objects that belongs to the given historical resource.
 CmsUUID 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.
 CmsGroup readManagerGroup(CmsDbContext dbc, CmsProject project)
          Reads the manager group of a project.
 String 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.
 CmsOrganizationalUnit readOrganizationalUnit(CmsDbContext dbc, String ouFqn)
          Reads an organizational Unit based on its fully qualified name.
 CmsUser readOwner(CmsDbContext dbc, CmsProject project)
          Reads the owner of a project.
 CmsResource readParentFolder(CmsDbContext dbc, CmsUUID structureId)
          Reads the parent folder to a given structure id.
 List<CmsResource> readPath(CmsDbContext dbc, String path, CmsResourceFilter filter)
          Builds a list of resources for a given path.
 CmsProject readProject(CmsDbContext dbc, CmsUUID id)
          Reads a project given the projects id.
 CmsProject readProject(CmsDbContext dbc, String name)
          Reads a project.
 List<String> readProjectResources(CmsDbContext dbc, CmsProject project)
          Returns the list of all resource names that define the "view" of the given project.
 List<CmsResource> readProjectView(CmsDbContext dbc, CmsUUID projectId, CmsResourceState state)
          Reads all resources of a project that match a given state from the VFS.
 CmsPropertyDefinition readPropertyDefinition(CmsDbContext dbc, String name)
          Reads a property definition.
 CmsProperty readPropertyObject(CmsDbContext dbc, CmsResource resource, String key, boolean search)
          Reads a property object from a resource specified by a property name.
 List<CmsProperty> readPropertyObjects(CmsDbContext dbc, CmsResource resource, boolean search)
          Reads all property objects mapped to a specified resource from the database.
 List<CmsPublishedResource> readPublishedResources(CmsDbContext dbc, CmsUUID publishHistoryId)
          Reads the resources that were published in a publish task for a given publish history ID.
 CmsPublishJobInfoBean readPublishJob(CmsDbContext dbc, CmsUUID publishHistoryId)
          Reads a single publish job identified by its publish history id.
 List<CmsPublishJobInfoBean> readPublishJobs(CmsDbContext dbc, long startTime, long endTime)
          Reads all available publish jobs.
 CmsPublishList 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.
 I_CmsHistoryResource readResource(CmsDbContext dbc, CmsResource resource, int version)
          Reads an historical resource entry for the given resource and with the given version number.
 CmsResource readResource(CmsDbContext dbc, CmsUUID structureID, CmsResourceFilter filter)
          Reads a resource from the VFS, using the specified resource filter.
 CmsResource readResource(CmsDbContext dbc, String resourcePath, CmsResourceFilter filter)
          Reads a resource from the VFS, using the specified resource filter.
 List<CmsResource> 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 the readTree parameter is true.
 List<CmsResource> readResourcesVisitedBy(CmsDbContext dbc, String poolName, CmsVisitedByFilter filter)
          Returns the resources that were visited by a user set in the filter.
 List<CmsResource> 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.
 Set<I_CmsPrincipal> readResponsiblePrincipals(CmsDbContext dbc, CmsResource resource)
          Returns the set of users that are responsible for a specific resource.
 Set<CmsUser> readResponsibleUsers(CmsDbContext dbc, CmsResource resource)
          Returns the set of users that are responsible for a specific resource.
 List<CmsResource> 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.
 String readStaticExportPublishedResourceParameters(CmsDbContext dbc, String rfsName)
          Returns the parameters of a resource in the table of all published template resources.
 List<String> readStaticExportResources(CmsDbContext dbc, int parameterResources, long timestamp)
          Returns a list of all template resources which must be processed during a static export.
 List<I_CmsHistoryResource> readSubscribedDeletedResources(CmsDbContext dbc, String poolName, CmsUser user, List<CmsGroup> groups, CmsResource parent, boolean includeSubFolders, long deletedFrom)
          Returns the subscribed history resources that were deleted.
 List<CmsResource> readSubscribedResources(CmsDbContext dbc, String poolName, CmsSubscriptionFilter filter)
          Returns the resources that were subscribed by a user or group set in the filter.
 List<CmsUrlNameMappingEntry> readUrlNameMappingEntries(CmsDbContext dbc, boolean online, CmsUrlNameMappingFilter filter)
          Reads URL name mapping entries which match the given filter.
 List<String> readUrlNamesForAllLocales(CmsDbContext dbc, CmsUUID id)
          Reads the newest URL names of a resource for all locales.
 CmsUser readUser(CmsDbContext dbc, CmsUUID id)
          Returns a user object based on the id of a user.
 CmsUser readUser(CmsDbContext dbc, String username)
          Returns a user object.
 CmsUser readUser(CmsDbContext dbc, String username, String password)
          Returns a user object if the password for the user is correct.
 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, String newPassword)
          Resets the password for a specified user.
 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.
 List<CmsUser> 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 updateExportPoints(CmsDbContext dbc)
          Update the export points.
 void updateLog(CmsDbContext dbc)
          Logs everything that has not been written to DB jet.
 void updateRelationsForResource(CmsDbContext dbc, CmsResource resource, List<CmsLink> links)
          Updates/Creates the given relations for the given resource.
 boolean userInGroup(CmsDbContext dbc, String username, String groupname, boolean readRoles)
          Returns true 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 I_CmsPasswordHandler interface and configured in the opencms.properties file.
 Map<String,List<CmsRelation>> 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.
 CmsFile 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 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.
 String writeUrlNameMapping(CmsDbContext dbc, Iterator<String> nameSeq, CmsUUID structureId, String locale)
          Adds a new url name mapping for a structure id.
 void writeUser(CmsDbContext dbc, CmsUser user)
          Updates the user information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTRIBUTE_LOGIN

public static final String ATTRIBUTE_LOGIN
Attribute login.

See Also:
Constant Field Values

CACHE_ALL_PROPERTIES

public static final String CACHE_ALL_PROPERTIES
Cache key for all properties.

See Also:
Constant Field Values

CHANGED_ACCESSCONTROL

public static final int CHANGED_ACCESSCONTROL
Value to indicate a change in access control entries of a resource.

See Also:
Constant Field Values

CHANGED_CONTENT

public static final int CHANGED_CONTENT
Value to indicate a content change.

See Also:
Constant Field Values

CHANGED_LASTMODIFIED

public static final int CHANGED_LASTMODIFIED
Value to indicate a change in the lastmodified settings of a resource.

See Also:
Constant Field Values

CHANGED_RESOURCE

public static final int CHANGED_RESOURCE
Value to indicate a change in the resource data.

See Also:
Constant Field Values

CHANGED_TIMEFRAME

public static final int CHANGED_TIMEFRAME
Value to indicate a change in the availability timeframe.

See Also:
Constant Field Values

CONFIGURATION_CACHE

public static final String CONFIGURATION_CACHE
"cache" string in the configuration-file.

See Also:
Constant Field Values

CONFIGURATION_DB

public static final String CONFIGURATION_DB
"db" string in the configuration-file.

See Also:
Constant Field Values

CONFIGURATION_HISTORY

public static final String CONFIGURATION_HISTORY
"driver.history" string in the configuration-file.

See Also:
Constant Field Values

CONFIGURATION_PROJECT

public static final String CONFIGURATION_PROJECT
"driver.project" string in the configuration-file.

See Also:
Constant Field Values

CONFIGURATION_SUBSCRIPTION

public static final String CONFIGURATION_SUBSCRIPTION
"subscription.vfs" string in the configuration file.

See Also:
Constant Field Values

CONFIGURATION_USER

public static final String CONFIGURATION_USER
"driver.user" string in the configuration-file.

See Also:
Constant Field Values

CONFIGURATION_VFS

public static final String CONFIGURATION_VFS
"driver.vfs" string in the configuration-file.

See Also:
Constant Field Values

KEY_CHANGED_AND_DELETED

public static final String KEY_CHANGED_AND_DELETED
DBC attribute key needed to fix publishing behavior involving siblings.

See Also:
Constant Field Values

LOST_AND_FOUND_FOLDER

public static final String LOST_AND_FOUND_FOLDER
The vfs path of the loast and found folder.

See Also:
Constant Field Values

MAX_VFS_RESOURCE_PATH_LENGTH

public static final int MAX_VFS_RESOURCE_PATH_LENGTH
The maximum length of a VFS resource path.

See Also:
Constant Field Values

NOTHING_CHANGED

public static final int NOTHING_CHANGED
Key for indicating no changes.

See Also:
Constant Field Values

READ_IGNORE_PARENT

public static final String READ_IGNORE_PARENT
Indicates to ignore the resource path when matching resources.


READ_IGNORE_TIME

public static final long READ_IGNORE_TIME
Indicates to ignore the time value.

See Also:
Constant Field Values

READ_IGNORE_TYPE

public static final int READ_IGNORE_TYPE
Indicates to ignore the resource type when matching resources.

See Also:
Constant Field Values

READMODE_EXCLUDE_STATE

public static final int READMODE_EXCLUDE_STATE
Indicates to match resources NOT having the given state.

See Also:
Constant Field Values

READMODE_EXCLUDE_TREE

public static final int READMODE_EXCLUDE_TREE
Indicates to match immediate children only.

See Also:
Constant Field Values

READMODE_EXCLUDE_TYPE

public static final int READMODE_EXCLUDE_TYPE
Indicates to match resources NOT having the given type.

See Also:
Constant Field Values

READMODE_IGNORESTATE

public static final int READMODE_IGNORESTATE
Mode for reading project resources from the db.

See Also:
Constant Field Values

READMODE_INCLUDE_PROJECT

public static final int READMODE_INCLUDE_PROJECT
Indicates to match resources in given project only.

See Also:
Constant Field Values

READMODE_INCLUDE_TREE

public static final int READMODE_INCLUDE_TREE
Indicates to match all successors.

See Also:
Constant Field Values

READMODE_MATCHSTATE

public static final int READMODE_MATCHSTATE
Mode for reading project resources from the db.

See Also:
Constant Field Values

READMODE_ONLY_FILES

public static final int READMODE_ONLY_FILES
Indicates if only file resources should be read.

See Also:
Constant Field Values

READMODE_ONLY_FOLDERS

public static final int READMODE_ONLY_FOLDERS
Indicates if only folder resources should be read.

See Also:
Constant Field Values

READMODE_UNMATCHSTATE

public static final int READMODE_UNMATCHSTATE
Mode for reading project resources from the db.

See Also:
Constant Field Values

TEMP_FILE_PREFIX

public static final String TEMP_FILE_PREFIX
Prefix char for temporary files in the VFS.

See Also:
Constant Field Values

UPDATE_ALL

public static final int UPDATE_ALL
Key to indicate complete update.

See Also:
Constant Field Values

UPDATE_RESOURCE

public static final int UPDATE_RESOURCE
Key to indicate update of resource record.

See Also:
Constant Field Values

UPDATE_RESOURCE_PROJECT

public static final int UPDATE_RESOURCE_PROJECT
Key to indicate update of last modified project reference.

See Also:
Constant Field Values

UPDATE_RESOURCE_STATE

public static final int UPDATE_RESOURCE_STATE
Key to indicate update of resource state.

See Also:
Constant Field Values

UPDATE_RESOURCE_STATE_CONTENT

public static final int UPDATE_RESOURCE_STATE_CONTENT
Key to indicate update of resource state including the content date.

See Also:
Constant Field Values

UPDATE_STRUCTURE

public static final int UPDATE_STRUCTURE
Key to indicate update of structure record.

See Also:
Constant Field Values

UPDATE_STRUCTURE_STATE

public static final int UPDATE_STRUCTURE_STATE
Key to indicate update of structure state.

See Also:
Constant Field Values
Method Detail

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:

Parameters:
configurationManager - the configuration manager
securityManager - the security manager
runtimeInfoFactory - the initialized OpenCms runtime info factory
publishEngine - the publish engine
Returns:
CmsDriverManager the instantiated driver manager
Throws:
CmsInitException - if the driver manager couldn't be instantiated

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 context
resource - the resource to add the relation to
target - the target of the relation
type - the type of the relation
importCase - 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 context
orgUnit - the organizational unit to add the resource to
resource - the resource that is to be added to the organizational unit
Throws:
CmsException - if something goes wrong
See Also:
CmsOrgUnitManager.addResourceToOrgUnit(CmsObject, String, String), CmsOrgUnitManager.addResourceToOrgUnit(CmsObject, String, String)

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 context
username - the name of the user that is to be added to the group
groupname - the name of the group
readRoles - if reading roles or groups
Throws:
CmsException - if operation was not successful
CmsDbEntryNotFoundException - if the given user or the given group was not found
See Also:
removeUserFromGroup(CmsDbContext, String, String, boolean)

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 context
resource - the resource to change the lock for
lockType - the new lock type to set
Throws:
CmsException - if something goes wrong
CmsSecurityException - if something goes wrong
See Also:
CmsObject.changeLock(String), I_CmsResourceType.changeLock(CmsObject, CmsSecurityManager, CmsResource), CmsSecurityManager.hasPermissions(CmsRequestContext, CmsResource, CmsPermissionSet, boolean, CmsResourceFilter)

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 context
resource - the resource on which property definition values are changed
propertyDefinition - the name of the propertydefinition to change the value
oldValue - the old value of the propertydefinition
newValue - the new value of the propertydefinition
recursive - 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 CmsResource's where the property value has been changed
Throws:
CmsVfsException - for now only when the search for the oldvalue failed.
CmsException - if operation was not successful

chflags

public void chflags(CmsDbContext dbc,
                    CmsResource resource,
                    int flags)
             throws CmsException
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 context
resource - the resource to change the flags for
flags - the new resource flags for this resource
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.chflags(String, int), I_CmsResourceType.chflags(CmsObject, CmsSecurityManager, CmsResource, int)

chtype

public void chtype(CmsDbContext dbc,
                   CmsResource resource,
                   int type)
            throws CmsException
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 context
resource - the resource to change the type for
type - the new resource type for this resource
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.chtype(String, int), I_CmsResourceType.chtype(CmsObject, CmsSecurityManager, CmsResource, int)

cmsEvent

public void cmsEvent(CmsEvent event)
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 interface I_CmsEventListener
Parameters:
event - CmsEvent that has occurred
See Also:
I_CmsEventListener.cmsEvent(org.opencms.main.CmsEvent)

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 context
source - the resource to copy the access control entries from
destination - the resource to which the access control entries are copied
updateLastModifiedInfo - 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 context
source - the resource to copy
destination - the name of the copy destination with complete path
siblingMode - indicates how to handle siblings during copy
Throws:
CmsException - if something goes wrong
CmsIllegalArgumentException - if the source argument is null
See Also:
CmsObject.copyResource(String, String, CmsResource.CmsResourceCopyMode), I_CmsResourceType.copyResource(CmsObject, CmsSecurityManager, CmsResource, String, CmsResource.CmsResourceCopyMode)

copyResourceToProject

public void copyResourceToProject(CmsDbContext dbc,
                                  CmsResource resource)
                           throws CmsException
Copies a resource to the current project of the user.

Parameters:
dbc - the current database context
resource - the resource to apply this operation to
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.copyResourceToProject(String), I_CmsResourceType.copyResourceToProject(CmsObject, CmsSecurityManager, CmsResource)

countLockedResources

public int countLockedResources(CmsProject project)
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 context
id - the id of the new group
name - the name of the new group
description - the description for the new group
flags - the flags for the new group
parent - the name of the parent group (or null)
Returns:
new created group
Throws:
CmsException - if the creation of the group failed
CmsIllegalArgumentException - 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 context
ouFqn - the fully qualified name of the new organizational unit
description - the description of the new organizational unit
flags - the flags for the new organizational unit
resource - the first associated resource
Returns:
a CmsOrganizationalUnit object representing the newly created organizational unit
Throws:
CmsException - if operation was not successful
See Also:
CmsOrgUnitManager.createOrganizationalUnit(CmsObject, String, String, int, String)

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 context
name - the name of the project to create
description - the description of the project
groupname - the project user group to be set
managergroupname - the project manager group to be set
projecttype - the type of the project
Returns:
the created project
Throws:
CmsIllegalArgumentException - if the chosen name is already used by the online project, or if the name is not valid
CmsException - 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 context
name - 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 context
publishJob - 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 be null 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 not null, the created resource will be made a sibling of the existing resource, and both will share the new content.

Parameters:
dbc - the current database context
resourcePath - the name of the resource to create (full path)
resource - the new resource to create
content - the content for the new resource
properties - the properties for the new resource
importCase - if true, 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 context
resourcename - the name of the resource to create (full path)
type - the type of the resource to create
content - the content for the new resource
properties - the properties for the new resource
Returns:
the created resource
Throws:
CmsException - if something goes wrong
CmsIllegalArgumentException - if the resourcename argument is null or of length 0
See Also:
CmsObject.createResource(String, int, byte[], List), CmsObject.createResource(String, int), I_CmsResourceType.createResource(CmsObject, CmsSecurityManager, String, byte[], List)

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 context
source - the resource to create a sibling for
destination - the name of the sibling to create with complete path
properties - the individual properties for the new sibling
Returns:
the new created sibling
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.createSibling(String, String, List), I_CmsResourceType.createSibling(CmsObject, CmsSecurityManager, CmsResource, String, List)

createTempfileProject

public CmsProject createTempfileProject(CmsDbContext dbc)
                                 throws CmsException
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,
                          CmsIllegalArgumentException
Creates a new user.

Parameters:
dbc - the current database context
name - the name for the new user
password - the password for the new user
description - the description for the new user
additionalInfos - the additional infos for the user
Returns:
the created user
Throws:
CmsException - if something goes wrong
CmsIllegalArgumentException - if the name for the user is not valid
See Also:
CmsObject.createUser(String, String, String, Map)

deleteAllProperties

public void deleteAllProperties(CmsDbContext dbc,
                                String resourcename)
                         throws CmsException
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 context
resourcename - 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 context
linkType - 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 context
group - the id of the group to be deleted
replacementId - the id of the group to be transfered, can be null
Throws:
CmsException - if operation was not successful
CmsDataAccessException - 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 context
versionsToKeep - number of versions to keep, is ignored if negative
versionsDeleted - number of versions to keep for deleted resources, is ignored if negative
timeDeleted - deleted resources older than this will also be deleted, is ignored if negative
report - the report for output logging
Throws:
CmsException - if operation was not successful

deleteLogEntries

public void deleteLogEntries(CmsDbContext dbc,
                             CmsLogFilter filter)
                      throws CmsException
Deletes all log entries matching the given filter.

Parameters:
dbc - the current db context
filter - the filter to use for deletion
Throws:
CmsException - if something goes wrong
See Also:
CmsSecurityManager.deleteLogEntries(CmsRequestContext, CmsLogFilter)

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 context
organizationalUnit - the organizational unit to delete
Throws:
CmsException - if operation was not successful
See Also:
CmsOrgUnitManager.deleteOrganizationalUnit(CmsObject, String)

deleteProject

public void deleteProject(CmsDbContext dbc,
                          CmsProject deleteProject)
                   throws CmsException
Deletes a project.

Only the admin or the owner of the project can do this.

Parameters:
dbc - the current database context
deleteProject - the project to be deleted
Throws:
CmsException - if something goes wrong

deletePropertyDefinition

public void deletePropertyDefinition(CmsDbContext dbc,
                                     String name)
                              throws CmsException
Deletes a property definition.

Parameters:
dbc - the current database context
name - the name of the property definition to delete
Throws:
CmsException - if something goes wrong

deletePublishJob

public void deletePublishJob(CmsDbContext dbc,
                             CmsUUID publishHistoryId)
                      throws CmsException
Deletes a publish job identified by its history id.

Parameters:
dbc - the current database context
publishHistoryId - the history id identifying the publish job
Throws:
CmsException - if something goes wrong

deletePublishList

public void deletePublishList(CmsDbContext dbc,
                              CmsUUID publishHistoryId)
                       throws CmsException
Deletes the publish list assigned to a publish job.

Parameters:
dbc - the current database context
publishHistoryId - 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 context
resource - the resource to delete the relations for
filter - the filter to use for deletion
Throws:
CmsException - if something goes wrong
See Also:
CmsSecurityManager.deleteRelationsForResource(CmsRequestContext, CmsResource, CmsRelationFilter)

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 context
resource - 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:
CmsObject.deleteResource(String, CmsResource.CmsResourceDeleteMode), I_CmsResourceType.deleteResource(CmsObject, CmsSecurityManager, CmsResource, CmsResource.CmsResourceDeleteMode)

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 context
resourceName - The name of the resource to be deleted in the static export
linkType - 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 context
project - the current project
username - the name of the user to be deleted
replacementUsername - the name of the user to be transfered, can be null
Throws:
CmsException - if operation was not successful

destroy

public void destroy()
Destroys this driver manager and releases all allocated resources.


existsResourceId

public boolean existsResourceId(CmsDbContext dbc,
                                CmsUUID resourceId)
                         throws CmsException
Tests if a resource with the given resourceId does already exist in the Database.

Parameters:
dbc - the current database context
resourceId - 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

public void fillPublishList(CmsDbContext dbc,
                            CmsPublishList publishList)
                     throws CmsException
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 CmsResource object can be published or not.

Parameters:
dbc - the current database context
publishList - 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:
CmsPublishList

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 context
resource - the resource to read the access control entries for
getInherited - true if the result should include all access control entries inherited by parent folders
Returns:
a list of CmsAccessControlEntry objects defining all permissions for the given resource
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 context
resource - 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 context
resource - the resource
inheritedOnly - skip non-inherited entries if set
Returns:
the access control list of the resource
Throws:
CmsException - if something goes wrong

getActiveConnections

public int getActiveConnections(String dbPoolUrl)
                         throws CmsDbException
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

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 context
orgUnit - the organizational unit to search project in
includeSubOus - if to include sub organizational units
Returns:
a list of objects of type CmsProject
Throws:
CmsException - if something goes wrong

getAllHistoricalProjects

public List<CmsHistoryProject> getAllHistoricalProjects(CmsDbContext dbc)
                                                 throws CmsException
Returns a list with all projects from history.

Parameters:
dbc - the current database context
Returns:
list of CmsHistoryProject objects with all projects from history.
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 context
orgUnit - the organizational unit to search project in
includeSubOus - 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 context
group - the group to get the child for
includeSubChildren - if set also returns all sub-child groups of the given group
Returns:
a list of all child CmsGroup objects
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 context
poolName - the name of the database pool to use
user - the user to check the date
resource - 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 context
orgUnit - the organizational unit to get the groups for
includeSubOus - if all groups of sub-organizational units should be retrieved too
readRoles - if to read roles or groups
Returns:
all CmsGroup objects in the organizational unit
Throws:
CmsException - if operation was not successful
See Also:
CmsOrgUnitManager.getResourcesForOrganizationalUnit(CmsObject, String), CmsOrgUnitManager.getGroups(CmsObject, String, boolean)

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 context
username - the name of the user
readRoles - 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 context
username - the name of the user
ouFqn - the fully qualified name of the organizational unit to restrict the result set for
includeChildOus - include groups of child organizational units
readRoles - if to read roles or groups
directGroupsOnly - if set only the direct assigned groups will be returned, if not also indirect groups
remoteAddress - the IP address to filter the groups in the result list
Returns:
a list of CmsGroup objects
Throws:
CmsException - if operation was not successful

getHistoryDriver

public I_CmsHistoryDriver getHistoryDriver()
Returns the history driver.

Returns:
the history driver

getHistoryDriver

public I_CmsHistoryDriver getHistoryDriver(CmsDbContext dbc)
Returns the history driver for a given database context.

Parameters:
dbc - the database context
Returns:
the history driver for the database context

getIdleConnections

public int getIdleConnections(String dbPoolUrl)
                       throws CmsDbException
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

public CmsLock getLock(CmsDbContext dbc,
                       CmsResource resource)
                throws CmsException
Returns the lock state of a resource.

Parameters:
dbc - the current database context
resource - 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 context
resource - the folder to search in
filter - 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 context
resource - the folder to search in
filter - 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 CmsException
Returns all locked resources in a given folder, but uses a cache for resource lookups.

Parameters:
dbc - the current database context
resource - the folder to search in
filter - the lock filter
cache - the cache to use for resource lookups
Returns:
a list of locked resources
Throws:
CmsException - if the current project is locked

getLogEntries

public List<CmsLogEntry> getLogEntries(CmsDbContext dbc,
                                       CmsLogFilter filter)
                                throws CmsException
Returns all log entries matching the given filter.

Parameters:
dbc - the current db context
filter - the filter to match the log entries
Returns:
all log entries matching the given filter
Throws:
CmsException - if something goes wrong
See Also:
CmsSecurityManager.getLogEntries(CmsRequestContext, CmsLogFilter)

getNextPublishTag

public int getNextPublishTag(CmsDbContext dbc)
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 context
parent - the parent organizational unit, or null for the root
includeChildren - if hierarchical deeper organization units should also be returned
Returns:
a list of CmsOrganizationalUnit objects
Throws:
CmsException - if operation was not successful
See Also:
CmsOrgUnitManager.getOrganizationalUnits(CmsObject, String, boolean)

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 context
role - the role to check
includeSubOus - if sub organizational units should be included in the search
Returns:
a list of CmsOrganizationalUnit objects
Throws:
CmsException - if something goes wrong

getParent

public CmsGroup getParent(CmsDbContext dbc,
                          String groupname)
                   throws CmsException
Returns the parent group of a group.

Parameters:
dbc - the current database context
groupname - 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 context
resource - the resource
user - the user
Returns:
bit set with allowed permissions
Throws:
CmsException - if something goes wrong

getProjectDriver

public I_CmsProjectDriver getProjectDriver()
Returns the project driver.

Returns:
the project driver

getProjectDriver

public I_CmsProjectDriver getProjectDriver(CmsDbContext dbc)
Returns the project driver for a given DB context.

Parameters:
dbc - the database context
Returns:
the project driver for the database context

getProjectDriver

public I_CmsProjectDriver getProjectDriver(CmsDbContext dbc,
                                           I_CmsProjectDriver defaultDriver)
Returns either the project driver for the DB context (if it has one) or a default project driver.

Parameters:
dbc - the DB context
defaultDriver - 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

public CmsUUID getProjectId(CmsDbContext dbc,
                            int id)
                     throws CmsException
Returns the uuid id for the given id.

TODO: remove this method as soon as possible

Parameters:
dbc - the current database context
id - the old project id
Returns:
the new uuid for the given id
Throws:
CmsException - if something goes wrong

getPropertyConfiguration

public CmsParameterConfiguration getPropertyConfiguration()
Returns the configuration read from the opencms.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 context
publishList - the publish list to exclude from result
filter - 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:
CmsPublishManager.getRelatedResourcesToPublish(CmsObject, CmsPublishList)

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 context
resource - the resource to retrieve the relations for
filter - 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:
CmsSecurityManager.getRelationsForResource(CmsRequestContext, CmsResource, CmsRelationFilter)

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 context
resource - 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 context
orgUnit - the organizational unit to get all resources for
Returns:
all CmsResource objects in the organizational unit
Throws:
CmsException - if operation was not successful
See Also:
CmsOrgUnitManager.getResourcesForOrganizationalUnit(CmsObject, String), CmsOrgUnitManager.getUsers(CmsObject, String, boolean), CmsOrgUnitManager.getGroups(CmsObject, String, boolean)

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.

Parameters:
dbc - the current database context
project - the to read the entries from
principalId - the id of the principal
permissions - a set of permissions to match, can be null for all ACEs
includeAttr - a flag to include resources associated by attributes
Returns:
a set of CmsResource objects
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 context
roleGroupName - the group related to the role
directUsersOnly - if true, only the group belonging to the entry itself wil
Returns:
the set of groups which constitute the role
Throws:
CmsException

getRoleGroupsImpl

public Set<CmsGroup> getRoleGroupsImpl(CmsDbContext dbc,
                                       String roleGroupName,
                                       boolean directUsersOnly,
                                       Map<String,Set<CmsGroup>> accumulator)
                                throws CmsException
Collects the groups which constitute a given role.

Parameters:
dbc - the database context
roleGroupName - the group related to the role
directUsersOnly - if true, only the group belonging to the entry itself wil
accumulator - a map for memoizing return values of recursive calls
Returns:
the set of groups which constitute the role
Throws:
CmsException

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 context
user - the user to check
resource - the resource to check the roles for
Returns:
a list of CmsRole objects
Throws:
CmsException - if something goes wrong

getRolesForUser

public List<CmsRole> getRolesForUser(CmsDbContext dbc,
                                     CmsUser user)
                              throws CmsException
Returns all roles the given user has independent of the resource.

Parameters:
dbc - the current database context
user - the user to check
Returns:
a list of CmsRole objects
Throws:
CmsException - if something goes wrong

getSecurityManager

public CmsSecurityManager getSecurityManager()
Returns the security manager this driver manager belongs to.

Returns:
the security manager this driver manager belongs to

getSqlManager

public CmsSqlManager getSqlManager()
Returns an instance of the common sql manager.

Returns:
an instance of the common sql manager

getSubscriptionDriver

public I_CmsSubscriptionDriver getSubscriptionDriver()
Returns the subscription driver of this driver manager.

Returns:
a subscription driver

getUserDriver

public I_CmsUserDriver getUserDriver()
Returns the user driver.

Returns:
the user driver

getUserDriver

public I_CmsUserDriver getUserDriver(CmsDbContext dbc)
Returns the user driver for a given database context.

Parameters:
dbc - the database context
Returns:
the user driver for the database context

getUserDriver

public I_CmsUserDriver 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.

Parameters:
dbc - the DB context
defaultDriver - 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 context
orgUnit - the organizational unit to get all users for
recursive - if all groups of sub-organizational units should be retrieved too
Returns:
all CmsUser objects in the organizational unit
Throws:
CmsException - if operation was not successful
See Also:
CmsOrgUnitManager.getResourcesForOrganizationalUnit(CmsObject, String), CmsOrgUnitManager.getUsers(CmsObject, String, boolean)

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 context
groupname - the name of the group to list users from
includeOtherOuUsers - include users of other organizational units
directUsersOnly - 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 roles
readRoles - if to read roles or groups
Returns:
all CmsUser objects in the group
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 context
userId - 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 context
orgUnit - the organizational unit to get all users for
recursive - if all groups of sub-organizational units should be retrieved too
Returns:
all CmsUser objects in the organizational unit
Throws:
CmsException - if operation was not successful
See Also:
CmsOrgUnitManager.getResourcesForOrganizationalUnit(CmsObject, String), CmsOrgUnitManager.getUsers(CmsObject, String, boolean)

getVfsDriver

public I_CmsVfsDriver getVfsDriver()
Returns the VFS driver.

Returns:
the VFS driver

getVfsDriver

public I_CmsVfsDriver getVfsDriver(CmsDbContext dbc)
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:

Parameters:
dbc - the current database context
resource - the resource
acEntries - a list of CmsAccessControlEntry objects
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 CmsException
Creates a new user by import.

Parameters:
dbc - the current database context
id - the id of the user
name - the new name for the user
password - the new password for the user (already encrypted)
firstname - the firstname of the user
lastname - the lastname of the user
email - the email of the user
flags - the flags for a user (for example I_CmsPrincipal.FLAG_ENABLED)
dateCreated - the creation date
additionalInfos - the additional user infos
Returns:
the imported user
Throws:
CmsException - if something goes wrong

incrementCounter

public int incrementCounter(CmsDbContext dbc,
                            String name)
                     throws CmsException
Increments a counter and returns its value before incrementing.

Parameters:
dbc - the current database context
name - 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 manager
dbContextFactory - the db context factory
Throws:
CmsException - if something goes wrong
Exception - if something goes wrong

isInsideCurrentProject

public boolean isInsideCurrentProject(CmsDbContext dbc,
                                      String resourcename)
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 context
resourcename - the specified resource name (full path)
Returns:
true, if the specified resource is inside the current project

isSubscriptionDriverAvailable

public boolean isSubscriptionDriverAvailable()
Checks whether the subscription driver is available.

Returns:
true if the subscription driver is available

isTempfileProject

public boolean isTempfileProject(CmsProject project)
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 with action = 2).

Parameters:
dbc - the current database context
resource - the resource
newResource - absolute path for a resource sibling which will be created
action - 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, otherwise false
Throws:
CmsDataAccessException - if something goes wrong

lockedBy

public CmsUser lockedBy(CmsDbContext dbc,
                        CmsResource resource)
                 throws CmsException
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 context
resource - 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 context
resource - the resource to lock
type - type of the lock
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.lockResource(String), CmsObject.lockResourceTemporary(String), I_CmsResourceType.lockResource(CmsObject, CmsSecurityManager, CmsResource, CmsLockType)

log

public void log(CmsDbContext dbc,
                CmsLogEntry logEntry,
                boolean force)
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 context
logEntry - the log entry to create
force - 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,
                         String remoteAddress)
                  throws CmsAuthentificationException,
                         CmsDataAccessException,
                         CmsPasswordEncryptionException
Attempts to authenticate a user into OpenCms with the given password.

Parameters:
dbc - the current database context
userName - the name of the user to be logged in
password - the password of the user
remoteAddress - the ip address of the request
Returns:
the logged in user
Throws:
CmsAuthentificationException - if the login was not successful
CmsDataAccessException - in case of errors accessing the database
CmsPasswordEncryptionException - in case of errors encrypting the users password

lookupPrincipal

public I_CmsPrincipal lookupPrincipal(CmsDbContext dbc,
                                      CmsUUID principalId)
Lookup and read the user or group with the given UUID.

Parameters:
dbc - the current database context
principalId - the UUID of the principal to lookup
Returns:
the principal (group or user) if found, otherwise null

lookupPrincipal

public I_CmsPrincipal lookupPrincipal(CmsDbContext dbc,
                                      String principalName)
Lookup and read the user or group with the given name.

Parameters:
dbc - the current database context
principalName - 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 context
poolName - the name of the database pool to use
resource - the resource to mark as visited
user - 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 context
source - the resource to move
destination - the name of the move destination with complete path
internal - if set nothing more than the path is modified
Throws:
CmsException - if something goes wrong
See Also:
CmsSecurityManager.moveResource(CmsRequestContext, CmsResource, String)

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 to true.

Parameters:
dbc - the current database context
resource - the resource to apply this operation to
returnNameOnly - if true, 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 wrong
CmsIllegalArgumentException - if the resourcename argument is null or of length 0
See Also:
CmsObject.moveToLostAndFound(String), CmsObject.getLostAndFoundName(String)

newDriverInstance

public Object newDriverInstance(CmsDbContext dbc,
                                CmsConfigurationManager configurationManager,
                                String driverName,
                                List<String> successiveDrivers)
                         throws CmsInitException
Gets a new driver instance.

Parameters:
dbc - the database context
configurationManager - the configuration manager
driverName - the driver name
successiveDrivers - 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 propertyfile
driverName - the class name of the driver
driverPoolUrl - 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 propertyfile
poolName - 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 context
dbc - the db context
publishList - the list of resources to publish
report - 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 context
dbc - the current database context
publishList - a publish list
report - an instance of I_CmsReport to print messages
Throws:
CmsException - if something goes wrong
See Also:
fillPublishList(CmsDbContext, CmsPublishList)

publishUrlNameMapping

public void publishUrlNameMapping(CmsDbContext dbc,
                                  CmsResource res)
                           throws CmsDataAccessException
Transfers the new URL name mappings (if any) for a given resource to the online project.

Parameters:
dbc - the current database context
res - 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 context
resource - the resource
principal - 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

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 context
resource - the resource to read the history for
Returns:
a list of file headers, as I_CmsHistoryResource objects
Throws:
CmsException - if something goes wrong

readAllPropertyDefinitions

public List<CmsPropertyDefinition> readAllPropertyDefinitions(CmsDbContext dbc)
                                                       throws CmsException
Reads all property definitions for the given mapping type.

Parameters:
dbc - the current database context
Returns:
a list with the CmsPropertyDefinition objects (may be empty)
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 context
poolName - the name of the database pool to use
principal - 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 context
id - the resource's structure id
locale - the requested locale
defaultLocales - 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 and getFiles 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 context
resource - the resource to return the child resources for
filter - the resource filter to use
getFolders - if true the child folders are included in the result
getFiles - if true the child files are included in the result
checkPermissions - 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)
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:

  1. the CmsPropertyDefinition.PROPERTY_DEFAULT_FILE is checked, and
  2. 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
  3. if still no file could be found, null is retuned

Parameters:
dbc - the database context
resource - the folder to get the default file for
Returns:
the default file for the given folder
See Also:
CmsObject.readDefaultFile(String), readDefaultFile(CmsDbContext, CmsResource)

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 context
resource - the parent resource to read the resources from
readTree - true to read all subresources
isVfsManager - true if the current user has the vfs manager role
Returns:
a list of I_CmsHistoryResource objects
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.readResource(CmsUUID, int), CmsObject.readResources(String, CmsResourceFilter, boolean), CmsObject.readDeletedResources(String, boolean)

readFile

public CmsFile readFile(CmsDbContext dbc,
                        CmsResource resource)
                 throws CmsException
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 readResource(CmsDbContext, String, CmsResourceFilter) instead.

The specified filter controls what kind of resources should be "found" during the read operation. This will depend on the application. For example, using CmsResourceFilter.DEFAULT will only return currently "valid" resources, while using CmsResourceFilter.IGNORE_EXPIRATION will ignore the date release / date expired information of the resource.

Parameters:
dbc - the current database context
resource - 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 context
resourcename - 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:
readResource(CmsDbContext, String, CmsResourceFilter), CmsObject.readFolder(String), CmsObject.readFolder(String, CmsResourceFilter)

readGroup

public CmsGroup readGroup(CmsDbContext dbc,
                          CmsProject project)
Reads the group of a project.

Parameters:
dbc - the current database context
project - the project to read from
Returns:
the group of a resource

readGroup

public CmsGroup readGroup(CmsDbContext dbc,
                          CmsUUID groupId)
                   throws CmsException
Reads a group based on its id.

Parameters:
dbc - the current database context
groupId - the id of the group that is to be read
Returns:
the requested group
Throws:
CmsException - if operation was not successful

readGroup

public CmsGroup readGroup(CmsDbContext dbc,
                          String groupname)
                   throws CmsDataAccessException
Reads a group based on its name.

Parameters:
dbc - the current database context
groupname - 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 context
principalId - 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:
CmsObject.readUser(CmsUUID), CmsObject.readGroup(CmsUUID), CmsObject.readHistoryPrincipal(CmsUUID)

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 context
projectId - the project id
Returns:
the requested historical project entry
Throws:
CmsException - if something goes wrong

readHistoryProject

public CmsHistoryProject readHistoryProject(CmsDbContext dbc,
                                            int publishTag)
                                     throws CmsException
Returns a historical project entry.

Parameters:
dbc - the current database context
publishTag - 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 CmsProperty objects that belongs to the given historical resource.

Parameters:
dbc - the current database context
historyResource - the historical resource to read the properties for
Returns:
the list of CmsProperty objects
Throws:
CmsException - if something goes wrong

readIdForUrlName

public CmsUUID readIdForUrlName(CmsDbContext dbc,
                                String name)
                         throws CmsDataAccessException
Reads the structure id which is mapped to a given URL name.

Parameters:
dbc - the current database context
name - 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

public void readLocks(CmsDbContext dbc)
               throws CmsException
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

public CmsGroup readManagerGroup(CmsDbContext dbc,
                                 CmsProject project)
Reads the manager group of a project.

Parameters:
dbc - the current database context
project - the project to read from
Returns:
the group of a resource

readNewestUrlNameForId

public String readNewestUrlNameForId(CmsDbContext dbc,
                                     CmsUUID id)
                              throws CmsDataAccessException
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 context
id - 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 context
ouFqn - 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

public CmsUser readOwner(CmsDbContext dbc,
                         CmsProject project)
                  throws CmsException
Reads the owner of a project.

Parameters:
dbc - the current database context
project - 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 context
structureId - 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 context
path - the requested path
filter - a filter object (only "includeDeleted" information is used!)
Returns:
list of CmsResources
Throws:
CmsException - if something goes wrong

readProject

public CmsProject readProject(CmsDbContext dbc,
                              CmsUUID id)
                       throws CmsDataAccessException
Reads a project given the projects id.

Parameters:
dbc - the current database context
id - the id of the project
Returns:
the project read
Throws:
CmsDataAccessException - if something goes wrong

readProject

public CmsProject readProject(CmsDbContext dbc,
                              String name)
                       throws CmsException
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 context
name - the name of the project
Returns:
the project read
Throws:
CmsException - if something goes wrong

readProjectResources

public List<String> readProjectResources(CmsDbContext dbc,
                                         CmsProject project)
                                  throws CmsException
Returns the list of all resource names that define the "view" of the given project.

Parameters:
dbc - the current database context
project - the project to get the project resources for
Returns:
the list of all resources, as String objects that define the "view" of the given project.
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:

Parameters:
dbc - the current database context
projectId - the id of the project to read the file resources for
state - the resource state to match
Returns:
a list of CmsResource objects matching the filter criteria
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.readProjectView(CmsUUID, CmsResourceState)

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 context
name - 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 CmsProperty.getNullProperty() if the property is not found.

Parameters:
dbc - the current database context
resource - the resource where the property is read from
key - the property key name
search - if true, 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 CmsProperty.getNullProperty() if the property was not found
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 context
resource - the resource where the properties are read from
search - 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:
CmsObject.readPropertyObjects(String, boolean)

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 context
publishHistoryId - unique int ID to identify each publish task in the publish history
Returns:
a list of CmsPublishedResource objects
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 context
publishHistoryId - 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 context
startTime - the start of the time range for finish time
endTime - 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 context
publishHistoryId - 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 context
publishHistoryId - 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 context
resource - the resource to be read
version - 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:
CmsObject.restoreResourceVersion(CmsUUID, int), CmsObject.readResource(CmsUUID, int)

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 context
structureID - the structure id of the resource to read
filter - the resource filter to use while reading
Returns:
the resource that was read
Throws:
CmsDataAccessException - if something goes wrong
See Also:
CmsObject.readResource(CmsUUID, CmsResourceFilter), CmsObject.readResource(CmsUUID)

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 context
resourcePath - 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:
CmsObject.readResource(String, CmsResourceFilter), CmsObject.readResource(String), CmsObject.readFile(CmsResource)

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 the readTree parameter is true.

Parameters:
dbc - the current database context
parent - the parent path to read the resources from
filter - the filter
readTree - true to read all subresources
Returns:
a list of CmsResource objects matching the filter criteria
Throws:
CmsDataAccessException - if the bare reading of the resources fails
CmsException - 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 context
poolName - the name of the database pool to use
filter - 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 is null, all resources having the given property set are returned.

Parameters:
dbc - the current database context
folder - the folder to get the resources with the property from
propertyDefinition - the name of the property (definition) to check for
value - the string to search in the value of the property
filter - the resource filter to apply to the result set
Returns:
a list of all CmsResource objects that have a value set for the specified property.
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 context
resource - 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 context
resource - 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 CmsResource objects.

Parameters:
dbc - the current database context
resource - the resource to read the siblings for
filter - a filter object
Returns:
a list of CmsResource Objects that are siblings to the specified resource, including the specified resource itself
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 context
rfsName - 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 context
parameterResources - 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 String objects
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 context
poolName - the name of the database pool to use
user - the user that subscribed to the resource
groups - the groups to check subscribed resources for
parent - the parent resource (folder) of the deleted resources, if null all deleted resources will be returned
includeSubFolders - indicates if the sub folders of the specified folder path should be considered, too
deletedFrom - 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 context
poolName - the name of the database pool to use
filter - 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 context
online - if true, read online URL name mappings, else offline ones
filter - 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

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 context
id - the resource's structure id
Returns:
the url names for the locales
Throws:
CmsDataAccessException - if the database operation failed

readUser

public CmsUser readUser(CmsDbContext dbc,
                        CmsUUID id)
                 throws CmsException
Returns a user object based on the id of a user.

Parameters:
dbc - the current database context
id - the id of the user to read
Returns:
the user read
Throws:
CmsException - if something goes wrong

readUser

public CmsUser readUser(CmsDbContext dbc,
                        String username)
                 throws CmsDataAccessException
Returns a user object.

Parameters:
dbc - the current database context
username - the name of the user that is to be read
Returns:
user read
Throws:
CmsDataAccessException - if operation was not successful

readUser

public CmsUser readUser(CmsDbContext dbc,
                        String username,
                        String password)
                 throws CmsException
Returns a user object if the password for the user is correct.

If the user/pwd pair is not valid a CmsException is thrown.

Parameters:
dbc - the current database context
username - the username of the user that is to be read
password - 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 context
resource - the resource
principal - 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 context
orgUnit - the organizational unit to remove the resource from
resource - the resource that is to be removed from the organizational unit
Throws:
CmsException - if something goes wrong
See Also:
CmsOrgUnitManager.addResourceToOrgUnit(CmsObject, String, String), CmsOrgUnitManager.addResourceToOrgUnit(CmsObject, String, String)

removeResourceFromProject

public void removeResourceFromProject(CmsDbContext dbc,
                                      CmsResource resource)
                               throws CmsException
Removes a resource from the current project of the user.

Parameters:
dbc - the current database context
resource - the resource to apply this operation to
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.copyResourceToProject(String), I_CmsResourceType.copyResourceToProject(CmsObject, CmsSecurityManager, CmsResource)

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 context
userId - the user's id
structureIds - 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 context
username - the name of the user that is to be removed from the group
groupname - the name of the group
readRoles - if to read roles or groups
Throws:
CmsException - if operation was not successful
CmsIllegalArgumentException - if the given user was not member in the given group
CmsDbEntryNotFoundException - if the given group was not found
CmsSecurityException - if the given user was read as 'null' from the database
See Also:
addUserToGroup(CmsDbContext, String, String, boolean)

repairCategories

public void repairCategories(CmsDbContext dbc,
                             CmsUUID projectId,
                             CmsResource resource)
                      throws CmsException
Repairs broken categories.

Parameters:
dbc - the database context
projectId - the project id
resource - 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 context
resource - the name of the resource to apply this operation to
type - the new type of the resource
content - the new content of the resource
properties - the new properties of the resource
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.replaceResource(String, int, byte[], List), I_CmsResourceType.replaceResource(CmsObject, CmsSecurityManager, CmsResource, int, byte[], List)

resetPassword

public void resetPassword(CmsDbContext dbc,
                          String username,
                          String oldPassword,
                          String newPassword)
                   throws CmsException,
                          CmsSecurityException
Resets the password for a specified user.

Parameters:
dbc - the current database context
username - the name of the user
oldPassword - the old password
newPassword - the new password
Throws:
CmsException - if the user data could not be read from the database
CmsSecurityException - if the specified username and old password could not be verified

restoreDeletedResource

public void restoreDeletedResource(CmsDbContext dbc,
                                   CmsUUID structureId)
                            throws CmsException
Restores a deleted resource identified by its structure id from the historical archive.

Parameters:
dbc - the current database context
structureId - the structure id of the resource to restore
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.restoreDeletedResource(CmsUUID)

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 context
resource - the resource to restore from the archive
version - the version number to restore from the archive
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.restoreResourceVersion(CmsUUID, int), I_CmsResourceType.restoreResource(CmsObject, CmsSecurityManager, CmsResource, int)

searchUsers

public List<CmsUser> searchUsers(CmsDbContext dbc,
                                 CmsUserSearchParameters searchParams)
                          throws CmsDataAccessException
Searches for users which fit the given criteria.

Parameters:
dbc - the database context
searchParams - 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 context
resource - the resource to touch
dateExpired - the new expire date of the resource
Throws:
CmsDataAccessException - if something goes wrong
See Also:
CmsObject.setDateExpired(String, long, boolean), I_CmsResourceType.setDateExpired(CmsObject, CmsSecurityManager, CmsResource, long, boolean)

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 context
resource - the resource to touch
dateLastModified - the new last modified date of the resource
Throws:
CmsDataAccessException - if something goes wrong
See Also:
CmsObject.setDateLastModified(String, long, boolean), I_CmsResourceType.setDateLastModified(CmsObject, CmsSecurityManager, CmsResource, long, boolean)

setDateReleased

public void setDateReleased(CmsDbContext dbc,
                            CmsResource resource,
                            long dateReleased)
                     throws CmsDataAccessException
Changes the "release" date of a resource.

Parameters:
dbc - the current database context
resource - the resource to touch
dateReleased - the new release date of the resource
Throws:
CmsDataAccessException - if something goes wrong
See Also:
CmsObject.setDateReleased(String, long, boolean), I_CmsResourceType.setDateReleased(CmsObject, CmsSecurityManager, CmsResource, long, boolean)

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 context
groupName - the name of the group that should be written
parentGroupName - the name of the parent group to set, or null if the parent group should be deleted.
Throws:
CmsException - if operation was not successful
CmsDataAccessException - if the group with groupName 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 context
username - the name of the user
newPassword - the new password
Throws:
CmsException - if operation was not successful
CmsIllegalArgumentException - if the user with the username 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 context
poolName - the name of the database pool to use
resource - 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 context
orgUnit - the organizational unit to add the resource to
user - the user that is to be moved to the organizational unit
Throws:
CmsException - if something goes wrong
See Also:
CmsOrgUnitManager.setUsersOrganizationalUnit(CmsObject, String, String)

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 context
poolName - the name of the database pool to use
principal - the principal that subscribes to the resource
resource - the resource to subscribe to
Throws:
CmsException - if something goes wrong

undelete

public void undelete(CmsDbContext dbc,
                     CmsResource resource)
              throws CmsException
Undelete the resource.

Parameters:
dbc - the current database context
resource - the name of the resource to apply this operation to
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.undeleteResource(String, boolean), I_CmsResourceType.undelete(CmsObject, CmsSecurityManager, CmsResource, boolean)

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 context
resource - the name of the resource to apply this operation to
mode - the undo mode, one of the CmsResource.CmsResourceUndoMode#UNDO_XXX constants please note that the recursive flag is ignored at this level
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.undoChanges(String, CmsResource.CmsResourceUndoMode), I_CmsResourceType.undoChanges(CmsObject, CmsSecurityManager, CmsResource, CmsResource.CmsResourceUndoMode)

unlockProject

public void unlockProject(CmsProject project)
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 context
resource - the resource to unlock
force - true, if a resource is forced to get unlocked, no matter by which user and in which project the resource is currently locked
removeSystemLock - true, if you also want to remove system locks
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.unlockResource(String), I_CmsResourceType.unlockResource(CmsObject, CmsSecurityManager, CmsResource)

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 context
poolName - the name of the database pool to use
deletedTo - 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 context
poolName - the name of the database pool to use
principal - 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 context
poolName - the name of the database pool to use
principal - the principal that unsubscribes from the resource
resource - 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 context
poolName - the name of the database pool to use
resource - the resource to unsubscribe all groups and users from
Throws:
CmsException - if something goes wrong

updateExportPoints

public void updateExportPoints(CmsDbContext dbc)
Update the export points.

All files and folders "inside" an export point are written.

Parameters:
dbc - the current database context

updateLog

public void updateLog(CmsDbContext dbc)
               throws CmsDataAccessException
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)
                                throws CmsException
Updates/Creates the given relations for the given resource.

Parameters:
dbc - the db context
resource - the resource to update the relations for
links - the links to consider for updating
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
Returns true if a user is member of the given group.

Parameters:
dbc - the current database context
username - the name of the user to check
groupname - the name of the group to check
readRoles - if to read roles or groups
Returns:
true, if the user is in the group, false otherwise
Throws:
CmsException - if something goes wrong

validatePassword

public void validatePassword(String password)
                      throws CmsSecurityException
This method checks if a new password follows the rules for new passwords, which are defined by a Class implementing the I_CmsPasswordHandler interface and configured in the opencms.properties file.

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 context
publishList - the resources to validate during publishing
report - a report to write the messages to
Returns:
a map with lists of invalid links (CmsRelation} objects) keyed by root paths
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 context
resource - the resource
ace - the entry to write
Throws:
CmsException - if something goes wrong

writeExportPoints

public 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.

Parameters:
dbc - the current database context
report - an I_CmsReport instance to print output message, or null to write messages to the log file
publishHistoryId - ID to identify the publish task in the publish history

writeFile

public CmsFile writeFile(CmsDbContext dbc,
                         CmsFile resource)
                  throws CmsException
Writes a resource to the OpenCms VFS, including it's content.

Applies only to resources of type CmsFile i.e. resources that have a binary content attached.

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 context
resource - the resource to apply this operation to
Returns:
the written resource (may have been modified)
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.writeFile(CmsFile), I_CmsResourceType.writeFile(CmsObject, CmsSecurityManager, CmsFile)

writeGroup

public void writeGroup(CmsDbContext dbc,
                       CmsGroup group)
                throws CmsException
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 context
group - 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 context
publishTag - the version
publishDate - the date of publishing
Throws:
CmsDataAccessException - if operation was not successful

writeLocks

public void writeLocks(CmsDbContext dbc)
                throws CmsException
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 context
organizationalUnit - the organizational unit that should be written
Throws:
CmsException - if operation was not successful
See Also:
CmsOrgUnitManager.writeOrganizationalUnit(CmsObject, CmsOrganizationalUnit)

writeProject

public void writeProject(CmsDbContext dbc,
                         CmsProject project)
                  throws CmsException
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 context
project - the project that should be written
Throws:
CmsException - if operation was not successful

writePropertyObject

public void writePropertyObject(CmsDbContext dbc,
                                CmsResource resource,
                                CmsProperty property)
                         throws CmsException
Writes a property for a specified resource.

Parameters:
dbc - the current database context
resource - the resource to write the property for
property - the property to write
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.writePropertyObject(String, CmsProperty), I_CmsResourceType.writePropertyObject(CmsObject, CmsSecurityManager, CmsResource, CmsProperty)

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 that a.equals(b), otherwise an exception is thrown.

Parameters:
dbc - the current database context
resource - the resource to write the properties for
properties - the list of properties to write
updateState - if true the state of the resource will be updated
Throws:
CmsException - if something goes wrong
See Also:
CmsObject.writePropertyObjects(String, List), I_CmsResourceType.writePropertyObjects(CmsObject, CmsSecurityManager, CmsResource, List)

writePublishJob

public void writePublishJob(CmsDbContext dbc,
                            CmsPublishJobInfoBean publishJob)
                     throws CmsException
Updates a publish job.

Parameters:
dbc - the current database context
publishJob - 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 context
publishJob - the publish job
Throws:
CmsException - if something goes wrong

writeResource

public void writeResource(CmsDbContext dbc,
                          CmsResource resource)
                   throws CmsException
Writes a resource to the OpenCms VFS.

Parameters:
dbc - the current database context
resource - 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 context
resourceName - The name of the resource to be added to the static export
linkType - the type of resource exported (0= non-parameter, 1=parameter)
linkParameter - the parameters added to the resource
timestamp - 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)
                           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 context
nameSeq - the sequence of URL name candidates
structureId - the structure id to which the url name should be mapped
locale - the locale for which the mapping should be written
Returns:
the actual name which was mapped to the structure id
Throws:
CmsDataAccessException - if something goes wrong

writeUser

public void writeUser(CmsDbContext dbc,
                      CmsUser user)
               throws CmsException
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 context
user - the user to be updated
Throws:
CmsException - if operation was not successful

addOrReplaceUrlNameMapping

protected void addOrReplaceUrlNameMapping(CmsDbContext dbc,
                                          String name,
                                          CmsUUID structureId,
                                          String locale)
                                   throws CmsDataAccessException
Adds or replaces a new url name mapping in the offline project.

Parameters:
dbc - the current database context
name - the URL name of the mapping
structureId - the structure id of the mapping
locale - the locale of the mapping
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 context
configManager - the configuration manager
config - the configuration
driverChainKey - the configuration key under which the driver chain is stored
suffix - 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 context
resource - 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 context
dbc - the current database context
pubList - 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 context
nameSeq - the sequence of name candidates
structureId - the structure id to which an URL name should be mapped
locale - 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 context
name - the name of the mapping
structureId - 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

protected CmsLockManager getLockManager()
Returns the lock manager instance.

Returns:
the lock manager instance

getNumberedName

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.

Parameters:
name - the base name
number - the number from which to form the suffix
Returns:
the concatenation of the base name and possibly the numeric suffix