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 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); }
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); } }