use of org.kie.server.api.model.cases.CaseStageList in project droolsjbpm-integration by kiegroup.
the class CaseResource method getCaseInstanceStages.
@ApiOperation(value = "Returns stages for a specified case instance.")
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"), @ApiResponse(code = 404, message = "Case instance not found"), @ApiResponse(code = 200, response = CaseStageList.class, message = "Successful response", examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = CASE_STAGES_JSON) })) })
@GET
@Path(CASE_STAGES_GET_URI)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getCaseInstanceStages(@javax.ws.rs.core.Context HttpHeaders headers, @ApiParam(value = "container id that case instance belongs to", required = true, example = "evaluation_1.0.0-SNAPSHOT") @PathParam(CONTAINER_ID) String containerId, @ApiParam(value = "identifier of the case instance", required = true, example = "CASE-00000000001") @PathParam(CASE_ID) String caseId, @ApiParam(value = "optional flag that allows to control which stages to load - active only or completed ones too, defaults to true", required = false) @QueryParam("activeOnly") @DefaultValue("true") boolean activeOnly, @ApiParam(value = "optional pagination - at which page to start, defaults to 0 (meaning first)", required = false) @QueryParam("page") @DefaultValue("0") Integer page, @ApiParam(value = "optional pagination - size of the result, defaults to 10", required = false) @QueryParam("pageSize") @DefaultValue("10") Integer pageSize) {
return invokeCaseOperation(headers, containerId, caseId, (Variant v, String type, Header... customHeaders) -> {
logger.debug("About to look for stages in case {} active only = {}", caseId, activeOnly);
CaseStageList responseObject = this.caseManagementRuntimeDataServiceBase.getStages(containerId, caseId, activeOnly, page, pageSize);
logger.debug("Returning OK response with content '{}'", responseObject);
return createCorrectVariant(responseObject, headers, Response.Status.OK, customHeaders);
});
}
use of org.kie.server.api.model.cases.CaseStageList in project droolsjbpm-integration by kiegroup.
the class CaseServicesClientImpl method getStages.
@Override
public List<CaseStage> getStages(String containerId, String caseId, boolean activeOnly, Integer page, Integer pageSize) {
CaseStageList 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("?activeOnly=" + activeOnly, page, pageSize);
list = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), CASE_URI + "/" + CASE_STAGES_GET_URI, valuesMap) + queryString, CaseStageList.class);
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("CaseQueryService", "getStages", new Object[] { containerId, caseId, activeOnly, page, pageSize })));
ServiceResponse<CaseStageList> response = (ServiceResponse<CaseStageList>) 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.cases.CaseStageList in project droolsjbpm-integration by kiegroup.
the class CaseManagementRuntimeDataServiceBase method getStages.
public CaseStageList getStages(String containerId, String caseId, boolean activeOnly, Integer page, Integer pageSize) {
Collection<CaseStageInstance> caseStageInstances = caseRuntimeDataService.getCaseInstanceStages(caseId, activeOnly, ConvertUtils.buildQueryContext(page, pageSize));
List<CaseStage> caseStages = ConvertUtils.transformStages(caseStageInstances);
CaseStageList stageList = new CaseStageList(caseStages);
return stageList;
}
Aggregations