in src/main/java/org/apache/sling/servlets/post/impl/helper/JCRSupportImpl.java [104:128]
public void checkoutIfNecessary(final Resource resource,
final List<Modification> changes,
final VersioningConfiguration versioningConfiguration)
throws PersistenceException {
if (resource != null && versioningConfiguration.isAutoCheckout()) {
final Node node = resource.adaptTo(Node.class);
if ( node != null ) {
try {
Node versionableNode = findVersionableAncestor(node);
if (versionableNode != null) {
if (!versionableNode.isCheckedOut()) {
versionableNode.getSession().getWorkspace().getVersionManager().checkout(versionableNode.getPath());
changes.add(Modification.onCheckout(versionableNode.getPath()));
}
}
} catch (final AccessDeniedException e) {
throw new PreconditionViolatedPersistenceException(e.getMessage(),e);
} catch (final UnsupportedRepositoryOperationException e) {
throw new TemporaryPersistenceException(e.getMessage(),e);
} catch (final RepositoryException re) {
throw new PersistenceException(re.getMessage(), re);
}
}
}
}