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

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Fri Aug 10 09:28:23 2007
New Revision: 564657

URL: http://svn.apache.org/viewvc?view=rev&rev=564657
Log:
Use revision history for last modification date in source nodes, more accurate than file system

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

Modified: lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceWrapper.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceWrapper.java?view=diff&rev=564657&r1=564656&r2=564657
==============================================================================
--- lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceWrapper.java (original)
+++ lenya/trunk/src/modules/sourcerepository/java/src/org/apache/lenya/cms/repository/SourceWrapper.java Fri Aug 10 09:28:23 2007
@@ -39,6 +39,8 @@
 import org.apache.lenya.cms.publication.DocumentFactory;
 import org.apache.lenya.cms.publication.DocumentUtil;
 import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.rc.CheckInEntry;
+import org.apache.lenya.cms.rc.RevisionControlException;
 import org.apache.lenya.util.Assert;
 
 /**
@@ -229,7 +231,6 @@
 
                 this.data = out.toByteArray();
                 this.mimeType = source.getMimeType();
-                this.lastModified = source.getLastModified();
             }
         } catch (Exception e) {
             throw new RepositoryException(e);
@@ -363,7 +364,14 @@
      * @see org.apache.lenya.cms.repository.Node#getLastModified()
      */
     public long getLastModified() throws RepositoryException {
-        loadData();
+        try {
+            CheckInEntry entry = this.node.getRcml().getLatestCheckInEntry();
+            if (entry != null) {
+                this.lastModified = entry.getTime();
+            }
+        } catch (RevisionControlException e) {
+            throw new RepositoryException(e);
+        }
         return this.lastModified;
     }
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.