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); }
protected void deleteOperatorNumber(HttpServletRequest req) throws ServletException, IOException { String data = req.getParameter("deletePressed"); if (data != null && data.startsWith(PREFIX_DELETE)) { int id = Integer.parseInt(data.substring(PREFIX_DELETE.length())); PhoneNumberBean phoneNumberBean = new PhoneNumberBean(); phoneNumberBean.setPhoneNumberId(id); ApplicationManager.deletePhoneNumber(phoneNumberBean); } }
/** 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); }
protected void updateOperatorNumbers(HttpServletRequest req) throws ServletException, IOException { // Check for new item String newNote = req.getParameter("newNote"); if (newNote != null && newNote.trim().length() > 0) { String newNumber = req.getParameter("newNumber"); // // System.out.println("Found new Note & Number: " + newNote + " : " + newNumber); // // // Insert the new note and number PhoneNumberBean phoneNumberBean = new PhoneNumberBean(); phoneNumberBean.setOwnerTypeId(OperatorBean.OPERATOR_TYPE_ID); phoneNumberBean.setPhoneTypeId(PhoneNumberBean.PHONETYPEID_WORK); phoneNumberBean.setNumber(newNumber); phoneNumberBean.setNote(newNote); ApplicationManager.insertPhoneNumber(phoneNumberBean); } // Update existing items Enumeration params = req.getParameterNames(); while (params.hasMoreElements()) { String data = (String) params.nextElement(); if (!data.startsWith(PREFIX_NOTE)) continue; String strId = data.substring(PREFIX_NOTE.length()); String number = req.getParameter(PREFIX_NUMBER + strId); if (number == null) continue; String note = req.getParameter(data); // // System.out.println("About to update: " + note + " : " + number); // // // Update it... PhoneNumberBean phoneNumberBean = new PhoneNumberBean(); phoneNumberBean.setPhoneNumberId(Integer.parseInt(strId)); phoneNumberBean.setNumber(number); phoneNumberBean.setNote(note); ApplicationManager.updatePhoneNumber(phoneNumberBean); } }
/** 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); }
/** Updates the Greeting Prompts */ protected void processPromptGreetings(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { BeanCollection promptBeanList = retrievePromptBeanList(req); if (promptBeanList != null) { // Clear out all the currently active prompts for (int i = 0; i < promptBeanList.size(); i++) { ((PromptBean) promptBeanList.getItem(i)).setActive(false); } String[] promptIds = req.getParameterValues("promptId"); for (int j = 0; j < promptIds.length; j++) { int promptId = Integer.parseInt(promptIds[j]); // // // System.out.println("Checked Id:" + promptId); // // for (int i = 0; i < promptBeanList.size(); i++) { PromptBean promptBean = (PromptBean) promptBeanList.getItem(i); if (promptBean.getPromptId() == promptId) promptBean.setActive(true); } } ApplicationManager.updatePrompts(promptBeanList); } showPrompts(req, res); }