public boolean jsFunction_getLocked() { try { return node.isLocked(); } catch (RepositoryException re) { return false; } }
@Override public boolean isLocked() throws RepositoryException { return this.node.isLocked(); }
@Override public boolean canOperateOnNode(final Node node) throws Exception { return !node.isLocked(); }
/** {@inheritDoc} */ public boolean isLocked() throws RepositoryException, RemoteException { try { return node.isLocked(); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
private void logLockStatus(Node node, boolean isLock) throws RepositoryException { if (log.isDebugEnabled()) { // this log obtains too much data to processed all the time when not enabled log.debug("{} {} {}locked {}:{}", node.getSession(), isLock ^ node.isLocked() ? "DIDN'T" : "DID", isLock ? "" : "un", node.getSession().getWorkspace().getName(), node.getPath()); } } }
private boolean isLocked() { try { final Node node = getModelObject(); return node != null && node.isLocked(); } catch (RepositoryException e) { log.error("An error occurred determining if node is locked.", e); return false; } }
private boolean isLocked() { try { final Node node = getModelObject(); return node != null && node.isLocked(); } catch (RepositoryException e) { log.error("An error occurred determining if node is locked.", e); return false; } }
private void unlock(Node node) throws RepositoryException { if (node != null && node.isLocked()) { node.getSession().getWorkspace().getLockManager().unlock(node.getPath()); logLockStatus(node, false); } }
/** * @see javax.jcr.lock.LockManager#isLocked(String) */ public boolean isLocked(String absPath) throws RepositoryException { Node n = itemManager.getNode(resolver.getQPath(absPath)); return n.isLocked(); }
public boolean isLocked(final String absPath) { try { final Node node = getNode(absPath); return node.isLocked(); } catch (RepositoryException e) { // node.isLocked() RepositoryException if an error occurs. throw new org.apache.jackrabbit.ocm.exception.RepositoryException("An exception was thrown while checking the lock at path : " + absPath, e); } }
/** * @see javax.jcr.lock.LockManager#isLocked(String) */ public boolean isLocked(String absPath) throws RepositoryException { Node n = itemManager.getNode(resolver.getQPath(absPath)); return n.isLocked(); }
/** * Test {@link LockManager#isLocked(String)} and {@link javax.jcr.Node#isLocked()}. * * @throws RepositoryException If an exception occurs. */ public void testNodeIsLocked() throws RepositoryException { assertTrue("Node must be locked after lock creation.", lockedNode.isLocked()); assertTrue("Node must be locked after lock creation.", lockMgr.isLocked(lockedNode.getPath())); }
public static boolean isLocked( final PentahoJcrConstants pentahoJcrConstants, final Node node ) throws RepositoryException { Assert.notNull( node ); if ( node.isNodeType( pentahoJcrConstants.getNT_FROZENNODE() ) ) { // frozen nodes are never locked return false; } boolean locked = node.isLocked(); if ( locked ) { Assert.isTrue( node.isNodeType( pentahoJcrConstants.getMIX_LOCKABLE() ) ); } return locked; }
/** * {@inheritDoc} */ public void addLockTokenToSessionIfNecessary( final Session session, final PentahoJcrConstants pentahoJcrConstants, final Serializable fileId ) throws RepositoryException { Node fileNode = session.getNodeByIdentifier( fileId.toString() ); if ( fileNode.isLocked() ) { LockManager lockManager = session.getWorkspace().getLockManager(); Lock lock = lockManager.getLock( fileNode.getPath() ); String lockToken = getLockToken( session, pentahoJcrConstants, lock ); lockManager.addLockToken( lockToken ); } }
/** * {@inheritDoc} */ public void removeLockTokenFromSessionIfNecessary( final Session session, final PentahoJcrConstants pentahoJcrConstants, final Serializable fileId ) throws RepositoryException { Node fileNode = session.getNodeByIdentifier( fileId.toString() ); if ( fileNode.isLocked() ) { LockManager lockManager = session.getWorkspace().getLockManager(); Lock lock = lockManager.getLock( fileNode.getPath() ); String lockToken = getLockToken( session, pentahoJcrConstants, lock ); lockManager.removeLockToken( lockToken ); } }
public void testIsLockedNewChild() throws RepositoryException { Node newChild = lockedNode.addNode(nodeName3, testNodeType); assertEquals("New child node must be locked according to isDeep flag.", isDeep(), newChild.isLocked()); assertEquals("New child node must be locked according to isDeep flag.", isDeep(), lockMgr.isLocked(newChild.getPath())); }
public Object doInJcr( final Session session ) throws RepositoryException { Item item = session.getItem( absPath ); Assert.isTrue( item.isNode() ); return ( (Node) item ).isLocked(); } } );
public void testReorder() throws Exception { testRootNode.addNode(nodeName2); testRootNode.addNode(nodeName3); testRootNode.save(); // move last node in front of first testRootNode.orderBefore(lockedNode.getName(), nodeName3); testRootNode.save(); assertTrue("Node must remain locked upon reordering", testRootNode.getNode(lockedNode.getName()).isLocked()); }
public void execute(Session session, Node test) throws RepositoryException { Node n = test.addNode("test"); n.addMixin(mixLockable); session.save(); for (int i = 0; i < NUM_OPERATIONS / CONCURRENCY; i++) { if (n.isLocked()) { n.unlock(); } n.lock(false, true); } } }, CONCURRENCY);
private void assertLocking( Session session, String path, boolean locked ) throws Exception { Node node = session.getNode(path); if (locked) { assertTrue(node.isLocked()); assertTrue(node.hasProperty(JcrLexicon.LOCK_IS_DEEP.getString())); assertTrue(node.hasProperty(JcrLexicon.LOCK_OWNER.getString())); } else { assertFalse(node.isLocked()); assertFalse(node.hasProperty(JcrLexicon.LOCK_IS_DEEP.getString())); assertFalse(node.hasProperty(JcrLexicon.LOCK_OWNER.getString())); } }