[Yanel-commits] rev 57439 - in public/yanel/trunk/src/resources/workflow-dashboard: htdocs src/java/org/wyona/yanel/impl/resources/dashboard

michi at wyona.com michi at wyona.com
Tue Mar 22 21:25:58 CET 2011


Author: michi
Date: 2011-03-22 21:25:57 +0100 (Tue, 22 Mar 2011)
New Revision: 57439

Modified:
   public/yanel/trunk/src/resources/workflow-dashboard/htdocs/search-resources.xsl
   public/yanel/trunk/src/resources/workflow-dashboard/src/java/org/wyona/yanel/impl/resources/dashboard/WorkflowDashboardResource.java
Log:
made dashboard XSLT more dynamic

Modified: public/yanel/trunk/src/resources/workflow-dashboard/htdocs/search-resources.xsl
===================================================================
--- public/yanel/trunk/src/resources/workflow-dashboard/htdocs/search-resources.xsl	2011-03-22 20:06:37 UTC (rev 57438)
+++ public/yanel/trunk/src/resources/workflow-dashboard/htdocs/search-resources.xsl	2011-03-22 20:25:57 UTC (rev 57439)
@@ -34,6 +34,8 @@
           <input type="submit" value="Search"/>
         </form>
 
+        <xsl:choose>
+          <xsl:when test="/workflow-dashboard/@query">
         <p>
         Query: <xsl:value-of select="/workflow-dashboard/@query"/>
         </p>
@@ -53,8 +55,13 @@
         </xsl:choose>
 
         <p>
-        <a href="?yanel.resource.viewid=xml">XML</a>
+        <a href="?yanel.resource.viewid=xml&workflow-state={/workflow-dashboard/@workflow-state}&mime-type={/workflow-dashboard/@mime-type}">XML</a>
         </p>
+          </xsl:when>
+          <xsl:otherwise>
+<xsl:comment>No query yet.</xsl:comment>
+          </xsl:otherwise>
+        </xsl:choose>
       </body>
     </html>
   </xsl:template>

Modified: public/yanel/trunk/src/resources/workflow-dashboard/src/java/org/wyona/yanel/impl/resources/dashboard/WorkflowDashboardResource.java
===================================================================
--- public/yanel/trunk/src/resources/workflow-dashboard/src/java/org/wyona/yanel/impl/resources/dashboard/WorkflowDashboardResource.java	2011-03-22 20:06:37 UTC (rev 57438)
+++ public/yanel/trunk/src/resources/workflow-dashboard/src/java/org/wyona/yanel/impl/resources/dashboard/WorkflowDashboardResource.java	2011-03-22 20:25:57 UTC (rev 57439)
@@ -27,14 +27,19 @@
             log.debug("requested viewId: " + viewId);
         }
 
-        String workflowState = "draft";
+        String workflowState = null;
         if (getEnvironment().getRequest().getParameter("workflow-state") != null) {
             workflowState = getEnvironment().getRequest().getParameter("workflow-state");
         }
 
-        String queryText = "workflow-state:" + workflowState;
-        if (getEnvironment().getRequest().getParameter("mime-type") != null) {
-            queryText = queryText + " AND " + "yarep_mimeType:" + getEnvironment().getRequest().getParameter("mime-type");
+        String queryText = null;
+        String mimeType = null;
+        if (workflowState != null) {
+            queryText = "workflow-state:" + workflowState;
+            mimeType = getEnvironment().getRequest().getParameter("mime-type");
+            if (mimeType != null) {
+                queryText = queryText + " AND " + "yarep_mimeType:" + mimeType;
+            }
         }
 
 /*
@@ -64,12 +69,25 @@
         }
 */
 
-        //org.wyona.yarep.core.Node[] nodes = getRealm().getRepository().getSearcher().searchProperty("workflow-state", workflowState, "/meetings");
-        //org.wyona.yarep.core.Node[] nodes = getRealm().getRepository().getSearcher().searchProperty("workflow-state", workflowState, "/");
-        org.wyona.yarep.core.Node[] nodes = getRealm().getRepository().getSearcher().searchProperty("workflow-state", queryText, "/");
+        org.wyona.yarep.core.Node[] nodes = null;
+        if (queryText != null) {
+            //nodes = getRealm().getRepository().getSearcher().searchProperty("workflow-state", workflowState, "/meetings");
+            //nodes = getRealm().getRepository().getSearcher().searchProperty("workflow-state", workflowState, "/");
+            nodes = getRealm().getRepository().getSearcher().searchProperty("workflow-state", queryText, "/");
+        }
 
         StringBuilder sb = new StringBuilder("<?xml version=\"1.0\"?>");
-        sb.append("<workflow-dashboard query=\"" + queryText + "\">");
+        sb.append("<workflow-dashboard");
+        if (queryText != null) {
+            sb.append(" query=\"" + queryText + "\"");
+        }
+        if (workflowState != null) {
+            sb.append(" workflow-state=\"" + workflowState + "\"");
+        }
+        if (mimeType != null) {
+            sb.append(" mime-type=\"" + mimeType + "\"");
+        }
+        sb.append(">");
 
         String[] mimeTypes = getMimeTypes();
         if (mimeTypes != null) {



More information about the Yanel-commits mailing list