use of org.wso2.carbon.bpmn.rest.model.history.HistoricDetailQueryRequest in project carbon-business-process by wso2.
the class HistoricDetailQueryService method queryHistoricDetail.
@POST
@Path("/")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response queryHistoricDetail(HistoricDetailQueryRequest 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, uriInfo);
return Response.ok().entity(dataResponse).build();
}
use of org.wso2.carbon.bpmn.rest.model.history.HistoricDetailQueryRequest in project carbon-business-process by wso2.
the class HistoricDetailService method getHistoricDetailInfo.
@GET
@Path("/")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getHistoricDetailInfo() {
Map<String, String> allRequestParams = new HashMap<>();
for (String property : allPropertiesList) {
String value = uriInfo.getQueryParameters().getFirst(property);
if (value != null) {
allRequestParams.put(property, value);
}
}
// Populate query based on request
HistoricDetailQueryRequest queryRequest = new HistoricDetailQueryRequest();
if (allRequestParams.get("id") != null) {
queryRequest.setId(allRequestParams.get("id"));
}
if (allRequestParams.get("processInstanceId") != null) {
queryRequest.setProcessInstanceId(allRequestParams.get("processInstanceId"));
}
if (allRequestParams.get("executionId") != null) {
queryRequest.setExecutionId(allRequestParams.get("executionId"));
}
if (allRequestParams.get("activityInstanceId") != null) {
queryRequest.setActivityInstanceId(allRequestParams.get("activityInstanceId"));
}
if (allRequestParams.get("taskId") != null) {
queryRequest.setTaskId(allRequestParams.get("taskId"));
}
if (allRequestParams.get("selectOnlyFormProperties") != null) {
queryRequest.setSelectOnlyFormProperties(Boolean.valueOf(allRequestParams.get("selectOnlyFormProperties")));
}
if (allRequestParams.get("selectOnlyVariableUpdates") != null) {
queryRequest.setSelectOnlyVariableUpdates(Boolean.valueOf(allRequestParams.get("selectOnlyVariableUpdates")));
}
DataResponse dataResponse = getQueryResponse(queryRequest, allRequestParams, uriInfo);
return Response.ok().entity(dataResponse).build();
}
use of org.wso2.carbon.bpmn.rest.model.history.HistoricDetailQueryRequest in project carbon-business-process by wso2.
the class BaseHistoricDetailService method getQueryResponse.
protected DataResponse getQueryResponse(HistoricDetailQueryRequest queryRequest, Map<String, String> allRequestParams, UriInfo uriInfo) {
HistoryService historyService = BPMNOSGIService.getHistoryService();
HistoricDetailQuery query = historyService.createHistoricDetailQuery();
// Populate query based on request
if (queryRequest.getProcessInstanceId() != null) {
query.processInstanceId(queryRequest.getProcessInstanceId());
}
if (queryRequest.getExecutionId() != null) {
query.executionId(queryRequest.getExecutionId());
}
if (queryRequest.getActivityInstanceId() != null) {
query.activityInstanceId(queryRequest.getActivityInstanceId());
}
if (queryRequest.getTaskId() != null) {
query.taskId(queryRequest.getTaskId());
}
if (queryRequest.getSelectOnlyFormProperties() != null) {
if (queryRequest.getSelectOnlyFormProperties()) {
query.formProperties();
}
}
if (queryRequest.getSelectOnlyVariableUpdates() != null) {
if (queryRequest.getSelectOnlyVariableUpdates()) {
query.variableUpdates();
}
}
return new HistoricDetailPaginateList(new RestResponseFactory(), uriInfo).paginateList(allRequestParams, queryRequest, query, "processInstanceId", allowedSortProperties);
}
Aggregations