use of org.wso2.carbon.humantask.core.dao.CommentDAO in project carbon-business-process by wso2.
the class TaskOperationsImpl method addComment.
/**
* Add a comment to a task.
* @param taskIdURI : task identifier
* @param commentString : comment in plain text
* @return an identifier that can be used to later update or delete the comment.
* @throws IllegalStateFault
* @throws IllegalOperationFault
* @throws IllegalArgumentFault
* @throws IllegalAccessFault
*/
public URI addComment(final URI taskIdURI, final String commentString) throws IllegalStateFault, IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
try {
validateTaskId(taskIdURI);
Validate.notEmpty(commentString, "The comment string cannot be empty");
return HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler().execTransaction(new Callable<URI>() {
public URI call() throws Exception {
AddComment addComment = new AddComment(getCaller(), new Long(taskIdURI.toString()), commentString);
addComment.execute();
CommentDAO persisted = addComment.getPersistedComment();
if (persisted != null) {
return ConverterUtil.convertToURI(persisted.getId().toString());
} else {
throw new IllegalStateFault("The persisted comment is null. " + "See error log for more details.");
}
}
});
} catch (Exception ex) {
handleException(ex);
}
return null;
}
Aggregations