Search in sources :

Example 1 with TaskInstanceList

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

the class QueryServicesClientImpl method findHumanTasksWithFilters.

@Override
public List<TaskInstance> findHumanTasksWithFilters(String queryName, TaskQueryFilterSpec filterSpec, Integer page, Integer pageSize) {
    String mapper = "UserTasks";
    TaskInstanceList result = null;
    if (config.isRest()) {
        Map<String, Object> valuesMap = new HashMap<String, Object>();
        valuesMap.put(QUERY_NAME, queryName);
        String queryString = getPagingQueryString("?mapper=" + mapper, page, pageSize);
        result = makeHttpPostRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), QUERY_DEF_URI + "/" + RUN_FILTERED_QUERY_DEF_POST_URI, valuesMap) + queryString, filterSpec, TaskInstanceList.class);
    } else {
        CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("QueryDataService", "queryFiltered", serialize(filterSpec), marshaller.getFormat().getType(), new Object[] { queryName, mapper, page, pageSize })));
        ServiceResponse<TaskInstanceList> response = (ServiceResponse<TaskInstanceList>) executeJmsCommand(script, DescriptorCommand.class.getName(), "BPM").getResponses().get(0);
        throwExceptionOnFailure(response);
        if (shouldReturnWithNullResponse(response)) {
            return null;
        }
        result = response.getResult();
    }
    if (result != null) {
        return result.getItems();
    } else {
        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) HashMap(java.util.HashMap) CommandScript(org.kie.server.api.commands.CommandScript) TaskInstanceList(org.kie.server.api.model.instance.TaskInstanceList)

Example 2 with TaskInstanceList

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

the class ConvertUtils method convertToTaskInstanceList.

public static TaskInstanceList convertToTaskInstanceList(Collection<UserTaskInstanceDesc> instances) {
    if (instances == null) {
        return new TaskInstanceList(new org.kie.server.api.model.instance.TaskInstance[0]);
    }
    List<TaskInstance> taskInstances = new ArrayList<TaskInstance>(instances.size());
    for (UserTaskInstanceDesc task : instances) {
        org.kie.server.api.model.instance.TaskInstance instance = convertToTask(task);
        taskInstances.add(instance);
    }
    return new TaskInstanceList(taskInstances);
}
Also used : TaskInstance(org.kie.server.api.model.instance.TaskInstance) ArrayList(java.util.ArrayList) TaskInstance(org.kie.server.api.model.instance.TaskInstance) UserTaskInstanceDesc(org.jbpm.services.api.model.UserTaskInstanceDesc) TaskInstanceList(org.kie.server.api.model.instance.TaskInstanceList)

Example 3 with TaskInstanceList

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

the class ConvertUtils method convertToTaskInstanceWithVarsList.

public static TaskInstanceList convertToTaskInstanceWithVarsList(Collection<UserTaskInstanceWithVarsDesc> instances) {
    if (instances == null) {
        return new TaskInstanceList(new org.kie.server.api.model.instance.TaskInstance[0]);
    }
    List<TaskInstance> taskInstances = new ArrayList<TaskInstance>(instances.size());
    for (UserTaskInstanceWithVarsDesc task : instances) {
        org.kie.server.api.model.instance.TaskInstance instance = convertToTask(task);
        instance.setInputData(task.getVariables());
        taskInstances.add(instance);
    }
    return new TaskInstanceList(taskInstances);
}
Also used : TaskInstance(org.kie.server.api.model.instance.TaskInstance) ArrayList(java.util.ArrayList) TaskInstance(org.kie.server.api.model.instance.TaskInstance) UserTaskInstanceWithVarsDesc(org.jbpm.services.api.model.UserTaskInstanceWithVarsDesc) TaskInstanceList(org.kie.server.api.model.instance.TaskInstanceList)

Aggregations

TaskInstanceList (org.kie.server.api.model.instance.TaskInstanceList)3 ArrayList (java.util.ArrayList)2 TaskInstance (org.kie.server.api.model.instance.TaskInstance)2 HashMap (java.util.HashMap)1 UserTaskInstanceDesc (org.jbpm.services.api.model.UserTaskInstanceDesc)1 UserTaskInstanceWithVarsDesc (org.jbpm.services.api.model.UserTaskInstanceWithVarsDesc)1 CommandScript (org.kie.server.api.commands.CommandScript)1 DescriptorCommand (org.kie.server.api.commands.DescriptorCommand)1 KieServerCommand (org.kie.server.api.model.KieServerCommand)1 ServiceResponse (org.kie.server.api.model.ServiceResponse)1