[Yanel-commits] rev 57788 - public/yanel/trunk/src/core/java/org/wyona/yanel/core/util

michi at wyona.com michi at wyona.com
Tue Apr 12 10:12:23 CEST 2011


Author: michi
Date: 2011-04-12 10:12:22 +0200 (Tue, 12 Apr 2011)
New Revision: 57788

Modified:
   public/yanel/trunk/src/core/java/org/wyona/yanel/core/util/VersioningUtil.java
Log:
method which does not scale well commented

Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/core/util/VersioningUtil.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/util/VersioningUtil.java	2011-04-12 07:56:35 UTC (rev 57787)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/util/VersioningUtil.java	2011-04-12 08:12:22 UTC (rev 57788)
@@ -53,16 +53,20 @@
                             newRevisionName = getMostRecentRevision((VersionableV3) resource).getName();
                         }
                         if (newRevisionName != null) {
+                            if (log.isDebugEnabled()) log.debug("Revision head: " + newRevisionName);
                             WorkflowableV1 workflowableRes = (WorkflowableV1) resource;
                             if (workflowableRes.getWorkflowState(newRevisionName) == null) {
+
                                 // TODO/TBD: Should the workflow state of the old revision be used (as is) or rather workflow.getInitialState()
-                                //if (log.isDebugEnabled()) log.debug("Revision head: " + getRevisionHead(versionableRes)); // WARN: Very bad peformance, because does not scale well!
-                                workflowableRes.setWorkflowState(workflowableRes.getWorkflowState(revisionName), getRevisionHead(versionableRes));
+                                String newWorkflowState = workflowableRes.getWorkflowState(revisionName);
+                                //String newWorkflowState = workflowableRes.getInitialWorkflowState(); // INFO: Maybe Part of WorkflowableV2?!
+
+                                workflowableRes.setWorkflowState(newWorkflowState, newRevisionName);
                             } else {
                                 log.warn("The workflow state has already been set (probably by the checkin method): " + workflowableRes.getWorkflowState(newRevisionName));
                             }
                         } else {
-                            log.warn("Cannot determine the revision name, hence please make sure to set the workflow state inside the checkin method if applicable!");
+                            log.warn("Cannot determine the revision name, hence please make sure to set the workflow state inside the checkin method if applicable or implement the versionable V3 interface!");
                         }
                     } else {
                         log.info("Cannot set workflow, because resource '" + resource.getPath() + "' is not WorkflowableV1");
@@ -81,11 +85,13 @@
     /**
      * Get revision number/name of head (most recent) revision (WARN: Peformance/Scalability)
      */
-    private static String getRevisionHead(VersionableV2 resource) throws Exception {
+/*
+    private static String getRevisionHeadName(VersionableV2 resource) throws Exception {
         RevisionInformation[] ri = resource.getRevisions();
         java.util.Arrays.sort(ri);
         return ri[0].getName();
     }
+*/
 
     /**
      * Get most recent revision



More information about the Yanel-commits mailing list