/** * Returns the a new db context object.<p> * * @param ctx optional request context, can be <code>null</code> * * @return the a new db context object */ protected CmsDbContext getDbContext(CmsRequestContext ctx) { return m_dbContextFactory.getDbContext(ctx); }
/** * Initializes the default groups for an organizational unit.<p> * * @param context the request context * @param ou the organizational unit */ public void initializeOrgUnit(CmsRequestContext context, CmsOrganizationalUnit ou) { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); m_driverManager.initOrgUnit(dbc, ou); }
/** * Reads the locks that were saved to the database in the previous run of OpenCms.<p> * * @throws CmsException if something goes wrong */ public void readLocks() throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(); try { m_driverManager.readLocks(dbc); } finally { dbc.clear(); } }
/** * Reads the locks that were saved to the database in the previous run of OpenCms.<p> * * @throws CmsException if something goes wrong */ public void readLocks() throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(); try { m_driverManager.readLocks(dbc); } finally { dbc.clear(); } }
/** * Logs everything that has not been written to DB jet.<p> * * @throws CmsException if something goes wrong */ public void updateLog() throws CmsException { if (m_dbContextFactory == null) { // already shutdown return; } CmsDbContext dbc = m_dbContextFactory.getDbContext(); try { m_driverManager.updateLog(dbc); } finally { dbc.clear(); } }
/** * Reads the manager group of a project.<p> * * @param context the current request context * @param project the project to read from * * @return the group of a resource */ public CmsGroup readManagerGroup(CmsRequestContext context, CmsProject project) { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsGroup result = null; try { result = m_driverManager.readManagerGroup(dbc, project); } finally { dbc.clear(); } return result; }
/** * Reads the manager group of a project.<p> * * @param context the current request context * @param project the project to read from * * @return the group of a resource */ public CmsGroup readManagerGroup(CmsRequestContext context, CmsProject project) { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsGroup result = null; try { result = m_driverManager.readManagerGroup(dbc, project); } finally { dbc.clear(); } return result; }
/** * Lookup and read the user or group with the given UUID.<p> * * @param context the current request context * @param principalId the UUID of the principal to lookup * * @return the principal (group or user) if found, otherwise <code>null</code> */ public I_CmsPrincipal lookupPrincipal(CmsRequestContext context, CmsUUID principalId) { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); I_CmsPrincipal result = null; try { result = m_driverManager.lookupPrincipal(dbc, principalId); } finally { dbc.clear(); } return result; }
/** * Reads the group of a project.<p> * * @param context the current request context * @param project the project to read from * * @return the group of a resource */ public CmsGroup readGroup(CmsRequestContext context, CmsProject project) { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsGroup result = null; try { result = m_driverManager.readGroup(dbc, project); } finally { dbc.clear(); } return result; }
/** * Lookup and read the user or group with the given UUID.<p> * * @param context the current request context * @param principalId the UUID of the principal to lookup * * @return the principal (group or user) if found, otherwise <code>null</code> */ public I_CmsPrincipal lookupPrincipal(CmsRequestContext context, CmsUUID principalId) { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); I_CmsPrincipal result = null; try { result = m_driverManager.lookupPrincipal(dbc, principalId); } finally { dbc.clear(); } return result; }
/** * Reads the group of a project.<p> * * @param context the current request context * @param project the project to read from * * @return the group of a resource */ public CmsGroup readGroup(CmsRequestContext context, CmsProject project) { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsGroup result = null; try { result = m_driverManager.readGroup(dbc, project); } finally { dbc.clear(); } return result; }
/** * Returns the user identified by the given id.<p> * * @param userId the id of the user to retrieve * * @return the user identified by the given id */ protected CmsUser getUser(CmsUUID userId) { CmsDbContext dbc = m_dbContextFactory.getDbContext(); try { return m_driverManager.readUser(dbc, userId); } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); } finally { dbc.clear(); } return null; }
/** * Returns the content of the publish report assigned to the given publish job.<p> * * @param publishJob the published job * @return the content of the assigned publish report * * @throws CmsException if something goes wrong */ protected byte[] getReportContents(CmsPublishJobFinished publishJob) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(); try { return m_driverManager.readPublishReportContents(dbc, publishJob.getPublishHistoryId()); } finally { dbc.clear(); } }
/** * Lookup and read the user or group with the given name.<p> * * @param context the current request context * @param principalName the name of the principal to lookup * * @return the principal (group or user) if found, otherwise <code>null</code> */ public I_CmsPrincipal lookupPrincipal(CmsRequestContext context, String principalName) { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); I_CmsPrincipal result = null; try { result = m_driverManager.lookupPrincipal(dbc, CmsOrganizationalUnit.removeLeadingSeparator(principalName)); } finally { dbc.clear(); } return result; }
/** * Sets the driver manager instance.<p> * * @param driverManager the driver manager instance */ public void setDriverManager(CmsDriverManager driverManager) { m_driverManager = driverManager; CmsDbContext dbc = m_dbContextFactory.getDbContext(); try { m_adminUserId = m_driverManager.readUser(dbc, OpenCms.getDefaultUsers().getUserAdmin()).getId(); } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); } finally { dbc.clear(); } }
/** * Sets the driver manager instance.<p> * * @param driverManager the driver manager instance */ public void setDriverManager(CmsDriverManager driverManager) { m_driverManager = driverManager; CmsDbContext dbc = m_dbContextFactory.getDbContext(); try { m_adminUserId = m_driverManager.readUser(dbc, OpenCms.getDefaultUsers().getUserAdmin()).getId(); } catch (CmsException e) { dbc.rollback(); LOG.error(e.getLocalizedMessage(), 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(); } }
/** * 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(); } }
/** * 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(); } }