Search in sources :

Example 1 with HistoricDetailQueryRequest

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();
}
Also used : HashMap(java.util.HashMap) DataResponse(org.wso2.carbon.bpmn.rest.model.common.DataResponse) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces)

Example 2 with HistoricDetailQueryRequest

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();
}
Also used : HashMap(java.util.HashMap) DataResponse(org.wso2.carbon.bpmn.rest.model.common.DataResponse) HistoricDetailQueryRequest(org.wso2.carbon.bpmn.rest.model.history.HistoricDetailQueryRequest) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 3 with HistoricDetailQueryRequest

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);
}
Also used : HistoricDetailPaginateList(org.wso2.carbon.bpmn.rest.model.history.HistoricDetailPaginateList) RestResponseFactory(org.wso2.carbon.bpmn.rest.common.RestResponseFactory) HistoryService(org.activiti.engine.HistoryService) HistoricDetailQuery(org.activiti.engine.history.HistoricDetailQuery)

Aggregations

HashMap (java.util.HashMap)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 DataResponse (org.wso2.carbon.bpmn.rest.model.common.DataResponse)2 GET (javax.ws.rs.GET)1 POST (javax.ws.rs.POST)1 HistoryService (org.activiti.engine.HistoryService)1 HistoricDetailQuery (org.activiti.engine.history.HistoricDetailQuery)1 RestResponseFactory (org.wso2.carbon.bpmn.rest.common.RestResponseFactory)1 HistoricDetailPaginateList (org.wso2.carbon.bpmn.rest.model.history.HistoricDetailPaginateList)1 HistoricDetailQueryRequest (org.wso2.carbon.bpmn.rest.model.history.HistoricDetailQueryRequest)1