private ExoSocialActivity createCommentWhenUpdateQuestion( Identity userIdentity, Question question) { ExoSocialActivityImpl comment = new ExoSocialActivityImpl(); comment.setType(ANSWER_APP_ID); comment.setUserId(userIdentity.getId()); StringBuilder commentTitle = new StringBuilder(); String prefix = ""; for (PropertyChangeEvent pce : question.getChangeEvent()) { commentTitle.append(prefix); prefix = "\n"; commentTitle.append(getQuestionMessage(pce, question, comment)); } comment.setTitle(commentTitle.toString()); return comment; }
private ExoSocialActivity createCommentForAnswer(Identity userIdentity, Answer answer) { ExoSocialActivityImpl comment = new ExoSocialActivityImpl(); StringBuilder commentTitle = new StringBuilder(); comment.setUserId(userIdentity.getId()); comment.setType(ANSWER_APP_ID); // Build the message corresponding with an event String prefix = ""; for (PropertyChangeEvent pce : answer.getChangeEvent()) { commentTitle.append(prefix); prefix = "\n"; commentTitle.append(getAnswerMessage(pce, answer, comment)); } comment.setTitle(commentTitle.toString()); return comment; }
private ExoSocialActivity createComment( String title, String titleId, String spacePrettyName, String type, Identity identity, Map<String, String> templateParams) { ExoSocialActivityImpl comment = new ExoSocialActivityImpl(); comment.setTitle(title); comment.setTitleId(titleId); comment.setUserId(identity.getId()); comment.setType(type); if (spacePrettyName != null) { templateParams.put(SPACE_DISPLAY_NAME_PARAM, spacePrettyName); templateParams.put( BaseActivityProcessorPlugin.TEMPLATE_PARAM_TO_PROCESS, SPACE_DISPLAY_NAME_PARAM); } comment.setTemplateParams(templateParams); return comment; }