/** * Gets the admin cmsObject.<p> * * @return Admin cmsObject * * @throws CmsException is something goes wrong */ public CmsObject getCmsAdminObject() throws CmsException { return OpenCms.initCmsObject(m_cmsAdmin); }
/** * Gets the admin cmsObject.<p> * * @return Admin cmsObject * * @throws CmsException is something goes wrong */ public CmsObject getCmsAdminObject() throws CmsException { return OpenCms.initCmsObject(m_cmsAdmin); }
/** * Creates a new instance.<p> * * @param cms the CMS context * @throws CmsException if something goes wrong */ public CmsNewResourceBuilder(CmsObject cms) throws CmsException { m_cms = OpenCms.initCmsObject(cms); }
/** * Creates a new cache instance for inherited containers.<p> * * @param cms the CMS context to use for VFS operations. * @param name the name of the cache, for debugging/testing purposes * * @throws CmsException if something goes wrong */ public CmsContainerConfigurationCache(CmsObject cms, String name) throws CmsException { m_cms = OpenCms.initCmsObject(cms); m_name = name; }
/** * Updates the internally stored OpenCms user context.<p> * * @param cms the new OpenCms user context */ public void updateCmsObject(CmsObject cms) { try { m_cms = OpenCms.initCmsObject(cms); } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); m_cms = cms; } }
/** * Creates a new formatter configuration cache instance.<p> * * @param cms the CMS context to use * @param name the cache name * * @throws CmsException if something goes wrong */ public CmsFormatterConfigurationCache(CmsObject cms, String name) throws CmsException { m_cms = OpenCms.initCmsObject(cms); Map<CmsUUID, I_CmsFormatterBean> noFormatters = Collections.emptyMap(); m_state = new CmsFormatterConfigurationCacheState(noFormatters); m_name = name; }
/** * Creates a new CMS object based on existing one and changes its site root to the site root.<p> * * @param cms the CMS context * @return the root site CMS context * @throws CmsException if something goes wrong */ protected CmsObject rootCms(CmsObject cms) throws CmsException { CmsObject result = OpenCms.initCmsObject(cms); result.getRequestContext().setSiteRoot(""); return result; }
/** * Creates a new instance.<p> * * @param cms the CMS context to use for file operations * * @throws CmsException if something goes wrong */ public ElementGenerator(CmsObject cms) throws CmsException { m_cms = OpenCms.initCmsObject(cms); m_cms.getRequestContext().setSiteRoot(""); }
/** * Creates a new instance.<p> * * @param cms the CMS context * * @throws CmsException if something goes wrong */ public CmsPdfUserAgent(CmsObject cms) throws CmsException { super(IMAGE_CACHE_CAPACITY); m_cms = cms; m_rootCms = OpenCms.initCmsObject(cms); m_rootCms.getRequestContext().setSiteRoot(""); }
/** * Returns the root cms context.<p> * * @return the root cms context * * @throws CmsException in case initializing the context fails */ private CmsObject getRootCms() throws CmsException { if (m_rootCms == null) { m_rootCms = OpenCms.initCmsObject(getCms()); m_rootCms.getRequestContext().setSiteRoot("/"); } return m_rootCms; }
/** * Returns a cloned cms instance that prevents the time range resource filter check.<p> * * Use it always for unmarshalling and file writing.<p> * * @return a cloned cms instance that prevents the time range resource filter check * * @throws CmsException if something goes wrong */ protected CmsObject getCloneCms() throws CmsException { CmsObject cloneCms = OpenCms.initCmsObject(getCms()); cloneCms.getRequestContext().setRequestTime(CmsResource.DATE_RELEASED_EXPIRED_IGNORE); return cloneCms; }
/** * Starts the report.<p> */ public void start() { if (m_writeHtml) { try { m_printStream.println(CmsReport.generatePageStartExtended( OpenCms.initCmsObject(OpenCms.getDefaultUsers().getUserGuest()), OpenCms.getSystemInfo().getDefaultEncoding())); } catch (CmsException e) { // ignore } } }
/** * Starts the report.<p> */ public void start() { if (m_writeHtml) { try { m_printStream.println( CmsWorkplace.generatePageStartExtended( OpenCms.initCmsObject(OpenCms.getDefaultUsers().getUserGuest()), OpenCms.getSystemInfo().getDefaultEncoding())); } catch (CmsException e) { // ignore } } }
/** * Gets the sitemap service.<p> * * @return the sitemap service * * @throws CmsException if something goes wrong */ public CmsVfsSitemapService getSitemapService() throws CmsException { CmsVfsSitemapService svc = new CmsVfsSitemapService(); CmsObject cms = OpenCms.initCmsObject(m_cms); cms.getRequestContext().setSiteRoot(""); svc.setCms(cms); return svc; }
/** * Constructor.<p> * * @param adminCms the admin cms context * * @throws CmsException in case initializing the cms object fails */ public CmsWorkplaceAppManager(CmsObject adminCms) throws CmsException { m_adminCms = adminCms; m_iconHelper = new CmsUserIconHelper(OpenCms.initCmsObject(m_adminCms)); m_workplaceMenuItemProvider = new CmsContextMenuItemProviderGroup(); m_workplaceMenuItemProvider.addProvider(CmsDefaultMenuItemProvider.class); m_workplaceMenuItemProvider.initialize(); }
/** * @see org.opencms.gwt.shared.rpc.I_CmsVfsService#substituteLinkForRootPath(java.lang.String, java.lang.String) */ public String substituteLinkForRootPath(String currentSiteRoot, String rootPath) throws CmsRpcException { String result = null; try { CmsObject cms = OpenCms.initCmsObject(getCmsObject()); cms.getRequestContext().setSiteRoot(currentSiteRoot); result = OpenCms.getLinkManager().substituteLinkForRootPath(cms, rootPath); } catch (CmsException e) { error(e); } return result; }
/** * Rewrites the content of the given file.<p> * * @param cms the CmsObject * @param resource the resource to rewrite the content for * * @throws CmsException if something goes wrong */ private void hardTouch(CmsObject cms, CmsResource resource) throws CmsException { CmsFile file = cms.readFile(resource); cms = OpenCms.initCmsObject(cms); cms.getRequestContext().setAttribute(CmsXmlContent.AUTO_CORRECTION_ATTRIBUTE, Boolean.TRUE); file.setContents(file.getContents()); cms.writeFile(file); }
/** * @see org.opencms.gwt.shared.rpc.I_CmsVfsService#undelete(org.opencms.util.CmsUUID) */ public void undelete(CmsUUID structureId) throws CmsRpcException { try { CmsObject cms = OpenCms.initCmsObject(getCmsObject()); cms.getRequestContext().setSiteRoot(""); CmsResource resource = cms.readResource(structureId, CmsResourceFilter.ALL); ensureLock(resource); cms.undeleteResource(resource.getRootPath(), true); } catch (Exception e) { error(e); } }
/** * Rewrites the content of the given file.<p> * * @param resource the resource to rewrite the content for * * @throws CmsException if something goes wrong */ private void hardTouch(CmsResource resource) throws CmsException { CmsFile file = m_context.getCms().readFile(resource); CmsObject cms = OpenCms.initCmsObject(m_context.getCms()); cms.getRequestContext().setAttribute(CmsXmlContent.AUTO_CORRECTION_ATTRIBUTE, Boolean.TRUE); file.setContents(file.getContents()); cms.writeFile(file); }
/** * Repairs broken categories.<p> * * @param dbc the database context * @param projectId the project id * @param resource the resource to repair the categories for * * @throws CmsException if something goes wrong */ public void repairCategories(CmsDbContext dbc, CmsUUID projectId, CmsResource resource) throws CmsException { CmsObject cms = OpenCms.initCmsObject(new CmsObject(getSecurityManager(), dbc.getRequestContext())); cms.getRequestContext().setSiteRoot(""); cms.getRequestContext().setCurrentProject(readProject(dbc, projectId)); CmsCategoryService.getInstance().repairRelations(cms, resource); }