Commit b9fb7a45 authored by Nicola Fulvio Calabria's avatar Nicola Fulvio Calabria
Browse files

Updated constraints to copy paths

parent 0babd77f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -48,6 +48,11 @@ public class CopyService extends AbstractNodeService {
            throw new IllegalArgumentException("Cannot copy node to a subdirectory of its own path");
        }
        
        // Check if destination equals parent path of source
        if(NodeUtils.getParentPath(sourcePath).equals(destinationPath)){
            throw new IllegalArgumentException("Cannot duplicate node at same path without renaming it");
        }           

        try {

            // check source branch for read and lock it
+5 −0
Original line number Diff line number Diff line
@@ -52,6 +52,11 @@ public class MoveService extends AbstractNodeService {
            throw new IllegalArgumentException("Cannot move node to a subdirectory of its own path");
        }

        // Check if destination equals parent path of source
        if(NodeUtils.getParentPath(sourcePath).equals(destinationPath)){
            return;
        }        

        try {
            // Get source node
            Optional<Long> sourceIdOpt = nodeDao.getNodeId(sourcePath);