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