Merged 5.2.N (5.2.1) to HEAD (5.2)

129173 mmuller: Merged RETURN-OF-THE-API (5.2.0) to 5.2.N (5.2.1)
      128583 jvonka: V1 REST API: Node Version History - tweak "delete version" operation
      - cannot delete last version for now (return 422)
      REPO-835


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@129347 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alexandru Epure
2016-08-09 14:13:29 +00:00
parent 6084cc72b5
commit 575183a5ac
4 changed files with 112 additions and 17 deletions

View File

@@ -26,6 +26,7 @@
package org.alfresco.rest.api.nodes;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.node.integrity.IntegrityException;
import org.alfresco.repo.policy.BehaviourFilter;
import org.alfresco.repo.security.permissions.AccessDeniedException;
import org.alfresco.repo.version.Version2Model;
@@ -254,7 +255,11 @@ public class NodeVersionsRelation extends AbstractNodeRelation implements
Map<QName, Serializable> props = sr.getNodeService().getProperties(nodeRef);
if (props.get(ContentModel.PROP_VERSION_LABEL) == null)
{
// last version was deleted
// attempt to delete last version - we do not yet support this (see REPO-835 & REPO-834)
// note: alternatively, the client can remove the "cm:versionable" aspect (if permissions allow) to clear the version history and disable versioning
throw new IntegrityException("Cannot delete last version (did you mean to disable versioning instead ?) ["+nodeId+","+versionId+"]", null);
/*
if (props.get(ContentModel.PROP_VERSION_TYPE) != null)
{
// minor fix up to versionable aspect - ie. remove versionType
@@ -270,6 +275,7 @@ public class NodeVersionsRelation extends AbstractNodeRelation implements
behaviourFilter.enableBehaviour(nodeRef, ContentModel.ASPECT_VERSIONABLE);
}
}
*/
}
}