Package org.apache.jsp

Source Code of org.apache.jsp.test_jsp

package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;
import com.opensymphony.module.user.User;
import com.opensymphony.workflow.Workflow;
import com.opensymphony.workflow.basic.BasicWorkflow;
import com.opensymphony.workflow.spi.Step;
import com.opensymphony.workflow.loader.StatusValues;
import java.util.*;

public class test_jsp extends HttpJspBase {


  private static java.util.Vector _jspx_includes;

  static {
    _jspx_includes = new java.util.Vector(1);
    _jspx_includes.add("/nav.jsp");
  }

  public java.util.List getIncludes() {
    return _jspx_includes;
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    javax.servlet.jsp.PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;


    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html;ISO-8859-1");
      pageContext = _jspxFactory.getPageContext(this, request, response,
            null, true, 8192, true);
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");

    Workflow wf = new BasicWorkflow((String) session.getAttribute("username"));

    long id = Long.parseLong(request.getParameter("id"));

    String doString = request.getParameter("do");
    if (doString != null && !doString.equals("")) {
        int action = Integer.parseInt(doString);
        wf.doAction(id, action, Collections.EMPTY_MAP);
    }


    int[] actions = wf.getAvailableActions(id);

    for (int i = 0; i < actions.length; i++) {
        String name = wf.getActionName("example", actions[i]);
              out.write("\r\n        ");
      out.write("<li> ");
      out.write("<a href=\"test.jsp?id=");
      out.print(id);
      out.write("&do=");
      out.print( actions[i] );
      out.write("\">");
      out.print( name );
      out.write("</a>\r\n        ");

    }
      out.write("\r\n\r\n");
      out.write("<hr>\r\n");
      out.write("<b>Permissions");
      out.write("</b>\r\n");
      out.write("<p>\r\n\r\n");

    List perms = wf.getSecurityPermissions(id);
    for (Iterator iterator = perms.iterator(); iterator.hasNext();) {
        String perm = (String) iterator.next();
      out.write("\r\n    ");
      out.write("<li>");
      out.print( perm );
      out.write("\r\n");

    }
      out.write("\r\n");
      out.write("<hr>\r\n\r\n");
      out.write("\r\n\r\n");
      out.write("<hr>\n\n");
      out.write("<a href=\"default.jsp\">All Workflows");
      out.write("</a> |\n");
      out.write("<a href=\"newworkflow.jsp\">New Workflow");
      out.write("</a>\n\n");
      out.write("<form action=\"test.jsp\">\nView Workflow #:\n");
      out.write("<input type=\"text\" name=\"id\" size=\"5\">\n");
      out.write("<input type=\"submit\" value=\"View\">\n");
      out.write("</form>\n\n");
    } catch (Throwable t) {
      out = _jspx_out;
      if (out != null && out.getBufferSize() != 0)
        out.clearBuffer();
      if (pageContext != null) pageContext.handlePageException(t);
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
    }
  }
}
TOP

Related Classes of org.apache.jsp.test_jsp

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.