@Override
 public int compareTo(ChildContainer o) {
   // Compare by surname.
   int ret = child.getSurname().compareTo(o.getChild().getSurname());
   if (ret == 0) {
     // Surname is the same, just by firstname.
     ret = child.getFirstname().compareTo(o.getChild().getFirstname());
     // If still 0, use the id.
     if (ret == 0) {
       ret = child.getChildid().compareTo(o.getChild().getChildid());
     }
   }
   return ret;
 }
Esempio n. 2
0
 //  public EventType prepareCreate() {
 //    created = new EventType();
 //    initializeEmbeddableKey();
 //    return created;
 //  }
 public Child create(Child newChild) {
   System.out.println("CREATE");
   Child ret =
       persist(
           PersistAction.CREATE,
           newChild,
           MessageFormat.format(
               ResourceBundle.getBundle("/Bundle").getString("ChildCreated"),
               newChild.getFirstname()));
   if (!JsfUtil.isValidationFailed()) {
     items = null; // Invalidate list of items to trigger re-query.
   }
   return ret;
 }
Esempio n. 3
0
 public void update(Child child) {
   Child ret =
       persist(
           PersistAction.UPDATE,
           child,
           MessageFormat.format(
               ResourceBundle.getBundle("/Bundle").getString("ChildUpdated"),
               child.getFirstname()));
   if (ret != null) {
     int index = items.indexOf(child);
     if (index > -1) {
       items.set(index, ret);
     }
   }
 }