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

126404 jkaabimofrad: Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)
      121328 jvonka: FileFolder API - add additional (-ve) "move" tests
      - also rationalise some of the other tests (start removing dependency on repoService/repositoryHelper)
      RA-683


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@126749 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ancuta Morarasu
2016-05-11 11:03:11 +00:00
parent a8920053db
commit 7799b7b262
2 changed files with 154 additions and 83 deletions

View File

@@ -91,6 +91,7 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.CyclicChildRelationshipException;
import org.alfresco.service.cmr.repository.DuplicateChildNodeNameException;
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
import org.alfresco.service.cmr.repository.MimetypeService;
@@ -1179,6 +1180,12 @@ public class NodesImpl implements Nodes
private void move(NodeRef nodeRef, NodeRef parentNodeRef, String name)
{
NodeRef currentParentNodeRef = getParentNodeRef(nodeRef);
if (currentParentNodeRef == null)
{
// implies root (Company Home) hence return 403 here
throw new PermissionDeniedException();
}
if (! currentParentNodeRef.equals(parentNodeRef))
{
try
@@ -1200,11 +1207,15 @@ public class NodesImpl implements Nodes
catch (FileExistsException fee)
{
// duplicate - name clash
throw new ConstraintViolatedException(fee.getMessage());
throw new ConstraintViolatedException(fee.getMessage()+" ["+nodeRef+","+parentNodeRef+"]");
}
catch (FileFolderServiceImpl.InvalidTypeException ite)
{
throw new InvalidArgumentException("Expect target parentId to be a folder: "+parentNodeRef);
throw new InvalidArgumentException(ite.getMessage()+" ["+nodeRef+","+parentNodeRef+"]");
}
catch (CyclicChildRelationshipException ccre)
{
throw new InvalidArgumentException(ccre.getMessage()+" ["+nodeRef+","+parentNodeRef+"]");
}
}
}
@@ -1416,15 +1427,15 @@ public class NodesImpl implements Nodes
}
catch (AccessDeniedException ade)
{
throw new PermissionDeniedException();
throw new PermissionDeniedException(ade.getMessage());
}
catch (ContentQuotaException cqe)
{
throw new RequestEntityTooLargeException();
throw new RequestEntityTooLargeException(cqe.getMessage());
}
catch (ContentLimitViolationException clv)
{
throw new ConstraintViolatedException();
throw new ConstraintViolatedException(clv.getMessage());
}
catch (Exception ex)
{