@Override @SuppressWarnings("deprecation") public void restore( Version[] versions, boolean removeExisting ) throws ItemExistsException, UnsupportedRepositoryOperationException, VersionException, LockException, InvalidItemStateException, RepositoryException { session.checkLive(); versionManager().restore(versions, removeExisting); }
@Override @SuppressWarnings("deprecation") public void restore( Version[] versions, boolean removeExisting ) throws ItemExistsException, UnsupportedRepositoryOperationException, VersionException, LockException, InvalidItemStateException, RepositoryException { session.checkLive(); versionManager().restore(versions, removeExisting); }
protected void restoreAtAbsPath( String absPath, Version version, boolean removeExisting, boolean failIfNodeAlreadyExists ) throws RepositoryException { validateSessionLiveWithoutPendingChanges(); // Create a new session in which we'll finish the restore, so this session remains thread-safe ... JcrSession restoreSession = session.spawnSession(false); Path path = restoreSession.absolutePathFor(absPath); if (failIfNodeAlreadyExists) { try { AbstractJcrNode existingNode = restoreSession.node(path); String msg = JcrI18n.unableToRestoreAtAbsPathNodeAlreadyExists.text(absPath, existingNode.key()); throw new VersionException(msg); } catch (PathNotFoundException e) { // expected } } restore(restoreSession, path, version, null, removeExisting); }
protected void restoreAtAbsPath( String absPath, Version version, boolean removeExisting, boolean failIfNodeAlreadyExists ) throws RepositoryException { validateSessionLiveWithoutPendingChanges(); // Create a new session in which we'll finish the restore, so this session remains thread-safe ... JcrSession restoreSession = session.spawnSession(false); Path path = restoreSession.absolutePathFor(absPath); if (failIfNodeAlreadyExists) { try { AbstractJcrNode existingNode = restoreSession.node(path); String msg = JcrI18n.unableToRestoreAtAbsPathNodeAlreadyExists.text(absPath, existingNode.key()); throw new VersionException(msg); } catch (PathNotFoundException e) { // expected } } restore(restoreSession, path, version, null, removeExisting); }
@Override public void restore( String absPath, String versionName, boolean removeExisting ) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException { if (LOGGER.isDebugEnabled()) LOGGER.debug("VersionManager.restore('{0}','{1}',{2})", absPath, versionName, removeExisting); validateSessionLiveWithoutPendingChanges(); // Create a new session in which we'll finish the restore, so this session remains thread-safe ... JcrSession restoreSession = session.spawnSession(false); Version version = null; // See if the node at absPath exists and has version storage. Path path = restoreSession.absolutePathFor(absPath); AbstractJcrNode existingNode = restoreSession.node(path); VersionHistory historyNode = existingNode.getVersionHistory(); version = historyNode.getVersion(versionName); assert version != null; restore(restoreSession, path, version, null, removeExisting); }
@Override public void restore( String absPath, String versionName, boolean removeExisting ) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException { if (LOGGER.isDebugEnabled()) LOGGER.debug("VersionManager.restore('{0}','{1}',{2})", absPath, versionName, removeExisting); validateSessionLiveWithoutPendingChanges(); // Create a new session in which we'll finish the restore, so this session remains thread-safe ... JcrSession restoreSession = session.spawnSession(false); Version version = null; // See if the node at absPath exists and has version storage. Path path = restoreSession.absolutePathFor(absPath); AbstractJcrNode existingNode = restoreSession.node(path); VersionHistory historyNode = existingNode.getVersionHistory(); version = historyNode.getVersion(versionName); assert version != null; 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); }
@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); }