@Override public int countSiblingsNamed( Name childName ) { return childRefs.getChildCount(childName); } };
@Override public int countSiblingsNamed( Name childName ) { return childRefs.getChildCount(childName); } };
@Override public int getChildCount( Name name ) { return secondReferences.getChildCount(name) + firstReferences.getChildCount(name); }
@Override public int getChildCount( Name name ) { return secondReferences.getChildCount(name) + firstReferences.getChildCount(name); }
@Override public int countSiblingsNamed( Name childName ) { return node.getChildReferences(cache).getChildCount(childName); } };
@Override public int countSiblingsNamed( Name childName ) { return node.getChildReferences(cache).getChildCount(childName); } };
@Override public int getChildCount( Name name ) { int result = 0; Segment segment = this.firstSegment; while (segment != null) { result += segment.getReferences().getChildCount(name); segment = segment.next(cache); } return result; }
@Override public int getChildCount( Name name ) { int result = 0; Segment segment = this.firstSegment; while (segment != null) { result += segment.getReferences().getChildCount(name); segment = segment.next(cache); } return result; }
int existingChildrenWithSameName = persistedChildReferences.getChildCount(childName); if (existingChildrenWithSameName == 0) { continue;
int numSnsInPersisted = persisted.getChildCount(ref.getName()); if (numSnsInPersisted != 0) {
int numSnsInPersisted = persisted.getChildCount(ref.getName()); if (numSnsInPersisted != 0) {
ChildReferences federationChildRefs = federationNode.getChildReferences(systemSession); int projectionsCount = federationChildRefs.getChildCount(ModeShapeLexicon.PROJECTION);
ChildReferences federationChildRefs = federationNode.getChildReferences(systemSession); int projectionsCount = federationChildRefs.getChildCount(ModeShapeLexicon.PROJECTION);
private void assertUniqueChildren( JcrSession session, String nodeAbsPath, Set<String> names ) throws RepositoryException { ChildReferences childReferences = session.getNode(nodeAbsPath).node().getChildReferences(session.cache()); for (String name : names) { assertEquals(1, childReferences.getChildCount(session.nameFactory().create(name))); } }
void addSharedNode( AbstractJcrNode shareableNode, Name newNodeName ) throws RepositoryException { assert session == shareableNode.session; session.checkPermission(this, ModeShapePermissions.ADD_NODE); if (isLockedByAnotherSession()) { throw new LockException(JcrI18n.lockTokenNotHeld.text(location())); } // Determine the node type based upon this node's type information ... SessionCache cache = sessionCache(); MutableCachedNode node = mutable(); // validate there is an appropriate child node definition JcrNodeDefinition childDefn = validateChildNodeDefinition(newNodeName, shareableNode.getPrimaryTypeName(), true); // See if this node is checked in. If so, then we can only create children if the child // node definition has an OPV of 'ignore'. See Section 15.2.2 of the JSR-283 spec for details ... if (!isCheckedOut() && childDefn.getOnParentVersion() != OnParentVersionAction.IGNORE) { // The OPV is not 'ignore', so we can't create the new node ... Path parentPath = path(); String parentPathStr = readable(parentPath); int numExistingSns = node.getChildReferences(cache).getChildCount(newNodeName); int sns = numExistingSns + 1; String segment = readable(session.pathFactory().createSegment(newNodeName, sns)); String opv = OnParentVersionAction.nameFromValue(childDefn.getOnParentVersion()); I18n msg = JcrI18n.cannotCreateChildOnCheckedInNodeSinceOpvOfChildDefinitionIsNotIgnore; throw new VersionException(msg.text(segment, readable(parentPathStr), childDefn.getName(), opv)); } // We can create the shared node ... NodeKey childKey = shareableNode.key(); node.linkChild(cache, childKey, newNodeName); }
void addSharedNode( AbstractJcrNode shareableNode, Name newNodeName ) throws RepositoryException { assert session == shareableNode.session; session.checkPermission(this, ModeShapePermissions.ADD_NODE); if (isLockedByAnotherSession()) { throw new LockException(JcrI18n.lockTokenNotHeld.text(location())); } // Determine the node type based upon this node's type information ... SessionCache cache = sessionCache(); MutableCachedNode node = mutable(); // validate there is an appropriate child node definition JcrNodeDefinition childDefn = validateChildNodeDefinition(newNodeName, shareableNode.getPrimaryTypeName(), true); // See if this node is checked in. If so, then we can only create children if the child // node definition has an OPV of 'ignore'. See Section 15.2.2 of the JSR-283 spec for details ... if (!isCheckedOut() && childDefn.getOnParentVersion() != OnParentVersionAction.IGNORE) { // The OPV is not 'ignore', so we can't create the new node ... Path parentPath = path(); String parentPathStr = readable(parentPath); int numExistingSns = node.getChildReferences(cache).getChildCount(newNodeName); int sns = numExistingSns + 1; String segment = readable(session.pathFactory().createSegment(newNodeName, sns)); String opv = OnParentVersionAction.nameFromValue(childDefn.getOnParentVersion()); I18n msg = JcrI18n.cannotCreateChildOnCheckedInNodeSinceOpvOfChildDefinitionIsNotIgnore; throw new VersionException(msg.text(segment, readable(parentPathStr), childDefn.getName(), opv)); } // We can create the shared node ... NodeKey childKey = shareableNode.key(); node.linkChild(cache, childKey, newNodeName); }
Name nodeName = nodeDefn.getInternalName(); if (refs == null) refs = node.getChildReferences(cache); if (refs.getChildCount(nodeName) == 0) { JcrNodeType defaultPrimaryType = nodeDefn.getDefaultPrimaryType(); assert defaultPrimaryType != null;
Name nodeName = nodeDefn.getInternalName(); if (refs == null) refs = node.getChildReferences(cache); if (refs.getChildCount(nodeName) == 0) { JcrNodeType defaultPrimaryType = nodeDefn.getDefaultPrimaryType(); assert defaultPrimaryType != null;
int numExistingSns = node.getChildReferences(cache).getChildCount(childName); int sns = numExistingSns + 1; String segment = readable(session.pathFactory().createSegment(childName, sns));
int numExistingSns = node.getChildReferences(cache).getChildCount(childName); int sns = numExistingSns + 1; String segment = readable(session.pathFactory().createSegment(childName, sns));