src/main/java/org/openimmunizationsoftware/pt/servlet/BillBudgetsServlet.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() || appReq.isDependentWebUser()) {
        forwardToHome(request, response);
        return;
      }
      Session dataSession = appReq.getDataSession();
      String action = appReq.getAction();

      if (action != null) {
        if (action.equals("Update Time")) {
          Transaction transaction = dataSession.beginTransaction();
          SimpleDateFormat formatCompact = webUser.getDateFormat("yyyyMMdd");
          Enumeration<String> enumeration = request.getParameterNames();
          while (enumeration.hasMoreElements()) {
            String paramName = enumeration.nextElement();
            if (paramName.startsWith("wd")) {
              Date date = null;
              String timeString = "0";
              try {
                date = formatCompact.parse(paramName.substring(2));
                timeString = request.getParameter(paramName);
              } catch (ParseException pe) {
                throw new ServletException("Unable to parse date '" + paramName + "'");
              }
              Query query = dataSession
                  .createQuery("from BillExpected where id.username = ? and id.billDate = ?");
              query.setParameter(0, webUser.getUsername());
              query.setParameter(1, date);
              List<BillExpected> billExpectedList = query.list();
              BillExpected billExpected = null;
              if (billExpectedList.size() > 0) {
                billExpected = billExpectedList.get(0);
                billExpected.setBillMins(TimeTracker.readTime(timeString));
                dataSession.update(billExpected);
              } else {
                billExpected = new BillExpected(new BillExpectedId(webUser.getUsername(), date),
                    TimeTracker.readTime(timeString), 0);
                dataSession.save(billExpected);
              }
            }
          }

          transaction.commit();
        }
      }
      appReq.setTitle("Track");
      printHtmlHead(appReq);

      runReport(webUser, appReq.getOut(), dataSession, true);
      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() || appReq.isDependentWebUser()) {
        forwardToHome(request, response);
        return;
      }
      Session dataSession = appReq.getDataSession();
      String action = appReq.getAction();
      if (action != null) {
        if (action.equals("Update Time")) {
          Transaction transaction = dataSession.beginTransaction();
          SimpleDateFormat formatCompact = webUser.getDateFormat("yyyyMMdd");
          Enumeration<String> enumeration = request.getParameterNames();
          while (enumeration.hasMoreElements()) {
            String paramName = enumeration.nextElement();
            if (paramName.startsWith("wd")) {
              Date date = null;
              String timeString = "0";
              try {
                date = formatCompact.parse(paramName.substring(2));
                timeString = request.getParameter(paramName);
              } catch (ParseException pe) {
                throw new ServletException("Unable to parse date '" + paramName + "'");
              }
              Query query = dataSession
                  .createQuery("from BillExpected where id.username = ? and id.billDate = ?");
              query.setParameter(0, webUser.getUsername());
              query.setParameter(1, date);
              List<BillExpected> billExpectedList = query.list();
              BillExpected billExpected = null;
              if (billExpectedList.size() > 0) {
                billExpected = billExpectedList.get(0);
                billExpected.setBillMins(TimeTracker.readTime(timeString));
                dataSession.update(billExpected);
              } else {
                billExpected = new BillExpected(new BillExpectedId(webUser.getUsername(), date),
                    TimeTracker.readTime(timeString), 0);
                dataSession.save(billExpected);
              }
            }
          }
          transaction.commit();
        }
      }
      appReq.setTitle("Track");
      printHtmlHead(appReq);
      runReport(webUser, appReq.getOut(), dataSession, true);
      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 ( ) || appReq . isDependentWebUser ( ) ) { forwardToHome ( request , response ) ; return ; } Session dataSession = appReq . getDataSession ( ) ; String action = appReq . getAction ( ) ; if ( action != null ) { if ( action . equals ( "Update Time" ) ) { Transaction transaction = dataSession . beginTransaction ( ) ; SimpleDateFormat formatCompact = webUser . getDateFormat ( "yyyyMMdd" ) ; Enumeration < String > enumeration = request . getParameterNames ( ) ; while ( enumeration . hasMoreElements ( ) ) { String paramName = enumeration . nextElement ( ) ; if ( paramName . startsWith ( "wd" ) ) { Date date = null ; String timeString = "0" ; try { date = formatCompact . parse ( paramName . substring ( 2 ) ) ; timeString = request . getParameter ( paramName ) ; } catch ( ParseException pe ) { throw new ServletException ( "Unable to parse date '" + paramName + "'" ) ; } Query query = dataSession . createQuery ( "from BillExpected where id.username = ? and id.billDate = ?" ) ; query . setParameter ( 0 , webUser . getUsername ( ) ) ; query . setParameter ( 1 , date ) ; List < BillExpected > billExpectedList = query . list ( ) ; BillExpected billExpected = null ; if ( billExpectedList . size ( ) > 0 ) { billExpected = billExpectedList . get ( 0 ) ; billExpected . setBillMins ( TimeTracker . readTime ( timeString ) ) ; dataSession . update ( billExpected ) ; } else { billExpected = new BillExpected ( new BillExpectedId ( webUser . getUsername ( ) , date ) , TimeTracker . readTime ( timeString ) , 0 ) ; dataSession . save ( billExpected ) ; } } } transaction . commit ( ) ; } } appReq . setTitle ( "Track" ) ; printHtmlHead ( appReq ) ; runReport ( webUser , appReq . getOut ( ) , dataSession , true ) ; 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 .