jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: rev 54853 - incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version
Date Fri, 15 Oct 2004 14:37:23 GMT
Author: tripod
Date: Fri Oct 15 07:37:21 2004
New Revision: 54853

Modified:
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionImpl.java
Log:
JCR-9: Version.isSame(Object) not working

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java
Fri Oct 15 07:37:21 2004
@@ -20,6 +20,7 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.Item;
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionHistory;
 import javax.jcr.version.VersionIterator;
@@ -104,5 +105,17 @@
      */
     public String getUUID() throws UnsupportedRepositoryOperationException, RepositoryException
{
         return history.getUUID();
+    }
+
+    /**
+     * @see javax.jcr.Item#isSame(javax.jcr.Item)
+     */
+    public boolean isSame(Item otherItem) {
+        if (otherItem instanceof VersionHistoryImpl) {
+            // since all version histories live in the same workspace, we can compare the
uuids
+            return ((VersionHistoryImpl) otherItem).history.getUUID().equals(history.getUUID());
+        } else {
+            return false;
+        }
     }
 }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionImpl.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionImpl.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionImpl.java
Fri Oct 15 07:37:21 2004
@@ -20,6 +20,7 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.Item;
 import javax.jcr.version.Version;
 import java.util.Calendar;
 
@@ -120,4 +121,15 @@
         return version.getFrozenNode();
     }
 
+    /**
+     * @see Item#isSame(javax.jcr.Item)
+     */
+    public boolean isSame(Item otherItem) {
+        if (otherItem instanceof VersionImpl) {
+            // since all versions live in the same workspace, we can compare the uuids
+            return ((VersionImpl) otherItem).version.getUUID().equals(version.getUUID());
+        } else {
+            return false;
+        }
+    }
 }

Mime
View raw message