@Override public String getVersionableIdentifier() throws RepositoryException { return delegate.getVersionableIdentifier(); }
public String getVersionableIdentifier() throws RepositoryException { return versionHistory.getVersionableIdentifier(); }
/** {@inheritDoc} */ public String getVersionableIdentifier() throws RepositoryException, RemoteException { try { return versionHistory.getVersionableIdentifier(); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
@Override public String getVersionableIdentifier() throws RepositoryException { return getWrappedVersionHistory().getVersionableIdentifier(); }
public String execute() throws Exception { return getDelegate().getVersionableIdentifier(); } });
public String getVersionableIdentifier() throws RepositoryException { return getDelegate().getVersionableIdentifier(); }
public String getVersionableUUID() throws RepositoryException { return getDelegate().getVersionableIdentifier(); }
/** * Tests if VersionHistory.getVersionableIdentifier() returns the ID of the * corresponding versionable node. * @since JCR 2.9 */ public void testGetVersionableIdentifier() throws RepositoryException { VersionManager vm = versionableNode.getSession().getWorkspace().getVersionManager(); vm.checkpoint(versionableNode.getPath()); assertEquals("Method getVersionableIdentifier() must return the identifier of the corresponding Node.", vm.getVersionHistory(versionableNode.getPath()).getVersionableIdentifier(), versionableNode.getIdentifier()); } }
private static VersionSummary toVersionSummary( final PentahoJcrConstants pentahoJcrConstants, final VersionHistory versionHistory, final Version version ) throws RepositoryException { List<String> labels = Arrays.asList( versionHistory.getVersionLabels( version ) ); // get custom Hitachi Vantara properties (i.e. author and message) Node nodeAtVersion = getNodeAtVersion( pentahoJcrConstants, version ); String author = "BASE_VERSION"; if ( nodeAtVersion.hasProperty( pentahoJcrConstants.getPHO_VERSIONAUTHOR() ) ) { author = nodeAtVersion.getProperty( pentahoJcrConstants.getPHO_VERSIONAUTHOR() ).getString(); } String message = null; if ( nodeAtVersion.hasProperty( pentahoJcrConstants.getPHO_VERSIONMESSAGE() ) ) { message = nodeAtVersion.getProperty( pentahoJcrConstants.getPHO_VERSIONMESSAGE() ).getString(); } boolean aclOnlyChange = false; if ( nodeAtVersion.hasProperty( pentahoJcrConstants.getPHO_ACLONLYCHANGE() ) && nodeAtVersion.getProperty( pentahoJcrConstants.getPHO_ACLONLYCHANGE() ).getBoolean() ) { aclOnlyChange = true; } return new VersionSummary( version.getName(), versionHistory.getVersionableIdentifier(), aclOnlyChange, version .getCreated().getTime(), author, message, labels ); }
/** * @see javax.jcr.Node#restore(javax.jcr.version.Version, boolean) */ @Override public void restore(Version version, boolean removeExisting) throws RepositoryException { if (!isNodeType(NodeType.MIX_VERSIONABLE)) { throw new UnsupportedRepositoryOperationException(format("Node [%s] is not mix:versionable", getNodePath())); } String id = version.getContainingHistory().getVersionableIdentifier(); if (getIdentifier().equals(id)) { getVersionManager().restore(version, removeExisting); } else { throw new VersionException(format("Version does not belong to the " + "VersionHistory of this node [%s].", getNodePath())); } }
/** * @see javax.jcr.Node#restore(javax.jcr.version.Version, boolean) */ @Override public void restore(Version version, boolean removeExisting) throws RepositoryException { if (!isNodeType(NodeType.MIX_VERSIONABLE)) { throw new UnsupportedRepositoryOperationException(format("Node [%s] is not mix:versionable", getNodePath())); } String id = version.getContainingHistory().getVersionableIdentifier(); if (getIdentifier().equals(id)) { getVersionManager().restore(version, removeExisting); } else { throw new VersionException(format("Version does not belong to the " + "VersionHistory of this node [%s].", getNodePath())); } }
/** * @see javax.jcr.Node#restore(javax.jcr.version.Version, boolean) */ @Override public void restore(Version version, boolean removeExisting) throws RepositoryException { if (!isNodeType(NodeType.MIX_VERSIONABLE)) { throw new UnsupportedRepositoryOperationException(format("Node [%s] is not mix:versionable", getNodePath())); } String id = version.getContainingHistory().getVersionableIdentifier(); if (getIdentifier().equals(id)) { getVersionManager().restore(version, removeExisting); } else { throw new VersionException(format("Version does not belong to the " + "VersionHistory of this node [%s].", getNodePath())); } }
/** * Fill the property set for this resource. */ @Override protected void initProperties() { super.initProperties(); // change resource type defined by default item collection properties.add(new ResourceType(ResourceType.VERSION_HISTORY)); // jcr specific property pointing to the node this history belongs to try { properties.add(new DefaultDavProperty<String>(JCR_VERSIONABLEUUID, ((VersionHistory)item).getVersionableIdentifier())); } catch (RepositoryException e) { log.error(e.getMessage()); } } }
public static <T extends JcrObject> T getVersionedNode(Version version, Class<T> type, Object[] constructorArgs) { String nodeName = null; String versionName = null; try { versionName = version.getName(); Node node = version.getFrozenNode(); nodeName = node.getName(); String entityId = version.getContainingHistory().getVersionableIdentifier(); T obj = JcrUtil.constructNodeObject(node, type, constructorArgs); obj.setVersionName(versionName); obj.setVersionableIdentifier(entityId); return obj; } catch (RepositoryException e) { throw new MetadataRepositoryException("Unable to find Version " + versionName + " for Node " + nodeName, e); } }
/** * @since oak */ @Test public void testVersionHistoryGetVersionableIdentifier() throws Exception { VersionHistory testVh = testSession.getNode(versionablePath).getVersionHistory(); testVh.getVersionableIdentifier(); }
AbstractJcrNode existingNode = restoreSession.getNonSystemNodeByIdentifier(history.getVersionableIdentifier()); existingVersions.put((JcrVersionNode)versions[i], existingNode); versionRootPaths.add(existingNode.path());
/** * Incoming node is in versionStorage. Find its associated versionable--the node associated with this version history * node. */ protected NodeImpl getVersionable( final NodeImpl node ) throws RepositoryException { NodeImpl currentNode = node; while ( !currentNode.isNodeType( "nt:versionHistory" ) && !rootID .equals( currentNode.getNodeId() ) ) { //$NON-NLS-1$ currentNode = (NodeImpl) currentNode.getParent(); } if ( rootID.equals( currentNode.getNodeId() ) ) { return currentNode; } else { return (NodeImpl) systemSession.getNodeByIdentifier( ( (VersionHistory) currentNode ) .getVersionableIdentifier() ); } }
@Override public void restore( Version version, boolean removeExisting ) throws VersionException, ItemExistsException, InvalidItemStateException, UnsupportedRepositoryOperationException, LockException, RepositoryException { if (LOGGER.isDebugEnabled()) LOGGER.debug("VersionManager.restore({0},{1})", version, removeExisting); validateSessionLiveWithoutPendingChanges(); // Create a new session in which we'll finish the restore, so this session remains thread-safe ... JcrSession restoreSession = session.spawnSession(false); String identifier = version.getContainingHistory().getVersionableIdentifier(); AbstractJcrNode node = null; try { node = restoreSession.getNonSystemNodeByIdentifier(identifier); } catch (ItemNotFoundException e) { throw new VersionException(JcrI18n.invalidVersionForRestore.text()); } Path path = node.path(); restore(restoreSession, path, version, null, removeExisting); }
@Override public void restore( Version version, boolean removeExisting ) throws VersionException, ItemExistsException, InvalidItemStateException, UnsupportedRepositoryOperationException, LockException, RepositoryException { if (LOGGER.isDebugEnabled()) LOGGER.debug("VersionManager.restore({0},{1})", version, removeExisting); validateSessionLiveWithoutPendingChanges(); // Create a new session in which we'll finish the restore, so this session remains thread-safe ... JcrSession restoreSession = session.spawnSession(false); String identifier = version.getContainingHistory().getVersionableIdentifier(); AbstractJcrNode node = null; try { node = restoreSession.getNonSystemNodeByIdentifier(identifier); } catch (ItemNotFoundException e) { throw new VersionException(JcrI18n.invalidVersionForRestore.text()); } Path path = node.path(); restore(restoreSession, path, version, null, removeExisting); }
protected WorkflowDescriptor load() { try { Session session = UserSession.get().getJcrSession(); WorkflowManager workflowManager = ((HippoWorkspace) session.getWorkspace()).getWorkflowManager(); Node node = getNode(session); if (node.isNodeType(JcrConstants.NT_FROZEN_NODE)) { Version version = (Version) node.getParent(); String docId = version.getContainingHistory().getVersionableIdentifier(); Node docNode = version.getSession().getNodeByIdentifier(docId); if (docNode.getParent().isNodeType(HippoNodeType.NT_HANDLE)) { Node handle = docNode.getParent(); return workflowManager.getWorkflowDescriptor(category, handle); } else { return workflowManager.getWorkflowDescriptor(category, docNode); } } else { return workflowManager.getWorkflowDescriptor(category, node); } } catch (RepositoryException ex) { return null; } }