You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ma...@apache.org on 2011/05/13 17:41:21 UTC
svn commit: r1102794 [1/3] - in /oodt/trunk: ./ webapp/components/
webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/
webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/conditions/
webapp/components/src/...
Author: mattmann
Date: Fri May 13 15:41:18 2011
New Revision: 1102794
URL: http://svn.apache.org/viewvc?rev=1102794&view=rev
Log:
- fix for OODT-156 Rewrite Workflow Monitor webapp using Apache Wicket
Added:
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/WMMonitorAppBase.java
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/WorkflowMgrConn.java
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/conditions/
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/conditions/WorkflowConditionViewer.css
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/conditions/WorkflowConditionViewer.html
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/conditions/WorkflowConditionViewer.java
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/event/
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/event/EventToWorkflowViewer.css
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/event/EventToWorkflowViewer.html
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/event/EventToWorkflowViewer.java
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/WorkflowInstancesViewer.css
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/WorkflowInstancesViewer.html
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/WorkflowInstancesViewer.java
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage.png (with props)
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage_back.png (with props)
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage_back1.png (with props)
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage_back2.png (with props)
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage_back3.png (with props)
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage_back4.png (with props)
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/progress.css
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/progress.js
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/progress_wicket.css
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/prototype.js
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/model/
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/model/WorkflowViewer.css
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/model/WorkflowViewer.html
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/model/WorkflowViewer.java
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/model/WorkflowsViewer.css
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/model/WorkflowsViewer.html
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/model/WorkflowsViewer.java
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/model/task_arrow.jpg (with props)
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/model/task_circle.jpg (with props)
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/pagination/
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/pagination/WorkflowPagePaginator.css
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/pagination/WorkflowPagePaginator.html
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/pagination/WorkflowPagePaginator.java
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/tasks/
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/tasks/WorkflowTaskViewer.css
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/tasks/WorkflowTaskViewer.html
oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/tasks/WorkflowTaskViewer.java
oodt/trunk/webapp/wmonitor/ (with props)
oodt/trunk/webapp/wmonitor/pom.xml
oodt/trunk/webapp/wmonitor/src/
oodt/trunk/webapp/wmonitor/src/main/
oodt/trunk/webapp/wmonitor/src/main/java/
oodt/trunk/webapp/wmonitor/src/main/java/org/
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/Home.css
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/Home.html
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/Home.java
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/WMMonitorApp.java
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/condition/
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/condition/WorkflowConditionViewerPage.css
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/condition/WorkflowConditionViewerPage.html
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/condition/WorkflowConditionViewerPage.java
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/events/
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/events/WorkflowEventViewerPage.css
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/events/WorkflowEventViewerPage.html
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/events/WorkflowEventViewerPage.java
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/instance/
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/instance/WorkflowInstanceViewerPage.css
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/instance/WorkflowInstanceViewerPage.html
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/instance/WorkflowInstanceViewerPage.java
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/task/
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/task/WorkflowTaskViewerPage.css
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/task/WorkflowTaskViewerPage.html
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/task/WorkflowTaskViewerPage.java
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/workflow/
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/workflow/WorkflowViewerPage.css
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/workflow/WorkflowViewerPage.html
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/workflow/WorkflowViewerPage.java
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/workflow/WorkflowsViewerPage.css
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/workflow/WorkflowsViewerPage.html
oodt/trunk/webapp/wmonitor/src/main/java/org/apache/oodt/cas/workflow/webapp/monitor/workflow/WorkflowsViewerPage.java
oodt/trunk/webapp/wmonitor/src/main/resources/
oodt/trunk/webapp/wmonitor/src/main/webapp/
oodt/trunk/webapp/wmonitor/src/main/webapp/META-INF/
oodt/trunk/webapp/wmonitor/src/main/webapp/META-INF/context.xml
oodt/trunk/webapp/wmonitor/src/main/webapp/WEB-INF/
oodt/trunk/webapp/wmonitor/src/main/webapp/WEB-INF/web.xml
Removed:
oodt/trunk/webapp/workflow/
Modified:
oodt/trunk/CHANGES.txt
oodt/trunk/webapp/components/pom.xml
Modified: oodt/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1102794&r1=1102793&r2=1102794&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Fri May 13 15:41:18 2011
@@ -4,6 +4,8 @@ Apache OODT Change Log
Release 0.3-SNAPSHOT (in progress)
--------------------------------------------
+* OODT-156 Rewrite Workflow Monitor webapp using Apache Wicket (mattmann)
+
* OODT-190 WorkflowCondition configuration isn't read (mattmann)
* OODT-189 Refactor and clean up WorkflowCondition
Modified: oodt/trunk/webapp/components/pom.xml
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/components/pom.xml?rev=1102794&r1=1102793&r2=1102794&view=diff
==============================================================================
--- oodt/trunk/webapp/components/pom.xml (original)
+++ oodt/trunk/webapp/components/pom.xml Fri May 13 15:41:18 2011
@@ -36,6 +36,11 @@ the License.
<version>0.3-SNAPSHOT</version>
</dependency>
<dependency>
+ <groupId>org.apache.oodt</groupId>
+ <artifactId>cas-workflow</artifactId>
+ <version>0.3-SNAPSHOT</version>
+ </dependency>
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.8</version>
Added: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/WMMonitorAppBase.java
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/WMMonitorAppBase.java?rev=1102794&view=auto
==============================================================================
--- oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/WMMonitorAppBase.java (added)
+++ oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/WMMonitorAppBase.java Fri May 13 15:41:18 2011
@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.cas.webcomponents.workflow;
+
+import java.util.List;
+import java.util.Vector;
+
+import org.apache.oodt.cas.metadata.util.PathUtils;
+import org.apache.wicket.protocol.http.WebApplication;
+
+/**
+ *
+ * Describe your class here.
+ *
+ * @author mattmann
+ * @version $Revision$
+ *
+ */
+public abstract class WMMonitorAppBase extends WebApplication {
+
+ public String getWorkflowUrl() {
+ return getContextParamEnvReplace("workflow.url");
+ }
+
+ public String getLifecycleFilePath() {
+ return getContextParamEnvReplace("org.apache.oodt.cas.workflow.webapp.lifecycleFilePath");
+ }
+
+ public List<String> getStatuses() {
+ String[] statuses = getContextParamEnvReplace("org.apache.oodt.cas.workflow.inst.statuses").split(",");
+ List<String> statusList = new Vector<String>();
+ for(String status: statuses){
+ statusList.add(status.trim());
+ }
+ statusList.add("ALL");
+ return statusList;
+ }
+
+ public String getInstMetFieldsFilePath() {
+ return getContextParamEnvReplace("org.apache.oodt.cas.workflow.webapp.inst.metFields.filePath");
+ }
+
+ private String getContextParamEnvReplace(String paramName) {
+ return PathUtils.replaceEnvVariables(this.getServletContext()
+ .getInitParameter(paramName));
+ }
+
+}
Added: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/WorkflowMgrConn.java
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/WorkflowMgrConn.java?rev=1102794&view=auto
==============================================================================
--- oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/WorkflowMgrConn.java (added)
+++ oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/WorkflowMgrConn.java Fri May 13 15:41:18 2011
@@ -0,0 +1,220 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.cas.webcomponents.workflow;
+
+import java.io.Serializable;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+import java.util.Vector;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.oodt.cas.workflow.structs.Workflow;
+import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
+import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
+import org.apache.oodt.cas.workflow.structs.WorkflowInstancePage;
+import org.apache.oodt.cas.workflow.structs.WorkflowTask;
+import org.apache.oodt.cas.workflow.system.XmlRpcWorkflowManagerClient;
+
+/**
+ *
+ * Describe your class here.
+ *
+ * @author mattmann
+ * @version $Revision$
+ *
+ */
+public class WorkflowMgrConn implements Serializable {
+
+ private static final long serialVersionUID = -9081117871702614402L;
+
+ private static final Logger LOG = Logger.getLogger(WorkflowMgrConn.class
+ .getName());
+
+ private XmlRpcWorkflowManagerClient wm;
+
+ public WorkflowMgrConn(String wmUrlStr) {
+ try {
+ this.wm = new XmlRpcWorkflowManagerClient(new URL(wmUrlStr));
+ } catch (MalformedURLException e) {
+ LOG.log(Level.SEVERE, "Unable to contact Workflow Manager at URL: ["
+ + wmUrlStr + "]: Message: " + e.getMessage());
+ this.wm = null;
+ }
+ }
+
+ public WorkflowTask safeGetTaskById(String taskId) {
+ try {
+ return new SerializableWorkflowTask(this.wm.getTaskById(taskId));
+ } catch (Exception e) {
+ LOG.log(Level.WARNING, "Unable to obtain workflow task with ID: ["
+ + taskId + "]: Message: " + e.getMessage());
+ return null;
+ }
+ }
+
+ public WorkflowCondition safeGetConditionById(String conditionId) {
+ try {
+ return new SerializableWorkflowCondition(this.wm
+ .getConditionById(conditionId));
+ } catch (Exception e) {
+ LOG.log(Level.WARNING, "Unable to obtain workflow condition with ID: ["
+ + conditionId + "]: Message: " + e.getMessage());
+ return null;
+ }
+ }
+
+ public Workflow safeGetWorkflowById(String workflowId) {
+ try {
+ return this.wm.getWorkflowById(workflowId);
+ } catch (Exception e) {
+ LOG.log(Level.WARNING, "Unable to obtain workflow with ID: ["
+ + workflowId + "]: Message: " + e.getMessage());
+ return null;
+ }
+ }
+
+ public List<Workflow> safeGetWorkflowsByEvent(String eventName) {
+ try {
+ return this.wm.getWorkflowsByEvent(eventName);
+ } catch (Exception e) {
+ LOG.log(Level.WARNING, "Unable to obtain workflows by event: ["
+ + eventName + "]: Message: " + e.getMessage());
+ return new Vector<Workflow>();
+ }
+ }
+
+ public List<String> safeGetRegisteredEvents() {
+ try {
+ return this.wm.getRegisteredEvents();
+ } catch (Exception e) {
+ LOG.log(Level.WARNING, "Unable to obtain registered events: Message: "
+ + e.getMessage());
+ return new Vector<String>();
+ }
+ }
+
+ public List<Workflow> safeGetWorkflows() {
+ try {
+ return this.wm.getWorkflows();
+ } catch (Exception e) {
+ LOG.log(Level.WARNING, "Unable to obtain workflows: Message: "
+ + e.getMessage());
+ return new Vector<Workflow>();
+ }
+ }
+
+ public List<WorkflowInstance> safeGetWorkflowInsts() {
+ try {
+ return this.wm.getWorkflowInstances();
+ } catch (Exception e) {
+ LOG.log(Level.WARNING, "Unable to obtain workflow instances: Message: "
+ + e.getMessage());
+ return new Vector<WorkflowInstance>();
+ }
+ }
+
+ public List<WorkflowInstance> safeGetWorkflowInstsByStatus(String status) {
+ try {
+ return this.wm.getWorkflowInstancesByStatus(status);
+ } catch (Exception e) {
+ LOG.log(Level.WARNING, "Unable to obtain workflow instances by status: ["
+ + status + "]: Message: " + e.getMessage());
+ return new Vector<WorkflowInstance>();
+ }
+ }
+
+ public WorkflowInstancePage safeGetWorkflowInstPageByStatus(int pageNum,
+ String status) {
+ try {
+ return this.wm.paginateWorkflowInstances(pageNum, status);
+ } catch (Exception e) {
+ LOG.log(Level.WARNING, "Unable to obtain workflow instance page: ["
+ + pageNum + "] by status: [" + status + "]: Message: "
+ + e.getMessage());
+ return null;
+ }
+ }
+
+ public WorkflowInstancePage safeGetWorkflowInstPageByStatus(int pageNum) {
+ try {
+ return this.wm.paginateWorkflowInstances(pageNum);
+ } catch (Exception e) {
+ LOG.log(Level.WARNING, "Unable to obtain workflow instance page: ["
+ + pageNum + "]: Message: " + e.getMessage());
+ return null;
+ }
+ }
+
+ public double safeGetWorkflowWallClockMinutes(WorkflowInstance inst) {
+ try {
+ return this.wm.getWorkflowWallClockMinutes(inst.getId());
+ } catch (Exception e) {
+ LOG.log(Level.WARNING,
+ "Unable to obtain workflow wall clock mins: inst id: ["
+ + inst.getId() + "]: Message: " + e.getMessage());
+ return -999.0;
+ }
+ }
+
+ public double safeGetWorkflowCurrentTaskWallClockMinutes(WorkflowInstance inst) {
+ try {
+ return this.wm.getWorkflowCurrentTaskWallClockMinutes(inst.getId());
+ } catch (Exception e) {
+ LOG.log(Level.WARNING,
+ "Unable to obtain workflow current task wall clock mins: inst id: ["
+ + inst.getId() + "]: Message: " + e.getMessage());
+ return -999.0;
+ }
+ }
+
+ public XmlRpcWorkflowManagerClient getWM() {
+ return this.wm;
+ }
+
+ class SerializableWorkflowTask extends WorkflowTask implements Serializable {
+
+ private static final long serialVersionUID = 6859678680008137795L;
+
+ public SerializableWorkflowTask(WorkflowTask task) {
+ this.taskName = task.getTaskName();
+ this.taskId = task.getTaskId();
+ this.taskInstanceClassName = task.getTaskInstanceClassName();
+ this.conditions = task.getConditions();
+ this.order = task.getOrder();
+ this.requiredMetFields = task.getRequiredMetFields();
+ this.taskConfig = task.getTaskConfig();
+ }
+ }
+
+ class SerializableWorkflowCondition extends WorkflowCondition implements
+ Serializable {
+
+ private static final long serialVersionUID = 909843381568743621L;
+
+ public SerializableWorkflowCondition(WorkflowCondition cond) {
+ this.setConditionName(cond.getConditionName());
+ this.conditionInstanceClassName = cond.getConditionInstanceClassName();
+ this.order = cond.getOrder();
+ this.condConfig = cond.getTaskConfig();
+ }
+
+ }
+
+}
Added: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/conditions/WorkflowConditionViewer.css
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/conditions/WorkflowConditionViewer.css?rev=1102794&view=auto
==============================================================================
--- oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/conditions/WorkflowConditionViewer.css (added)
+++ oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/conditions/WorkflowConditionViewer.css Fri May 13 15:41:18 2011
@@ -0,0 +1,21 @@
+#condition_tbl{
+ border-spacing:2px;
+ font-family: Arial,Sans-Serif,sans-serif;
+}
+
+.header{
+
+}
+
+.value{
+
+}
+
+#workflow_cond_config_tbl{
+ border-spacing:2px;
+ font-family: Arial,Sans-Serif,sans-serif;
+}
+
+#cond_config{
+
+}
Added: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/conditions/WorkflowConditionViewer.html
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/conditions/WorkflowConditionViewer.html?rev=1102794&view=auto
==============================================================================
--- oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/conditions/WorkflowConditionViewer.html (added)
+++ oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/conditions/WorkflowConditionViewer.html Fri May 13 15:41:18 2011
@@ -0,0 +1,35 @@
+<wicket:panel>
+<wicket:link>
+ <link rel="stylesheet" type="text/css" href="WorkflowConditionViewer.css"/>
+</wicket:link>
+
+<table id="condition_tbl">
+ <tr>
+ <td class="header">Condition ID</td>
+ <td class="value"><span wicket:id="condition_id">urn:oodt:TrueCondition</span></td>
+ </tr>
+ <tr>
+ <td class="header">Name</td>
+ <td class="value"><span wicket:id="condition_name">True Condition</span></td>
+ </tr>
+ <tr>
+ <td class="header">Implementation Class</td>
+ <td class="value"><span wicket:id="condition_class">org.apache.oodt.cas.workflow.examples.TrueCondition</span></td>
+ </tr>
+ <tr>
+ <td class="header">Configuration</td>
+ <td>
+ <table id="workflow_cond_config_tbl">
+ <tr class="header">
+ <td>Property</td>
+ <td>Value</td>
+ </tr>
+ <tr wicket:id="cond_config" id="cond_config">
+ <td><span wicket:id="cond_pname">numSeconds</span></td>
+ <td><span wicket:id="cond_pvalue">60</span></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+</wicket:panel>
Added: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/conditions/WorkflowConditionViewer.java
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/conditions/WorkflowConditionViewer.java?rev=1102794&view=auto
==============================================================================
--- oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/conditions/WorkflowConditionViewer.java (added)
+++ oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/conditions/WorkflowConditionViewer.java Fri May 13 15:41:18 2011
@@ -0,0 +1,80 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.cas.webcomponents.workflow.conditions;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.oodt.cas.webcomponents.workflow.WorkflowMgrConn;
+import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
+import org.apache.oodt.cas.workflow.structs.WorkflowConditionConfiguration;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.util.ListModel;
+
+/**
+ *
+ * Describe your class here.
+ *
+ * @author mattmann
+ * @version $Revision$
+ *
+ */
+public class WorkflowConditionViewer extends Panel {
+
+ private static final long serialVersionUID = 7861466388954745105L;
+
+ private WorkflowMgrConn wm;
+
+ public WorkflowConditionViewer(String id, String wmUrlStr, String conditionId) {
+ super(id);
+ this.wm = new WorkflowMgrConn(wmUrlStr);
+ final WorkflowCondition cond = this.wm.safeGetConditionById(conditionId);
+ add(new Label("condition_id", cond.getConditionId()));
+ add(new Label("condition_name", cond.getConditionName()));
+ add(new Label("condition_class", cond.getConditionInstanceClassName()));
+ final WorkflowConditionConfiguration config = cond.getCondConfig() != null ?
+ cond.getCondConfig():new WorkflowConditionConfiguration();
+ List<String> condConfigKeyNames = Arrays.asList(config
+ .getProperties().keySet().toArray(
+ new String[config.getProperties().size()]));
+ Collections.sort(condConfigKeyNames);
+ add(new ListView<String>("cond_config", new ListModel<String>(
+ condConfigKeyNames)) {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.wicket.markup.html.list.ListView#populateItem(org.apache
+ * .wicket.markup.html.list.ListItem)
+ */
+ @Override
+ protected void populateItem(ListItem<String> item) {
+ String keyName = item.getModelObject();
+ String keyVal = config.getProperty(keyName);
+ item.add(new Label("cond_pname", keyName));
+ item.add(new Label("cond_pvalue", keyVal));
+ }
+ });
+
+ }
+
+}
Added: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/event/EventToWorkflowViewer.css
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/event/EventToWorkflowViewer.css?rev=1102794&view=auto
==============================================================================
--- oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/event/EventToWorkflowViewer.css (added)
+++ oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/event/EventToWorkflowViewer.css Fri May 13 15:41:18 2011
@@ -0,0 +1,7 @@
+#event_header_title{
+
+}
+
+#event_workflow_tbl{
+
+}
\ No newline at end of file
Added: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/event/EventToWorkflowViewer.html
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/event/EventToWorkflowViewer.html?rev=1102794&view=auto
==============================================================================
--- oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/event/EventToWorkflowViewer.html (added)
+++ oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/event/EventToWorkflowViewer.html Fri May 13 15:41:18 2011
@@ -0,0 +1,38 @@
+<wicket:panel>
+<wicket:link>
+ <link rel="stylesheet" type="text/css" href="EventToWorkflowViewer.css"/>
+ </wicket:link>
+
+<h3 id="event_header_title">Event to Workflow Map</h3>
+<p>Select an event, and then click on "Get Workflows" to obtain a list of workflows associated
+with the selected event.</p>
+
+<form wicket:id="event_workflow_frm">
+ <table id="event_workflow_tbl">
+ <tr>
+ <td>Event</td>
+ <td><select wicket:id="event_list">
+ <wicket:remove>
+ <option value="test">test</option>
+ </wicket:remove>
+ </select>
+ </td>
+ <td><input type="submit" id="get_workflow_button" value="Get Worfklows!"></td>
+ </tr>
+ </table>
+ </form>
+
+ <div wicket:id="wtable">
+ <hr>
+ <h4>Workflows for <span wicket:id="selectedEvent">test</span> event</h4>
+
+ <table>
+ <tr>
+ <td>Workflow</td>
+ </tr>
+ <tr wicket:id="workflow_list">
+ <td><a href="#" wicket:id="workflow_link"><span wicket:id="workflow_name">Test Workflow</span></a></td>
+ </tr>
+ </table>
+ </div>
+</wicket:panel>
Added: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/event/EventToWorkflowViewer.java
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/event/EventToWorkflowViewer.java?rev=1102794&view=auto
==============================================================================
--- oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/event/EventToWorkflowViewer.java (added)
+++ oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/event/EventToWorkflowViewer.java Fri May 13 15:41:18 2011
@@ -0,0 +1,132 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.oodt.cas.webcomponents.workflow.event;
+
+import java.util.List;
+import java.util.Vector;
+
+import org.apache.oodt.cas.webcomponents.workflow.WorkflowMgrConn;
+import org.apache.oodt.cas.workflow.structs.Workflow;
+import org.apache.wicket.PageParameters;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.DropDownChoice;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.PropertyModel;
+
+/**
+ *
+ * Describe your class here.
+ *
+ * @author mattmann
+ * @version $Revision$
+ *
+ */
+public class EventToWorkflowViewer extends Panel {
+
+ private static final long serialVersionUID = -5120511045763328237L;
+
+ private final WorkflowMgrConn wm;
+
+ private final List<Workflow> workflows;
+
+ public EventToWorkflowViewer(String id, String workflowUrlStr, final Class<? extends WebPage> viewerPage) {
+ super(id);
+ this.wm = new WorkflowMgrConn(workflowUrlStr);
+ this.workflows = new Vector<Workflow>();
+ WebMarkupContainer wTable = new WebMarkupContainer("wtable");
+ wTable.setVisible(false);
+ PropertyModel<List<Workflow>> workflowsModel = new PropertyModel<List<Workflow>>(this, "workflows");
+ ListView<Workflow> workflowView = new ListView<Workflow>("workflow_list", workflowsModel) {
+ private static final long serialVersionUID = 5894604290395257941L;
+
+ @Override
+ protected void populateItem(ListItem<Workflow> item) {
+ Link<String> wLink = new Link<String>("workflow_link", new Model(item.getModelObject().getId())){
+
+ /* (non-Javadoc)
+ * @see org.apache.wicket.markup.html.link.Link#onClick()
+ */
+ @Override
+ public void onClick() {
+ PageParameters params = new PageParameters();
+ params.add("id", getModelObject());
+ setResponsePage(viewerPage, params);
+ }
+ };
+
+ wLink.add(new Label("workflow_name", item.getModelObject().getName()));
+ item.add(wLink);
+ }
+ };
+
+ EventWorkflowForm form =
+ new EventWorkflowForm("event_workflow_frm", workflowsModel, wTable);
+
+ wTable.add(workflowView);
+ add(wTable);
+ add(form);
+ }
+
+ class EventWorkflowForm extends Form<List<Workflow>>{
+
+ private static final long serialVersionUID = -3209079518977783358L;
+
+ private String selectedEvent;
+
+ private WebMarkupContainer wTable;
+
+ public EventWorkflowForm(String id, IModel<List<Workflow>> model, WebMarkupContainer wTable) {
+ super(id, model);
+ add(new DropDownChoice<String>("event_list", new PropertyModel(this, "selectedEvent"),
+ wm.safeGetRegisteredEvents()));
+ this.wTable = wTable;
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wicket.markup.html.form.Form#onSubmit()
+ */
+ @Override
+ protected void onSubmit() {
+ List<Workflow> workflows = wm.safeGetWorkflowsByEvent(this.selectedEvent);
+ setDefaultModelObject(workflows);
+ if(workflows != null && workflows.size() > 0){
+ this.wTable.setVisible(true);
+ this.wTable.add(new Label("selectedEvent", this.selectedEvent));
+ }
+ }
+
+ public String getSelectedEvent(){
+ return this.selectedEvent;
+ }
+
+ }
+
+
+
+
+}
Added: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/WorkflowInstancesViewer.css
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/WorkflowInstancesViewer.css?rev=1102794&view=auto
==============================================================================
--- oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/WorkflowInstancesViewer.css (added)
+++ oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/WorkflowInstancesViewer.css Fri May 13 15:41:18 2011
@@ -0,0 +1,25 @@
+#instance_filter_header{
+
+}
+
+a.workflow_status{
+
+}
+
+#workflow_display{
+
+}
+
+#workflow_inst_tbl{
+ border:0px;
+ border-spacing:3px;
+ border: 4px #000000;
+}
+
+.centered{
+ text-align:center;
+}
+
+.smaller{
+ font-size:9px;
+}
\ No newline at end of file
Added: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/WorkflowInstancesViewer.html
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/WorkflowInstancesViewer.html?rev=1102794&view=auto
==============================================================================
--- oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/WorkflowInstancesViewer.html (added)
+++ oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/WorkflowInstancesViewer.html Fri May 13 15:41:18 2011
@@ -0,0 +1,67 @@
+<wicket:panel>
+<wicket:link>
+ <link rel="stylesheet" type="text/css" href="WorkflowInstancesViewer.css"/>
+ <link rel="stylesheet" type="text/css" href="progress_wicket.css"/>
+ <wicket:remove>
+ <link rel="stylesheet" type="text/css" href="progress.css"/>
+ </wicket:remove>
+ <script type="text/javascript" language="Javascript" src="prototype.js"></script>
+ <script type="text/javascript" language="Javascript" src="progress.js"></script>
+</wicket:link>
+
+<div id="instance_filter_header">Filter Workflows by Status:<br> |
+ <wicket:container wicket:id="workflow_statuses">
+ <a class="workflow_status" wicket:id="wstatus_link" href="#"><span wicket:id="wstatus">STARTED</span></a> |
+ </wicket:container>
+ <wicket:remove>
+ <a class="workflow_status" href="#">FINISHED</a> |
+ <a class="workflow_status" href="#">METMISS</a> |
+ <a class="workflow_status" href="#">PAUSED</a> |
+ <a class="workflow_status" href="#">ALL</a> |
+ </wicket:remove>
+</div>
+
+ <p>Workflows <b wicket:id="start_idx">1</b>-<b wicket:id="end_idx">20</b> of <b wicket:id="num_insts">20</b> total</p>
+ <table id="workflow_inst_tbl">
+ <tr class="centered">
+ <td>Workflow</td>
+ <td>Progress</td>
+ <td>Status</td>
+ <td>Execution Time (min)</td>
+ <td>Current Task Execution Time (min)</td>
+ <td>Current Task</td>
+ </tr>
+
+ <tr wicket:id="workflow_insts">
+ <td><a href="#" wicket:id="workflow_link"><span wicket:id="workflow_name">Test Workflow</span></a>
+ <br/>
+ <p class="smaller" wicket:id="inst_met_display">ProcessingNode:localhost,WorkflowInstanceId:1</p>
+ </td>
+ <td class="centered"><script wicket:id="winst_display">display('./percentImage.png', 'winst_1_progress', 66, 1);</script></td>
+ <td class="centered" wicket:id="winst_status">RSUBMIT</td>
+ <td class="centered" wicket:id="winst_wallclock_mins">5.22</td>
+ <td class="centered" wicket:id="winst_task_wallclock_mins">2.5</td>
+ <td class="centered"><a href="#" wicket:id="task_link"><span wicket:id="task_name">Hello World</span></a></td>
+ </tr>
+ </table>
+ <p> </p>
+ <p> </p>
+ <span wicket:id="paginator"/>
+
+ <wicket:remove>
+ <hr width="*">
+ <div align="center">
+ <table id="pagination_table">
+ <tr>
+ <td id="pagination_table_result_hdr">Result Page</td>
+ </tr>
+ </table>
+ </div>
+ </wicket:remove>
+
+ <p> </p>
+ <p> </p>
+ <p> </p>
+ <p> </p>
+</wicket:panel>
+
Added: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/WorkflowInstancesViewer.java
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/WorkflowInstancesViewer.java?rev=1102794&view=auto
==============================================================================
--- oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/WorkflowInstancesViewer.java (added)
+++ oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/WorkflowInstancesViewer.java Fri May 13 15:41:18 2011
@@ -0,0 +1,292 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.cas.webcomponents.workflow.instance;
+
+import java.text.NumberFormat;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.webcomponents.workflow.WorkflowMgrConn;
+import org.apache.oodt.cas.webcomponents.workflow.pagination.WorkflowPagePaginator;
+import org.apache.oodt.cas.workflow.instrepo.WorkflowInstanceMetMap;
+import org.apache.oodt.cas.workflow.instrepo.WorkflowInstanceMetadataReader;
+import org.apache.oodt.cas.workflow.lifecycle.WorkflowLifecycleManager;
+import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
+import org.apache.oodt.cas.workflow.structs.WorkflowInstancePage;
+import org.apache.oodt.cas.workflow.structs.WorkflowTask;
+import org.apache.wicket.IResourceListener;
+import org.apache.wicket.PageParameters;
+import org.apache.wicket.ResourceReference;
+import org.apache.wicket.behavior.SimpleAttributeModifier;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.wicket.markup.html.link.ResourceLink;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.util.ListModel;
+import org.apache.wicket.util.value.ValueMap;
+
+/**
+ *
+ * Describe your class here.
+ *
+ * @author mattmann
+ * @version $Revision$
+ *
+ */
+public class WorkflowInstancesViewer extends Panel {
+
+ private static final long serialVersionUID = -311004303658412137L;
+
+ private WorkflowMgrConn wm;
+
+ private int pageNum;
+
+ private int startIdx;
+
+ private int endIdx;
+
+ private int totalWorkflowInsts;
+
+ private static final int PAGE_SIZE = 20;
+
+ /**
+ * @param id
+ */
+ public WorkflowInstancesViewer(String id, String workflowUrlStr,
+ final String status, int pageNum, List<String> wStatuses,
+ final String lifecycleFilePath, final String metInstanceFilePath,
+ final Class<? extends WebPage> workflowViewer,
+ final Class<? extends WebPage> workflowTaskViewer,
+ final Class<? extends WebPage> workflowInstViewer) {
+ super(id);
+ this.wm = new WorkflowMgrConn(workflowUrlStr);
+ this.pageNum = pageNum;
+ WorkflowInstancePage page = null;
+ System.out.println("STATUS IS "+status);
+ if (status.equals("ALL")) {
+ page = this.wm.safeGetWorkflowInstPageByStatus(pageNum);
+ } else {
+ page = this.wm.safeGetWorkflowInstPageByStatus(pageNum, status);
+ }
+
+ this.computeStartEndIdx(page);
+ add(new ListView<String>("workflow_statuses", new ListModel<String>(
+ wStatuses)) {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.wicket.markup.html.list.ListView#populateItem(org.apache
+ * .wicket.markup.html.list.ListItem)
+ */
+ @Override
+ protected void populateItem(ListItem<String> item) {
+ Link<String> wStatusLink = new Link<String>("wstatus_link", new Model(
+ item.getModelObject())) {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.wicket.markup.html.link.Link#onClick()
+ */
+ @Override
+ public void onClick() {
+ PageParameters params = new PageParameters();
+ params.add("status", getModelObject());
+ setResponsePage(getPage().getClass(), params);
+
+ }
+ };
+
+ Label wStatusLabel = new Label("wstatus", item.getModelObject());
+ if (item.getModelObject().equals(status)) {
+ wStatusLabel.add(new SimpleAttributeModifier("class", "selected"));
+ }
+ wStatusLink.add(wStatusLabel);
+ item.add(wStatusLink);
+ }
+ });
+
+ add(new Label("start_idx", String.valueOf(this.startIdx)));
+ add(new Label("end_idx", String.valueOf(this.endIdx)));
+ add(new Label("num_insts", String.valueOf(this.totalWorkflowInsts)));
+
+ add(new ListView<WorkflowInstance>("workflow_insts",
+ new ListModel<WorkflowInstance>(page.getPageWorkflows())) {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.apache.wicket.markup.html.list.ListView#populateItem(org.apache
+ * .wicket.markup.html.list.ListItem)
+ */
+ @Override
+ protected void populateItem(ListItem<WorkflowInstance> item) {
+ WorkflowInstance inst = item.getModelObject();
+ Link<String> workflowLink = new Link<String>("workflow_link", new Model<String>(inst
+ .getWorkflow().getId())) {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.wicket.markup.html.link.Link#onClick()
+ */
+ @Override
+ public void onClick() {
+ PageParameters params = new PageParameters();
+ params.add("id", getModelObject());
+ setResponsePage(workflowViewer, params);
+ }
+ };
+ workflowLink.add(new Label("workflow_name", inst.getWorkflow().getName()));
+ item.add(workflowLink);
+
+ String instMetString = getWorkflowInstMet(inst, metInstanceFilePath);
+ item.add(new Label("inst_met_display", instMetString));
+
+ ResourceReference imgRef = new ResourceReference(WorkflowInstancesViewer.class,
+ "percentImage.png");
+ imgRef.bind(getApplication());
+ String resRefString = getRequestCycle().urlFor(imgRef, new ValueMap()).toString();
+ item.add(new Label("winst_display", "display('" + resRefString
+ + "', 'winst_" + inst.getId() + "_progress', "
+ + getPctComplete(inst, lifecycleFilePath) + ", 1);").setEscapeModelStrings(false));
+
+ item.add(new Label("winst_status", inst.getStatus()));
+ item.add(new Label("winst_wallclock_mins", formatWallClockMins(wm
+ .safeGetWorkflowWallClockMinutes(inst))));
+ item.add(new Label("winst_task_wallclock_mins", formatWallClockMins(wm
+ .safeGetWorkflowCurrentTaskWallClockMinutes(inst))));
+
+ Link<String> taskLink = new Link<String>("task_link", new Model<String>(inst
+ .getCurrentTaskId())) {
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.wicket.markup.html.link.Link#onClick()
+ */
+ @Override
+ public void onClick() {
+ PageParameters params = new PageParameters();
+ params.add("id", getModelObject());
+ setResponsePage(workflowTaskViewer, params);
+
+ }
+ };
+ taskLink.add(new Label("task_name", getTaskNameFromTaskId(inst, inst.getCurrentTaskId())));
+ item.add(taskLink);
+
+ }
+ });
+
+ add(new WorkflowPagePaginator("paginator", page, status, workflowInstViewer));
+
+ }
+
+ private void computeStartEndIdx(WorkflowInstancePage page) {
+ if (page.getTotalPages() == 1) {
+ this.totalWorkflowInsts = page.getPageWorkflows().size();
+ this.pageNum = 1;
+ } else if (page.getTotalPages() == 0) {
+ this.totalWorkflowInsts = 0;
+ this.pageNum = 1;
+ } else {
+ this.totalWorkflowInsts = (page.getTotalPages() - 1) * PAGE_SIZE;
+ this.pageNum = page.getPageNum();
+
+ // get the last page
+ WorkflowInstancePage lastPage = null;
+ lastPage = wm.safeGetWorkflowInstPageByStatus(page.getTotalPages());
+ this.totalWorkflowInsts += lastPage.getPageWorkflows().size();
+
+ }
+ this.endIdx = this.totalWorkflowInsts != 0 ? Math.min(
+ this.totalWorkflowInsts, (PAGE_SIZE) * (this.pageNum)) : 0;
+ this.startIdx = this.totalWorkflowInsts != 0 ? ((this.pageNum - 1) * PAGE_SIZE) + 1
+ : 0;
+ }
+
+ private String getWorkflowInstMet(WorkflowInstance inst, String metMapFilePath) {
+ WorkflowInstanceMetMap wInstMetMap = null;
+ String metString = null;
+
+ try {
+ wInstMetMap = WorkflowInstanceMetadataReader
+ .parseMetMapFile(metMapFilePath);
+ Metadata instMetadata = wm.getWM().getWorkflowInstanceMetadata(
+ inst.getId());
+ List<String> wInstFields = wInstMetMap.getFieldsForWorkflow(inst
+ .getWorkflow().getId()) != null ? wInstMetMap
+ .getFieldsForWorkflow(inst.getWorkflow().getId()) : wInstMetMap
+ .getDefaultFields();
+ StringBuffer metStrBuf = new StringBuffer();
+
+ for (String wInstField : wInstFields) {
+ metStrBuf.append(wInstField);
+ metStrBuf.append(":");
+ metStrBuf.append(instMetadata.getMetadata(wInstField));
+ metStrBuf.append(",");
+ }
+
+ metStrBuf.deleteCharAt(metStrBuf.length() - 1);
+ metString = metStrBuf.toString();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ return metString;
+
+ }
+
+ private String formatWallClockMins(double wallClockMins) {
+ NumberFormat fn = NumberFormat.getNumberInstance();
+ fn.setMaximumFractionDigits(2);
+ fn.setMinimumFractionDigits(2);
+ return fn.format(wallClockMins);
+ }
+
+ private String getPctComplete(WorkflowInstance inst, String lifecycleFilePath) {
+ WorkflowLifecycleManager lifecycleMgr = null;
+ try {
+ lifecycleMgr = new WorkflowLifecycleManager(lifecycleFilePath);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return lifecycleMgr
+ .formatPct(lifecycleMgr.getPercentageComplete(inst) * 100.0);
+ }
+
+ private String getTaskNameFromTaskId(WorkflowInstance w, String taskId) {
+ if (w.getWorkflow() != null && w.getWorkflow().getTasks() != null
+ && w.getWorkflow().getTasks().size() > 0) {
+ for(WorkflowTask task: (List<WorkflowTask>)(List<?>)w.getWorkflow().getTasks()){
+ if (task.getTaskId().equals(taskId)) {
+ return task.getTaskName();
+ }
+ }
+
+ return null;
+ } else
+ return null;
+}
+
+}
Added: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage.png
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage.png?rev=1102794&view=auto
==============================================================================
Binary file - no diff available.
Propchange: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage_back.png
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage_back.png?rev=1102794&view=auto
==============================================================================
Binary file - no diff available.
Propchange: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage_back.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage_back1.png
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage_back1.png?rev=1102794&view=auto
==============================================================================
Binary file - no diff available.
Propchange: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage_back1.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage_back2.png
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage_back2.png?rev=1102794&view=auto
==============================================================================
Binary file - no diff available.
Propchange: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage_back2.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage_back3.png
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage_back3.png?rev=1102794&view=auto
==============================================================================
Binary file - no diff available.
Propchange: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage_back3.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage_back4.png
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage_back4.png?rev=1102794&view=auto
==============================================================================
Binary file - no diff available.
Propchange: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/percentImage_back4.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/progress.css
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/progress.css?rev=1102794&view=auto
==============================================================================
--- oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/progress.css (added)
+++ oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/progress.css Fri May 13 15:41:18 2011
@@ -0,0 +1,44 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+img.percentImage1 {
+ background: white url(percentImage_back1.png) top left no-repeat;
+ padding: 0;
+ margin: 5px 0 0 0;
+ background-position: 1px 0;
+}
+
+img.percentImage2 {
+ background: white url(percentImage_back2.png) top left no-repeat;
+ padding: 0;
+ margin: 5px 0 0 0;
+ background-position: 1px 0;
+}
+
+img.percentImage3 {
+ background: white url(percentImage_back3.png) top left no-repeat;
+ padding: 0;
+ margin: 5px 0 0 0;
+ background-position: 1px 0;
+}
+
+img.percentImage4 {
+ background: white url(percentImage_back4.png) top left no-repeat;
+ padding: 0;
+ margin: 5px 0 0 0;
+ background-position: 1px 0;
+}
Added: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/progress.js
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/progress.js?rev=1102794&view=auto
==============================================================================
--- oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/progress.js (added)
+++ oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/progress.js Fri May 13 15:41:18 2011
@@ -0,0 +1,119 @@
+/* WebAppers Progress Bar, version 0.2
+* (c) 2007 Ray Cheung
+*
+* WebAppers Progress Bar is freely distributable under the terms of an Creative Commons license.
+* For details, see the WebAppers web site: http://www.webappers.com/progressBar/
+*
+/*--------------------------------------------------------------------------*/
+
+var initial = -120;
+var imageWidth=240;
+var eachPercent = (imageWidth/2)/100;
+/************************************************************\
+*
+\************************************************************/
+function setText (id, percent)
+{
+ $(id+'Text').innerHTML = percent+"%";
+}
+/************************************************************\
+*
+\************************************************************/
+function display (img, id, percentage,color )
+{
+ if (typeof color == "undefined") {
+ color = "1";
+ }
+ var percentageWidth = eachPercent * percentage;
+ var actualWidth = initial + percentageWidth ;
+ document.write('<img id="'+id+'" src="'+img+'" alt="'+percentage+'%" class="percentImage'+color+'" style="background-position: '+actualWidth+'px 0pt;"/> <span id="'+id+'Text">'+percentage+'%</span>');
+}
+/************************************************************\
+*
+\************************************************************/
+function emptyProgress(id)
+{
+ var newProgress = initial+'px';
+ $(id).style.backgroundPosition=newProgress+' 0';
+ setText(id,'0');
+}
+/************************************************************\
+*
+\************************************************************/
+function getProgress(id)
+{
+ var nowWidth = $(id).style.backgroundPosition.split("px");
+ return (Math.floor(100+(nowWidth[0]/eachPercent))+'%');
+
+}
+/************************************************************\
+*
+\************************************************************/
+function setProgress(id, percentage)
+{
+ var percentageWidth = eachPercent * percentage;
+ var newProgress = eval(initial)+eval(percentageWidth)+'px';
+ $(id).style.backgroundPosition=newProgress+' 0';
+ setText(id,percentage);
+}
+/************************************************************\
+*
+\************************************************************/
+function plus ( id, percentage )
+{
+ var nowWidth = $(id).style.backgroundPosition.split("px");
+ var nowPercent = Math.floor(100+(nowWidth[0]/eachPercent))+eval(percentage);
+ var percentageWidth = eachPercent * percentage;
+ var actualWidth = eval(nowWidth[0]) + eval(percentageWidth);
+ var newProgress = actualWidth+'px';
+ if(actualWidth>=0 && percentage <100)
+ {
+ var newProgress = 1+'px';
+ $(id).style.backgroundPosition=newProgress+' 0';
+ setText(id,100);
+ alert('full');
+ }
+ else
+ {
+ $(id).style.backgroundPosition=newProgress+' 0';
+ setText(id,nowPercent);
+ }
+}
+/************************************************************\
+*
+\************************************************************/
+function minus ( id, percentage )
+{
+ var nowWidth = $(id).style.backgroundPosition.split("px");
+ var nowPercent = Math.floor(100+(nowWidth[0]/eachPercent))-eval(percentage);
+ var percentageWidth = eachPercent * percentage;
+ var actualWidth = eval(nowWidth[0]) - eval(percentageWidth);
+ var newProgress = actualWidth+'px';
+ if(actualWidth<=-120)
+ {
+ var newProgress = -120+'px';
+ $(id).style.backgroundPosition=newProgress+' 0';
+ setText(id,0);
+ alert('empty');
+ }
+ else
+ {
+ $(id).style.backgroundPosition=newProgress+' 0';
+ setText(id,nowPercent);
+ }
+}
+/************************************************************\
+*
+\************************************************************/
+function fillProgress(id, endPercent)
+{
+ var nowWidth = $(id).style.backgroundPosition.split("px");
+ startPercent = Math.ceil(100+(nowWidth[0]/eachPercent))+1;
+ var actualWidth = initial + (eachPercent * endPercent);
+ if (startPercent <= endPercent && nowWidth[0] <= actualWidth)
+ {
+ plus(id,'1');
+ setText(id,startPercent);
+ setTimeout("fillProgress('"+id+"',"+endPercent+")",10);
+ }
+}
Added: oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/progress_wicket.css
URL: http://svn.apache.org/viewvc/oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/progress_wicket.css?rev=1102794&view=auto
==============================================================================
--- oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/progress_wicket.css (added)
+++ oodt/trunk/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/progress_wicket.css Fri May 13 15:41:18 2011
@@ -0,0 +1,44 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+img.percentImage1 {
+ background: white url(../../images/percentImage_back1.png) top left no-repeat;
+ padding: 0;
+ margin: 5px 0 0 0;
+ background-position: 1px 0;
+}
+
+img.percentImage2 {
+ background: white url(../../images/percentImage_back2.png) top left no-repeat;
+ padding: 0;
+ margin: 5px 0 0 0;
+ background-position: 1px 0;
+}
+
+img.percentImage3 {
+ background: white url(../../images/percentImage_back3.png) top left no-repeat;
+ padding: 0;
+ margin: 5px 0 0 0;
+ background-position: 1px 0;
+}
+
+img.percentImage4 {
+ background: white url(../../images/percentImage_back4.png) top left no-repeat;
+ padding: 0;
+ margin: 5px 0 0 0;
+ background-position: 1px 0;
+}