Ejemplo n.º 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);
  }
Ejemplo n.º 2
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);
  }