예제 #1
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);
    }
  }
예제 #2
0
  public static void delete(Long confidentialID) {
    InsConfidential c = InsConfidential.findById(confidentialID);
    c.delete();

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

    InsConfidentials.show(c.person.id);
  }