コード例 #1
0
 private void saveTypes(EvaluateController ec) throws ManagerBeanException {
   Integer score = 0;
   List types = (List) ec.getTypes().getWrappedData();
   IManagerBean bean = BeanManager.getManagerBean(Evaluate.class);
   for (Iterator iter = types.iterator(); iter.hasNext(); ) {
     Evaluate e = (Evaluate) iter.next();
     if (e.getId() == null) bean.insert(e);
     else bean.update(e);
     score += e.getValue().ordinal();
   }
   ec.setScore(score);
 }
コード例 #2
0
 @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);
 }