/** * Copies a resource to the current project of the user.<p> * * This is used to extend the current users project with the * specified resource, in case that the resource is not yet part of the project. * The resource is not really copied like in a regular copy operation, * it is in fact only "enabled" in the current users project.<p> * * @param resourcename the name of the resource to copy to the current project (full current site relative path) * * @throws CmsException if something goes wrong */ public void copyResourceToProject(String resourcename) throws CmsException { CmsResource resource = readResource(resourcename, CmsResourceFilter.ALL); copyResourceToProject(resource); }
/** * Submits the dialog.<p> */ void submit() { CmsResource target = m_context.getResources().get(0); String resPath = m_context.getCms().getSitePath(target); try { m_context.getCms().copyResourceToProject(resPath); m_context.finish(Collections.singletonList(target.getStructureId())); } catch (CmsException e) { m_context.error(e); } } }
/** * Performs the copy to project action, will be called by the JSP page.<p> * * @throws JspException if problems including sub-elements occur */ public void actionCopyToProject() throws JspException { // save initialized instance of this class in request attribute for included sub-elements getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this); try { // copy the resource to the current project getCms().copyResourceToProject(getParamResource()); // close the dialog actionCloseDialog(); } catch (Throwable e) { // error copying resource to project, include error page includeErrorpage(this, e); } }
/** * Performs the copy to project action, will be called by the JSP page.<p> * * @throws JspException if problems including sub-elements occur */ public void actionCopyToProject() throws JspException { // save initialized instance of this class in request attribute for included sub-elements getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this); try { // copy the resource to the current project getCms().copyResourceToProject(getParamResource()); // close the dialog actionCloseDialog(); } catch (Throwable e) { // error copying resource to project, include error page includeErrorpage(this, e); } }
String resName = itAdd.next().toString(); if (!currentResNames.contains(resName)) { getCms().copyResourceToProject(resName);
cms.copyResourceToProject(resName);
cmsAdmin.copyResourceToProject(resource);
cmsAdmin.copyResourceToProject(resource);
/** * Adds the given resource to the temporary project.<p> * * @param adminCms the admin cms context * @param userCms the user cms context * @param resource the resource * @param tmpProject the temporary project * @throws CmsException in case something goes wrong */ private void addToTempProject(CmsObject adminCms, CmsObject userCms, CmsResource resource, CmsProject tmpProject) throws CmsException { // copy the resource to the project adminCms.copyResourceToProject(resource); // lock the resource in the current project CmsLock lock = userCms.getLock(resource); // prove is current lock from current but not in current project if ((lock != null) && lock.isOwnedBy(userCms.getRequestContext().getCurrentUser()) && !lock.isOwnedInProjectBy( userCms.getRequestContext().getCurrentUser(), userCms.getRequestContext().getCurrentProject())) { // file is locked by current user but not in current project // change the lock from this file userCms.changeLock(resource); } // lock resource from current user in current project userCms.lockResource(resource); // get current lock lock = userCms.getLock(resource); }
newProjectCms.getRequestContext().setCurrentProject(workflowProject); newProjectCms.getRequestContext().setSiteRoot(""); newProjectCms.copyResourceToProject("/"); CmsUser admin = offlineAdminCms.getRequestContext().getCurrentUser(); clearLocks(userCms.getRequestContext().getCurrentProject(), resources);
try { cms.copyResourceToProject(RELEASE_CONFIG);
String resName = itResNames.next(); try { getCms().copyResourceToProject(resName); } catch (@SuppressWarnings("unused") CmsVfsResourceNotFoundException e) {
String resName = (String)itResNames.next(); try { getCms().copyResourceToProject(resName); } catch (CmsVfsResourceNotFoundException e) {
String resName = itResNames.next(); try { getCms().copyResourceToProject(resName); } catch (CmsVfsResourceNotFoundException e) {
CmsProject.PROJECT_TYPE_NORMAL); m_cms.getRequestContext().setCurrentProject(project); m_cms.copyResourceToProject("/"); } finally { m_cms.getRequestContext().setSiteRoot(storedSiteRoot);
CmsProject.PROJECT_TYPE_NORMAL); m_cms.getRequestContext().setCurrentProject(project); m_cms.copyResourceToProject("/"); } finally { m_cms.getRequestContext().setSiteRoot(storedSiteRoot);
/** * Imports a folder or a ZIP file to the root folder of the * current site, creating a temporary project for this.<p> * * @param importFile the absolute path of the import resource * @throws Exception if something goes wrong */ public void importResourcesWithTempProject(String importFile) throws Exception { CmsProject project = m_cms.createProject( "SystemUpdate", getMessages().key(Messages.GUI_SHELL_IMPORT_TEMP_PROJECT_NAME_0), OpenCms.getDefaultUsers().getGroupAdministrators(), OpenCms.getDefaultUsers().getGroupAdministrators(), CmsProject.PROJECT_TYPE_TEMPORARY); CmsUUID id = project.getUuid(); m_cms.getRequestContext().setCurrentProject(project); m_cms.copyResourceToProject("/"); CmsImportParameters params = new CmsImportParameters(importFile, "/", true); OpenCms.getImportExportManager().importData( m_cms, new CmsShellReport(m_cms.getRequestContext().getLocale()), params); m_cms.unlockProject(id); OpenCms.getPublishManager().publishProject(m_cms); OpenCms.getPublishManager().waitWhileRunning(); }
/** * Imports a folder or a ZIP file to the root folder of the * current site, creating a temporary project for this.<p> * * @param importFile the absolute path of the import resource * @throws Exception if something goes wrong */ public void importResourcesWithTempProject(String importFile) throws Exception { CmsProject project = m_cms.createProject( "SystemUpdate", getMessages().key(Messages.GUI_SHELL_IMPORT_TEMP_PROJECT_NAME_0), OpenCms.getDefaultUsers().getGroupAdministrators(), OpenCms.getDefaultUsers().getGroupAdministrators(), CmsProject.PROJECT_TYPE_TEMPORARY); CmsUUID id = project.getUuid(); m_cms.getRequestContext().setCurrentProject(project); m_cms.copyResourceToProject("/"); CmsImportParameters params = new CmsImportParameters(importFile, "/", true); OpenCms.getImportExportManager().importData( m_cms, new CmsShellReport(m_cms.getRequestContext().getLocale()), params); m_cms.unlockProject(id); OpenCms.getPublishManager().publishProject(m_cms); OpenCms.getPublishManager().waitWhileRunning(); }
cms.copyResourceToProject("/"); } catch (Exception e) { throw new CmsImportExportException(
cms.copyResourceToProject("/"); } catch (Exception e) { throw new CmsImportExportException(Messages.get().container(