/** * @inheritDoc */ public Version getVersionByLabel(String label) throws RepositoryException { Version version = versionHistory.getVersionByLabel(label); return factory.getVersionDecorator(session, version); }
@Override public Version getVersionByLabel(String label) throws RepositoryException { Version internal = delegate.getVersionByLabel(label); return new VersionFacade<>(internal, session); }
@Override public Version getVersionByLabel(String label) throws VersionException, RepositoryException { return wrapVersion(getWrappedVersionHistory().getVersionByLabel(label)); }
/** * Restores this node to the version with the given label. * <p> * The default implement retrieves the labeled {@link Version} from the * associated {@link VersionHistory} and forwards the call to the * {@link Node#restore(Version, boolean)} method. * * @param versionLabel version label * @param removeExisting passed through * @throws RepositoryException if an error occurs */ public void restoreByLabel(String versionLabel, boolean removeExisting) throws RepositoryException { restore(getVersionHistory().getVersionByLabel(versionLabel), removeExisting); }
/** * Restores this node to the version with the given label. * <p> * The default implement retrieves the labeled {@link Version} from the * associated {@link VersionHistory} and forwards the call to the * {@link Node#restore(Version, boolean)} method. * * @param versionLabel version label * @param removeExisting passed through * @throws RepositoryException if an error occurs */ public void restoreByLabel(String versionLabel, boolean removeExisting) throws RepositoryException { restore(getVersionHistory().getVersionByLabel(versionLabel), removeExisting); }
/** * Restores this node to the version with the given label. * <p> * The default implement retrieves the labeled {@link Version} from the * associated {@link VersionHistory} and forwards the call to the * {@link Node#restore(Version, boolean)} method. * * @param versionLabel version label * @param removeExisting passed through * @throws RepositoryException if an error occurs */ public void restoreByLabel(String versionLabel, boolean removeExisting) throws RepositoryException { restore(getVersionHistory().getVersionByLabel(versionLabel), removeExisting); }
/** * Restores this node to the version with the given label. * <p> * The default implement retrieves the labeled {@link Version} from the * associated {@link VersionHistory} and forwards the call to the * {@link Node#restore(Version, boolean)} method. * * @param versionLabel version label * @param removeExisting passed through * @throws RepositoryException if an error occurs */ public void restoreByLabel(String versionLabel, boolean removeExisting) throws RepositoryException { restore(getVersionHistory().getVersionByLabel(versionLabel), removeExisting); }
/** * {@inheritDoc} */ public void restoreByLabel(String versionLabel, boolean removeExisting) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, RepositoryException, InvalidItemStateException { checkValid(); VersionImpl version = (VersionImpl)getVersionHistory().getVersionByLabel(versionLabel); restore(version, removeExisting); }
/** {@inheritDoc} */ public RemoteVersion getVersionByLabel(String label) throws RepositoryException, RemoteException { try { Version version = versionHistory.getVersionByLabel(label); return getFactory().getRemoteVersion(version); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
public JcrVersion execute() throws Exception { return JcrVersion.Wrapper.wrap(getDelegate().getVersionByLabel(label), getJcrSession()); } });
private void restore(Node node, String versionSpecifier, boolean removeExisting) throws RepositoryException { final VersionManager vm = node.getSession().getWorkspace().getVersionManager(); final VersionHistory history = vm.getVersionHistory(node.getPath()); final Version version; if (history.hasVersionLabel(versionSpecifier)) { version = history.getVersionByLabel(versionSpecifier); } else if (history.hasNode(versionSpecifier)) { version = history.getVersion(versionSpecifier); } else { throw new IllegalArgumentException("Unable to process restore. Invalid version: " + versionSpecifier); } vm.restore(version, removeExisting); } }
public Version getVersionByLabel(String label) throws RepositoryException { return VersionWrapper.wrap(getDelegate().getVersionByLabel(label), getSessionWrapper()); }
private Node getFrozenNode(Node node, String versionSpecifier) throws RepositoryException { final VersionManager versionManager = session.getWorkspace().getVersionManager(); final VersionHistory history = versionManager.getVersionHistory(node.getPath()); if (history.hasVersionLabel(versionSpecifier)) { return history.getVersionByLabel(versionSpecifier).getFrozenNode(); } else if (history.hasNode(versionSpecifier)) { return history.getVersion(versionSpecifier).getFrozenNode(); } else { return null; } }
/** * @see Node#restoreByLabel(String, boolean) */ public void restoreByLabel(String versionLabel, boolean removeExisting) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException { checkSessionHasPendingChanges(); // check for version-enabled and lock are performed with subsequent calls. Version v = getVersionHistory().getVersionByLabel(versionLabel); if (v == null) { throw new VersionException("No version for label " + versionLabel + " found."); } restore(this, null, v, removeExisting); }
/** * Test if VersionHistory.getVersionByLabel(String) returns the version that * has been specified with the addVersionLabel call. * * @throws RepositoryException * @see VersionHistory#getVersionByLabel(String) */ public void testGetVersionByLabel() throws RepositoryException { vHistory.addVersionLabel(version.getName(), versionLabel, true); Version v = vHistory.getVersionByLabel(versionLabel); assertTrue("VersionHistory.getVersionByLabel(String) must retrieve the particular version that was specified in addVersionLabel call.", v.isSame(version)); }
/** * @see Node#restoreByLabel(String, boolean) */ public void restoreByLabel(String versionLabel, boolean removeExisting) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException { checkSessionHasPendingChanges(); // check for version-enabled and lock are performed with subsequent calls. Version v = getVersionHistory().getVersionByLabel(versionLabel); if (v == null) { throw new VersionException("No version for label " + versionLabel + " found."); } restore(this, null, v, removeExisting); }
VersionHistory history = session.getWorkspace().getVersionManager().getVersionHistory("/my/node/path"); // To iterate over all versions VersionIterator versions = history.getAllVersions(); while (versions.hasNext()) { Version version = versions.nextVersion(); } // Obtain version per name Version mySpecificVersion = history.getVersion("myVersion"); //Obtain version per label Version labelisedVersion = history.getVersionByLabel("myLabel"); String myVersionPropertyValue = labelisedVersion.getFrozenNode().getProperty("myProperty").getString();
public void testMoveLabel4() throws RepositoryException { versionableNode.checkout(); Version v = versionableNode.checkin(); vHistory.addVersionLabel(version.getName(), versionLabel, false); vHistory.addVersionLabel(v.getName(), versionLabel, true); Version v2 = vHistory.getVersionByLabel(versionLabel); assertTrue(v2.isSame(v)); } }
nOther.getVersionHistory().getVersionByLabel(versionLabel); fail("Version label visible outside tx."); } catch (VersionException e) { nOther.getVersionHistory().getVersionByLabel(versionLabel);
String labelHeader = ((DeltaVServletRequest)request).getLabel(); if (labelHeader != null && DavMethods.isMethodAffectedByLabel(request) && isVersionControlled(resource)) { Version v = ((Node)item).getVersionHistory().getVersionByLabel(labelHeader); DavResourceLocator vloc = locator.getFactory().createResourceLocator(locator.getPrefix(), locator.getWorkspacePath(), v.getPath(), false); resource = new VersionItemCollection(vloc, session, this, v);