[Yanel-commits] rev 43263 - public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet

michi at wyona.com michi at wyona.com
Fri Jun 19 14:40:02 CEST 2009


Author: michi
Date: 2009-06-19 14:40:02 +0200 (Fri, 19 Jun 2009)
New Revision: 43263

Modified:
   public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java
Log:
check if workflow has been assigned

Modified: public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java
===================================================================
--- public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java	2009-06-19 09:16:29 UTC (rev 43262)
+++ public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java	2009-06-19 12:40:02 UTC (rev 43263)
@@ -409,7 +409,7 @@
                         // NOTE: Check also if usecase is not roll-back, because roll-back is also using the yanel.resource.revision
                         if (revisionName != null && ResourceAttributeHelper.hasAttributeImplemented(res, "Versionable", "2") && !isRollBack(request)) {
                             view = ((VersionableV2) res).getView(viewId, revisionName);
-                        } else if (ResourceAttributeHelper.hasAttributeImplemented(res, "Workflowable", "1") && environment.getStateOfView().equals(StateOfView.LIVE)) {
+                        } else if (environment.getStateOfView().equals(StateOfView.LIVE) && ResourceAttributeHelper.hasAttributeImplemented(res, "Workflowable", "1") && WorkflowHelper.getWorkflow(res) != null) { // TODO: Instead using the WorkflowHelper the Workflowable interface should have a method to check if the resource actually has a workflow assigned, see http://lists.wyona.org/pipermail/yanel-development/2009-June/003709.html
                             // TODO: Check if resource actually exists (see the exist problem above), because even it doesn't exist, the workflowable interfaces can return something although it doesn't really make sense. For example if a resource type is workflowable, but it has no workflow associated with it, then WorkflowHelper.isLive will nevertheless return true, whereas WorkflowHelper.getLiveView will throw an exception!
                             if (!((ViewableV2) res).exists()) {
                                 log.warn("No such ViewableV2 resource: " + res.getPath());
@@ -871,7 +871,7 @@
     }
 
     /**
-     *
+     * Get environment
      */
     private Environment getEnvironment(HttpServletRequest request, HttpServletResponse response) throws ServletException {
         Identity identity;



More information about the Yanel-commits mailing list