/** * Returns the start HTML for a disabled direct edit button.<p> * * @param params the direct edit parameters * @param resourceInfo contains information about the resource to edit * * @return the start HTML for a disabled direct edit button */ public String startDirectEditDisabled(CmsDirectEditParams params, CmsDirectEditResourceInfo resourceInfo) { StringBuffer result = new StringBuffer(256); result.append("<!-- EDIT BLOCK START (DISABLED): "); result.append(params.m_resourceName); result.append(" ["); result.append(resourceInfo.getResource().getState()); result.append("] "); if (!resourceInfo.getLock().isUnlocked()) { result.append(" locked "); result.append(resourceInfo.getLock().getProject().getName()); } result.append(" -->\n"); return result.toString(); }
if (!resourceInfo.getLock().isUnlocked()) { result.append(" locked "); result.append(resourceInfo.getLock().getProject().getName());
if (!resourceInfo.getLock().isUnlocked()) { result.append(" locked "); result.append(resourceInfo.getLock().getProject().getName());
if (!resourceInfo.getLock().isUnlocked()) { result.append(" locked "); result.append(resourceInfo.getLock().getProject().getName());
if (!resourceInfo.getLock().isUnlocked()) { result.append(" locked "); result.append(resourceInfo.getLock().getProject().getName());
/** * Returns the inherited lock of a resource.<p> * * @param resourcename the name of the resource * @return the inherited lock or the null lock */ private CmsLock getParentLock(String resourcename) { CmsLock parentFolderLock = getParentFolderLock(resourcename); if (!parentFolderLock.isNullLock()) { return new CmsLock( resourcename, parentFolderLock.getUserId(), parentFolderLock.getProject(), CmsLockType.INHERITED); } return CmsLock.getNullLock(); }
/** * Returns the inherited lock of a resource.<p> * * @param resourcename the name of the resource * @return the inherited lock or the null lock */ private CmsLock getParentLock(String resourcename) { CmsLock parentFolderLock = getParentFolderLock(resourcename); if (!parentFolderLock.isNullLock()) { return new CmsLock( resourcename, parentFolderLock.getUserId(), parentFolderLock.getProject(), CmsLockType.INHERITED); } return CmsLock.getNullLock(); }
siblingName, exclusiveLock.getUserId(), exclusiveLock.getProject(), exclusiveLock.getSystemLock().getType()); lock = new CmsLock(siblingName, exclusiveLock.getUserId(), exclusiveLock.getProject(), type); } else { CmsLock editionLock = new CmsLock( siblingName, exclusiveLock.getUserId(), exclusiveLock.getProject(), type); lock.setRelatedLock(editionLock);
siblingName, exclusiveLock.getUserId(), exclusiveLock.getProject(), exclusiveLock.getSystemLock().getType()); lock = new CmsLock(siblingName, exclusiveLock.getUserId(), exclusiveLock.getProject(), type); } else { CmsLock editionLock = new CmsLock( siblingName, exclusiveLock.getUserId(), exclusiveLock.getProject(), type); lock.setRelatedLock(editionLock);
/** * Returns the related Lock.<p> * * @return the related Lock */ protected CmsLock getRelatedLock() { if (m_relatedLock == null) { CmsLockType type; if (isSystemLock()) { type = CmsLockType.UNLOCKED; } else { type = CmsLockType.SYSTEM_UNLOCKED; } CmsLock lock = new CmsLock(getResourceName(), getUserId(), getProject(), type); lock.setRelatedLock(this); if (isUnlocked()) { // prevent the null lock gets modified return lock; } m_relatedLock = lock; } return m_relatedLock; }
/** * Returns the related Lock.<p> * * @return the related Lock */ protected CmsLock getRelatedLock() { if (m_relatedLock == null) { CmsLockType type; if (isSystemLock()) { type = CmsLockType.UNLOCKED; } else { type = CmsLockType.SYSTEM_UNLOCKED; } CmsLock lock = new CmsLock(getResourceName(), getUserId(), getProject(), type); lock.setRelatedLock(this); if (isUnlocked()) { // prevent the null lock gets modified return lock; } m_relatedLock = lock; } return m_relatedLock; }
/** * Moves a lock during the move resource operation.<p> * * @param source the source root path * @param destination the destination root path */ public void moveResource(String source, String destination) { CmsLock lock = OpenCms.getMemoryMonitor().getCachedLock(source); if (lock != null) { OpenCms.getMemoryMonitor().uncacheLock(lock.getResourceName()); CmsLock newLock = new CmsLock(destination, lock.getUserId(), lock.getProject(), lock.getType()); lock = lock.getRelatedLock(); if ((lock != null) && !lock.isNullLock()) { CmsLock relatedLock = new CmsLock(destination, lock.getUserId(), lock.getProject(), lock.getType()); newLock.setRelatedLock(relatedLock); } OpenCms.getMemoryMonitor().cacheLock(newLock); } }
/** * Moves a lock during the move resource operation.<p> * * @param source the source root path * @param destination the destination root path */ public void moveResource(String source, String destination) { CmsLock lock = OpenCms.getMemoryMonitor().getCachedLock(source); if (lock != null) { OpenCms.getMemoryMonitor().uncacheLock(lock.getResourceName()); CmsLock newLock = new CmsLock(destination, lock.getUserId(), lock.getProject(), lock.getType()); lock = lock.getRelatedLock(); if ((lock != null) && !lock.isNullLock()) { CmsLock relatedLock = new CmsLock(destination, lock.getUserId(), lock.getProject(), lock.getType()); newLock.setRelatedLock(relatedLock); } OpenCms.getMemoryMonitor().cacheLock(newLock); } }
/** * @see org.opencms.workflow.CmsDefaultPublishResourceFormatter.I_PublishResourceValidator#getInfoForResource(org.opencms.file.CmsResource) */ public CmsPublishResourceInfo getInfoForResource(CmsResource resource) throws CmsException { String info; CmsPublishResourceInfo.Type infoType; CmsPublishResourceInfo infoObj; CmsLock lock = m_cms.getLock(resource); info = Messages.get().getBundle(getLocale()).key( Messages.GUI_RESOURCE_LOCKED_BY_2, getOuAwareName(m_cms, m_cms.readUser(lock.getUserId()).getName()), getOuAwareName(m_cms, lock.getProject().getName())); infoType = CmsPublishResourceInfo.Type.LOCKED; infoObj = new CmsPublishResourceInfo(info, infoType); return infoObj; } }