Search in sources :

Example 86 with KieServerCommand

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

the class CaseServicesClientImpl method getMilestones.

@Override
public List<CaseMilestone> getMilestones(String containerId, String caseId, boolean achievedOnly, Integer page, Integer pageSize) {
    CaseMilestoneList list = null;
    if (config.isRest()) {
        Map<String, Object> valuesMap = new HashMap<String, Object>();
        valuesMap.put(CONTAINER_ID, containerId);
        valuesMap.put(CASE_ID, caseId);
        String queryString = getPagingQueryString("?achievedOnly=" + achievedOnly, page, pageSize);
        list = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), CASE_URI + "/" + CASE_MILESTONES_GET_URI, valuesMap) + queryString, CaseMilestoneList.class);
    } else {
        CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("CaseQueryService", "getMilestones", new Object[] { containerId, caseId, achievedOnly, page, pageSize })));
        ServiceResponse<CaseMilestoneList> response = (ServiceResponse<CaseMilestoneList>) executeJmsCommand(script, DescriptorCommand.class.getName(), KieServerConstants.CAPABILITY_CASE).getResponses().get(0);
        throwExceptionOnFailure(response);
        if (shouldReturnWithNullResponse(response)) {
            return null;
        }
        list = response.getResult();
    }
    if (list != null) {
        return list.getItems();
    }
    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) CaseMilestoneList(org.kie.server.api.model.cases.CaseMilestoneList) CommandScript(org.kie.server.api.commands.CommandScript)

Example 87 with KieServerCommand

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

the class CaseServicesClientImpl method internalGetCaseInstanceDataItems.

/*
     * internal methods
     */
protected List<CaseFileDataItem> internalGetCaseInstanceDataItems(String caseId, List<String> names, List<String> types, Integer page, Integer pageSize) {
    CaseFileDataItemList list = null;
    if (config.isRest()) {
        Map<String, Object> valuesMap = new HashMap<String, Object>();
        valuesMap.put(CASE_ID, caseId);
        String queryString = getPagingQueryString("", page, pageSize);
        if (names != null && !names.isEmpty()) {
            queryString = getAdditionalParams(queryString, "name", names);
        } else if (types != null && !types.isEmpty()) {
            queryString = getAdditionalParams(queryString, "type", types);
        }
        list = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), CASE_QUERY_URI + "/" + CASE_FILE_GET_URI, valuesMap) + queryString, CaseFileDataItemList.class);
    } else {
        CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("CaseQueryService", "getCaseInstanceDataItems", new Object[] { caseId, safeList(names), safeList(types), page, pageSize })));
        ServiceResponse<CaseFileDataItemList> response = (ServiceResponse<CaseFileDataItemList>) executeJmsCommand(script, DescriptorCommand.class.getName(), KieServerConstants.CAPABILITY_CASE).getResponses().get(0);
        throwExceptionOnFailure(response);
        if (shouldReturnWithNullResponse(response)) {
            return null;
        }
        list = response.getResult();
    }
    if (list != null) {
        return list.getItems();
    }
    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) CaseFileDataItemList(org.kie.server.api.model.cases.CaseFileDataItemList) CommandScript(org.kie.server.api.commands.CommandScript)

Example 88 with KieServerCommand

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

the class CaseServicesClientImpl method getCaseDefinitions.

