use of org.kie.server.api.model.cases.CaseAdHocFragmentList in project droolsjbpm-integration by kiegroup.
the class CaseResource method getCaseInstanceAdHocFragments.
@ApiOperation(value = "Returns ad hoc fragments 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 = CaseAdHocFragmentList.class, message = "Successful response", examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = CASE_ADHOC_FRAGMENTS_JSON) })) })
@GET
@Path(CASE_AD_HOC_FRAGMENTS_GET_URI)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getCaseInstanceAdHocFragments(@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) {
return invokeCaseOperation(headers, containerId, caseId, (Variant v, String type, Header... customHeaders) -> {
logger.debug("About to look for adhoc fragments in case {}", caseId);
CaseAdHocFragmentList responseObject = this.caseManagementRuntimeDataServiceBase.getAdHocFragments(containerId, caseId);
logger.debug("Returning OK response with content '{}'", responseObject);
return createCorrectVariant(responseObject, headers, Response.Status.OK, customHeaders);
});
}
use of org.kie.server.api.model.cases.CaseAdHocFragmentList in project droolsjbpm-integration by kiegroup.
the class CaseServicesClientImpl method getAdHocFragments.
@Override
public List<CaseAdHocFragment> getAdHocFragments(String containerId, String caseId) {
CaseAdHocFragmentList list = null;
if (config.isRest()) {
Map<String, Object> valuesMap = new HashMap<String, Object>();
valuesMap.put(CONTAINER_ID, containerId);
valuesMap.put(CASE_ID, caseId);
list = makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), CASE_URI + "/" + CASE_AD_HOC_FRAGMENTS_GET_URI, valuesMap), CaseAdHocFragmentList.class);
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("CaseQueryService", "getAdHocFragments", new Object[] { containerId, caseId })));
ServiceResponse<CaseAdHocFragmentList> response = (ServiceResponse<CaseAdHocFragmentList>) 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.CaseAdHocFragmentList in project droolsjbpm-integration by kiegroup.
the class CaseManagementRuntimeDataServiceBase method getAdHocFragments.
public CaseAdHocFragmentList getAdHocFragments(String containerId, String caseId) {
Collection<AdHocFragment> caseAdHocFragments = caseRuntimeDataService.getAdHocFragmentsForCase(caseId);
List<CaseAdHocFragment> caseAdHoc = caseAdHocFragments.stream().map(adf -> CaseAdHocFragment.builder().name(adf.getName()).type(adf.getType()).build()).collect(toList());
CaseAdHocFragmentList adHocFragmentList = new CaseAdHocFragmentList(caseAdHoc);
return adHocFragmentList;
}
Aggregations