Search in sources :

Example 21 with KieServerCommand

use of org.kie.server.api.model.KieServerCommand in project droolsjbpm-integration by kiegroup.

the class UserTaskServicesClientImpl method setTaskName.

@Override
public void setTaskName(String containerId, Long taskId, String name) {
    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_NAME_PUT_URI, valuesMap), serialize(name), String.class, getHeaders(null));
    } else {
        CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("UserTaskService", "setName", serialize(name), marshaller.getFormat().getType(), new Object[] { containerId, taskId })));
        ServiceResponse<Object> response = (ServiceResponse<Object>) executeJmsCommand(script, DescriptorCommand.class.getName(), "BPM", containerId).getResponses().get(0);
        throwExceptionOnFailure(response);
    }
}
Also used : DescriptorCommand(org.kie.server.api.commands.DescriptorCommand) ServiceResponse(org.kie.server.api.model.ServiceResponse) KieServerCommand(org.kie.server.api.model.KieServerCommand) HashMap(java.util.HashMap) CommandScript(org.kie.server.api.commands.CommandScript)

Example 22 with KieServerCommand

use of org.kie.server.api.model.KieServerCommand in project droolsjbpm-integration by kiegroup.

the class UserTaskServicesClientImpl method setTaskSkipable.

@Override
public void setTaskSkipable(String containerId, Long taskId, boolean skipable) {
    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_SKIPABLE_PUT_URI, valuesMap), serialize(skipable), String.class, getHeaders(null));
    } else {
        CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("UserTaskService", "setSkipable", serialize(skipable), marshaller.getFormat().getType(), new Object[] { containerId, taskId })));
        ServiceResponse<Object> response = (ServiceResponse<Object>) executeJmsCommand(script, DescriptorCommand.class.getName(), "BPM", containerId).getResponses().get(0);
        throwExceptionOnFailure(response);
    }
}
Also used : DescriptorCommand(org.kie.server.api.commands.DescriptorCommand) ServiceResponse(org.kie.server.api.model.ServiceResponse) KieServerCommand(org.kie.server.api.model.KieServerCommand) HashMap(java.util.HashMap) CommandScript(org.kie.server.api.commands.CommandScript)

Example 23 with KieServerCommand

use of org.kie.server.api.model.KieServerCommand 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);
    }
}
Also used : DescriptorCommand(org.kie.server.api.commands.DescriptorCommand) ServiceResponse(org.kie.server.api.model.ServiceResponse) KieServerCommand(org.kie.server.api.model.KieServerCommand) CommandScript(org.kie.server.api.commands.CommandScript)

Example 24 with KieServerCommand

use of org.kie.server.api.model.KieServerCommand 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);
    }
}
Also used : DescriptorCommand(org.kie.server.api.commands.DescriptorCommand) ServiceResponse(org.kie.server.api.model.ServiceResponse) KieServerCommand(org.kie.server.api.model.KieServerCommand) HashMap(java.util.HashMap) CommandScript(org.kie.server.api.commands.CommandScript)

Example 25 with KieServerCommand

use of org.kie.server.api.model.KieServerCommand 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();
}
Also used : DescriptorCommand(org.kie.server.api.commands.DescriptorCommand) ServiceResponse(org.kie.server.api.model.ServiceResponse) KieServerCommand(org.kie.server.api.model.KieServerCommand) TaskAttachmentList(org.kie.server.api.model.instance.TaskAttachmentList) HashMap(java.util.HashMap) CommandScript(org.kie.server.api.commands.CommandScript)

Aggregations

KieServerCommand (org.kie.server.api.model.KieServerCommand)262 ServiceResponse (org.kie.server.api.model.ServiceResponse)260 CommandScript (org.kie.server.api.commands.CommandScript)256 DescriptorCommand (org.kie.server.api.commands.DescriptorCommand)234 HashMap (java.util.HashMap)217 Wrapped (org.kie.server.api.model.Wrapped)31 ArrayList (java.util.ArrayList)27 ServiceResponsesList (org.kie.server.api.model.ServiceResponsesList)18 ProcessInstanceList (org.kie.server.api.model.instance.ProcessInstanceList)18 TaskSummaryList (org.kie.server.api.model.instance.TaskSummaryList)16 NodeInstanceList (org.kie.server.api.model.instance.NodeInstanceList)14 WebSocketServiceResponse (org.kie.server.controller.websocket.common.handlers.WebSocketServiceResponse)10 KieContainerResource (org.kie.server.api.model.KieContainerResource)9 ExecutionErrorInstanceList (org.kie.server.api.model.admin.ExecutionErrorInstanceList)8 ProcessDefinitionList (org.kie.server.api.model.definition.ProcessDefinitionList)8 VariableInstanceList (org.kie.server.api.model.instance.VariableInstanceList)8 RequestInfoInstanceList (org.kie.server.api.model.instance.RequestInfoInstanceList)7 CallContainerCommand (org.kie.server.api.commands.CallContainerCommand)6 CaseInstanceList (org.kie.server.api.model.cases.CaseInstanceList)6 Map (java.util.Map)5