예제 #1
0
  public static void save(long id, String content) {
    try {

      Policy policy =
          Policy.getInstance(
              Play.applicationPath.getAbsolutePath() + "/conf/antisamy-myspace-1.3.xml");
      AntiSamy as = new AntiSamy();
      CleanResults cr = as.scan(content, policy);

      InsConfidential c = InsConfidential.findById(id);
      c.content = cr.getCleanHTML();
      c.save();

      PersonEvaluation.changeMessage(c);

      renderJSON("{\"result\":\"ok\"}");

    } catch (ScanException ex) {

      Logger.error(InsConfidentials.class.getName() + " : " + ex);
      renderJSON("{\"result\":\"ko\"}");
    } catch (PolicyException ex) {

      Logger.error(InsConfidentials.class.getName() + " : " + ex);
      renderJSON("{\"result\":\"ko\"}");
    }
  }
예제 #2
0
  public static void delete(Long confidentialID) {
    InsConfidential c = InsConfidential.findById(confidentialID);
    c.delete();

    flash.put("success", "messageDeleted");

    InsConfidentials.show(c.person.id);
  }
예제 #3
0
  public static void show(Long id) {
    User user = User.loadFromSession();
    Person p = Person.findById(id);
    List<InsConfidential> insConfidentials = InsConfidential.byPerson(p);

    render(id, insConfidentials, p, user);
  }
예제 #4
0
  public static void create(long personID, String content) {
    try {
      User user = User.loadFromSession();
      Person person = Person.findById(personID);

      Policy policy =
          Policy.getInstance(
              Play.applicationPath.getAbsolutePath() + "/conf/antisamy-myspace-1.3.xml");
      AntiSamy as = new AntiSamy();
      CleanResults cr = as.scan(content, policy);

      InsConfidential c = new InsConfidential();
      c.content = cr.getCleanHTML();
      c.createAt = new GregorianCalendar();
      c.employe = user.person;
      c.person = person;
      c.save();

      flash.success("messageAdded");

      InsConfidentials.show(personID);
    } catch (ScanException ex) {
      Logger.error(InsConfidentials.class.getName() + " : " + ex);
    } catch (PolicyException ex) {
      Logger.error(InsConfidentials.class.getName() + " : " + ex);
    }
  }