/** * Locks a resource.<p> * * This will be an exclusive, persistent lock that is removed only if the user unlocks it.<p> * * @param resourcename the name of the resource to lock (full current site relative path) * * @throws CmsException if something goes wrong */ public void lockResource(String resourcename) throws CmsException { lockResource(resourcename, CmsLockType.EXCLUSIVE); }
/** * @see org.opencms.file.wrapper.I_CmsResourceWrapper#lockResource(org.opencms.file.CmsObject, java.lang.String, boolean) */ public boolean lockResource(CmsObject cms, String resourcename, boolean temporary) throws CmsException { if (m_isWrappedResource) { if (temporary) { cms.lockResourceTemporary(resourcename); } else { cms.lockResource(resourcename); } return true; } return false; }
/** * Locks a resource.<p> * * This will be an exclusive, persistent lock that is removed only if the user unlocks it.<p> * * @param resourcename the name of the resource to lock (full current site relative path) * * @throws CmsException if something goes wrong */ public void lockResource(String resourcename) throws CmsException { lockResource(resourcename, CmsLockType.EXCLUSIVE); }
/** * @see org.opencms.file.wrapper.A_CmsResourceWrapper#lockResource(org.opencms.file.CmsObject, java.lang.String, boolean) */ @Override public boolean lockResource(CmsObject cms, String resourcename, boolean temporary) throws CmsException { CmsResource res = getResource(cms, resourcename); if (res != null) { String path = cms.getRequestContext().removeSiteRoot(res.getRootPath()); if (temporary) { cms.lockResourceTemporary(path); } else { cms.lockResource(path); } return true; } return false; }
/** * @see org.opencms.file.wrapper.I_CmsResourceWrapper#lockResource(CmsObject, String) */ public boolean lockResource(CmsObject cms, String resourcename) throws CmsException { if (m_isWrappedResource) { cms.lockResource(resourcename); return true; } return false; }
/** * @see org.opencms.file.wrapper.A_CmsResourceWrapper#lockResource(org.opencms.file.CmsObject, java.lang.String, boolean) */ @Override public boolean lockResource(CmsObject cms, String resourcename, boolean temporary) throws CmsException { CmsResource res = getResource(cms, resourcename, CmsResourceFilter.DEFAULT); if (res != null) { String path = cms.getRequestContext().removeSiteRoot(res.getRootPath()); if (temporary) { cms.lockResourceTemporary(path); } else { cms.lockResource(path); } return true; } return false; }
/** * Locks a resource temporary.<p> * * This will be an exclusive, temporary lock valid only for the current users session. * Usually this should not be used directly, this method is intended for the OpenCms workplace only.<p> * * @param resourcename the name of the resource to lock (full current site relative path) * * @throws CmsException if something goes wrong * * @see CmsObject#lockResource(String) */ public void lockResourceTemporary(String resourcename) throws CmsException { lockResource(resourcename, CmsLockType.TEMPORARY); }
/** * @see org.opencms.file.wrapper.A_CmsResourceWrapper#lockResource(org.opencms.file.CmsObject, java.lang.String, boolean) */ @Override public boolean lockResource(CmsObject cms, String resourcename, boolean temporary) throws CmsException { CmsResource res = findXmlPage(cms, resourcename); if (res != null) { String path = cms.getRequestContext().removeSiteRoot(res.getRootPath()); if (temporary) { cms.lockResourceTemporary(path); } else { cms.lockResource(path); } return true; } return false; }
/** * Locks a resource temporary.<p> * * This will be an exclusive, temporary lock valid only for the current users session. * Usually this should not be used directly, this method is intended for the OpenCms workplace only.<p> * * @param resourcename the name of the resource to lock (full current site relative path) * * @throws CmsException if something goes wrong * * @see CmsObject#lockResource(String) */ public void lockResourceTemporary(String resourcename) throws CmsException { lockResource(resourcename, CmsLockType.TEMPORARY); }
/** * Deletes a resource.<p> * * @param name the name of the resource to delete * * @throws Exception if something goes wrong */ public void deleteResource(String name) throws Exception { m_cms.lockResource(name); m_cms.deleteResource(name, CmsResource.DELETE_PRESERVE_SIBLINGS); }
/** * Deletes a resource together with its siblings.<p> * * @param name the name of the resource to delete * * @throws Exception if something goes wrong */ public void deleteResourceWithSiblings(String name) throws Exception { m_cms.lockResource(name); m_cms.deleteResource(name, CmsResource.DELETE_REMOVE_SIBLINGS); }
/** * Locks a resource.<p> * * The <code>mode</code> parameter controls what kind of lock is used.<br> * * @param resourcename the name of the resource to lock (full path) * @param mode flag indicating the mode for the lock * * @throws CmsException if something goes wrong * * @deprecated use {@link #lockResource(String)} or {@link #lockResourceTemporary(String)} instead */ public void lockResource(String resourcename, int mode) throws CmsException { lockResource(resourcename, CmsLockType.valueOf(mode)); }
/** * Writes the given property to the resource as structure value.<p> * * @param resourceName the resource to write the value to * @param propertyName the property to write the value to * @param value the value to write * * @throws CmsException if something goes wrong */ public void writeProperty(String resourceName, String propertyName, String value) throws CmsException { m_cms.lockResource(resourceName); m_cms.writePropertyObject(resourceName, new CmsProperty(propertyName, value, null)); }
/** * Locks the given resource (if required).<p> * * @param cms the OpenCms user context * @param lock the previous lock status of the resource * @param res the resource to lock * * @throws CmsException in case something goes wrong */ private void lockResource(CmsObject cms, CmsLock lock, CmsResource res) throws CmsException { if (lock.isNullLock()) { cms.lockResource(res.getRootPath()); } }
/** * Locks the given resource (if required).<p> * * @param cms the OpenCms user context * @param lock the previous lock status of the resource * @param res the resource to lock * * @throws CmsException in case something goes wrong */ private void lockResource(CmsObject cms, CmsLock lock, CmsResource res) throws CmsException { if (lock.isNullLock()) { cms.lockResource(res.getRootPath()); } }
/** * @see org.opencms.file.wrapper.A_CmsResourceWrapper#lockResource(org.opencms.file.CmsObject, java.lang.String) */ @Override public boolean lockResource(CmsObject cms, String resourcename) throws CmsException { CmsResource res = getResource(cms, resourcename, CmsResourceFilter.DEFAULT); if (res != null) { cms.lockResource(cms.getRequestContext().removeSiteRoot(res.getRootPath())); return true; } return false; }
/** * Changes the access control for a given resource and a given principal(user/group). * * @param resourceName name of the resource * @param principalType the type of the principal (group or user) * @param principalName name of the principal * @param permissionString the permissions in the format ((+|-)(r|w|v|c|i))* * @throws CmsException if something goes wrong * @see CmsObject#chacc(String, String, String, String) */ public void chacc(String resourceName, String principalType, String principalName, String permissionString) throws CmsException { m_cms.lockResource(resourceName); if (I_CmsPrincipal.PRINCIPAL_GROUP.equalsIgnoreCase(principalType.trim())) { principalName = OpenCms.getImportExportManager().translateGroup(principalName); } else { principalName = OpenCms.getImportExportManager().translateUser(principalName); } m_cms.chacc(resourceName, principalType, principalName, permissionString); }
/** * Changes the access control for a given resource and a given principal(user/group). * * @param resourceName name of the resource * @param principalType the type of the principal (group or user) * @param principalName name of the principal * @param permissionString the permissions in the format ((+|-)(r|w|v|c|i))* * @throws CmsException if something goes wrong * @see CmsObject#chacc(String, String, String, String) */ public void chacc(String resourceName, String principalType, String principalName, String permissionString) throws CmsException { m_cms.lockResource(resourceName); if (I_CmsPrincipal.PRINCIPAL_GROUP.equalsIgnoreCase(principalType.trim())) { principalName = OpenCms.getImportExportManager().translateGroup(principalName); } else { principalName = OpenCms.getImportExportManager().translateUser(principalName); } m_cms.chacc(resourceName, principalType, principalName, permissionString); }
/** * @see org.opencms.file.wrapper.A_CmsResourceWrapper#lockResource(org.opencms.file.CmsObject, java.lang.String) */ @Override public boolean lockResource(CmsObject cms, String resourcename) throws CmsException { CmsResource res = findXmlPage(cms, resourcename); if (res != null) { cms.lockResource(cms.getRequestContext().removeSiteRoot(res.getRootPath())); return true; } return false; }
/** * @see org.opencms.file.wrapper.A_CmsResourceWrapper#lockResource(org.opencms.file.CmsObject, java.lang.String) */ @Override public boolean lockResource(CmsObject cms, String resourcename) throws CmsException { CmsResource res = getResource(cms, resourcename); if (res != null) { cms.lockResource(cms.getRequestContext().removeSiteRoot(res.getRootPath())); return true; } return false; }