@Override public boolean hasVersionLabel(String label) throws RepositoryException { return delegate.hasVersionLabel(label); }
/** * @inheritDoc */ public boolean hasVersionLabel(String label) throws RepositoryException { return versionHistory.hasVersionLabel(label); }
/** {@inheritDoc} */ public boolean hasVersionLabel(String label) throws RepositoryException, RemoteException { return versionHistory.hasVersionLabel(label); }
@Override public boolean hasVersionLabel(Version version, String label) throws RepositoryException { return delegate.hasVersionLabel(version, label); }
/** * @inheritDoc */ public boolean hasVersionLabel(Version version, String label) throws VersionException, RepositoryException { return versionHistory.hasVersionLabel(VersionDecorator.unwrap(version), label); }
@Override public boolean hasVersionLabel(String label) throws RepositoryException { return getWrappedVersionHistory().hasVersionLabel(label); }
public Boolean execute() throws Exception { return getDelegate().hasVersionLabel(label); } });
public boolean hasVersionLabel(String label) throws RepositoryException { return getDelegate().hasVersionLabel(label); }
@Override public boolean hasVersionLabel(Version version, String label) throws VersionException, RepositoryException { return getWrappedVersionHistory().hasVersionLabel(VersionUtil.unwrap(version), label); }
/** {@inheritDoc} */ public boolean hasVersionLabel(String versionUUID, String label) throws RepositoryException, RemoteException { try { Version version = getVersionByUUID(versionUUID); return versionHistory.hasVersionLabel(version, label); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
public Boolean execute() throws Exception { return getDelegate().hasVersionLabel(unwrap(version), label); } });
public boolean hasVersionLabel(Version version, String label) throws RepositoryException { return getDelegate().hasVersionLabel(unwrap(version), label); }
protected void setUp() throws Exception { super.setUp(); jcrVersionLabels = superuser.getNamespacePrefix(NS_JCR_URI) + ":versionLabels"; vHistory = versionableNode.getSession().getWorkspace().getVersionManager().getVersionHistory(versionableNode.getPath()); VersionManager vMgr = superuser.getWorkspace().getVersionManager(); vMgr.checkpoint(versionableNode.getPath()); version = vMgr.getBaseVersion(versionableNode.getPath()); if (vHistory.hasVersionLabel(versionLabel)) { fail("Version label '" + versionLabel + "' is already present in this version history. Label test cannot be performed."); } if (vHistory.hasVersionLabel(versionLabel2)) { fail("Version label '" + versionLabel2 + "' is already present in this version history. Label test cannot be performed."); } }
/** * Test if VersionHistory.hasVersionLabel(String) returns true, if the label * has beed successfully added before. * * @throws RepositoryException * @see VersionHistory#hasVersionLabel(String) */ public void testHasVersionLabel() throws RepositoryException { vHistory.addVersionLabel(version.getName(), versionLabel, false); assertTrue("VersionHistory.hasVersionLabel(String) must return true if the label has been sucessfully added.", vHistory.hasVersionLabel(versionLabel)); }
/** * Test if VersionHistory.hasVersionLabel(Version, String) returns true, if the label * has beed successfully added before to the specified version. * * @throws RepositoryException * @see VersionHistory#hasVersionLabel(javax.jcr.version.Version, String) */ public void testHasVersionLabelForVersion() throws RepositoryException { vHistory.addVersionLabel(version.getName(), versionLabel, false); assertTrue("VersionHistory.hasVersionLabel(Version, String) must return true if the label has been sucessfully added.", vHistory.hasVersionLabel(version, versionLabel)); }
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); } }
/** * Test the removal of an version label that does not exist (must throw VersionException). * * @throws RepositoryException */ public void testRemoveNonExistingLabel() throws RepositoryException { if (vHistory.hasVersionLabel(versionLabel)) { fail("Testing the removal on a non-existing version label failed: '" + versionLabel + "' exists on version history."); } try { vHistory.removeVersionLabel(versionLabel); fail("VersionHistory.removeLabel(String) must throw a VersionException if the label does not exist."); } catch (VersionException e) { // success } }
/** * Test the removal of an version label that has successfully been added * before. * * @throws RepositoryException * @see VersionHistory#removeVersionLabel(String) */ public void testRemoveLabel() throws RepositoryException { vHistory.addVersionLabel(version.getName(), versionLabel, false); vHistory.removeVersionLabel(versionLabel); assertFalse("VersionHistory.removeLabel(String) must remove the version label if it exists (has successfully been added before).", vHistory.hasVersionLabel(versionLabel)); }
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; } }
@Test public void testWrappedVersionDoesntFail() throws Exception { // GIVEN String label = "label"; VersionManager versionMan = Components.getComponent(VersionManager.class); Node node = MgnlContext.getJCRSession(RepositoryConstants.WEBSITE).getRootNode().addNode("test", NodeTypes.Content.NAME); Version version = versionMan.addVersion(node); VersionHistory versionHistory = versionMan.getVersionHistory(node); // WHEN boolean haveLabel = versionHistory.hasVersionLabel(version, label); // THEN assertFalse(haveLabel); } }