You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2006/07/27 18:34:40 UTC

svn commit: r426129 - /lenya/trunk/src/impl/java/org/apache/lenya/cms/observation/ObservationManager.java

Author: andreas
Date: Thu Jul 27 09:34:39 2006
New Revision: 426129

URL: http://svn.apache.org/viewvc?rev=426129&view=rev
Log:
Derive document from node source URI directly. This is a hack, but it allows to track deleted documents.

Modified:
    lenya/trunk/src/impl/java/org/apache/lenya/cms/observation/ObservationManager.java

Modified: lenya/trunk/src/impl/java/org/apache/lenya/cms/observation/ObservationManager.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/impl/java/org/apache/lenya/cms/observation/ObservationManager.java?rev=426129&r1=426128&r2=426129&view=diff
==============================================================================
--- lenya/trunk/src/impl/java/org/apache/lenya/cms/observation/ObservationManager.java (original)
+++ lenya/trunk/src/impl/java/org/apache/lenya/cms/observation/ObservationManager.java Thu Jul 27 09:34:39 2006
@@ -36,7 +36,6 @@
 import org.apache.lenya.cms.repository.Node;
 import org.apache.lenya.cms.repository.RepositoryUtil;
 import org.apache.lenya.cms.repository.Session;
-import org.apache.lenya.cms.site.SiteUtil;
 
 /**
  * Observation manager. Works as an observation registry and sends the notifications.
@@ -142,6 +141,11 @@
     }
 
     protected Document getDocument(Node node, Identity identity) {
+        
+        if (node.getSourceURI().endsWith(".xml")) {
+            return null;
+        }
+        
         Document doc = null;
 
         final String sourceUri = node.getSourceURI();
@@ -162,20 +166,14 @@
 
             Session session = RepositoryUtil.createSession(manager, identity);
             DocumentFactory factory = DocumentUtil.createDocumentIdentityMap(this.manager, session);
+            
+            String docPath = path.substring((pubId + "/content/" + area).length());
+            String docId = docPath.substring(0, docPath.length() - "/index_en".length());
+            String language = docPath.substring(docPath.length() - "en".length());
+            
+            doc = factory.get(pub, area, docId, language);
 
-            Document[] docs = SiteUtil.getDocuments(this.manager, factory, pub, area);
-
-            boolean matched = false;
-
-            for (int i = 0; i < docs.length; i++) {
-                String docUri = docs[i].getRepositoryNode().getSourceURI();
-                if (docUri.equals(node.getSourceURI())) {
-                    doc = docs[i];
-                    matched = true;
-                }
-            }
-
-            if (!matched) {
+            if (doc == null) {
                 // this happens if the node was not a document node
                 this.getLogger().info("No document found for node [" + sourceUri + "]");
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org