@Override public NodeKey getRootKey() { return delegate.getRootKey(); }
@Override public NodeKey getRootKey() { return delegate.getRootKey(); }
/** * Checks if the node given key is foreign by comparing the source key & workspace key against the same keys from this * session's root. This method is used for reference resolving. * * @param key the node key; may be null * @return true if the node key is considered foreign, false otherwise. */ protected final boolean isForeignKey( NodeKey key ) { return isForeignKey(key, cache.getRootKey()); }
/** * Returns a string representing a node's identifier, based on whether the node is foreign or not. * * @param key the node key; may be null * @return the identifier for the node; never null * @see javax.jcr.Node#getIdentifier() */ protected final String nodeIdentifier( NodeKey key ) { return nodeIdentifier(key, cache.getRootKey()); }
/** * Checks if the node given key is foreign by comparing the source key & workspace key against the same keys from this * session's root. This method is used for reference resolving. * * @param key the node key; may be null * @return true if the node key is considered foreign, false otherwise. */ protected final boolean isForeignKey( NodeKey key ) { return isForeignKey(key, cache.getRootKey()); }
/** * Returns a string representing a node's identifier, based on whether the node is foreign or not. * * @param key the node key; may be null * @return the identifier for the node; never null * @see javax.jcr.Node#getIdentifier() */ protected final String nodeIdentifier( NodeKey key ) { return nodeIdentifier(key, cache.getRootKey()); }
protected boolean shouldProcessSourceKey( NodeKey sourceKey ) { return !sourceKey.equals(sourceCache.getRootKey()) && !sourceKey.getWorkspaceKey().equalsIgnoreCase(systemWorkspaceKey); } }
protected boolean shouldProcessSourceKey( NodeKey sourceKey ) { return !sourceKey.equals(sourceCache.getRootKey()) && !sourceKey.getWorkspaceKey().equalsIgnoreCase(systemWorkspaceKey); } }
private Set<NodeKey> filterNodeKeysForClone( Set<NodeKey> sourceKeys, SessionCache sourceCache ) { Set<NodeKey> filteredSet = new HashSet<NodeKey>(); for (NodeKey sourceKey : sourceKeys) { if (sourceKey.equals(sourceCache.getRootKey()) || sourceKey.getWorkspaceKey().equalsIgnoreCase(repository().systemWorkspaceKey())) { continue; } filteredSet.add(sourceKey); } return filteredSet; }
private Set<NodeKey> filterNodeKeysForClone( Set<NodeKey> sourceKeys, SessionCache sourceCache ) { Set<NodeKey> filteredSet = new HashSet<NodeKey>(); for (NodeKey sourceKey : sourceKeys) { if (sourceKey.equals(sourceCache.getRootKey()) || sourceKey.getWorkspaceKey().equalsIgnoreCase(repository().systemWorkspaceKey())) { continue; } filteredSet.add(sourceKey); } return filteredSet; }
protected MutableCachedNode createNode( SessionCache session, MutableCachedNode parent, String id, Name name, Name primaryType, Property... properties ) { NodeKey key = session.getRootKey().withId(id); return parent.createChild(session, key, name, propFactory.create(JcrLexicon.PRIMARY_TYPE, primaryType), properties); }
protected MutableCachedNode createNode( SessionCache session, MutableCachedNode parent, String id, Name name, Name primaryType, Property... properties ) { NodeKey key = session.getRootKey().withId(id); return parent.createChild(session, key, name, propFactory.create(JcrLexicon.PRIMARY_TYPE, primaryType), properties); }
/** * Checks if this node belongs to an external source. * * @return true if the node is not repository-local */ protected final boolean isExternal() { return !key().getSourceKey().equals(session().cache().getRootKey().getSourceKey()); }
/** * Checks if this node belongs to an external source. * * @return true if the node is not repository-local */ protected final boolean isExternal() { return !key().getSourceKey().equals(session().cache().getRootKey().getSourceKey()); }
public NodeKey systemKey() { if (systemKey == null) { // This is idempotent, so no need to lock CachedNode rootNode = system.getNode(system.getRootKey()); ChildReference systemRef = rootNode.getChildReferences(system).getChild(JcrLexicon.SYSTEM); systemKey = systemRef.getKey(); } return systemKey; }
public NodeKey systemKey() { if (systemKey == null) { // This is idempotent, so no need to lock CachedNode rootNode = system.getNode(system.getRootKey()); ChildReference systemRef = rootNode.getChildReferences(system).getChild(JcrLexicon.SYSTEM); systemKey = systemRef.getKey(); } return systemKey; }
private CachedNode getSystemNode( SessionCache systemSession ) { CachedNode systemRoot = systemSession.getNode(systemSession.getRootKey()); ChildReference systemNodeRef = systemRoot.getChildReferences(systemSession).getChild(JcrLexicon.SYSTEM); assert systemNodeRef != null; return systemSession.getNode(systemNodeRef.getKey()); }
private CachedNode getSystemNode( SessionCache systemSession ) { CachedNode systemRoot = systemSession.getNode(systemSession.getRootKey()); ChildReference systemNodeRef = systemRoot.getChildReferences(systemSession).getChild(JcrLexicon.SYSTEM); assert systemNodeRef != null; return systemSession.getNode(systemNodeRef.getKey()); }
@Test public void shouldReturnTransientKeysAtOrBelowNodeWithRemovedChild() { NodeKey rootKey = session1.getRootKey(); MutableCachedNode root = session1.mutable(rootKey); SessionCache sessionCache = session(); NodeKey childKey = newKey("x-childA"); MutableCachedNode child = root.createChild(sessionCache, childKey, name("childA"), property("p1", "value A")); session1.destroy(child.getKey()); assertEquals(new HashSet<NodeKey>(Arrays.asList(rootKey, childKey)), session1.getChangedNodeKeysAtOrBelow(root)); } }
@Test public void shouldReturnAllTransientNodeKeys() { NodeKey rootKey = session1.getRootKey(); MutableCachedNode root = session1.mutable(rootKey); NodeKey childAKey = root.createChild(session(), newKey("x-childA"), name("childA"), property("p1", "value A")).getKey(); NodeKey childBKey = root.createChild(session(), newKey("x-childB"), name("childB"), property("p1", "value B")).getKey(); Set<NodeKey> transientNodeKeys = session1.getChangedNodeKeys(); assertEquals(new HashSet<NodeKey>(Arrays.asList(rootKey, childAKey, childBKey)), transientNodeKeys); }