/** * Deletes all entries in the published resource table.<p> * * @param context the current request context * @param linkType the type of resource deleted (0= non-parameter, 1=parameter) * * @throws CmsException if something goes wrong */ public void deleteAllStaticExportPublishedResources(CmsRequestContext context, int linkType) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { m_driverManager.deleteAllStaticExportPublishedResources(dbc, linkType); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_DELETE_STATEXP_PUBLISHED_RESOURCES_0), e); } finally { dbc.clear(); } }
/** * Deletes all entries in the published resource table.<p> * * @param context the current request context * @param linkType the type of resource deleted (0= non-parameter, 1=parameter) * * @throws CmsException if something goes wrong */ public void deleteAllStaticExportPublishedResources(CmsRequestContext context, int linkType) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { m_driverManager.deleteAllStaticExportPublishedResources(dbc, linkType); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_DELETE_STATEXP_PUBLISHED_RESOURCES_0), e); } finally { dbc.clear(); } }
/** * Gets all access control entries.<p> * * @param context the current request context * @return the list of all access control entries * * @throws CmsException if something goes wrong */ public List<CmsAccessControlEntry> getAllAccessControlEntries(CmsRequestContext context) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); List<CmsAccessControlEntry> result = null; try { result = m_driverManager.getAllAccessControlEntries(dbc); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_GET_ACL_ENTRIES_1, "<all resources>"), e); } finally { dbc.clear(); } return result; }
/** * Counts the total number of users which match the given search criteria.<p> * * @param requestContext the request context * @param searchParams the search criteria object * * @return the number of users which match the search criteria * @throws CmsException if something goes wrong */ public long countUsers(CmsRequestContext requestContext, CmsUserSearchParameters searchParams) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(requestContext); try { return m_driverManager.countUsers(dbc, searchParams); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_COUNT_USERS_0), e); return -1; } finally { dbc.clear(); } }
/** * Unsubscribes all deleted resources that were deleted before the specified time stamp.<p> * * @param context the request context * @param poolName the name of the database pool to use * @param deletedTo the time stamp to which the resources have been deleted * * @throws CmsException if something goes wrong */ public void unsubscribeAllDeletedResources(CmsRequestContext context, String poolName, long deletedTo) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { m_driverManager.unsubscribeAllDeletedResources(dbc, poolName, deletedTo); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_UNSUBSCRIBE_ALL_DELETED_RESOURCES_USER_0), e); } finally { dbc.clear(); } }
/** * Increments a counter and returns its old value.<p> * * @param context the request context * @param name the name of the counter * * @return the value of the counter before incrementing * * @throws CmsException if something goes wrong */ public int incrementCounter(CmsRequestContext context, String name) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { return m_driverManager.incrementCounter(dbc, name); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_INCREMENT_COUNTER_1, name), e); return -1; // will never be reached } finally { dbc.clear(); } }
/** * Reads a project given the projects id.<p> * * @param id the id of the project * * @return the project read * * @throws CmsException if something goes wrong */ public CmsProject readProject(CmsUUID id) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(); CmsProject result = null; try { result = m_driverManager.readProject(dbc, id); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_READ_PROJECT_FOR_ID_1, id), e); } finally { dbc.clear(); } return result; }
/** * Searches users by search criteria.<p> * * @param requestContext the request context * @param searchParams the search criteria object * * @return a list of users * @throws CmsException if something goes wrong */ public List<CmsUser> searchUsers(CmsRequestContext requestContext, CmsUserSearchParameters searchParams) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(requestContext); try { return m_driverManager.searchUsers(dbc, searchParams); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_SEARCH_USERS_0), e); return null; } finally { dbc.clear(); } }
/** * Reads all property definitions for the given mapping type.<p> * * @param context the current request context * * @return a list with the <code>{@link CmsPropertyDefinition}</code> objects (may be empty) * * @throws CmsException if something goes wrong */ public List readAllPropertyDefinitions(CmsRequestContext context) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); List result = null; try { result = m_driverManager.readAllPropertyDefinitions(dbc); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_READ_ALL_PROPDEF_0), e); } finally { dbc.clear(); } return result; }
/** * Gets the rewrite aliases matching a given filter.<p> * * @param requestContext the current request context * @param filter the filter used for selecting the rewrite aliases * @return the rewrite aliases matching the given filter * * @throws CmsException if something goes wrong */ public List<CmsRewriteAlias> getRewriteAliases(CmsRequestContext requestContext, CmsRewriteAliasFilter filter) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(requestContext); try { return m_driverManager.getRewriteAliases(dbc, filter); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_DB_OPERATION_0), e); return null; // will never be executed } finally { dbc.clear(); } }
/** * Reads all property definitions for the given mapping type.<p> * * @param context the current request context * * @return a list with the <code>{@link CmsPropertyDefinition}</code> objects (may be empty) * * @throws CmsException if something goes wrong */ public List<CmsPropertyDefinition> readAllPropertyDefinitions(CmsRequestContext context) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); List<CmsPropertyDefinition> result = null; try { result = m_driverManager.readAllPropertyDefinitions(dbc); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_READ_ALL_PROPDEF_0), e); } finally { dbc.clear(); } return result; }
/** * Reads a project given the projects id.<p> * * @param id the id of the project * * @return the project read * * @throws CmsException if something goes wrong */ public CmsProject readProject(CmsUUID id) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(); CmsProject result = null; try { result = m_driverManager.readProject(dbc, id); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_READ_PROJECT_FOR_ID_1, id), e); } finally { dbc.clear(); } return result; }
/** * Replaces the rewrite aliases for a given site root.<p> * * @param requestContext the current request context * @param siteRoot the site root for which the rewrite aliases should be replaced * @param newAliases the new list of aliases for the given site root * * @throws CmsException if something goes wrong */ public void saveRewriteAliases(CmsRequestContext requestContext, String siteRoot, List<CmsRewriteAlias> newAliases) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(requestContext); try { // checkOfflineProject(dbc); // checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_WRITE, true, CmsResourceFilter.ALL); m_driverManager.saveRewriteAliases(dbc, siteRoot, newAliases); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_DB_OPERATION_0), e); } finally { dbc.clear(); } }
/** * Adds an alias.<p> * * @param context the current request context * @param alias the alias to add * @throws CmsException if something goes wrong */ public void addAlias(CmsRequestContext context, CmsAlias alias) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { m_driverManager.addAlias(dbc, context.getCurrentProject(), alias); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_DB_OPERATION_0), e); } finally { dbc.clear(); } }
/** * Deletes alias entries matching a filter.<p> * * @param context the request context * @param filter the alias filter * * @throws CmsException if something goes wrong */ public void deleteAliases(CmsRequestContext context, CmsAliasFilter filter) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { m_driverManager.deleteAliases(dbc, context.getCurrentProject(), filter); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_DB_OPERATION_0), e); } finally { dbc.clear(); } }
/** * Reads a group based on its name.<p> * * @param context the current request context * @param groupname the name of the group that is to be read * * @return the requested group * * @throws CmsException if operation was not successful */ public CmsGroup readGroup(CmsRequestContext context, String groupname) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsGroup result = null; try { result = m_driverManager.readGroup(dbc, CmsOrganizationalUnit.removeLeadingSeparator(groupname)); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_READ_GROUP_FOR_NAME_1, groupname), e); } finally { dbc.clear(); } return result; }
/** * Restores a deleted resource identified by its structure id from the historical archive.<p> * * @param context the current request context * @param structureId the structure id of the resource to restore * * @throws CmsException if something goes wrong * * @see CmsObject#restoreDeletedResource(CmsUUID) */ public void restoreDeletedResource(CmsRequestContext context, CmsUUID structureId) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkOfflineProject(dbc); // write permissions on parent folder are checked later m_driverManager.restoreDeletedResource(dbc, structureId); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_RESTORE_DELETED_RESOURCE_1, structureId), e); } finally { dbc.clear(); } }
/** * Deletes all log entries matching the given filter.<p> * * @param context the current user context * @param filter the filter to use for deletion * * @throws CmsException if something goes wrong * * @see #getLogEntries(CmsRequestContext, CmsLogFilter) * @see CmsObject#deleteLogEntries(CmsLogFilter) */ public void deleteLogEntries(CmsRequestContext context, CmsLogFilter filter) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkRole(dbc, CmsRole.WORKPLACE_MANAGER); m_driverManager.deleteLogEntries(dbc, filter); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_DELETE_LOG_0), e); } finally { dbc.clear(); } }
/** * Creates the project for the temporary workplace files.<p> * * @param context the current request context * * @return the created project for the temporary workplace files * * @throws CmsException if something goes wrong */ public CmsProject createTempfileProject(CmsRequestContext context) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsProject result = null; try { checkRole(dbc, CmsRole.PROJECT_MANAGER.forOrgUnit(null)); result = m_driverManager.createTempfileProject(dbc); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_CREATE_TEMPFILE_PROJECT_0), e); } finally { dbc.clear(); } return result; }
/** * Writes a resource to the OpenCms VFS.<p> * * @param context the current request context * @param resource the resource to write * * @throws CmsSecurityException if the user has insufficient permission for the given resource ({@link CmsPermissionSet#ACCESS_WRITE} required) * @throws CmsException if something goes wrong */ public void writeResource(CmsRequestContext context, CmsResource resource) throws CmsException, CmsSecurityException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkOfflineProject(dbc); checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_WRITE, true, CmsResourceFilter.ALL); m_driverManager.writeResource(dbc, resource); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_WRITE_RESOURCE_1, context.getSitePath(resource)), e); } finally { dbc.clear(); } }