src/main/java/org/openimmunizationsoftware/pt/servlet/ReportsServlet.java
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    AppReq appReq = new AppReq(request, response);
    try {
      WebUser webUser = appReq.getWebUser();
      if (appReq.isLoggedOut()) {
        forwardToHome(request, response);
        return;
      }
      Session dataSession = appReq.getDataSession();
      PrintWriter out = appReq.getOut();

      printHtmlHead(appReq);

      Query query = dataSession.createQuery(
          "from ReportProfile where provider = :provider and useStatus = 'E' order by profileLabel");
      query.setParameter("provider", webUser.getProvider());
      List<ReportProfile> reportProfileList = query.list();

      out.println("<table class=\"boxed\">");
      out.println("  <tr class=\"boxed\">");
      out.println("    <th class=\"boxed\">Report</th>");
      out.println("    <th class=\"boxed\">Type</th>");
      out.println("    <th class=\"boxed\">Send</th>");
      out.println("    <th class=\"boxed\">Status</th>");
      out.println("  </tr>");
      for (ReportProfile reportProfile : reportProfileList) {
        loadReportProfileObject(dataSession, reportProfile);
        out.println("  <tr class=\"boxed\">");
        out.println("    <td class=\"boxed\"><a href=\"ReportServlet?profileId="
            + reportProfile.getProfileId() + "\" class=\"button\">"
            + reportProfile.getProfileLabel() + "</a></td>");
        out.println("    <td class=\"boxed\">" + reportProfile.getProfileType() + "</td>");

        ReportSchedule reportSchedule = reportProfile.getReportSchedule();
        if (reportSchedule != null) {
          out.println("    <td class=\"boxed\">"
              + (reportSchedule.getPeriod() != null ? reportSchedule.getPeriodText() : "")
              + "</td>");
          out.println("    <td class=\"boxed\">"
              + (reportSchedule.getStatus() != null ? reportSchedule.getStatusText() : "")
              + "</td>");
        } else {
          out.println("    <td class=\"boxed\">&nbsp;</td>");
          out.println("    <td class=\"boxed\">&nbsp;</td>");
        }
        out.println("  </tr>");
      }
      out.println("</table>");
      out.println("<h2>Create a New Report</h2>");
      query = dataSession.createQuery(
          "from ReportProfile where provider is null and extendStatus = 'E' order by profileLabel");
      List<ReportProfile> extendReportProfileList = query.list();
      out.println("<p>Choose a template to create a new report:</p>");
      out.println("<ul>");
      for (ReportProfile reportProfile : extendReportProfileList) {
        out.println("  <li><a href=\"ReportEditServlet?extendsProfileId="
            + reportProfile.getProfileId() + "\">" + reportProfile.getProfileLabel() + "</a></li>");
      }
      out.println("</ul>");
      if (webUser.isUserTypeAdmin()) {
        out.println("<h2>Reports Run</h2>");
        out.println(
            "<p><a href=\"ReportRunServlet\">See all reports</a> that have been sent since Tracker was initialized.</p>");
      }
      printHtmlFoot(appReq);

    } finally {
      appReq.close();
    }
  }
/**
   * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
   * methods.
   * 
   * @param request
   *          servlet request
   * @param response
   *          servlet response
   * @throws ServletException
   *           if a servlet-specific error occurs
   * @throws IOException
   *           if an I/O error occurs
   */
Processes requests for both HTTP GET and POST
methods.

@param request
servlet request
@param response
servlet response
@throws ServletException
if a servlet-specific error occurs
@throws IOException
if an I/O error occurs
Processes requests for both HTTP GET and POST methods . @param request servlet request @param response servlet response @throws ServletException if a servlet - specific error occurs @throws IOException if an I / O error occurs
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    AppReq appReq = new AppReq(request, response);
    try {
      WebUser webUser = appReq.getWebUser();
      if (appReq.isLoggedOut()) {
        forwardToHome(request, response);
        return;
      }
      Session dataSession = appReq.getDataSession();
      PrintWriter out = appReq.getOut();
      printHtmlHead(appReq);
      Query query = dataSession.createQuery(
          "from ReportProfile where provider = :provider and useStatus = 'E' order by profileLabel");
      query.setParameter("provider", webUser.getProvider());
      List<ReportProfile> reportProfileList = query.list();
      out.println("<table class=\"boxed\">");
      out.println("  <tr class=\"boxed\">");
      out.println("    <th class=\"boxed\">Report</th>");
      out.println("    <th class=\"boxed\">Type</th>");
      out.println("    <th class=\"boxed\">Send</th>");
      out.println("    <th class=\"boxed\">Status</th>");
      out.println("  </tr>");
      for (ReportProfile reportProfile : reportProfileList) {
        loadReportProfileObject(dataSession, reportProfile);
        out.println("  <tr class=\"boxed\">");
        out.println("    <td class=\"boxed\"><a href=\"ReportServlet?profileId="
            + reportProfile.getProfileId() + "\" class=\"button\">"
            + reportProfile.getProfileLabel() + "</a></td>");
        out.println("    <td class=\"boxed\">" + reportProfile.getProfileType() + "</td>");
        ReportSchedule reportSchedule = reportProfile.getReportSchedule();
        if (reportSchedule != null) {
          out.println("    <td class=\"boxed\">"
              + (reportSchedule.getPeriod() != null ? reportSchedule.getPeriodText() : "")
              + "</td>");
          out.println("    <td class=\"boxed\">"
              + (reportSchedule.getStatus() != null ? reportSchedule.getStatusText() : "")
              + "</td>");
        } else {
          out.println("    <td class=\"boxed\">&nbsp;</td>");
          out.println("    <td class=\"boxed\">&nbsp;</td>");
        }
        out.println("  </tr>");
      }
      out.println("</table>");
      out.println("<h2>Create a New Report</h2>");
      query = dataSession.createQuery(
          "from ReportProfile where provider is null and extendStatus = 'E' order by profileLabel");
      List<ReportProfile> extendReportProfileList = query.list();
      out.println("<p>Choose a template to create a new report:</p>");
      out.println("<ul>");
      for (ReportProfile reportProfile : extendReportProfileList) {
        out.println("  <li><a href=\"ReportEditServlet?extendsProfileId="
            + reportProfile.getProfileId() + "\">" + reportProfile.getProfileLabel() + "</a></li>");
      }
      out.println("</ul>");
      if (webUser.isUserTypeAdmin()) {
        out.println("<h2>Reports Run</h2>");
        out.println(
            "<p><a href=\"ReportRunServlet\">See all reports</a> that have been sent since Tracker was initialized.</p>");
      }
      printHtmlFoot(appReq);
    } finally {
      appReq.close();
    }
  }
