@Deprecated @Override public void save() throws AccessDeniedException, ItemExistsException, ConstraintViolationException, InvalidItemStateException, ReferentialIntegrityException, VersionException, LockException, NoSuchNodeTypeException, RepositoryException { if (this.isRoot()) { // Just call save on the session (it's more efficient) ... session.save(); } else { session.save(this); } }
@Deprecated @Override public void save() throws AccessDeniedException, ItemExistsException, ConstraintViolationException, InvalidItemStateException, ReferentialIntegrityException, VersionException, LockException, NoSuchNodeTypeException, RepositoryException { if (this.isRoot()) { // Just call save on the session (it's more efficient) ... session.save(); } else { session.save(this); } }
private void validateCloneForExternalNodes( boolean sameWorkspace, JcrSession sourceSession, AbstractJcrNode sourceNode, AbstractJcrNode parentNode ) throws RepositoryException { String rootSourceKey = sourceSession.getRootNode().key().getSourceKey(); Connectors connectors = repository().runningState().connectors(); Set<NodeKey> sourceKeys = sourceSession.cache().getNodeKeysAtAndBelow(sourceNode.key()); for (NodeKey sourceKey : sourceKeys) { String sourceNodeSourceKey = sourceKey.getSourceKey(); if (!sourceNodeSourceKey.equalsIgnoreCase(rootSourceKey)) { String sourceNameAtKey = connectors.getSourceNameAtKey(sourceNodeSourceKey); if (sameWorkspace) { throw new RepositoryException(JcrI18n.unableToCloneSameWsContainsExternalNode.text(sourceNameAtKey)); } else if (!sourceNode.isRoot() || !parentNode.isRoot()) { throw new RepositoryException(JcrI18n.unableToCloneExternalNodesRequireRoot.text(sourceNameAtKey)); } } } }
private void validateCloneForExternalNodes( boolean sameWorkspace, JcrSession sourceSession, AbstractJcrNode sourceNode, AbstractJcrNode parentNode ) throws RepositoryException { String rootSourceKey = sourceSession.getRootNode().key().getSourceKey(); Connectors connectors = repository().runningState().connectors(); Set<NodeKey> sourceKeys = sourceSession.cache().getNodeKeysAtAndBelow(sourceNode.key()); for (NodeKey sourceKey : sourceKeys) { String sourceNodeSourceKey = sourceKey.getSourceKey(); if (!sourceNodeSourceKey.equalsIgnoreCase(rootSourceKey)) { String sourceNameAtKey = connectors.getSourceNameAtKey(sourceNodeSourceKey); if (sameWorkspace) { throw new RepositoryException(JcrI18n.unableToCloneSameWsContainsExternalNode.text(sourceNameAtKey)); } else if (!sourceNode.isRoot() || !parentNode.isRoot()) { throw new RepositoryException(JcrI18n.unableToCloneExternalNodesRequireRoot.text(sourceNameAtKey)); } } } }
private void validateIncomingReferences( JcrVersionNode version ) throws RepositoryException { for (PropertyIterator iter = version.getReferences(); iter.hasNext();) { AbstractJcrProperty prop = (AbstractJcrProperty)iter.next(); AbstractJcrNode referrer = prop.getParent(); // If the property's parent is the root node, fail. if (referrer.isRoot()) { throw new ReferentialIntegrityException(JcrI18n.cannotRemoveVersion.text(prop.getPath())); } boolean referrerIsAnotherVersion = (referrer instanceof JcrVersionNode) && ((JcrVersionNode)referrer).getContainingHistory() .getIdentifier() .equals(version.getContainingHistory() .getIdentifier()); if (!this.equals(referrer) && !referrerIsAnotherVersion) { throw new ReferentialIntegrityException(JcrI18n.cannotRemoveVersion.text(prop.getPath())); } } }
private void validateIncomingReferences( JcrVersionNode version ) throws RepositoryException { for (PropertyIterator iter = version.getReferences(); iter.hasNext();) { AbstractJcrProperty prop = (AbstractJcrProperty)iter.next(); AbstractJcrNode referrer = prop.getParent(); // If the property's parent is the root node, fail. if (referrer.isRoot()) { throw new ReferentialIntegrityException(JcrI18n.cannotRemoveVersion.text(prop.getPath())); } boolean referrerIsAnotherVersion = (referrer instanceof JcrVersionNode) && ((JcrVersionNode)referrer).getContainingHistory() .getIdentifier() .equals(version.getContainingHistory() .getIdentifier()); if (!this.equals(referrer) && !referrerIsAnotherVersion) { throw new ReferentialIntegrityException(JcrI18n.cannotRemoveVersion.text(prop.getPath())); } } }
if (relativePath.equals(".")) return true; if (relativePath.equals("..")) { return !isRoot() && session.hasPermission(this.getParent().getPath(), ModeShapePermissions.READ); if (path.getLastSegment().isSelfReference()) return true; if (path.getLastSegment().isParentReference()) { return !isRoot() && session.hasPermission(this.getParent().getPath(), ModeShapePermissions.READ);
if (relativePath.equals(".")) return true; if (relativePath.equals("..")) { return !isRoot() && session.hasPermission(this.getParent().getPath(), ModeShapePermissions.READ); if (path.getLastSegment().isSelfReference()) return true; if (path.getLastSegment().isParentReference()) { return !isRoot() && session.hasPermission(this.getParent().getPath(), ModeShapePermissions.READ);
@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; }
@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; }
NodeTypes nodeTypes = session().nodeTypes(); if (defn == null || nodeTypes.getVersion() > defn.nodeTypesVersion) { assert !this.isRoot();
NodeTypes nodeTypes = session().nodeTypes(); if (defn == null || nodeTypes.getVersion() > defn.nodeTypesVersion) { assert !this.isRoot();
NodeTypes nodeTypes = session().nodeTypes(); if (defn == null || nodeTypes.getVersion() > defn.nodeTypesVersion) { assert !this.isRoot();
NodeTypes nodeTypes = session().nodeTypes(); if (defn == null || nodeTypes.getVersion() > defn.nodeTypesVersion) { assert !this.isRoot();
session.checkPermission(this, ModeShapePermissions.SET_PROPERTY); if (isRoot()) { throw new ConstraintViolationException(JcrI18n.setPrimaryTypeOnRootNodeIsNotSupported.text());
session.checkPermission(this, ModeShapePermissions.SET_PROPERTY); if (isRoot()) { throw new ConstraintViolationException(JcrI18n.setPrimaryTypeOnRootNodeIsNotSupported.text());
if (!existingDestNode.isRoot()) { parentNode = existingDestNode.getParent(); newNodeName = existingDestNode.segment().getName();
if (!existingDestNode.isRoot()) { parentNode = existingDestNode.getParent(); newNodeName = existingDestNode.segment().getName();
while (!destAncestor.isRoot()) { if (destAncestor.isShareable()) { SharedSet sharedSet = destAncestor.sharedSet();
while (!destAncestor.isRoot()) { if (destAncestor.isShareable()) { SharedSet sharedSet = destAncestor.sharedSet();