@Override
public List<TaskComment> getTaskCommentsByTaskId(String containerId, Long taskId) {
TaskCommentList commentList = null;
if( config.isRest() ) {
Map<String, Object> valuesMap = new HashMap<String, Object>();
valuesMap.put(CONTAINER_ID, containerId);
valuesMap.put(TASK_INSTANCE_ID, taskId);
commentList = makeHttpGetRequestAndCreateCustomResponse(
build(loadBalancer.getUrl(), TASK_URI + "/" + TASK_INSTANCE_COMMENTS_GET_URI, valuesMap), TaskCommentList.class);
} else {
CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand)
new DescriptorCommand( "UserTaskService", "getCommentsByTaskId", marshaller.getFormat().getType(), new Object[]{containerId, taskId}) ) );
ServiceResponse<String> response = (ServiceResponse<String>) executeJmsCommand( script, DescriptorCommand.class.getName(), "BPM", containerId ).getResponses().get(0);
throwExceptionOnFailure(response);
if (shouldReturnWithNullResponse(response)) {
return null;
}
commentList = deserialize(response.getResult(), TaskCommentList.class);
}
if (commentList.getTasks() != null) {
return Arrays.asList(commentList.getTasks());
}
return Collections.emptyList();
}