<%@page contentType="text/html;charset=UTF-8" pageEncoding="ISO-8859-1" session="true"
%><%@page errorPage="AdminException.jsp"
%><%@page import="com.fujitsu.iflow.model.wfcore.WFAdminSessionImpl"
%><%@page import="com.fujitsu.iflow.model.workflow.Plan"
%><%@page import="com.fujitsu.iflow.model.workflow.ProcessInstance"
%><%@page import="com.fujitsu.iflow.model.workflow.WFObjectFactory"
%><%@page import="com.fujitsu.iflow.model.util.URLEncoder"
%><%@page import="com.fujitsu.iflow.model.bpm.BPMAdmin"
%><%@page import="com.fujitsu.iflow.model.bpm.BPMSession"
%><%@page import="com.fujitsu.iflow.model.bpmcore.BPMAdminImpl"
%><%
    request.setCharacterEncoding("UTF-8");request.getParameterNames(); //Need dummy call for WL9.1
    BPMSession bps = (BPMSession) session.getAttribute("BPMSession");
    if (bps == null) {
        %><jsp:include page="PasswordPanel.jsp" flush="true"/><%
        return;
    }

    BPMAdmin bpas = bps.getAdmin();
    WFAdminSessionImpl wfSession = ((BPMAdminImpl)bpas)._wfas;

    String piId = (String)request.getParameter("piId");
    if (piId == null) {
        throw new Exception("ProcessInstance.jsp requires the process instance id to be specified ina 'piId' parameter.  No such parameter was found on this invocation.");
    }

    long piIdLong;
    try {
         piIdLong = Long.parseLong(piId);
    }
    catch (Exception e4) {
        throw new Exception("The piID variable had a problem being parsed as a long value: "+e4.toString());
    }
    ProcessInstance pi = WFObjectFactory.getProcessInstance(piIdLong, wfSession );
    Plan plan = pi.getPlan();

    String selectedPlanID = (String)request.getParameter("planId");
    String editMode = (String) request.getParameter("editMode");

    boolean isEditMode = false;
    if(editMode!=null && editMode.equalsIgnoreCase("true")) isEditMode = true;

    String historyURL = "ShowHistory.jsp?id="+piIdLong;
    String graphicalViewURL = "PIGraphic.jsp?piId="+piIdLong;
    String svgURL = "ProcInstGraph.svg?piId="+piIdLong;
    String editorURL = "ProcessEditor.jsp?AppletCommand=EditProcess&ProcessID="+piIdLong;
    String appletViewURL = "ProcessEditor.jsp?AppletCommand=DisplayProcess&ProcessID="+piIdLong;
%>

<table cellpadding=2 cellspacing=1 class="tableclass" align="center" width="100%">
  <tr>
    <td style="filter:progid:DXImageTransform.Microsoft.Gradient(startColorStr='#CCCCCC', endColorStr='#FFFFFF', gradientType='1')" align="right">
      <div align="right"> <a href="<%=historyURL%>"><img src="images/icons/history_icon.gif" border="0"></a>&nbsp;&nbsp;<a href="<%= graphicalViewURL %>"><img src="images/graphical_view.gif" border="0"></a>&nbsp;
        <a href="<%= svgURL %>"><img src="images/svg.gif" border="0"></a>&nbsp;&nbsp;<a href="<%=editorURL%>"><img src="images/edit_sm.gif" width="13" height="13" border="0"></a>
        <a href="<%=editorURL%>"> Edit</a>&nbsp;&nbsp;<a href="<%=appletViewURL%>"><img src="images/edit_sm.gif" width="13" height="13" border="0"></a>
        <a href="<%=appletViewURL%>"> Applet View</a> </div>
    </td>
  </tr>
</table>

<%!
    public WFAdminSessionImpl getiFlowSession(Object modelObject)
    {
            return (WFAdminSessionImpl)(modelObject);
    }

%>
