/** * Finds the top nodes which have been created during the sequencing process, based on the original output node. It is * important that this is called before the session is saved, because it uses the new flag. * * @param rootOutputNode the node under which the output of the sequencing process was written to. * @return the first level of output nodes that were created during the sequencing process; never null * @throws RepositoryException if there is a problem finding the output nodes */ private List<AbstractJcrNode> findOutputNodes( AbstractJcrNode rootOutputNode ) throws RepositoryException { if (rootOutputNode.isNew()) { return Arrays.asList(rootOutputNode); } // if the node was not new, we need to find the new sequenced nodes List<AbstractJcrNode> nodes = new ArrayList<AbstractJcrNode>(); NodeIterator childrenIt = rootOutputNode.getNodesInternal(); while (childrenIt.hasNext()) { Node child = childrenIt.nextNode(); if (child.isNew()) { nodes.add((AbstractJcrNode)child); } } return nodes; }
/** * Finds the top nodes which have been created during the sequencing process, based on the original output node. It is * important that this is called before the session is saved, because it uses the new flag. * * @param rootOutputNode the node under which the output of the sequencing process was written to. * @return the first level of output nodes that were created during the sequencing process; never null * @throws RepositoryException if there is a problem finding the output nodes */ private List<AbstractJcrNode> findOutputNodes( AbstractJcrNode rootOutputNode ) throws RepositoryException { if (rootOutputNode.isNew()) { return Arrays.asList(rootOutputNode); } // if the node was not new, we need to find the new sequenced nodes List<AbstractJcrNode> nodes = new ArrayList<AbstractJcrNode>(); NodeIterator childrenIt = rootOutputNode.getNodesInternal(); while (childrenIt.hasNext()) { Node child = childrenIt.nextNode(); if (child.isNew()) { nodes.add((AbstractJcrNode)child); } } return nodes; }
void cancelMerge( AbstractJcrNode targetNode, Version version ) throws RepositoryException { targetNode.session().checkLive(); checkVersionable(targetNode); if (targetNode.isNew() || targetNode.isModified()) { throw new InvalidItemStateException(JcrI18n.noPendingChangesAllowedForNode.text()); } if (!targetNode.isNodeType(JcrMixLexicon.VERSIONABLE)) { throw new UnsupportedRepositoryOperationException(JcrI18n.requiresVersionable.text()); } removeVersionFromMergeFailedProperty(targetNode, version); targetNode.session().save(); }
void cancelMerge( AbstractJcrNode targetNode, Version version ) throws RepositoryException { targetNode.session().checkLive(); checkVersionable(targetNode); if (targetNode.isNew() || targetNode.isModified()) { throw new InvalidItemStateException(JcrI18n.noPendingChangesAllowedForNode.text()); } if (!targetNode.isNodeType(JcrMixLexicon.VERSIONABLE)) { throw new UnsupportedRepositoryOperationException(JcrI18n.requiresVersionable.text()); } removeVersionFromMergeFailedProperty(targetNode, version); targetNode.session().save(); }
void doneMerge( AbstractJcrNode targetNode, Version version ) throws RepositoryException { targetNode.session().checkLive(); checkVersionable(targetNode); if (targetNode.isNew() || targetNode.isModified()) { throw new InvalidItemStateException(JcrI18n.noPendingChangesAllowedForNode.text()); } if (!targetNode.isNodeType(JcrMixLexicon.VERSIONABLE)) { throw new VersionException(JcrI18n.requiresVersionable.text()); } AbstractJcrProperty prop = targetNode.getProperty(JcrLexicon.PREDECESSORS); JcrValue[] values = prop.getValues(); JcrValue[] newValues = new JcrValue[values.length + 1]; System.arraycopy(values, 0, newValues, 0, values.length); newValues[values.length] = targetNode.valueFrom(version); targetNode.setProperty(JcrLexicon.PREDECESSORS, newValues, PropertyType.REFERENCE, false); removeVersionFromMergeFailedProperty(targetNode, version); targetNode.session().save(); }
void doneMerge( AbstractJcrNode targetNode, Version version ) throws RepositoryException { targetNode.session().checkLive(); checkVersionable(targetNode); if (targetNode.isNew() || targetNode.isModified()) { throw new InvalidItemStateException(JcrI18n.noPendingChangesAllowedForNode.text()); } if (!targetNode.isNodeType(JcrMixLexicon.VERSIONABLE)) { throw new VersionException(JcrI18n.requiresVersionable.text()); } AbstractJcrProperty prop = targetNode.getProperty(JcrLexicon.PREDECESSORS); JcrValue[] values = prop.getValues(); JcrValue[] newValues = new JcrValue[values.length + 1]; System.arraycopy(values, 0, newValues, 0, values.length); newValues[values.length] = targetNode.valueFrom(version); targetNode.setProperty(JcrLexicon.PREDECESSORS, newValues, PropertyType.REFERENCE, false); removeVersionFromMergeFailedProperty(targetNode, version); targetNode.session().save(); }
throw new LockException(JcrI18n.alreadyLocked.text(node.location())); if (node.isNew()|| node.isModified()) { throw new InvalidItemStateException(JcrI18n.changedNodeCannotBeLocked.text(node.location()));
throw new LockException(JcrI18n.alreadyLocked.text(node.location())); if (node.isNew()|| node.isModified()) { throw new InvalidItemStateException(JcrI18n.changedNodeCannotBeLocked.text(node.location()));
if (node.isNew()) {
if (node.isNew()) {
if (parentOfOutput.isNew() && parentOfOutput.getName().equals(outputNodeName)) {
if (parentOfOutput.isNew() && parentOfOutput.getName().equals(outputNodeName)) {
if (node.isNew()) { String msg = JcrI18n.noVersionHistoryForTransientVersionableNodes.text(node.location()); throw new InvalidItemStateException(msg);
if (node.isNew()) { String msg = JcrI18n.noVersionHistoryForTransientVersionableNodes.text(node.location()); throw new InvalidItemStateException(msg);
checkVersionable(node); if (node.isNew() || node.isModified()) { throw new InvalidItemStateException(JcrI18n.noPendingChangesAllowed.text());
checkVersionable(node); if (node.isNew() || node.isModified()) { throw new InvalidItemStateException(JcrI18n.noPendingChangesAllowed.text());