use of org.kie.server.api.model.KieServerCommand in project droolsjbpm-integration by kiegroup.
the class CaseServicesClientImpl method internalAddDynamicSubProcess.
protected void internalAddDynamicSubProcess(String containerId, String caseId, String stageId, String processId, Map<String, Object> taskSpecMap) {
if (config.isRest()) {
Map<String, Object> valuesMap = new HashMap<String, Object>();
valuesMap.put(CONTAINER_ID, containerId);
valuesMap.put(CASE_ID, caseId);
valuesMap.put(PROCESS_ID, processId);
if (stageId != null) {
valuesMap.put(CASE_STAGE_ID, stageId);
makeHttpPostRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), CASE_URI + "/" + CASE_DYNAMIC_PROCESS_IN_STAGE_POST_URI, valuesMap), taskSpecMap, null);
} else {
makeHttpPostRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), CASE_URI + "/" + CASE_DYNAMIC_PROCESS_POST_URI, valuesMap), taskSpecMap, null);
}
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("CaseService", "addDynamicSubprocess", serialize(safeMap(taskSpecMap)), marshaller.getFormat().getType(), new Object[] { containerId, caseId, emptyIfNull(stageId), processId })));
ServiceResponse<?> response = (ServiceResponse<?>) executeJmsCommand(script, DescriptorCommand.class.getName(), KieServerConstants.CAPABILITY_CASE).getResponses().get(0);
throwExceptionOnFailure(response);
}
}
use of org.kie.server.api.model.KieServerCommand in project droolsjbpm-integration by kiegroup.
the class CaseServicesClientImpl method findCaseTasksAssignedAsBusinessAdministrator.
@Override
public List<TaskSummary> findCaseTasksAssignedAsBusinessAdministrator(String caseId, String userId, List<String> status, Integer page, Integer pageSize, String sort, boolean sortOrder) {
TaskSummaryList result = null;
if (config.isRest()) {
Map<String, Object> valuesMap = new HashMap<String, Object>();
valuesMap.put(CASE_ID, caseId);
String userQuery = getUserQueryStr(userId);
String statusQuery = getAdditionalParams(userQuery, "status", status);
String queryString = getPagingQueryString(statusQuery, page, pageSize) + "&sort=" + sort + "&sortOrder=" + sortOrder;
result = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), CASE_QUERY_URI + "/" + CASE_TASKS_AS_ADMIN_GET_URI, valuesMap) + queryString, TaskSummaryList.class);
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("CaseQueryService", "getCaseTasksAsBusinessAdmin", new Object[] { caseId, userId, safeList(status), page, pageSize, sort, sortOrder })));
ServiceResponse<TaskSummaryList> response = (ServiceResponse<TaskSummaryList>) executeJmsCommand(script, DescriptorCommand.class.getName(), KieServerConstants.CAPABILITY_CASE).getResponses().get(0);
throwExceptionOnFailure(response);
if (shouldReturnWithNullResponse(response)) {
return null;
}
result = response.getResult();
}
if (result != null && result.getTasks() != null) {
return Arrays.asList(result.getTasks());
}
return Collections.emptyList();
}
use of org.kie.server.api.model.KieServerCommand in project droolsjbpm-integration by kiegroup.
the class CaseServicesClientImpl method getActiveNodes.
@Override
public List<NodeInstance> getActiveNodes(String containerId, String caseId, Integer page, Integer pageSize) {
NodeInstanceList 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("", page, pageSize);
list = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), CASE_URI + "/" + CASE_NODE_INSTANCES_GET_URI, valuesMap) + queryString, NodeInstanceList.class);
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("CaseQueryService", "getActiveNodes", new Object[] { containerId, caseId, page, pageSize })));
ServiceResponse<NodeInstanceList> response = (ServiceResponse<NodeInstanceList>) 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();
}
use of org.kie.server.api.model.KieServerCommand in project droolsjbpm-integration by kiegroup.
the class CaseServicesClientImpl method getCaseInstances.
@Override
public List<CaseInstance> getCaseInstances(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("", 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", "getCaseInstancesAnyRole", new Object[] { 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();
}
use of org.kie.server.api.model.KieServerCommand in project droolsjbpm-integration by kiegroup.
the class CaseServicesClientImpl method internalTriggerAdHoc.
protected void internalTriggerAdHoc(String containerId, String caseId, String stageId, String adHocName, Map<String, Object> data) {
if (config.isRest()) {
Map<String, Object> valuesMap = new HashMap<String, Object>();
valuesMap.put(CONTAINER_ID, containerId);
valuesMap.put(CASE_ID, caseId);
valuesMap.put(CASE_NODE_NAME, adHocName);
if (stageId != null) {
valuesMap.put(CASE_STAGE_ID, stageId);
makeHttpPutRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), CASE_URI + "/" + CASE_DYNAMIC_TASK_IN_STAGE_PUT_URI, valuesMap), data, null, new HashMap<String, String>());
} else {
makeHttpPutRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), CASE_URI + "/" + CASE_DYNAMIC_TASK_PUT_URI, valuesMap), data, null, new HashMap<String, String>());
}
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("CaseService", "triggerAdHocNode", serialize(safeMap(data)), marshaller.getFormat().getType(), new Object[] { containerId, caseId, emptyIfNull(stageId), emptyIfNull(adHocName) })));
ServiceResponse<?> response = (ServiceResponse<?>) executeJmsCommand(script, DescriptorCommand.class.getName(), KieServerConstants.CAPABILITY_CASE).getResponses().get(0);
throwExceptionOnFailure(response);
}
}
Aggregations