*/
public static void createWorkFlowTask(Contentlet contentlet, String userId, String moderatorRole) throws DotDataException{
User user = getUserFromId(userId);
StringBuffer changeHist = new StringBuffer("Task Added<br>");
WorkflowTask task = new WorkflowTask();
changeHist.append("Title: " + UtilHTML.escapeHTMLSpecialChars(contentlet.getTitle()) + "<br>");
task.setTitle("A new content titled: " + UtilHTML.escapeHTMLSpecialChars(contentlet.getTitle())+ " has been posted.");
task.setDescription("A new content titled \"" + UtilHTML.escapeHTMLSpecialChars(contentlet.getTitle().trim()) +
"\" has been posted by " + UtilHTML.escapeHTMLSpecialChars(user.getFullName()) + " ("+user.getEmailAddress()+")");
changeHist.append("Description: " + UtilHTML.escapeHTMLSpecialChars(task.getDescription()) + "<br>");
Role role = roleAPI.loadRoleByKey(moderatorRole);
task.setBelongsTo(role.getId());
task.setAssignedTo("Nobody");
task.setModDate(new Date());
task.setCreationDate(new Date());
task.setCreatedBy(user.getUserId());
task.setStatus(WorkflowStatuses.OPEN.toString());
changeHist.append("Due Date: " + UtilMethods.dateToHTMLDate(task.getDueDate()) + " -> <br>");
task.setDueDate(null);
task.setWebasset(contentlet.getInode());
//HibernateUtil.saveOrUpdate(task);
//Save the work flow comment
WorkflowComment taskComment = new WorkflowComment ();
taskComment.setComment(task.getDescription());
taskComment.setCreationDate(new Date());
taskComment.setPostedBy(user.getUserId());
HibernateUtil.saveOrUpdate(taskComment);
relAPI.addRelationship(task.getInode(), taskComment.getInode(), "child");
//Save the work flow history
WorkflowHistory hist = new WorkflowHistory ();
hist.setChangeDescription("Task Creation");
hist.setCreationDate(new Date ());
hist.setMadeBy(user.getUserId());
HibernateUtil.saveOrUpdate(hist);
relAPI.addRelationship(task.getInode(), hist.getInode(), "child");
//WorkflowEmailUtil.sendWorkflowChangeEmails (task, "New user content has been submitted", "New Task", null);
}