@Override public void beforeBeanAdded(ControllerEvent event) throws ControllerListenerException { CurriculumController curriculumController = (CurriculumController) AonUtil.getController(CurriculumController.MANAGER_BEAN_NAME); Curriculum cv = (Curriculum) curriculumController.getTo(); ((EvaluateSummary) event.getController().getTo()).setCurriculum(cv); }
/* (non-Javadoc) * @see com.code.aon.ui.form.event.ControllerAdapter#beforeBeanUpdated(com.code.aon.ui.form.event.ControllerEvent) */ @Override public void beforeBeanUpdated(ControllerEvent event) throws ControllerListenerException { UserController uc = (UserController) event.getController(); User user = (User) uc.getTo(); UserManager userManager = uc.getUserManager(); String name = user.getName(); name = (name.equals(userManager.getUser().getName())) ? userManager.getUser().getName() : name; String password = userManager.getPassword(); if (password == null || password.equals("") || password.equals(userManager.getUser().getPasswd())) { userManager.setChangePassword(false); } else { userManager.setChangePassword(true); } userManager.setName(name); try { userManager.accept(null); user.setLogin(userManager.getId()); } catch (MaximumLoginException e) { FacesContext ctx = FacesContext.getCurrentInstance(); ResourceBundle bundle = ResourceBundle.getBundle(IOperation.MESSAGES_FILE, ctx.getViewRoot().getLocale()); MessageFormat mf = new MessageFormat(bundle.getString(e.getMessage())); throw new ControllerListenerException(mf.format(new Object[] {e.getArg()}), e); } }
/* (non-Javadoc) * @see com.code.aon.ui.form.event.ControllerAdapter#afterBeanCreated(com.code.aon.ui.form.event.ControllerEvent) */ @Override public void afterBeanCreated(ControllerEvent event) throws ControllerListenerException { UserController userController = (UserController) event.getController(); userController.setUserManager(new UserManager()); userController .getUserManager() .setRelation(new Relation(userController.getUserManager().getUser().getId())); }
/* (non-Javadoc) * @see com.code.aon.ui.form.event.ControllerAdapter#afterBeanUpdated(com.code.aon.ui.form.event.ControllerEvent) */ @Override public void afterBeanUpdated(ControllerEvent event) throws ControllerListenerException { EvaluateController ec = (EvaluateController) event.getController(); try { saveTypes(ec); } catch (ManagerBeanException e) { throw new ControllerListenerException(e); } }
@Override public void afterBeanRemoved(ControllerEvent event) throws ControllerListenerException { EvaluateController ec = (EvaluateController) event.getController(); try { IManagerBean bean = BeanManager.getManagerBean(Evaluate.class); List types = (List) ec.getTypes().getWrappedData(); for (Iterator iter = types.iterator(); iter.hasNext(); ) { Evaluate e = (Evaluate) iter.next(); bean.remove(e); } } catch (ManagerBeanException e) { throw new ControllerListenerException(e); } ec.onReset(null); }
/* (non-Javadoc) * @see com.code.aon.ui.form.event.ControllerAdapter#beforeBeanAdded(com.code.aon.ui.form.event.ControllerEvent) */ @Override public void beforeBeanAdded(ControllerEvent event) throws ControllerListenerException { UserController uc = (UserController) event.getController(); User user = (User) uc.getTo(); UserManager userManager = uc.getUserManager(); userManager.setId(user.getLogin()); userManager.setName(user.getName()); changePassword(uc.getUserManager()); try { userManager.accept(null); user.setLogin(uc.getUserManager().getId()); } catch (MaximumLoginException e) { uc.onReset(null); FacesContext ctx = FacesContext.getCurrentInstance(); ResourceBundle bundle = ResourceBundle.getBundle(IOperation.MESSAGES_FILE, ctx.getViewRoot().getLocale()); MessageFormat mf = new MessageFormat(bundle.getString(e.getMessage())); throw new ControllerListenerException(mf.format(new Object[] {e.getArg()}), e); } }
/* (non-Javadoc) * @see com.code.aon.ui.form.event.ControllerAdapter#beforeBeanRemoved(com.code.aon.ui.form.event.ControllerEvent) */ @Override public void beforeBeanRemoved(ControllerEvent event) throws ControllerListenerException { UserController userController = (UserController) event.getController(); userController.getUserManager().remove(); }
/* (non-Javadoc) * @see com.code.aon.ui.form.event.ControllerAdapter#afterBeanSelected(com.code.aon.ui.form.event.ControllerEvent) */ @Override public void afterBeanSelected(ControllerEvent event) throws ControllerListenerException { UserController userController = (UserController) event.getController(); User user = (User) userController.getTo(); userController.getUserManager().findUser(user.getLogin()); }