Search in sources :

Example 1 with HistoricVariableInstanceQueryRequest

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();
}
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 HistoricVariableInstanceQueryRequest

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

Example 3 with HistoricVariableInstanceQueryRequest

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

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 HistoricVariableInstanceQuery (org.activiti.engine.history.HistoricVariableInstanceQuery)1 RestResponseFactory (org.wso2.carbon.bpmn.rest.common.RestResponseFactory)1 HistoricVariableInstancePaginateList (org.wso2.carbon.bpmn.rest.model.history.HistoricVariableInstancePaginateList)1 HistoricVariableInstanceQueryRequest (org.wso2.carbon.bpmn.rest.model.history.HistoricVariableInstanceQueryRequest)1