svn commit: r730699 - /lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Fri Jan  2 03:14:19 2009
New Revision: 730699

URL: http://svn.apache.org/viewvc?rev=730699&view=rev
Log:
SourceNode.exists(): return true if node has been checked out by the current session.

Modified:
    lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java

Modified: lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java?rev=730699&r1=730698&r2=730699&view=diff
==============================================================================
--- lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java (original)
+++ lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceNode.java Fri Jan  2 03:14:19 2009
@@ -35,7 +35,9 @@
 import org.apache.lenya.cms.observation.RepositoryEvent;
 import org.apache.lenya.cms.observation.RepositoryEventFactory;
 import org.apache.lenya.cms.rc.CheckInEntry;
+import org.apache.lenya.cms.rc.CheckOutEntry;
 import org.apache.lenya.cms.rc.RCML;
+import org.apache.lenya.cms.rc.RCMLEntry;
 import org.apache.lenya.cms.rc.RevisionControlException;
 import org.apache.lenya.transaction.Lock;
 import org.apache.lenya.transaction.TransactionException;
@@ -394,7 +396,16 @@
 
     public boolean exists() throws RepositoryException {
         try {
-            return getRcml().getLatestCheckInEntry() != null;
+            RCMLEntry entry = getRcml().getLatestEntry();
+            if (entry == null) {
+                return false;
+            } else if (entry.getType() == RCML.ci) {
+                return true;
+            }
+            else {
+                // before check-in, the node exists only in the session that created it
+                return entry.getSessionId().equals(getSession().getId());
+            }
         } catch (RevisionControlException e) {
             throw new RepositoryException(e);
         }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.