public void addComment(Comment comment) { if (comment != null) { if (comments == null) comments = new ArrayList(); comments.add(comment); comment.setTaskInstance(this); if (token != null) { comment.setToken(token); token.addComment(comment); } } }
/** Add Token Comment */ public static void addTokenComment(String user, long tokenId, String message) throws WorkflowException { log.debug("addTokenComment({}, {}, {})", new Object[] {user, tokenId, message}); JbpmContext jbpmContext = JBPMUtils.getConfig().createJbpmContext(); try { org.jbpm.graph.exe.Token t = jbpmContext.getToken(tokenId); t.addComment(new org.jbpm.graph.exe.Comment(user, message)); jbpmContext.getSession().flush(); } catch (JbpmException e) { throw new WorkflowException(e.getMessage(), e); } finally { jbpmContext.close(); } log.debug("addTokenComment: void"); }