svn commit: r595621 - /lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/workflow/usecases/Publish.java

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Fri Nov 16 02:56:39 2007
New Revision: 595621

URL: http://svn.apache.org/viewvc?rev=595621&view=rev
Log:
Publish usecase: consider non-UUID site nodes (don't throw exception)

Modified:
    lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/workflow/usecases/Publish.java

Modified: lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/workflow/usecases/Publish.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/workflow/usecases/Publish.java?rev=595621&r1=595620&r2=595621&view=diff
==============================================================================
--- lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/workflow/usecases/Publish.java (original)
+++ lenya/trunk/src/modules-core/workflow/java/src/org/apache/lenya/cms/workflow/usecases/Publish.java Fri Nov 16 02:56:39 2007
@@ -188,7 +188,6 @@
                     DocumentLocator[] requiredNodes = siteManager
                             .getRequiredResources(map, liveLoc);
                     for (int i = 0; i < requiredNodes.length; i++) {
-
                         String path = requiredNodes[i].getPath();
                         if (!liveSite.contains(path)) {
                             Link link = getExistingLink(path, document);
@@ -233,7 +232,7 @@
     }
 
     /**
-     * Returns a link of a certain node, preferrably in the document's language,
+     * Returns a link of a certain node, preferably in the document's language,
      * or <code>null</code> if the node has no links.
      * @param path The path of the node.
      * @param document The document.
@@ -243,10 +242,13 @@
     protected Link getExistingLink(String path, Document document) throws SiteException {
         SiteNode node = document.area().getSite().getNode(path);
         Link link = null;
-        if (node.hasLink(document.getLanguage())) {
-            link = node.getLink(document.getLanguage());
-        } else if (node.getLanguages().length > 0) {
-            link = node.getLink(node.getLanguages()[0]);
+        String uuid = node.getUuid();
+        if (uuid != null && uuid.equals(document.getUUID())) {
+            if (node.hasLink(document.getLanguage())) {
+                link = node.getLink(document.getLanguage());
+            } else if (node.getLanguages().length > 0) {
+                link = node.getLink(node.getLanguages()[0]);
+            }
         }
         return link;
     }
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.