@Override
public List<CaseDefinition> getCaseDefinitions(String filter, Integer page, Integer pageSize, String sort, boolean sortOrder) {
    CaseDefinitionList list = null;
    if (config.isRest()) {
        Map<String, Object> valuesMap = new HashMap<String, Object>();
        String filterQueryString = "";
        if (filter != null) {
            filterQueryString = "?filter=" + emptyIfNull(filter);
        }
        String queryString = getPagingQueryString(filterQueryString, page, pageSize);
        queryString = getSortingQueryString(queryString, sort, sortOrder);
        list = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), CASE_QUERY_URI, valuesMap) + queryString, CaseDefinitionList.class);
    } else {
        CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("CaseQueryService", "getCaseDefinitions", new Object[] { emptyIfNull(filter), page, pageSize, sort, sortOrder })));
        ServiceResponse<CaseDefinitionList> response = (ServiceResponse<CaseDefinitionList>) executeJmsCommand(script, DescriptorCommand.class.getName(), KieServerConstants.CAPABILITY_CASE).getResponses().get(0);
        throwExceptionOnFailure(response);
        if (shouldReturnWithNullResponse(response)) {
            return null;
        }
        list = response.getResult();
    }
    if (list != null) {
        return list.getItems();
    }
    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) CaseDefinitionList(org.kie.server.api.model.cases.CaseDefinitionList) CommandScript(org.kie.server.api.commands.CommandScript)

Example 89 with KieServerCommand

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

the class CaseServicesClientImpl method getCaseInstancesOwnedBy.

@Override
public List<CaseInstance> getCaseInstancesOwnedBy(String owner, List<String> status, Integer page, Integer pageSize, String sort, boolean sortOrder, boolean withData) {
    CaseInstanceList list = null;
    if (config.isRest()) {
        Map<String, Object> valuesMap = new HashMap<String, Object>();
        String queryString = getPagingQueryString("?owner=" + owner, page, pageSize);
        queryString = getAdditionalParams(queryString, "status", status);
        queryString = getSortingQueryString(queryString, sort, sortOrder);
        queryString = getAdditionalParams(queryString, "withData", Collections.singletonList(withData));
        list = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), CASE_QUERY_URI + "/" + CASE_ALL_INSTANCES_GET_URI, valuesMap) + queryString, CaseInstanceList.class);
    } else {
        CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("CaseQueryService", "getCaseInstancesOwnedBy", new Object[] { owner, safeList(status), page, pageSize, sort, sortOrder, withData })));
        ServiceResponse<CaseInstanceList> response = (ServiceResponse<CaseInstanceList>) executeJmsCommand(script, DescriptorCommand.class.getName(), KieServerConstants.CAPABILITY_CASE).getResponses().get(0);
        throwExceptionOnFailure(response);
        if (shouldReturnWithNullResponse(response)) {
            return null;
        }
        list = response.getResult();
    }
    if (list != null) {
        return list.getItems();
    }
    return Collections.emptyList();
}
Also used : CaseInstanceList(org.kie.server.api.model.cases.CaseInstanceList) 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 90 with KieServerCommand

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

the class CaseServicesClientImpl method getComments.

@Override
public List<CaseComment> getComments(String containerId, String caseId, String sortBy, Integer page, Integer pageSize) {
    CaseCommentList list = null;
    if (config.isRest()) {
        Map<String, Object> valuesMap = new HashMap<String, Object>();
        valuesMap.put(CONTAINER_ID, containerId);
        valuesMap.put(CASE_ID, caseId);
        String queryString = getPagingQueryString("?sort=" + sortBy, page, pageSize);
        list = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), CASE_URI + "/" + CASE_COMMENTS_GET_URI, valuesMap) + queryString, CaseCommentList.class);
    } else {
        CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("CaseService", "getComments", new Object[] { containerId, caseId, sortBy, page, pageSize })));
        ServiceResponse<CaseCommentList> response = (ServiceResponse<CaseCommentList>) executeJmsCommand(script, DescriptorCommand.class.getName(), KieServerConstants.CAPABILITY_CASE).getResponses().get(0);
        throwExceptionOnFailure(response);
        if (shouldReturnWithNullResponse(response)) {
            return null;
        }
        list = response.getResult();
    }
    if (list != null) {
        return list.getItems();
    }
    return Collections.emptyList();
}
Also used : DescriptorCommand(org.kie.server.api.commands.DescriptorCommand) CaseCommentList(org.kie.server.api.model.cases.CaseCommentList) 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)

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