示例#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);
 }