Пример #1
0
  public static void save(MJEvaluation evaluation, Long appraisers[]) throws Exception {
    Policy policy =
        Policy.getInstance(
            Play.applicationPath.getAbsolutePath() + "/conf/antisamy-myspace-1.3.xml");
    AntiSamy as = new AntiSamy();
    CleanResults cr = as.scan(evaluation.content, policy);
    User editor = User.loadFromSession();

    evaluation.actif = false;
    evaluation.editor = editor.person;
    evaluation.evaluationDate = new GregorianCalendar();

    List<Person> employes = new ArrayList<Person>();
    for (Long id : appraisers) {
      employes.add((Person) Person.findById(id));
    }

    evaluation.appraisers = employes;
    evaluation.save();

    MJEvaluation newEvaluation = new MJEvaluation();
    GregorianCalendar date = new GregorianCalendar();
    date.setTimeInMillis(evaluation.evaluationDate.getTimeInMillis());
    date.add(Calendar.MONTH, 6);

    evaluation.actif = true;
    newEvaluation.evaluationDate = date;
    newEvaluation.resident = evaluation.resident;
    newEvaluation.save();

    flash.success("saved");

    MJEvaluations.show(evaluation.resident.id);
  }
Пример #2
0
  public static void show(Long id) {
    Person p = Person.findById(id);
    List<Person> employes = Person.getTSMJ();
    long nbOlds = MJEvaluation.nbOlds(p);
    MJEvaluation evaluation = MJEvaluation.getLast(p);

    render(nbOlds, employes, p, evaluation);
  }
Пример #3
0
  public static void saveOld(MJEvaluation evaluation) throws Exception {
    Policy policy =
        Policy.getInstance(
            Play.applicationPath.getAbsolutePath() + "/conf/antisamy-myspace-1.3.xml");
    AntiSamy as = new AntiSamy();
    evaluation.content = as.scan(evaluation.content, policy).getCleanHTML();
    evaluation.save();

    flash.success("saved");

    MJEvaluations.show(evaluation.resident.id);
  }
Пример #4
0
 public static void edit(long id) {
   MJEvaluation evaluation = MJEvaluation.findById(id);
   render(evaluation);
 }
Пример #5
0
 public static void showOlds(long residentID) {
   List<MJEvaluation> evaluations =
       MJEvaluation.find("resident.id = ? " + "and actif = false", residentID).fetch();
   render(evaluations);
 }
Пример #6
0
  public static void delete(Long evaluationID) {
    MJEvaluation e = MJEvaluation.findById(evaluationID);
    e.delete();

    MJEvaluations.show(e.resident.id);
  }