@Override
public List<TaskNotification> getTaskNotifications(String containerId, Long taskId, boolean activeOnly) {
TaskNotificationList result = null;
if( config.isRest() ) {
Map<String, Object> valuesMap = new HashMap<String, Object>();
valuesMap.put(CONTAINER_ID, containerId);
valuesMap.put(TASK_INSTANCE_ID, taskId);
String queryString = "?activeOnly=" + activeOnly;
result = makeHttpGetRequestAndCreateCustomResponse(
build(loadBalancer.getUrl(), ADMIN_TASK_URI + "/" + TASK_INSTANCE_NOTIFICATIONS_URI, valuesMap) + queryString, TaskNotificationList.class);
} else {
CommandScript script = new CommandScript( Collections.singletonList( (KieServerCommand)
new DescriptorCommand( "UserTaskAdminService", "getTaskNotifications", new Object[]{containerId, taskId, activeOnly}) ) );
ServiceResponse<TaskNotificationList> response = (ServiceResponse<TaskNotificationList>) executeJmsCommand( script, DescriptorCommand.class.getName(), "BPM" ).getResponses().get(0);
throwExceptionOnFailure(response);
if (shouldReturnWithNullResponse(response)) {
return null;
}
result = response.getResult();
}
if (result != null && result.getItems() != null) {
return result.getItems();
}
return Collections.emptyList();
}