You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by cl...@apache.org on 2007/05/13 22:49:20 UTC
svn commit: r537657 - in
/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence:
PersistenceManager.java impl/PersistenceManagerImpl.java
Author: clombart
Date: Sun May 13 13:49:19 2007
New Revision: 537657
URL: http://svn.apache.org/viewvc?view=rev&rev=537657
Log:
Apply patch provided by Ruchi Goel for JCR-910. Unit tests are missing
Modified:
jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/PersistenceManager.java
jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/impl/PersistenceManagerImpl.java
Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/PersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/PersistenceManager.java?view=diff&rev=537657&r1=537656&r2=537657
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/PersistenceManager.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/PersistenceManager.java Sun May 13 13:49:19 2007
@@ -346,5 +346,25 @@
* @param keepChanges
*/
public void refresh(boolean keepChanges);
+
+ /**
+ * Move an object
+ *
+ * @param srcPath path of the object to move
+ * @param destPath destination path
+ *
+ * @throws PersistenceException
+ */
+ public void move(String srcPath, String destPath) throws PersistenceException;
+
+ /**
+ * Copy an object
+ *
+ * @param srcPath path of the object to copy
+ * @param destPath destination path
+ *
+ * @throws PersistenceException
+ */
+ public void copy(String srcPath, String destPath) throws PersistenceException;
}
Modified: jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/impl/PersistenceManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/impl/PersistenceManagerImpl.java?view=diff&rev=537657&r1=537656&r2=537657
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/impl/PersistenceManagerImpl.java (original)
+++ jackrabbit/trunk/contrib/jackrabbit-jcr-mapping/jcr-mapping/src/main/java/org/apache/jackrabbit/ocm/persistence/impl/PersistenceManagerImpl.java Sun May 13 13:49:19 2007
@@ -31,6 +31,7 @@
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.Workspace;
import javax.jcr.lock.Lock;
import javax.jcr.lock.LockException;
import javax.jcr.nodetype.NoSuchNodeTypeException;
@@ -1110,10 +1111,84 @@
catch(RepositoryException e) {
throw new PersistenceException("Cannot refresh current session ", e);
}
-
-
}
-
+ /**
+ *
+ * @see org.apache.jackrabbit.ocm.persistence.PersistenceManager#move(java.lang.String, java.lang.String)
+ */
+ public void move(String srcPath, String destPath){
+ Workspace workspace = session.getWorkspace();
+ try {
+
+ workspace.move(srcPath,destPath);
+
+ }catch(javax.jcr.nodetype.ConstraintViolationException cve){
+ throw new PersistenceException(
+ "Cannot move the object from " + srcPath + " to " + destPath + "." + " Violation of a nodetype or attempt to move under a property detected", cve);
+
+ }catch(javax.jcr.version.VersionException ve){
+ throw new VersionException(
+ "Cannot move the object from " + srcPath + " to " + destPath + "." + " Parent node of source or destination is versionable and checked in ", ve);
+
+ }catch(javax.jcr.AccessDeniedException ade){
+ throw new PersistenceException(
+ "Cannot move the object from " + srcPath + " to " + destPath + "." + " Session does not have access permissions", ade);
+
+ }catch(javax.jcr.PathNotFoundException pnf){
+ throw new PersistenceException(
+ "Cannot move the object from " + srcPath + " to " + destPath + "." + " Node at source or destination does not exist ", pnf);
+
+ }catch(javax.jcr.ItemExistsException ie){
+ throw new PersistenceException(
+ "Cannot move the object from " + srcPath + " to " + destPath + "." + " It might already exist at destination path.", ie);
+
+ }catch(javax.jcr.lock.LockException le){
+ throw new PersistenceException(
+ "Cannot move the object from " + srcPath + " to " + destPath + "." + "Violation of a lock detected", le);
+
+ }catch(javax.jcr.RepositoryException re){
+ throw new PersistenceException(
+ "Cannot move the object from " + srcPath + " to " + destPath + "." , re);
+ }
+ }
+ /**
+ *
+ * @see org.apache.jackrabbit.ocm.persistence.PersistenceManager#copy(java.lang.String, java.lang.String)
+ */
+ public void copy(String srcPath, String destPath){
+ Workspace workspace = session.getWorkspace();
+ try{
+ workspace.copy(srcPath,destPath);
+
+ }catch(javax.jcr.nodetype.ConstraintViolationException cve){
+ throw new PersistenceException(
+ "Cannot copy the object from " + srcPath + " to " + destPath + "." + "Violation of a nodetype or attempt to copy under property detected ", cve);
+
+ }catch(javax.jcr.version.VersionException ve){
+ throw new VersionException(
+ "Cannot copy the object from " + srcPath + " to " + destPath + "." + "Parent node of source or destination is versionable and checked in ", ve);
+
+ }catch(javax.jcr.AccessDeniedException ade){
+ throw new PersistenceException(
+ "Cannot copy the object from " + srcPath + " to " + destPath + "." + " Session does not have access permissions", ade);
+
+ }catch(javax.jcr.PathNotFoundException pnf){
+ throw new PersistenceException(
+ "Cannot copy the object from " + srcPath + " to " + destPath + "." + "Node at source or destination does not exist ", pnf);
+
+ }catch(javax.jcr.ItemExistsException ie){
+ throw new PersistenceException(
+ "Cannot copy the object from " + srcPath + " to " + destPath + "." + "It might already exist at destination path.", ie);
+
+ }catch(javax.jcr.lock.LockException le){
+ throw new PersistenceException(
+ "Cannot copy the object from " + srcPath + " to " + destPath + "." + "Violation of a lock detected", le);
+
+ }catch(javax.jcr.RepositoryException re){
+ throw new PersistenceException(
+ "Cannot copy the node from " + srcPath + " to " + destPath + "." , re);
+ }
+ }
}