public String adminAddSuccessAction() { if (areaSelectName == null) { FacesContext context = FacesContext.getCurrentInstance(); String bundleName = context.getApplication().getMessageBundle(); ResourceBundle messageBundle = ResourceBundle.getBundle( bundleName, context.getViewRoot().getLocale(), Thread.currentThread().getContextClassLoader()); String prompt = messageBundle.getString("selectArea"); FacesUtils.addErrorMessage(prompt); return null; } else { Administrator admin = new Administrator(); String condition = " name ='" + this.areaSelectName + "'"; area_admin = this.serviceLocator.getAreaService().queryAreaByCondition(condition).get(0); admin.setAdr(adr_admin); admin.setArea(area_admin); admin.setEmail(email_admin); admin.setName(name_admin); admin.setTel(tel_admin); this.serviceLocator.getAdminService().saveAdministrator(admin); return NavigationResults.ADMINADDSUCCESSACTION; } }
public String adminEditSuccessAction() { Administrator admin = this.serviceLocator.getAdminService().queryAdministratorById(administratorId); String condition = " name ='" + this.areaSelectName + "'"; area_admin = this.serviceLocator.getAreaService().queryAreaByCondition(condition).get(0); admin.setAdr(adr_admin); admin.setArea(area_admin); admin.setEmail(email_admin); admin.setName(name_admin); admin.setTel(tel_admin); this.serviceLocator.getAdminService().saveAdministrator(admin); return NavigationResults.ADMINEDITSUCCESSACTION; }