예제 #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();
    }
  }
예제 #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;
  }
예제 #3
0
 public static List<MJPastWork> getOlds(Person resident) {
   return MJPastWork.find(
           "resident = ? " + "and actif = false " + "order by creationDate desc", resident)
       .fetch();
 }
예제 #4
0
 public static long nbOlds(Person resident) {
   return MJPastWork.count("resident = ? " + "and actif = false ", resident);
 }