/** * Returns an extended filter with the given user restriction.<p> * * @param user the user to filter * * @return an extended filter with the given user restriction */ public CmsLockFilter filterNotLockableByUser(CmsUser user) { CmsLockFilter filter = (CmsLockFilter)clone(); filter.m_notLockableByUser = user; return filter; }
/** * Returns <code>true</code> if this is a persistent lock that should be saved when the systems shuts down.<p> * * @return <code>true</code> if this is a persistent lock that should be saved when the systems shuts down */ public boolean isPersistent() { return m_type.isPersistent(); }
/** * Returns <code>true</code> if this is an inherited lock, which may either be directly or shared inherited.<p> * * @return <code>true</code> if this is an inherited lock, which may either be directly or shared inherited */ public boolean isInherited() { return m_type.isInherited(); }
/** * Returns <code>true</code> if this is an exclusive (or temporary exclusive) lock, * and the given user is the owner of this lock.<p> * * @param user the user to compare to the owner of this lock * * @return <code>true</code> if this is an exclusive (or temporary exclusive) lock, * and the given user is the owner of this lock */ public boolean isExclusiveOwnedBy(CmsUser user) { return isExclusive() && isOwnedBy(user); }
/** * Returns <code>true</code> if this lock is the <code>NULL</code> lock which can * be obtained by {@link #getNullLock()}.<p> * * Only for the <code>NULL</code> lock, {@link #isUnlocked()} is <code>true</code>.<p> * * @return <code>true</code> if this lock is the <code>NULL</code> lock */ public boolean isNullLock() { return isUnlocked(); }
/** * Returns the edition lock.<p> * * @return the edition lock */ public CmsLock getEditionLock() { if (isSystemLock()) { return getRelatedLock(); } return this; }
/** * Returns <code>true</code> if this is an inherited lock, which may either be directly or shared inherited.<p> * * @return <code>true</code> if this is an inherited lock, which may either be directly or shared inherited */ public boolean isInherited() { return (isDirectlyInherited() || isSharedInherited()); }
/** * Returns <code>true</code> if this is a shared lock.<p> * * @return <code>true</code> if this is a shared lock */ public boolean isShared() { return (isSharedExclusive() || isSharedInherited()); }
/** * Counts the locked resources in this project.<p> * * @param project the project to count the locked resources in * * @return the amount of locked resources in this project */ public int countLockedResources(CmsProject project) { // count locks return m_lockManager.countExclusiveLocksInProject(project); }
/** * Returns <code>true</code> if this is an exclusive (or temporary exclusive) lock.<p> * * @return <code>true</code> if this is an exclusive (or temporary exclusive) lock */ public boolean isExclusive() { return m_type.isExclusive(); }
/** * Returns <code>true</code> if this is a shared lock.<p> * * @return <code>true</code> if this is a shared lock */ public boolean isShared() { return m_type.isShared(); }
/** * Locks the current resource.<p> * * @throws CmsException in case locking the resource fails */ private void ensureLock() throws CmsException { if (m_lockActionRecord == null) { m_lockActionRecord = CmsLockUtil.ensureLock(m_cms, m_resource); } }
/** * Returns an extended filter that will extend the result to the given path and all its parents.<p> * * @return an extended filter to search the subresources of the given path */ public CmsLockFilter filterIncludeParents() { CmsLockFilter filter = (CmsLockFilter)clone(); filter.m_includeParents = true; return filter; }
/** * Returns <code>true</code> if this is a persistent lock that should be saved when the systems shuts down.<p> * * @return <code>true</code> if this is a persistent lock that should be saved when the systems shuts down */ public boolean isPersistent() { return m_type.isPersistent(); }
/** * Returns an extended filter with the given user restriction.<p> * * @param user the user to filter * * @return an extended filter with the given user restriction */ public CmsLockFilter filterNotLockableByUser(CmsUser user) { CmsLockFilter filter = (CmsLockFilter)this.clone(); filter.m_notLockableByUser = user; return filter; }
/** * Returns an extended filter with the given user restriction.<p> * * @param userId the user id to filter * * @return an extended filter with the given user restriction */ public CmsLockFilter filterOwnedByUserId(CmsUUID userId) { CmsLockFilter filter = (CmsLockFilter)this.clone(); filter.m_ownedByUserId = userId; return filter; }
/** * Returns an extended filter with the given user restriction.<p> * * @param userId the user id to filter * * @return an extended filter with the given user restriction */ public CmsLockFilter filterOwnedByUserId(CmsUUID userId) { CmsLockFilter filter = (CmsLockFilter)clone(); filter.m_ownedByUserId = userId; return filter; }
/** * Returns an extended filter with the given project restriction.<p> * * @param projectId the project to filter the locks with * * @return an extended filter with the given project restriction */ public CmsLockFilter filterProject(CmsUUID projectId) { CmsLockFilter filter = (CmsLockFilter)clone(); filter.m_projectId = projectId; return filter; }
/** * Returns an extended filter that also matches shared exclusive locks (siblings).<p> * * @return an extended filter that also matches shared exclusive locks */ public CmsLockFilter filterSharedExclusive() { CmsLockFilter filter = (CmsLockFilter)clone(); filter.m_sharedExclusive = true; return filter; }