/** * Throw a {@link ConstraintViolationException} if this node is protected (based on the its node definition). * * @throws ConstraintViolationException if this node's definition indicates that the node is protected * @throws RepositoryException if an error occurs retrieving the definition for this node */ private void checkNotProtected() throws ConstraintViolationException, RepositoryException { if (getDefinition().isProtected()) { throw new ConstraintViolationException(JcrI18n.cannotRemoveItemWithProtectedDefinition.text(getPath())); } }
/** * Throw a {@link ConstraintViolationException} if this node is protected (based on the its node definition). * * @throws ConstraintViolationException if this node's definition indicates that the node is protected * @throws RepositoryException if an error occurs retrieving the definition for this node */ private void checkNotProtected() throws ConstraintViolationException, RepositoryException { if (getDefinition().isProtected()) { throw new ConstraintViolationException(JcrI18n.cannotRemoveItemWithProtectedDefinition.text(getPath())); } }
boolean nodeAlreadyExists = existingNode != null && existingNode.getDefinition().isAutoCreated();
boolean nodeAlreadyExists = existingNode != null && existingNode.getDefinition().isAutoCreated();
onParentVersion = OnParentVersionAction.COPY; } else { onParentVersion = node.getDefinition().getOnParentVersion();
@Override public boolean isCheckedOut() throws RepositoryException { AbstractJcrNode node = this; SessionCache cache = sessionCache(); ValueFactory<Boolean> booleanFactory = session.context().getValueFactories().getBooleanFactory(); while (node != null) { // If the node has an OPV of 'ignore' ... NodeDefinition defn = node.getDefinition(); if (defn.getOnParentVersion() == OnParentVersionAction.IGNORE) { // This node is not or cannot be checked in ... return true; } if (node.isNodeType(JcrMixLexicon.VERSIONABLE)) { Property prop = node.node().getProperty(JcrLexicon.IS_CHECKED_OUT, cache); // This prop can only be null if the node has not been saved since it was made versionable. return prop == null || booleanFactory.create(prop.getFirstValue()); } if (node.isRoot()) break; node = node.getParent(); } return true; }
onParentVersion = OnParentVersionAction.COPY; } else { onParentVersion = node.getDefinition().getOnParentVersion();
@Override public boolean isCheckedOut() throws RepositoryException { AbstractJcrNode node = this; SessionCache cache = sessionCache(); ValueFactory<Boolean> booleanFactory = session.context().getValueFactories().getBooleanFactory(); while (node != null) { // If the node has an OPV of 'ignore' ... NodeDefinition defn = node.getDefinition(); if (defn.getOnParentVersion() == OnParentVersionAction.IGNORE) { // This node is not or cannot be checked in ... return true; } if (node.isNodeType(JcrMixLexicon.VERSIONABLE)) { Property prop = node.node().getProperty(JcrLexicon.IS_CHECKED_OUT, cache); // This prop can only be null if the node has not been saved since it was made versionable. return prop == null || booleanFactory.create(prop.getFirstValue()); } if (node.isRoot()) break; node = node.getParent(); } return true; }
session.checkPermission(this, ModeShapePermissions.SET_PROPERTY); if (getDefinition().isProtected()) { throw new ConstraintViolationException(JcrI18n.cannotRemoveFromProtectedNode.text(getPath())); for (NodeIterator iter = getNodesInternal(); iter.hasNext();) { AbstractJcrNode child = (AbstractJcrNode)iter.nextNode(); NodeDefinition childDefinition = child.getDefinition(); String childDeclaredNodeType = childDefinition.getDeclaringNodeType().getName();
session.checkPermission(this, ModeShapePermissions.SET_PROPERTY); if (getDefinition().isProtected()) { throw new ConstraintViolationException(JcrI18n.cannotRemoveFromProtectedNode.text(getPath())); for (NodeIterator iter = getNodesInternal(); iter.hasNext();) { AbstractJcrNode child = (AbstractJcrNode)iter.nextNode(); NodeDefinition childDefinition = child.getDefinition(); String childDeclaredNodeType = childDefinition.getDeclaringNodeType().getName();
switch (child.getDefinition().getOnParentVersion()) { case OnParentVersionAction.ABORT: case OnParentVersionAction.VERSION:
switch (child.getDefinition().getOnParentVersion()) { case OnParentVersionAction.ABORT: case OnParentVersionAction.VERSION:
NodeDefinition defn = getDefinition(); int opv = defn.getOnParentVersion(); if (opv != OnParentVersionAction.IGNORE) {
NodeDefinition defn = getDefinition(); int opv = defn.getOnParentVersion(); if (opv != OnParentVersionAction.IGNORE) {
if (isLockedByAnotherSession()) return false; if (!isCheckedOut()) return false; if (getDefinition().isProtected()) return false; if (mixinType.isAbstract()) return false; final Name mixinNameObj = mixinType.getInternalName();
if (isLockedByAnotherSession()) return false; if (!isCheckedOut()) return false; if (getDefinition().isProtected()) return false; if (mixinType.isAbstract()) return false; final Name mixinNameObj = mixinType.getInternalName();