use of org.kie.server.api.commands.CommandScript in project droolsjbpm-integration by kiegroup.
the class UserTaskServicesClientImpl method nominateTask.
@Override
public void nominateTask(String containerId, Long taskId, String userId, List<String> potentialOwners) {
if (config.isRest()) {
sendTaskOperation(containerId, taskId, TASK_URI + "/" + TASK_INSTANCE_NOMINATE_PUT_URI, getUserAndAdditionalParams(userId, "potOwner", potentialOwners));
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("UserTaskService", "nominate", new Object[] { containerId, taskId, userId, potentialOwners })));
ServiceResponse<Object> response = (ServiceResponse<Object>) executeJmsCommand(script, DescriptorCommand.class.getName(), "BPM", containerId).getResponses().get(0);
throwExceptionOnFailure(response);
}
}
use of org.kie.server.api.commands.CommandScript in project droolsjbpm-integration by kiegroup.
the class UserTaskServicesClientImpl method updateTask.
@Override
public void updateTask(String containerId, Long taskId, String userId, TaskInstance updatedTask) {
if (config.isRest()) {
Map<String, Object> valuesMap = new HashMap<String, Object>();
valuesMap.put(CONTAINER_ID, containerId);
valuesMap.put(TASK_INSTANCE_ID, taskId);
makeHttpPutRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), TASK_URI + "/" + TASK_INSTANCE_PUT_URI, valuesMap) + getUserQueryStr(userId), updatedTask, String.class, getHeaders(null));
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("UserTaskService", "update", serialize(updatedTask), marshaller.getFormat().getType(), new Object[] { containerId, taskId, userId })));
ServiceResponse<Object> response = (ServiceResponse<Object>) executeJmsCommand(script, DescriptorCommand.class.getName(), "BPM", containerId).getResponses().get(0);
throwExceptionOnFailure(response);
}
}
use of org.kie.server.api.commands.CommandScript in project droolsjbpm-integration by kiegroup.
the class UserTaskServicesClientImpl method getTaskAttachmentsByTaskId.
@Override
public List<TaskAttachment> getTaskAttachmentsByTaskId(String containerId, Long taskId) {
TaskAttachmentList attachmentList = null;
if (config.isRest()) {
Map<String, Object> valuesMap = new HashMap<String, Object>();
valuesMap.put(CONTAINER_ID, containerId);
valuesMap.put(TASK_INSTANCE_ID, taskId);
attachmentList = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), TASK_URI + "/" + TASK_INSTANCE_ATTACHMENTS_GET_URI, valuesMap), TaskAttachmentList.class);
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("UserTaskService", "getAttachmentsByTaskId", 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;
}
attachmentList = deserialize(response.getResult(), TaskAttachmentList.class);
;
}
if (attachmentList.getTasks() != null) {
return Arrays.asList(attachmentList.getTasks());
}
return Collections.emptyList();
}
use of org.kie.server.api.commands.CommandScript in project droolsjbpm-integration by kiegroup.
the class UserTaskServicesClientImpl method suspendTask.
@Override
public void suspendTask(String containerId, Long taskId, String userId, Map<String, Object> parameters) {
if (config.isRest()) {
sendTaskOperation(containerId, taskId, TASK_URI + "/" + TASK_INSTANCE_SUSPEND_PUT_URI, getUserQueryStr(userId), parameters);
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("UserTaskService", "suspend", serialize(safeMap(parameters)), marshaller.getFormat().getType(), new Object[] { containerId, taskId, userId })));
ServiceResponse<Object> response = (ServiceResponse<Object>) executeJmsCommand(script, DescriptorCommand.class.getName(), "BPM", containerId).getResponses().get(0);
throwExceptionOnFailure(response);
}
}
use of org.kie.server.api.commands.CommandScript in project droolsjbpm-integration by kiegroup.
the class UserTaskServicesClientImpl method getTaskInstance.
@Override
public TaskInstance getTaskInstance(String containerId, Long taskId) {
TaskInstance result = null;
if (config.isRest()) {
Map<String, Object> valuesMap = new HashMap<String, Object>();
valuesMap.put(CONTAINER_ID, containerId);
valuesMap.put(TASK_INSTANCE_ID, taskId);
result = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), TASK_URI + "/" + TASK_INSTANCE_GET_URI, valuesMap), TaskInstance.class);
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("UserTaskService", "getTask", marshaller.getFormat().getType(), new Object[] { containerId, taskId, false, false, false })));
ServiceResponse<String> response = (ServiceResponse<String>) executeJmsCommand(script, DescriptorCommand.class.getName(), "BPM", containerId).getResponses().get(0);
throwExceptionOnFailure(response);
if (shouldReturnWithNullResponse(response)) {
return null;
}
result = deserialize(response.getResult(), TaskInstance.class);
}
return result;
}
Aggregations