use of org.kie.server.remote.rest.common.marker.KieServerEndpoint in project droolsjbpm-integration by kiegroup.
the class CaseQueryResource method queryCaseUserTasksByVariables.
@ApiOperation(value = "Queries cases tasks by variables", response = CaseUserTaskWithVariablesList.class)
@POST
@Path(RestURI.VARIABLES_TASKS_CASES_URI)
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@KieServerEndpoint(categories = { EndpointType.DEFAULT, EndpointType.HISTORY })
public Response queryCaseUserTasksByVariables(@Context HttpHeaders headers, String payload, @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) {
Header conversationIdHeader = buildConversationIdHeader("", context, headers);
Variant v = getVariant(headers);
try {
String type = getContentType(headers);
CaseUserTaskWithVariablesList taskVariableSummaryList = caseManagementRuntimeDataServiceBase.queryUserTasksByVariables(payload, type, new QueryContext((page * pageSize), pageSize));
logger.debug("Returning result of case instance user task search: {}", taskVariableSummaryList);
return createCorrectVariant(taskVariableSummaryList, headers, Response.Status.OK, conversationIdHeader);
} catch (Exception e) {
logger.error("Unexpected error during processing {}", e.getMessage(), e);
return internalServerError(errorMessage(e), v, conversationIdHeader);
}
}
use of org.kie.server.remote.rest.common.marker.KieServerEndpoint in project droolsjbpm-integration by kiegroup.
the class RuntimeDataResource method queryUserTasksByVariables.
@ApiOperation(value = "Queries process tasks by variables", response = ProcessInstanceUserTaskWithVariablesList.class)
@POST
@Path(RestURI.VARIABLES_TASKS_PROCESSES_URI)
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@KieServerEndpoint(categories = { EndpointType.DEFAULT, EndpointType.HISTORY })
public Response queryUserTasksByVariables(@Context HttpHeaders headers, String payload, @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, @ApiParam(value = "optional sort column", required = false) @QueryParam("orderBy") String orderBy, @ApiParam(value = "optional sort direction - true ascending, false descending", required = false) @QueryParam("asc") @DefaultValue("true") boolean asc) {
Header conversationIdHeader = buildConversationIdHeader("", context, headers);
Variant v = getVariant(headers);
try {
String type = getContentType(headers);
ProcessInstanceUserTaskWithVariablesList taskVariableSummaryList = runtimeDataServiceBase.queryUserTasksByVariables(payload, type, new QueryContext(page * pageSize, pageSize, orderBy, asc));
logger.debug("Returning result of process tasks search: {}", taskVariableSummaryList);
return createCorrectVariant(taskVariableSummaryList, headers, Response.Status.OK, conversationIdHeader);
} catch (Exception e) {
logger.error("Unexpected error during processing {}", e.getMessage(), e);
return internalServerError(errorMessage(e), v, conversationIdHeader);
}
}
use of org.kie.server.remote.rest.common.marker.KieServerEndpoint in project droolsjbpm-integration by kiegroup.
the class RuntimeDataResource method queryProcessesByVariables.
@ApiOperation(value = "Queries processes by variables and tasks", response = ProcessInstanceCustomVarsList.class)
@POST
@Path(RestURI.VARIABLES_PROCESSES_URI)
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@KieServerEndpoint(categories = { EndpointType.DEFAULT, EndpointType.HISTORY })
public Response queryProcessesByVariables(@Context HttpHeaders headers, String payload, @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, @ApiParam(value = "optional sort column", required = false) @QueryParam("orderBy") String orderBy, @ApiParam(value = "optional sort direction - true ascending, false descending", required = false) @QueryParam("asc") @DefaultValue("true") boolean asc) {
Header conversationIdHeader = buildConversationIdHeader("", context, headers);
Variant v = getVariant(headers);
try {
String type = getContentType(headers);
ProcessInstanceCustomVarsList processVariableSummaryList = runtimeDataServiceBase.queryProcessesByVariables(payload, type, new QueryContext(page * pageSize, pageSize, orderBy, asc));
logger.debug("Returning result of process instance search: {}", processVariableSummaryList);
return createCorrectVariant(processVariableSummaryList, headers, Response.Status.OK, conversationIdHeader);
} catch (Exception e) {
logger.error("Unexpected error during processing {}", e.getMessage(), e);
return internalServerError(errorMessage(e), v, conversationIdHeader);
}
}
use of org.kie.server.remote.rest.common.marker.KieServerEndpoint in project droolsjbpm-integration by kiegroup.
the class ReadOnlySwaggerDecoration method decorateOperation.
@Override
public void decorateOperation(Operation operation, Method method, Iterator<SwaggerExtension> chain) {
if (method.isAnnotationPresent(GET.class)) {
operation.setVendorExtension(SWAGGER_EXTENSION_READ_ONLY, Boolean.TRUE);
if (chain.hasNext()) {
chain.next().decorateOperation(operation, method, chain);
}
return;
}
KieServerEndpoint api = method.getAnnotation(KieServerEndpoint.class);
if (api == null) {
api = method.getDeclaringClass().getAnnotation(KieServerEndpoint.class);
}
if (api != null) {
List<EndpointType> current = new ArrayList<>(asList(api.categories()));
current.retainAll(valid);
if (!current.isEmpty()) {
operation.setVendorExtension(SWAGGER_EXTENSION_READ_ONLY, Boolean.TRUE);
}
}
if (chain.hasNext()) {
chain.next().decorateOperation(operation, method, chain);
}
}
use of org.kie.server.remote.rest.common.marker.KieServerEndpoint in project droolsjbpm-integration by kiegroup.
the class CaseQueryResource method queryCaseByVariables.
@ApiOperation(value = "Queries cases by variables and tasks", response = CaseInstanceCustomVarsList.class)
@POST
@Path(RestURI.VARIABLES_CASES_URI)
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@KieServerEndpoint(categories = { EndpointType.DEFAULT, EndpointType.HISTORY })
public Response queryCaseByVariables(@Context HttpHeaders headers, String payload, @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) {
Header conversationIdHeader = buildConversationIdHeader("", context, headers);
Variant v = getVariant(headers);
try {
String type = getContentType(headers);
CaseInstanceCustomVarsList processVariableSummaryList = caseManagementRuntimeDataServiceBase.queryCasesByVariables(payload, type, new QueryContext(page * pageSize, pageSize));
logger.debug("Returning result of case instance search: {}", processVariableSummaryList);
return createCorrectVariant(processVariableSummaryList, headers, Response.Status.OK, conversationIdHeader);
} catch (Exception e) {
logger.error("Unexpected error during processing {}", e.getMessage(), e);
return internalServerError(errorMessage(e), v, conversationIdHeader);
}
}
Aggregations