/** * @see org.opencms.repository.I_CmsRepositorySession#exists(java.lang.String) */ public boolean exists(String path) { try { path = validatePath(path); return m_cms.existsResource(path); } catch (CmsException ex) { return false; } }
/** * @see org.opencms.repository.I_CmsRepositorySession#exists(java.lang.String) */ public boolean exists(String path) { try { path = validatePath(path); return m_cms.existsResource(path); } catch (CmsException ex) { return false; } }
/** * @see org.opencms.repository.I_CmsRepositorySession#lock(java.lang.String, org.opencms.repository.CmsRepositoryLockInfo) */ public boolean lock(String path, CmsRepositoryLockInfo lock) throws CmsException { path = validatePath(path); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_LOCK_ITEM_1, path)); } m_cms.lockResource(path); return true; }
/** * @see org.opencms.repository.I_CmsRepositorySession#lock(java.lang.String, org.opencms.repository.CmsRepositoryLockInfo) */ public boolean lock(String path, CmsRepositoryLockInfo lock) throws CmsException { path = validatePath(path); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_LOCK_ITEM_1, path)); } m_cms.lockResource(path); return true; }
/** * @see org.opencms.repository.I_CmsRepositorySession#getItem(java.lang.String) */ public I_CmsRepositoryItem getItem(String path) throws CmsException { path = validatePath(path); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_READ_ITEM_1, path)); } CmsResource res = m_cms.readResource(path, CmsResourceFilter.DEFAULT); CmsRepositoryItem item = new CmsRepositoryItem(res, m_cms); return item; }
/** * @see org.opencms.repository.I_CmsRepositorySession#getItem(java.lang.String) */ public I_CmsRepositoryItem getItem(String path) throws CmsException { path = validatePath(path); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_READ_ITEM_1, path)); } CmsResource res = m_cms.readResource(path, CmsResourceFilter.DEFAULT); CmsRepositoryItem item = new CmsRepositoryItem(res, m_cms); return item; }
/** * @see org.opencms.repository.I_CmsRepositorySession#unlock(java.lang.String) */ public void unlock(String path) { try { path = validatePath(path); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_UNLOCK_ITEM_1, path)); } m_cms.unlockResource(path); } catch (CmsException ex) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.ERR_UNLOCK_FAILED_0), ex); } } }
/** * @see org.opencms.repository.I_CmsRepositorySession#unlock(java.lang.String) */ public void unlock(String path) { try { path = validatePath(path); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_UNLOCK_ITEM_1, path)); } m_cms.unlockResource(path); } catch (CmsException ex) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.ERR_UNLOCK_FAILED_0), ex); } } }
/** * @see org.opencms.repository.I_CmsRepositorySession#create(java.lang.String) */ public void create(String path) throws CmsException { path = validatePath(path); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_CREATE_ITEM_1, path)); } // create the folder CmsResource res = m_cms.createResource(path, CmsResourceTypeFolder.RESOURCE_TYPE_ID); // unlock new created folders if lock is not inherited if (!m_cms.getLock(res).isInherited()) { m_cms.unlockResource(path); } }
/** * @see org.opencms.repository.I_CmsRepositorySession#create(java.lang.String) */ public void create(String path) throws CmsException { path = validatePath(path); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_CREATE_ITEM_1, path)); } // create the folder CmsResource res = m_cms.createResource(path, CmsResourceTypeFolder.RESOURCE_TYPE_ID); // unlock new created folders if lock is not inherited if (!m_cms.getLock(res).isInherited()) { m_cms.unlockResource(path); } }
/** * @see org.opencms.repository.I_CmsRepositorySession#delete(java.lang.String) */ public void delete(String path) throws CmsException { path = validatePath(path); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_DELETE_ITEM_1, path)); } CmsRepositoryLockInfo lock = getLock(path); // lock resource m_cms.lockResource(path); // delete resource m_cms.deleteResource(path, CmsResource.DELETE_PRESERVE_SIBLINGS); // if deleting items out of a xml page restore lock state after deleting try { if (lock == null) { m_cms.unlockResource(path); } } catch (CmsException ex) { // noop } }
/** * @see org.opencms.repository.I_CmsRepositorySession#delete(java.lang.String) */ public void delete(String path) throws CmsException { path = validatePath(path); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_DELETE_ITEM_1, path)); } CmsRepositoryLockInfo lock = getLock(path); // lock resource m_cms.lockResource(path); // delete resource m_cms.deleteResource(path, CmsResource.DELETE_PRESERVE_SIBLINGS); // if deleting items out of a xml page restore lock state after deleting try { if (lock == null) { m_cms.unlockResource(path); } } catch (CmsException ex) { // noop } }
/** * @see org.opencms.repository.I_CmsRepositorySession#list(java.lang.String) */ public List<I_CmsRepositoryItem> list(String path) throws CmsException { List<I_CmsRepositoryItem> ret = new ArrayList<I_CmsRepositoryItem>(); path = validatePath(path); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_LIST_ITEMS_1, path)); } List<CmsResource> resources = m_cms.getResourcesInFolder(path, CmsResourceFilter.DEFAULT); Iterator<CmsResource> iter = resources.iterator(); while (iter.hasNext()) { CmsResource res = iter.next(); if (!isFiltered(m_cms.getRequestContext().removeSiteRoot(res.getRootPath()))) { // open the original resource (for virtual files this is the resource in the VFS // which the virtual resource is based on) // this filters e.g. property files for resources that are filtered out and thus // should not be displayed CmsResource org = m_cms.readResource(res.getStructureId(), CmsResourceFilter.DEFAULT); if (!isFiltered(m_cms.getRequestContext().removeSiteRoot(org.getRootPath()))) { ret.add(new CmsRepositoryItem(res, m_cms)); } } } if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_LIST_ITEMS_SUCESS_1, new Integer(ret.size()))); } return ret; }
/** * @see org.opencms.repository.I_CmsRepositorySession#list(java.lang.String) */ public List list(String path) throws CmsException { List ret = new ArrayList(); path = validatePath(path); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_LIST_ITEMS_1, path)); } List resources = m_cms.getResourcesInFolder(path, CmsResourceFilter.DEFAULT); Iterator iter = resources.iterator(); while (iter.hasNext()) { CmsResource res = (CmsResource)iter.next(); if (!isFiltered(m_cms.getRequestContext().removeSiteRoot(res.getRootPath()))) { // open the original resource (for virtual files this is the resource in the VFS // which the virtual resource is based on) // this filters e.g. property files for resources that are filtered out and thus // should not be displayed CmsResource org = m_cms.readResource(res.getStructureId(), CmsResourceFilter.DEFAULT); if (!isFiltered(m_cms.getRequestContext().removeSiteRoot(org.getRootPath()))) { ret.add(new CmsRepositoryItem(res, m_cms)); } } } if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_LIST_ITEMS_SUCESS_1, new Integer(ret.size()))); } return ret; }
src = validatePath(src); dest = validatePath(dest);
src = validatePath(src); dest = validatePath(dest);
src = validatePath(src); dest = validatePath(dest);
src = validatePath(src); dest = validatePath(dest);
/** * @see org.opencms.repository.I_CmsRepositorySession#getLock(java.lang.String) */ public CmsRepositoryLockInfo getLock(String path) { try { CmsRepositoryLockInfo lockInfo = new CmsRepositoryLockInfo(); path = validatePath(path); CmsResource res = m_cms.readResource(path, CmsResourceFilter.DEFAULT); // check user locks CmsLock cmsLock = m_cms.getLock(res); if (!cmsLock.isUnlocked()) { lockInfo.setPath(path); CmsUser owner = m_cms.readUser(cmsLock.getUserId()); if (owner != null) { lockInfo.setUsername(owner.getName()); lockInfo.setOwner(owner.getName() + "||" + owner.getEmail()); } return lockInfo; } return null; } catch (CmsException ex) { // error occurred while finding locks // return null (no lock found) return null; } }
/** * @see org.opencms.repository.I_CmsRepositorySession#getLock(java.lang.String) */ public CmsRepositoryLockInfo getLock(String path) { try { CmsRepositoryLockInfo lockInfo = new CmsRepositoryLockInfo(); path = validatePath(path); CmsResource res = m_cms.readResource(path, CmsResourceFilter.DEFAULT); // check user locks CmsLock cmsLock = m_cms.getLock(res); if (!cmsLock.isUnlocked()) { lockInfo.setPath(path); CmsUser owner = m_cms.readUser(cmsLock.getUserId()); if (owner != null) { lockInfo.setUsername(owner.getName()); lockInfo.setOwner(owner.getName() + "||" + owner.getEmail()); } return lockInfo; } return null; } catch (CmsException ex) { // error occurred while finding locks // return null (no lock found) return null; } }