use of org.kie.server.api.model.KieServerCommand in project droolsjbpm-integration by kiegroup.
the class JobServicesClientImpl method cancelRequest.
@Override
public void cancelRequest(String containerId, long requestId) {
if (config.isRest()) {
Map<String, Object> valuesMap = new HashMap<String, Object>();
valuesMap.put(JOB_ID, requestId);
String queryString = "";
if (containerId != null && !containerId.isEmpty()) {
queryString = "?containerId=" + containerId;
}
makeHttpDeleteRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), JOB_URI + "/" + CANCEL_JOB_DEL_URI, valuesMap) + queryString, null);
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("JobService", "cancelRequest", new Object[] { requestId })));
ServiceResponse<?> response = (ServiceResponse<?>) executeJmsCommand(script, DescriptorCommand.class.getName(), "BPM").getResponses().get(0);
throwExceptionOnFailure(response);
}
}
use of org.kie.server.api.model.KieServerCommand in project droolsjbpm-integration by kiegroup.
the class KieServicesClientImpl method listContainers.
@Override
public ServiceResponse<KieContainerResourceList> listContainers(KieContainerResourceFilter containerFilter) {
if (config.isRest()) {
String queryParams = containerFilter.toURLQueryString();
String uri = loadBalancer.getUrl() + "/containers" + (queryParams.isEmpty() ? "" : "?" + queryParams);
return makeHttpGetRequestAndCreateServiceResponse(uri, KieContainerResourceList.class);
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new ListContainersCommand(containerFilter)));
ServiceResponse<KieContainerResourceList> response = (ServiceResponse<KieContainerResourceList>) executeJmsCommand(script).getResponses().get(0);
return getResponseOrNullIfNoResponse(response);
}
}
use of org.kie.server.api.model.KieServerCommand in project droolsjbpm-integration by kiegroup.
the class KieServicesClientImpl method updateScanner.
@Override
public ServiceResponse<KieScannerResource> updateScanner(String id, KieScannerResource resource) {
if (config.isRest()) {
return makeHttpPostRequestAndCreateServiceResponse(loadBalancer.getUrl() + "/containers/" + id + "/scanner", resource, KieScannerResource.class);
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new UpdateScannerCommand(id, resource)));
ServiceResponse<KieScannerResource> response = (ServiceResponse<KieScannerResource>) executeJmsCommand(script, null, null, id).getResponses().get(0);
return getResponseOrNullIfNoResponse(response);
}
}
use of org.kie.server.api.model.KieServerCommand in project droolsjbpm-integration by kiegroup.
the class KieServicesClientImpl method executeCommands.
/**
* This method is deprecated on KieServicesClient as it was moved to RuleServicesClient
*
* @see RuleServicesClient#executeCommands(String, Command)
* @deprecated
*/
@Deprecated
@Override
public ServiceResponse<String> executeCommands(String id, Command<?> cmd, Status status) {
if (config.isRest()) {
return makeBackwardCompatibleHttpPostRequestAndCreateServiceResponse(loadBalancer.getUrl() + "/containers/instances/" + id, cmd, String.class, getHeaders(cmd), status);
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new CallContainerCommand(id, serialize(cmd))));
ServiceResponse<String> response = (ServiceResponse<String>) executeJmsCommand(script, cmd.getClass().getName(), null, id).getResponses().get(0);
return getResponseOrNullIfNoResponse(response);
}
}
use of org.kie.server.api.model.KieServerCommand in project droolsjbpm-integration by kiegroup.
the class KieServicesClientImpl method disposeContainer.
@Override
public ServiceResponse<Void> disposeContainer(String id) {
if (config.isRest()) {
return makeHttpDeleteRequestAndCreateServiceResponse(loadBalancer.getUrl() + "/containers/" + id, Void.class);
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DisposeContainerCommand(id)));
ServiceResponse<Void> response = (ServiceResponse<Void>) executeJmsCommand(script, null, null, id).getResponses().get(0);
return getResponseOrNullIfNoResponse(response);
}
}
Aggregations