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\"}"); } }
public static void delete(Long confidentialID) { InsConfidential c = InsConfidential.findById(confidentialID); c.delete(); flash.put("success", "messageDeleted"); InsConfidentials.show(c.person.id); }
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); }
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); } }