Author: sergiykarpenko
Date: 2010-08-26 08:47:40 -0400 (Thu, 26 Aug 2010)
New Revision: 2993
Modified:
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRnFr.java
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRnTo.java
Log:
EXOJCR-849: now RENAME_TO operation do ignores RENAME_FROM workspace name
Modified:
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRnFr.java
===================================================================
---
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRnFr.java 2010-08-26
12:43:55 UTC (rev 2992)
+++
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRnFr.java 2010-08-26
12:47:40 UTC (rev 2993)
@@ -65,7 +65,7 @@
curSession.getItem(repoPath);
- clientSession().setPrevParamsEx(repoPath);
+ clientSession().setPrevParamsEx(resName);
reply(FtpConst.Replyes.REPLY_350);
return;
Modified:
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRnTo.java
===================================================================
---
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRnTo.java 2010-08-26
12:43:55 UTC (rev 2992)
+++
jcr/trunk/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/CmdRnTo.java 2010-08-26
12:47:40 UTC (rev 2993)
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.util.ArrayList;
+import javax.jcr.Item;
import javax.jcr.NoSuchWorkspaceException;
import javax.jcr.PathNotFoundException;
import javax.jcr.Session;
@@ -75,8 +76,25 @@
return;
}
- curSession.move(clientSession().getPrevParamsEx(), repoPath);
- curSession.save();
+ // now check does move executed on same workspace
+ ArrayList<String> prevParamPath =
clientSession().getFullPath(clientSession().getPrevParamsEx());
+ String prevRepoPath = clientSession().getRepoPath(prevParamPath);
+ if (prevParamPath.get(0).equals(newPath.get(0)))
+ {
+ //its the same workspace
+ curSession.move(prevRepoPath, repoPath);
+ curSession.save();
+ }
+ else
+ {
+ // there is different workspaces operation
+ curSession.getWorkspace().copy(prevParamPath.get(0), prevRepoPath,
repoPath);
+ // now remove source node
+ Session srcSession = clientSession().getSession(prevParamPath.get(0));
+ Item item = srcSession.getItem(prevRepoPath);
+ item.remove();
+ srcSession.save();
+ }
reply(String.format(FtpConst.Replyes.REPLY_250, FtpConst.Commands.CMD_RNTO));
return;
Show replies by date