protected void processPasscodeEdit(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {

    ApplicationBean appBean = retrieveApplicationBean();
    ErrorBean errorBean = new ErrorBean();

    if (req.getParameter("save") != null) {
      String oldPasscode = req.getParameter("oldPasscode");
      String newPasscode = req.getParameter("newPasscode");
      String newPasscode2 = req.getParameter("newPasscode2");

      if (oldPasscode.equals(appBean.getPasscode()) && newPasscode.equals(newPasscode2)) {
        // Update Passcode...
        appBean.setPasscode(newPasscode);
        ApplicationManager.updateApplicationBean(appBean);

        errorBean.addError("Passcode has been updated.", FormError.SEVERITY_STOP);
        req.setAttribute("errorBean", errorBean);

        showSettings(req, res);
      } else {
        errorBean.addError(
            "Old Passcode does not match. Failed to change passcode.", FormError.SEVERITY_STOP);
        req.setAttribute("errorBean", errorBean);

        showPasscodeEdit(req, res);
      }
    } else {
      showSettings(req, res);
    }
  }
  /** Updates the Play Directions */
  protected void processPromptDirections(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {

    ApplicationBean appBean = retrieveApplicationBean();
    appBean.togglePlayDirectionAudio();
    ApplicationManager.updateApplicationBean(appBean);
    showPrompts(req, res);
  }
  /** Updates the current Operator information */
  protected void processOperatorUpdate(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {

    ApplicationBean appBean = retrieveApplicationBean();
    String selectedId = (String) req.getParameter("selectedId");
    if (selectedId != null) {
      appBean.setCurrentOperatorNumberId(Integer.parseInt(selectedId));
      ApplicationManager.updateApplicationBean(appBean);
    }
    showSettings(req, res);
  }
  /** Shows the Greeting Prompts */
  protected void showPrompts(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {

    ApplicationBean appBean = retrieveApplicationBean();
    if (appBean.isPlayDirectionAudio()) {
      req.setAttribute("drivingDir", "on");
    }
    BeanCollection promptBeanList = retrievePromptBeanList(req);
    if (promptBeanList != null) {
      req.setAttribute("promptBeanList", promptBeanList);
    }
    displayHtmlJsp(req, res, "settingsPrompts.jsp");
  }
  /** Updates the Application information */
  protected void processApplicationEdit(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {

    String appNumber = req.getParameter("appNumber");
    if (appNumber == null) {
      displayHtmlJsp(req, res, "error.jsp");
    }
    if (req.getParameter("save") != null) {
      ApplicationBean appBean = retrieveApplicationBean();
      // Needs to update the current AppBean
      appBean.setApplicationNumber(appNumber);

      PhoneNumberBean phoneNumberBean = new PhoneNumberBean();
      phoneNumberBean.setOwnerTypeId(ApplicationBean.APPLICATION_TYPE_ID);
      phoneNumberBean.setPhoneTypeId(PhoneNumberBean.PHONETYPEID_APPLICATION);
      phoneNumberBean.setNumber(appNumber);
      ApplicationManager.updatePhoneNumberByOwner(phoneNumberBean);
    }
    showSettings(req, res);
  }