Esempio n. 1
0
  public static void disableLast(Person resident) {
    MJPastWork pastWork = MJPastWork.find("resident = ? " + "and actif = true", resident).first();

    if (pastWork != null) {
      pastWork.actif = false;
      pastWork.save();
    }
  }
Esempio n. 2
0
  public static MJPastWork getLastActif(Person resident) {
    MJPastWork pastWork =
        MJPastWork.find(
                "resident = ? " + "and actif = true " + "order by creationDate desc", resident)
            .first();

    if (pastWork == null) {
      pastWork = new MJPastWork();
      pastWork.resident = resident;
      pastWork.creationDate = new GregorianCalendar();
      pastWork.actif = true;
      pastWork.save();
    }

    return pastWork;
  }
Esempio n. 3
0
 public static List<MJPastWork> getOlds(Person resident) {
   return MJPastWork.find(
           "resident = ? " + "and actif = false " + "order by creationDate desc", resident)
       .fetch();
 }
Esempio n. 4
0
 public static long nbOlds(Person resident) {
   return MJPastWork.count("resident = ? " + "and actif = false ", resident);
 }