protected void processRequest ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { AppReq appReq = new AppReq ( request , response ) ; try { WebUser webUser = appReq . getWebUser ( ) ; if ( appReq . isLoggedOut ( ) ) { forwardToHome ( request , response ) ; return ; } Session dataSession = appReq . getDataSession ( ) ; PrintWriter out = appReq . getOut ( ) ; printHtmlHead ( appReq ) ; Query query = dataSession . createQuery ( "from ReportProfile where provider = :provider and useStatus = 'E' order by profileLabel" ) ; query . setParameter ( "provider" , webUser . getProvider ( ) ) ; List < ReportProfile > reportProfileList = query . list ( ) ; out . println ( "<table class=\"boxed\">" ) ; out . println ( "  <tr class=\"boxed\">" ) ; out . println ( "    <th class=\"boxed\">Report</th>" ) ; out . println ( "    <th class=\"boxed\">Type</th>" ) ; out . println ( "    <th class=\"boxed\">Send</th>" ) ; out . println ( "    <th class=\"boxed\">Status</th>" ) ; out . println ( "  </tr>" ) ; for ( ReportProfile reportProfile : reportProfileList ) { loadReportProfileObject ( dataSession , reportProfile ) ; out . println ( "  <tr class=\"boxed\">" ) ; out . println ( "    <td class=\"boxed\"><a href=\"ReportServlet?profileId=" + reportProfile . getProfileId ( ) + "\" class=\"button\">" + reportProfile . getProfileLabel ( ) + "</a></td>" ) ; out . println ( "    <td class=\"boxed\">" + reportProfile . getProfileType ( ) + "</td>" ) ; ReportSchedule reportSchedule = reportProfile . getReportSchedule ( ) ; if ( reportSchedule != null ) { out . println ( "    <td class=\"boxed\">" + ( reportSchedule . getPeriod ( ) != null ? reportSchedule . getPeriodText ( ) : "" ) + "</td>" ) ; out . println ( "    <td class=\"boxed\">" + ( reportSchedule . getStatus ( ) != null ? reportSchedule . getStatusText ( ) : "" ) + "</td>" ) ; } else { out . println ( "    <td class=\"boxed\">&nbsp;</td>" ) ; out . println ( "    <td class=\"boxed\">&nbsp;</td>" ) ; } out . println ( "  </tr>" ) ; } out . println ( "</table>" ) ; out . println ( "<h2>Create a New Report</h2>" ) ; query = dataSession . createQuery ( "from ReportProfile where provider is null and extendStatus = 'E' order by profileLabel" ) ; List < ReportProfile > extendReportProfileList = query . list ( ) ; out . println ( "<p>Choose a template to create a new report:</p>" ) ; out . println ( "<ul>" ) ; for ( ReportProfile reportProfile : extendReportProfileList ) { out . println ( "  <li><a href=\"ReportEditServlet?extendsProfileId=" + reportProfile . getProfileId ( ) + "\">" + reportProfile . getProfileLabel ( ) + "</a></li>" ) ; } out . println ( "</ul>" ) ; if ( webUser . isUserTypeAdmin ( ) ) { out . println ( "<h2>Reports Run</h2>" ) ; out . println ( "<p><a href=\"ReportRunServlet\">See all reports</a> that have been sent since Tracker was initialized.</p>" ) ; } printHtmlFoot ( appReq ) ; } finally { appReq . close ( ) ; } }
Processes requests for both HTTP <code>GET</code> and <code>POST</code>
 methods.
Processes requests for both HTTP <code > GET< / code > and <code > POST< / code > methods .