use of org.wso2.carbon.bpmn.rest.model.history.HistoricVariableInstanceQueryRequest in project carbon-business-process by wso2.
the class HistoricVariableInstanceQueryService method queryVariableInstances.
@POST
@Path("/")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response queryVariableInstances(HistoricVariableInstanceQueryRequest queryRequest) {
Map<String, String> allRequestParams = new HashMap<>();
for (String property : allPropertiesList) {
String value = uriInfo.getQueryParameters().getFirst(property);
if (value != null) {
allRequestParams.put(property, value);
}
}
DataResponse dataResponse = getQueryResponse(queryRequest, allRequestParams);
return Response.ok().entity(dataResponse).build();
}
use of org.wso2.carbon.bpmn.rest.model.history.HistoricVariableInstanceQueryRequest in project carbon-business-process by wso2.
the class HistoricVariableInstanceService method getHistoricActivityInstances.
@GET
@Path("/")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getHistoricActivityInstances() {
HistoricVariableInstanceQueryRequest query = new HistoricVariableInstanceQueryRequest();
// Populate query based on request
Map<String, String> allRequestParams = new HashMap<>();
for (String property : allPropertiesList) {
String value = uriInfo.getQueryParameters().getFirst(property);
if (value != null) {
allRequestParams.put(property, value);
}
}
if (allRequestParams.get("excludeTaskVariables") != null) {
query.setExcludeTaskVariables(Boolean.valueOf(allRequestParams.get("excludeTaskVariables")));
}
if (allRequestParams.get("taskId") != null) {
query.setTaskId(allRequestParams.get("taskId"));
}
if (allRequestParams.get("executionId") != null) {
query.setExecutionId(allRequestParams.get("executionId"));
}
if (allRequestParams.get("processInstanceId") != null) {
query.setProcessInstanceId(allRequestParams.get("processInstanceId"));
}
if (allRequestParams.get("variableName") != null) {
query.setVariableName(allRequestParams.get("variableName"));
}
if (allRequestParams.get("variableNameLike") != null) {
query.setVariableNameLike(allRequestParams.get("variableNameLike"));
}
DataResponse dataResponse = getQueryResponse(query, allRequestParams);
return Response.ok().entity(dataResponse).build();
}
use of org.wso2.carbon.bpmn.rest.model.history.HistoricVariableInstanceQueryRequest in project carbon-business-process by wso2.
the class BaseHistoricVariableInstanceService method getQueryResponse.
protected DataResponse getQueryResponse(HistoricVariableInstanceQueryRequest queryRequest, Map<String, String> allRequestParams) {
HistoryService historyService = BPMNOSGIService.getHistoryService();
HistoricVariableInstanceQuery query = historyService.createHistoricVariableInstanceQuery();
// Populate query based on request
if (queryRequest.getExcludeTaskVariables() != null) {
if (queryRequest.getExcludeTaskVariables()) {
query.excludeTaskVariables();
}
}
if (queryRequest.getTaskId() != null) {
query.taskId(queryRequest.getTaskId());
}
if (queryRequest.getExecutionId() != null) {
query.executionId(queryRequest.getExecutionId());
}
if (queryRequest.getProcessInstanceId() != null) {
query.processInstanceId(queryRequest.getProcessInstanceId());
}
if (queryRequest.getVariableName() != null) {
query.variableName(queryRequest.getVariableName());
}
if (queryRequest.getVariableNameLike() != null) {
query.variableNameLike(queryRequest.getVariableNameLike());
}
if (queryRequest.getVariables() != null) {
addVariables(query, queryRequest.getVariables());
}
return new HistoricVariableInstancePaginateList(new RestResponseFactory(), uriInfo).paginateList(allRequestParams, query, "variableName", allowedSortProperties);
}
Aggregations