use of org.wso2.carbon.bpmn.rest.model.runtime.ExecutionPaginateList in project carbon-business-process by wso2.
the class BaseExecutionService method getQueryResponse.
protected DataResponse getQueryResponse(ExecutionQueryRequest queryRequest, Map<String, String> requestParams, UriInfo uriInfo) {
RuntimeService runtimeService = BPMNOSGIService.getRuntimeService();
ExecutionQuery query = runtimeService.createExecutionQuery();
// Populate query based on request
if (queryRequest.getId() != null) {
query.executionId(queryRequest.getId());
requestParams.put("id", queryRequest.getId());
}
if (queryRequest.getProcessInstanceId() != null) {
query.processInstanceId(queryRequest.getProcessInstanceId());
requestParams.put("processInstanceId", queryRequest.getProcessInstanceId());
}
if (queryRequest.getProcessDefinitionKey() != null) {
query.processDefinitionKey(queryRequest.getProcessDefinitionKey());
requestParams.put("processDefinitionKey", queryRequest.getProcessDefinitionKey());
}
if (queryRequest.getProcessDefinitionId() != null) {
query.processDefinitionId(queryRequest.getProcessDefinitionId());
requestParams.put("processDefinitionId", queryRequest.getProcessDefinitionId());
}
if (queryRequest.getProcessBusinessKey() != null) {
query.processInstanceBusinessKey(queryRequest.getProcessBusinessKey());
requestParams.put("processInstanceBusinessKey", queryRequest.getProcessBusinessKey());
}
if (queryRequest.getActivityId() != null) {
query.activityId(queryRequest.getActivityId());
requestParams.put("activityId", queryRequest.getActivityId());
}
if (queryRequest.getParentId() != null) {
query.parentId(queryRequest.getParentId());
requestParams.put("parentId", queryRequest.getParentId());
}
if (queryRequest.getMessageEventSubscriptionName() != null) {
query.messageEventSubscriptionName(queryRequest.getMessageEventSubscriptionName());
requestParams.put("messageEventSubscriptionName", queryRequest.getMessageEventSubscriptionName());
}
if (queryRequest.getSignalEventSubscriptionName() != null) {
query.signalEventSubscriptionName(queryRequest.getSignalEventSubscriptionName());
requestParams.put("signalEventSubscriptionName", queryRequest.getSignalEventSubscriptionName());
}
if (queryRequest.getVariables() != null) {
addVariables(query, queryRequest.getVariables(), false);
}
if (queryRequest.getProcessInstanceVariables() != null) {
addVariables(query, queryRequest.getProcessInstanceVariables(), true);
}
if (queryRequest.getTenantId() != null) {
query.executionTenantId(queryRequest.getTenantId());
requestParams.put("tenantId", queryRequest.getTenantId());
}
if (queryRequest.getTenantIdLike() != null) {
query.executionTenantIdLike(queryRequest.getTenantIdLike());
requestParams.put("tenantIdLike", queryRequest.getTenantIdLike());
}
if (Boolean.TRUE.equals(queryRequest.getWithoutTenantId())) {
query.executionWithoutTenantId();
requestParams.put("withoutTenantId", queryRequest.getWithoutTenantId().toString());
}
DataResponse dataResponse = new ExecutionPaginateList(new RestResponseFactory(), uriInfo).paginateList(requestParams, queryRequest, query, "processInstanceId", allowedSortProperties);
return dataResponse;
}
use of org.wso2.carbon.bpmn.rest.model.runtime.ExecutionPaginateList in project carbon-business-process by wso2.
the class BaseRuntimeService method getQueryResponse.
protected DataResponse getQueryResponse(ExecutionQueryRequest queryRequest, Map<String, String> requestParams, String serverRootUrl) {
ExecutionQuery query = runtimeService.createExecutionQuery();
// Populate query based on request
if (queryRequest.getId() != null) {
query.executionId(queryRequest.getId());
requestParams.put("id", queryRequest.getId());
}
if (queryRequest.getProcessInstanceId() != null) {
query.processInstanceId(queryRequest.getProcessInstanceId());
requestParams.put("processInstanceId", queryRequest.getProcessInstanceId());
}
if (queryRequest.getProcessDefinitionKey() != null) {
query.processDefinitionKey(queryRequest.getProcessDefinitionKey());
requestParams.put("processDefinitionKey", queryRequest.getProcessDefinitionKey());
}
if (queryRequest.getProcessDefinitionId() != null) {
query.processDefinitionId(queryRequest.getProcessDefinitionId());
requestParams.put("processDefinitionId", queryRequest.getProcessDefinitionId());
}
if (queryRequest.getProcessBusinessKey() != null) {
query.processInstanceBusinessKey(queryRequest.getProcessBusinessKey());
requestParams.put("processInstanceBusinessKey", queryRequest.getProcessBusinessKey());
}
if (queryRequest.getActivityId() != null) {
query.activityId(queryRequest.getActivityId());
requestParams.put("activityId", queryRequest.getActivityId());
}
if (queryRequest.getParentId() != null) {
query.parentId(queryRequest.getParentId());
requestParams.put("parentId", queryRequest.getParentId());
}
if (queryRequest.getMessageEventSubscriptionName() != null) {
query.messageEventSubscriptionName(queryRequest.getMessageEventSubscriptionName());
requestParams.put("messageEventSubscriptionName", queryRequest.getMessageEventSubscriptionName());
}
if (queryRequest.getSignalEventSubscriptionName() != null) {
query.signalEventSubscriptionName(queryRequest.getSignalEventSubscriptionName());
requestParams.put("signalEventSubscriptionName", queryRequest.getSignalEventSubscriptionName());
}
if (queryRequest.getVariables() != null) {
addVariables(query, queryRequest.getVariables(), false);
}
if (queryRequest.getProcessInstanceVariables() != null) {
addVariables(query, queryRequest.getProcessInstanceVariables(), true);
}
if (queryRequest.getTenantId() != null) {
query.executionTenantId(queryRequest.getTenantId());
requestParams.put("tenantId", queryRequest.getTenantId());
}
if (queryRequest.getTenantIdLike() != null) {
query.executionTenantIdLike(queryRequest.getTenantIdLike());
requestParams.put("tenantIdLike", queryRequest.getTenantIdLike());
}
if (Boolean.TRUE.equals(queryRequest.getWithoutTenantId())) {
query.executionWithoutTenantId();
requestParams.put("withoutTenantId", queryRequest.getWithoutTenantId().toString());
}
return new ExecutionPaginateList(new RestResponseFactory(), uriInfo).paginateList(requestParams, queryRequest, query, "processInstanceId", allowedSortProperties);
}
Aggregations