svn commit: r685587 - /ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r685587 - /ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java

jacopoc
Author: jacopoc
Date: Wed Aug 13 08:33:15 2008
New Revision: 685587

URL: http://svn.apache.org/viewvc?rev=685587&view=rev
Log:
Improved some comments; slightly enhanced error handling for the "cms" event; some minor fixes.

Modified:
    ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java?rev=685587&r1=685586&r2=685587&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java Wed Aug 13 08:33:15 2008
@@ -233,17 +233,17 @@
                 return "success";
             } else {
                 if (Debug.verboseOn()) Debug.logVerbose("No website [" + webSiteId + "] publish point found for contentId: " + contentId, module);
+                return "error";
             }
         }
 
-        return "success";
+        return "error";
         // throw an unknown request error
         //throw new GeneralRuntimeException("Unknown request; this request does not exist or cannot be called directly.");
     }
 
     protected static boolean verifyContentToWebSite(GenericDelegator delegator, String webSiteId, String contentId) throws GeneralException {
-        // first check the top level publish point
-        // get the root content id
+        // first check if the passed in contentId is a publish point for the web site
         List<GenericValue> publishPoints = null;
         try {
             publishPoints = delegator.findByAndCache("WebSiteContent",
@@ -254,7 +254,12 @@
         }
 
         publishPoints = EntityUtil.filterByDate(publishPoints);
-        if (publishPoints == null || publishPoints.size() == 0) {
+        if (publishPoints != null && publishPoints.size() > 0) {
+            if (Debug.verboseOn()) Debug.logVerbose("Found publish points: " + publishPoints, module);
+            return true;
+        } else {
+            // the passed in contentId is not a publish point for the web site;
+            // however we will publish its content if it is a node of one of the trees that have a publish point as the root
             List<GenericValue> topLevelContentValues = delegator.findByAndCache("WebSiteContent",
                 UtilMisc.toMap("webSiteId", webSiteId, "webSiteContentTypeId", "PUBLISH_POINT"), UtilMisc.toList("-fromDate"));
             topLevelContentValues = EntityUtil.filterByDate(topLevelContentValues);
@@ -265,16 +270,13 @@
                     }
                 }
             }
-        } else {
-            if (Debug.verboseOn()) Debug.logVerbose("Found publish points: " + publishPoints, module);
-            return true;
         }
 
         return false;
     }
 
     protected static boolean verifySubContent(GenericDelegator delegator, String contentId, String contentIdFrom) throws GeneralException {
-        List<GenericValue> contentAssoc = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", contentIdFrom, "contentIdTo", contentId));
+        List<GenericValue> contentAssoc = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", contentIdFrom, "contentIdTo", contentId, "contentAssocTypeId", "SUB_CONTENT"));
         contentAssoc = EntityUtil.filterByDate(contentAssoc);
         if (contentAssoc == null || contentAssoc.size() == 0) {
             List<GenericValue> assocs = delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId", contentIdFrom));