use of org.kie.server.api.model.cases.CaseRoleAssignmentList in project droolsjbpm-integration by kiegroup.
the class CaseResource method getCaseInstanceRoleAssignments.
@ApiOperation(value = "Returns role assignments 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 = CaseRoleAssignmentList.class, message = "Successful response", examples = @Example(value = { @ExampleProperty(mediaType = JSON, value = CASE_ROLES_ASSIGNMENTS_JSON) })) })
@GET
@Path(CASE_ROLES_GET_URI)
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getCaseInstanceRoleAssignments(@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 role assignments in case {}", caseId);
CaseRoleAssignmentList responseObject = this.caseManagementServiceBase.getRoleAssignment(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.CaseRoleAssignmentList in project droolsjbpm-integration by kiegroup.
the class CaseManagementServiceBase method getRoleAssignment.
public CaseRoleAssignmentList getRoleAssignment(String containerId, String caseId) {
verifyContainerId(containerId, caseId);
Collection<CaseRoleInstance> caseRoleInstances = caseService.getCaseRoleAssignments(caseId);
logger.debug("Roles assignments for case {} are {}", caseId, caseRoleInstances);
List<CaseRoleAssignment> caseRoles = ConvertUtils.transformRoleAssignment(caseRoleInstances);
CaseRoleAssignmentList caseRolesList = new CaseRoleAssignmentList(caseRoles);
return caseRolesList;
}
use of org.kie.server.api.model.cases.CaseRoleAssignmentList in project droolsjbpm-integration by kiegroup.
the class CaseServicesClientImpl method getRoleAssignments.
@Override
public List<CaseRoleAssignment> getRoleAssignments(String containerId, String caseId) {
CaseRoleAssignmentList 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_ROLES_GET_URI, valuesMap), CaseRoleAssignmentList.class);
} else {
CommandScript script = new CommandScript(Collections.singletonList((KieServerCommand) new DescriptorCommand("CaseService", "getRoleAssignment", new Object[] { containerId, caseId })));
ServiceResponse<CaseRoleAssignmentList> response = (ServiceResponse<CaseRoleAssignmentList>) 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();
}
Aggregations