<%-- 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. --%> <%@ page import="org.apache.airavata.tools.workflow.monitoring.QueryManager" %> <%@ page import="org.apache.airavata.tools.workflow.monitoring.WorkflowMonitoringException" %> <%@ page import="org.apache.airavata.tools.workflow.monitoring.bean.WorkflowInfo" %> <%@ page import="org.apache.airavata.tools.workflow.monitoring.db.DBConstants" %> <%@ page import="org.apache.airavata.tools.workflow.monitoring.util.Util" %> <%@ page import="java.sql.ResultSet" %> <%@ page import="java.sql.SQLException" %> <%@ page import="java.util.HashMap" %> <%@ page import="java.util.Map" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %> :: Workflow Information :: <% try { String username = request.getParameter("username"); QueryManager queryManager = new QueryManager(); ResultSet workflowData = queryManager.getWorkflowsOfUser(username); %>

Workflow Information for <%=username%>




<% if (workflowData == null) { %>

No worflow information available for this user

<% } else { String endTime; Map workflowInfoObjects = new HashMap(); while (workflowData.next()) { WorkflowInfo workflow = new WorkflowInfo(); workflow.setStatus(workflowData.getString(DBConstants.T_SUMMARY_STATUS)); workflow.setTemplateId(workflowData.getString(DBConstants.T_SUMMARY_TEMPLATE_ID)); workflow.setUsername(workflowData.getString(DBConstants.T_SUMMARY_USERNAME)); String workflowId = workflowData.getString(DBConstants.T_SUMMARY_WORKFLOW_ID); workflow.setWorkflowId(workflowId); workflow.setStartTime(Util.getFormattedDateFromLongValue(workflowData.getString(DBConstants.T_SUMMARY_START_TIME))); endTime = workflowData.getString(DBConstants.T_SUMMARY_END_TIME); if (endTime != null && !"".equals(endTime) && !"0".equals(endTime.trim())) { endTime = Util.getFormattedDateFromLongValue(endTime); } else { endTime = ""; } workflow.setEndTime(endTime); workflow.setFaultsAvailable("FAILED".equalsIgnoreCase(workflow.getStatus())); workflowInfoObjects.put(workflowId, workflow); } ResultSet resultSet = queryManager.getPreviouslyFailedSuccessfulInstances(username); if (resultSet != null) { while (resultSet.next()) { String workflowId = resultSet.getString(DBConstants.T_SUMMARY_WORKFLOW_ID); if (workflowInfoObjects.containsKey(workflowId)) { workflowInfoObjects.get(workflowId).setFaultsAvailable(true); } } } queryManager.close(); for (WorkflowInfo workflowInfo : workflowInfoObjects.values()) { %> <% } } } catch (SQLException e) { e.printStackTrace(); %>

An error occurred while retreiving data. Please retry later.

<% } catch (WorkflowMonitoringException e) { e.printStackTrace(); %>

An error occurred while parsing input data. Make sure all the dates are in mm/dd/yyyy HH.mm format.

<% } %>
Wokflow Id Template Id Username Status Start Time End Time
<% if (workflowInfo.isFaultsAvailable()) { %> <%=workflowInfo.getWorkflowId()%> <% } else { %> <%=workflowInfo.getWorkflowId()%> <% } %> <%=Util.extractShortTemplateId(workflowInfo.getTemplateId())%> <%=Util.extractUsername(workflowInfo.getUsername())%> <%=workflowInfo.getStatus()%> <%=workflowInfo.getStartTime()%> <%=workflowInfo.getEndTime()%>