Search in sources :

Example 81 with Property

use of org.wso2.carbon.identity.application.common.model.Property in project carbon-business-process by wso2.

the class HistoricActivitiInstanceQueryService method queryActivityInstances.

@POST
@Path("/")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response queryActivityInstances(HistoricActivityInstanceQueryRequest queryRequest, @Context UriInfo uriInfo) {
    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 82 with Property

use of org.wso2.carbon.identity.application.common.model.Property in project carbon-business-process by wso2.

the class BaseTaskService method getTasksFromQueryRequest.

protected DataResponse getTasksFromQueryRequest(TaskQueryRequest request, UriInfo uriInfo, Map<String, String> requestParams) {
    if (requestParams == null) {
        requestParams = new HashMap<>();
        for (String property : allPropertiesList) {
            String value = uriInfo.getQueryParameters().getFirst(property);
            if (value != null) {
                requestParams.put(property, value);
            }
        }
    }
    TaskService taskService = BPMNOSGIService.getTaskService();
    TaskQuery taskQuery = taskService.createTaskQuery();
    if (request.getName() != null) {
        taskQuery.taskName(request.getName());
    }
    if (request.getNameLike() != null) {
        taskQuery.taskNameLike(request.getNameLike());
    }
    if (request.getDescription() != null) {
        taskQuery.taskDescription(request.getDescription());
    }
    if (request.getDescriptionLike() != null) {
        taskQuery.taskDescriptionLike(request.getDescriptionLike());
    }
    if (request.getPriority() != null) {
        taskQuery.taskPriority(request.getPriority());
    }
    if (request.getMinimumPriority() != null) {
        taskQuery.taskMinPriority(request.getMinimumPriority());
    }
    if (request.getMaximumPriority() != null) {
        taskQuery.taskMaxPriority(request.getMaximumPriority());
    }
    if (request.getAssignee() != null) {
        taskQuery.taskAssignee(request.getAssignee());
    }
    if (request.getAssigneeLike() != null) {
        taskQuery.taskAssigneeLike(request.getAssigneeLike());
    }
    if (request.getOwner() != null) {
        taskQuery.taskOwner(request.getOwner());
    }
    if (request.getOwnerLike() != null) {
        taskQuery.taskOwnerLike(request.getOwnerLike());
    }
    if (request.getUnassigned() != null) {
        taskQuery.taskUnassigned();
    }
    if (request.getDelegationState() != null) {
        DelegationState state = getDelegationState(request.getDelegationState());
        if (state != null) {
            taskQuery.taskDelegationState(state);
        }
    }
    if (request.getCandidateUser() != null) {
        taskQuery.taskCandidateUser(request.getCandidateUser());
    }
    if (request.getInvolvedUser() != null) {
        taskQuery.taskInvolvedUser(request.getInvolvedUser());
    }
    if (request.getCandidateGroup() != null) {
        taskQuery.taskCandidateGroup(request.getCandidateGroup());
    }
    if (request.getCandidateGroupIn() != null) {
        taskQuery.taskCandidateGroupIn(request.getCandidateGroupIn());
    }
    if (request.getProcessInstanceId() != null) {
        taskQuery.processInstanceId(request.getProcessInstanceId());
    }
    if (request.getProcessInstanceBusinessKey() != null) {
        taskQuery.processInstanceBusinessKey(request.getProcessInstanceBusinessKey());
    }
    if (request.getExecutionId() != null) {
        taskQuery.executionId(request.getExecutionId());
    }
    if (request.getCreatedOn() != null) {
        taskQuery.taskCreatedOn(request.getCreatedOn());
    }
    if (request.getCreatedBefore() != null) {
        taskQuery.taskCreatedBefore(request.getCreatedBefore());
    }
    if (request.getCreatedAfter() != null) {
        taskQuery.taskCreatedAfter(request.getCreatedAfter());
    }
    if (request.getExcludeSubTasks() != null) {
        if (request.getExcludeSubTasks()) {
            taskQuery.excludeSubtasks();
        }
    }
    if (request.getTaskDefinitionKey() != null) {
        taskQuery.taskDefinitionKey(request.getTaskDefinitionKey());
    }
    if (request.getTaskDefinitionKeyLike() != null) {
        taskQuery.taskDefinitionKeyLike(request.getTaskDefinitionKeyLike());
    }
    if (request.getDueDate() != null) {
        taskQuery.taskDueDate(request.getDueDate());
    }
    if (request.getDueBefore() != null) {
        taskQuery.taskDueBefore(request.getDueBefore());
    }
    if (request.getDueAfter() != null) {
        taskQuery.taskDueAfter(request.getDueAfter());
    }
    if (request.getWithoutDueDate() != null && request.getWithoutDueDate()) {
        taskQuery.withoutTaskDueDate();
    }
    if (request.getActive() != null) {
        if (request.getActive().booleanValue()) {
            taskQuery.active();
        } else {
            taskQuery.suspended();
        }
    }
    if (request.getIncludeTaskLocalVariables() != null) {
        if (request.getIncludeTaskLocalVariables()) {
            taskQuery.includeTaskLocalVariables();
        }
    }
    if (request.getIncludeProcessVariables() != null) {
        if (request.getIncludeProcessVariables()) {
            taskQuery.includeProcessVariables();
        }
    }
    if (request.getProcessInstanceBusinessKeyLike() != null) {
        taskQuery.processInstanceBusinessKeyLike(request.getProcessInstanceBusinessKeyLike());
    }
    if (request.getProcessDefinitionKey() != null) {
        taskQuery.processDefinitionKey(request.getProcessDefinitionKey());
    }
    if (request.getProcessDefinitionKeyLike() != null) {
        taskQuery.processDefinitionKeyLike(request.getProcessDefinitionKeyLike());
    }
    if (request.getProcessDefinitionName() != null) {
        taskQuery.processDefinitionName(request.getProcessDefinitionName());
    }
    if (request.getProcessDefinitionNameLike() != null) {
        taskQuery.processDefinitionNameLike(request.getProcessDefinitionNameLike());
    }
    if (request.getTaskVariables() != null) {
        addTaskvariables(taskQuery, request.getTaskVariables());
    }
    if (request.getProcessInstanceVariables() != null) {
        addProcessvariables(taskQuery, request.getProcessInstanceVariables());
    }
    if (request.getTenantId() != null) {
        taskQuery.taskTenantId(request.getTenantId());
    }
    if (request.getTenantIdLike() != null) {
        taskQuery.taskTenantIdLike(request.getTenantIdLike());
    }
    if (Boolean.TRUE.equals(request.getWithoutTenantId())) {
        taskQuery.taskWithoutTenantId();
    }
    if (request.getCandidateOrAssigned() != null) {
        taskQuery.taskCandidateOrAssigned(request.getCandidateOrAssigned());
    }
    DataResponse dataResponse = new TaskPaginateList(new RestResponseFactory(), uriInfo).paginateList(requestParams, request, taskQuery, "id", properties);
    return dataResponse;
// return Response.ok().entity(dataResponse).build();
}
Also used : DelegationState(org.activiti.engine.task.DelegationState) RestResponseFactory(org.wso2.carbon.bpmn.rest.common.RestResponseFactory) DataResponse(org.wso2.carbon.bpmn.rest.model.common.DataResponse) TaskQuery(org.activiti.engine.task.TaskQuery) TaskPaginateList(org.wso2.carbon.bpmn.rest.model.runtime.TaskPaginateList)

Example 83 with Property

use of org.wso2.carbon.identity.application.common.model.Property in project carbon-business-process by wso2.

the class ProcessInstanceService method startInstance.

@POST
@Path("/")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response startInstance(ProcessInstanceCreateRequest processInstanceCreateRequest) {
    if (log.isDebugEnabled()) {
        log.debug("ProcessInstanceCreateRequest:" + processInstanceCreateRequest.getProcessDefinitionId());
        log.debug(" processInstanceCreateRequest.getVariables().size():" + processInstanceCreateRequest.getVariables().size());
    }
    if (processInstanceCreateRequest.getProcessDefinitionId() == null && processInstanceCreateRequest.getProcessDefinitionKey() == null && processInstanceCreateRequest.getMessage() == null) {
        throw new ActivitiIllegalArgumentException("Either processDefinitionId, processDefinitionKey or message is required.");
    }
    int paramsSet = ((processInstanceCreateRequest.getProcessDefinitionId() != null) ? 1 : 0) + ((processInstanceCreateRequest.getProcessDefinitionKey() != null) ? 1 : 0) + ((processInstanceCreateRequest.getMessage() != null) ? 1 : 0);
    if (paramsSet > 1) {
        throw new ActivitiIllegalArgumentException("Only one of processDefinitionId, processDefinitionKey or message should be set.");
    }
    if (processInstanceCreateRequest.isCustomTenantSet()) {
        // Tenant-id can only be used with either key or message
        if (processInstanceCreateRequest.getProcessDefinitionId() != null) {
            throw new ActivitiIllegalArgumentException("TenantId can only be used with either processDefinitionKey or message.");
        }
    } else {
        // if no tenantId, it must be from definitionId
        if (processInstanceCreateRequest.getProcessDefinitionId() == null) {
            throw new ActivitiIllegalArgumentException("TenantId should be specified to be used with either " + "processDefinitionKey or message.");
        }
    }
    // Have to add the validation part here
    if (!isValidUserToStartProcess(processInstanceCreateRequest)) {
        throw new RestApiBasicAuthenticationException("User doesn't have the necessary permission to start the process");
    }
    if (processInstanceCreateRequest.getSkipInstanceCreation() || processInstanceCreateRequest.getSkipInstanceCreationIfExist()) {
        ProcessInstanceQueryRequest processInstanceQueryRequest = processInstanceCreateRequest.cloneInstanceCreationRequest();
        Map<String, String> allRequestParams = allRequestParams(uriInfo);
        DataResponse dataResponse = getQueryResponse(processInstanceQueryRequest, allRequestParams, uriInfo);
        if (log.isDebugEnabled()) {
            log.debug("ProcessInstanceCreation check:" + dataResponse.getSize());
        }
        int dataResponseSize = dataResponse.getSize();
        if (dataResponseSize > 0) {
            if (processInstanceCreateRequest.getCorrelate()) {
                if (dataResponseSize != 1) {
                    String responseMessage = "Correlation matching failed as there are more than one matching instance with " + "given variables state";
                    throw new NotFoundException(Response.ok().entity(responseMessage).status(Response.Status.NOT_FOUND).build());
                }
                if (processInstanceCreateRequest.getMessageName() == null) {
                    String responseMessage = "Correlation matching failed as messageName property is not specified";
                    throw new ActivitiIllegalArgumentException(responseMessage);
                }
                return performCorrelation(processInstanceCreateRequest);
            } else {
                dataResponse.setMessage("Instance information corresponding to the request");
                return Response.ok().entity(dataResponse).build();
            }
        }
    }
    RestResponseFactory restResponseFactory = new RestResponseFactory();
    Map<String, Object> startVariables = null;
    if (processInstanceCreateRequest.getVariables() != null) {
        startVariables = new HashMap<>();
        for (RestVariable variable : processInstanceCreateRequest.getVariables()) {
            if (variable.getName() == null) {
                throw new ActivitiIllegalArgumentException("Variable name is required.");
            }
            startVariables.put(variable.getName(), restResponseFactory.getVariableValue(variable));
        }
    }
    // updated the additional variables
    if (processInstanceCreateRequest.getAdditionalVariables() != null) {
        if (startVariables == null) {
            startVariables = new HashMap<>();
        }
        for (RestVariable variable : processInstanceCreateRequest.getAdditionalVariables()) {
            if (variable.getName() == null) {
                throw new ActivitiIllegalArgumentException("Additional Variable name is required.");
            }
            startVariables.put(variable.getName(), restResponseFactory.getVariableValue(variable));
        }
    }
    RuntimeService runtimeService = BPMNOSGIService.getRuntimeService();
    IdentityService identityService = BPMNOSGIService.getIdentityService();
    PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext();
    String userName = carbonContext.getUsername();
    ProcessInstanceResponse processInstanceResponse;
    // Actually start the instance based on key or id
    try {
        ProcessInstance instance;
        identityService.setAuthenticatedUserId(userName);
        if (processInstanceCreateRequest.getProcessDefinitionId() != null) {
            instance = runtimeService.startProcessInstanceById(processInstanceCreateRequest.getProcessDefinitionId(), processInstanceCreateRequest.getBusinessKey(), startVariables);
        } else if (processInstanceCreateRequest.getProcessDefinitionKey() != null) {
            if (processInstanceCreateRequest.isCustomTenantSet()) {
                instance = runtimeService.startProcessInstanceByKeyAndTenantId(processInstanceCreateRequest.getProcessDefinitionKey(), processInstanceCreateRequest.getBusinessKey(), startVariables, processInstanceCreateRequest.getTenantId());
            } else {
                instance = runtimeService.startProcessInstanceByKey(processInstanceCreateRequest.getProcessDefinitionKey(), processInstanceCreateRequest.getBusinessKey(), startVariables);
            }
        } else {
            if (processInstanceCreateRequest.isCustomTenantSet()) {
                instance = runtimeService.startProcessInstanceByMessageAndTenantId(processInstanceCreateRequest.getMessage(), processInstanceCreateRequest.getBusinessKey(), startVariables, processInstanceCreateRequest.getTenantId());
            } else {
                instance = runtimeService.startProcessInstanceByMessage(processInstanceCreateRequest.getMessage(), processInstanceCreateRequest.getBusinessKey(), startVariables);
            }
        }
        HistoryService historyService = BPMNOSGIService.getHistoryService();
        if (processInstanceCreateRequest.getReturnVariables()) {
            Map<String, Object> runtimeVariableMap = null;
            List<HistoricVariableInstance> historicVariableList = null;
            if (instance.isEnded()) {
                historicVariableList = historyService.createHistoricVariableInstanceQuery().processInstanceId(instance.getId()).list();
            } else {
                runtimeVariableMap = runtimeService.getVariables(instance.getId());
            }
            processInstanceResponse = restResponseFactory.createProcessInstanceResponse(instance, true, runtimeVariableMap, historicVariableList, uriInfo.getBaseUri().toString());
        } else {
            processInstanceResponse = restResponseFactory.createProcessInstanceResponse(instance, uriInfo.getBaseUri().toString());
        }
    } catch (ActivitiObjectNotFoundException aonfe) {
        throw new ActivitiIllegalArgumentException(aonfe.getMessage(), aonfe);
    } finally {
        identityService.setAuthenticatedUserId(null);
    }
    return Response.ok().status(Response.Status.CREATED).entity(processInstanceResponse).build();
}
Also used : RestResponseFactory(org.wso2.carbon.bpmn.rest.common.RestResponseFactory) RuntimeService(org.activiti.engine.RuntimeService) NotFoundException(javax.ws.rs.NotFoundException) ActivitiObjectNotFoundException(org.activiti.engine.ActivitiObjectNotFoundException) HistoryService(org.activiti.engine.HistoryService) PrivilegedCarbonContext(org.wso2.carbon.context.PrivilegedCarbonContext) ActivitiObjectNotFoundException(org.activiti.engine.ActivitiObjectNotFoundException) ProcessInstanceQueryRequest(org.wso2.carbon.bpmn.rest.model.runtime.ProcessInstanceQueryRequest) RestVariable(org.wso2.carbon.bpmn.rest.engine.variable.RestVariable) IdentityService(org.activiti.engine.IdentityService) RestApiBasicAuthenticationException(org.wso2.carbon.bpmn.rest.common.exception.RestApiBasicAuthenticationException) DataResponse(org.wso2.carbon.bpmn.rest.model.common.DataResponse) ActivitiIllegalArgumentException(org.activiti.engine.ActivitiIllegalArgumentException) ProcessInstanceResponse(org.wso2.carbon.bpmn.rest.model.runtime.ProcessInstanceResponse) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) HistoricVariableInstance(org.activiti.engine.history.HistoricVariableInstance) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces)

Example 84 with Property

use of org.wso2.carbon.identity.application.common.model.Property in project carbon-business-process by wso2.

the class ExecutionService method getProcessInstances.

@GET
@Path("/")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getProcessInstances() {
    // Populate query based on request
    ExecutionQueryRequest queryRequest = new ExecutionQueryRequest();
    Map<String, String> allRequestParams = new HashMap<>();
    for (String property : allPropertiesList) {
        String value = uriInfo.getQueryParameters().getFirst(property);
        if (value != null) {
            allRequestParams.put(property, value);
        }
    }
    String id = uriInfo.getQueryParameters().getFirst("id");
    if (id != null) {
        queryRequest.setId(id);
    }
    String processInstanceId = uriInfo.getQueryParameters().getFirst("processInstanceId");
    if (processInstanceId != null) {
        queryRequest.setProcessInstanceId(processInstanceId);
    }
    String processInstanceBusinessKey = uriInfo.getQueryParameters().getFirst("processInstanceBusinessKey");
    if (processInstanceBusinessKey != null) {
        queryRequest.setProcessBusinessKey(processInstanceBusinessKey);
    }
    String processDefinitionKey = uriInfo.getQueryParameters().getFirst("processDefinitionKey");
    if (processDefinitionKey != null) {
        queryRequest.setProcessDefinitionKey(processDefinitionKey);
    }
    String processDefinitionId = uriInfo.getQueryParameters().getFirst("processDefinitionId");
    if (processDefinitionId != null) {
        queryRequest.setProcessDefinitionId(processDefinitionId);
    }
    String messageEventSubscriptionName = uriInfo.getQueryParameters().getFirst("messageEventSubscriptionName");
    if (messageEventSubscriptionName != null) {
        queryRequest.setMessageEventSubscriptionName(messageEventSubscriptionName);
    }
    String signalEventSubscriptionName = uriInfo.getQueryParameters().getFirst("signalEventSubscriptionName");
    if (signalEventSubscriptionName != null) {
        queryRequest.setSignalEventSubscriptionName(signalEventSubscriptionName);
    }
    String activityId = uriInfo.getQueryParameters().getFirst("activityId");
    if (activityId != null) {
        queryRequest.setActivityId(activityId);
    }
    String parentId = uriInfo.getQueryParameters().getFirst("parentId");
    if (parentId != null) {
        queryRequest.setParentId(parentId);
    }
    String tenantId = uriInfo.getQueryParameters().getFirst("tenantId");
    if (tenantId != null) {
        queryRequest.setTenantId(tenantId);
    }
    String tenantIdLike = uriInfo.getQueryParameters().getFirst("tenantIdLike");
    if (tenantIdLike != null) {
        queryRequest.setTenantIdLike(tenantIdLike);
    }
    String withoutTenantId = uriInfo.getQueryParameters().getFirst("withoutTenantId");
    if (withoutTenantId != null) {
        if (Boolean.valueOf(withoutTenantId)) {
            queryRequest.setWithoutTenantId(Boolean.TRUE);
        }
    }
    // add common parameters such as sort,order,start etc.
    // allRequestParams = Utils.prepareCommonParameters(allRequestParams, uriInfo);
    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)

Example 85 with Property

use of org.wso2.carbon.identity.application.common.model.Property in project carbon-business-process by wso2.

the class WorkflowTaskService method getTasks.

@GET
@Path("/")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getTasks() {
    // Create a Task query request
    TaskQueryRequest request = new TaskQueryRequest();
    Map<String, String> requestParams = new HashMap<>();
    for (String property : allPropertiesList) {
        String value = uriInfo.getQueryParameters().getFirst(property);
        if (value != null) {
            requestParams.put(property, value);
        }
    }
    // Populate filter-parameters
    if (requestParams.containsKey("name")) {
        request.setName(requestParams.get("name"));
    }
    if (requestParams.containsKey("nameLike")) {
        request.setNameLike(requestParams.get("nameLike"));
    }
    if (requestParams.containsKey("description")) {
        request.setDescription(requestParams.get("description"));
    }
    if (requestParams.containsKey("descriptionLike")) {
        request.setDescriptionLike(requestParams.get("descriptionLike"));
    }
    if (requestParams.containsKey("priority")) {
        request.setPriority(Integer.valueOf(requestParams.get("priority")));
    }
    if (requestParams.containsKey("minimumPriority")) {
        request.setMinimumPriority(Integer.valueOf(requestParams.get("minimumPriority")));
    }
    if (requestParams.containsKey("maximumPriority")) {
        request.setMaximumPriority(Integer.valueOf(requestParams.get("maximumPriority")));
    }
    if (requestParams.containsKey("assignee")) {
        request.setAssignee(requestParams.get("assignee"));
    }
    if (requestParams.containsKey("owner")) {
        request.setOwner(requestParams.get("owner"));
    }
    if (requestParams.containsKey("unassigned")) {
        request.setUnassigned(Boolean.valueOf(requestParams.get("unassigned")));
    }
    if (requestParams.containsKey("delegationState")) {
        request.setDelegationState(requestParams.get("delegationState"));
    }
    if (requestParams.containsKey("candidateUser")) {
        request.setCandidateUser(requestParams.get("candidateUser"));
    }
    if (requestParams.containsKey("involvedUser")) {
        request.setInvolvedUser(requestParams.get("involvedUser"));
    }
    if (requestParams.containsKey("candidateGroup")) {
        request.setCandidateGroup(requestParams.get("candidateGroup"));
    }
    if (requestParams.containsKey("candidateGroups")) {
        String[] candidateGroups = requestParams.get("candidateGroups").split(",");
        List<String> groups = new ArrayList<String>(candidateGroups.length);
        for (String candidateGroup : candidateGroups) {
            groups.add(candidateGroup);
        }
        request.setCandidateGroupIn(groups);
    }
    if (requestParams.containsKey("processDefinitionKey")) {
        request.setProcessDefinitionKey(requestParams.get("processDefinitionKey"));
    }
    if (requestParams.containsKey("processDefinitionKeyLike")) {
        request.setProcessDefinitionKeyLike(requestParams.get("processDefinitionKeyLike"));
    }
    if (requestParams.containsKey("processDefinitionName")) {
        request.setProcessDefinitionName(requestParams.get("processDefinitionName"));
    }
    if (requestParams.containsKey("processDefinitionNameLike")) {
        request.setProcessDefinitionNameLike(requestParams.get("processDefinitionNameLike"));
    }
    if (requestParams.containsKey("processInstanceId")) {
        request.setProcessInstanceId(requestParams.get("processInstanceId"));
    }
    if (requestParams.containsKey("processInstanceBusinessKey")) {
        request.setProcessInstanceBusinessKey(requestParams.get("processInstanceBusinessKey"));
    }
    if (requestParams.containsKey("executionId")) {
        request.setExecutionId(requestParams.get("executionId"));
    }
    if (requestParams.containsKey("createdOn")) {
        request.setCreatedOn(RequestUtil.getDate(requestParams, "createdOn"));
    }
    if (requestParams.containsKey("createdBefore")) {
        request.setCreatedBefore(RequestUtil.getDate(requestParams, "createdBefore"));
    }
    if (requestParams.containsKey("createdAfter")) {
        request.setCreatedAfter(RequestUtil.getDate(requestParams, "createdAfter"));
    }
    if (requestParams.containsKey("excludeSubTasks")) {
        request.setExcludeSubTasks(Boolean.valueOf(requestParams.get("excludeSubTasks")));
    }
    if (requestParams.containsKey("taskDefinitionKey")) {
        request.setTaskDefinitionKey(requestParams.get("taskDefinitionKey"));
    }
    if (requestParams.containsKey("taskDefinitionKeyLike")) {
        request.setTaskDefinitionKeyLike(requestParams.get("taskDefinitionKeyLike"));
    }
    if (requestParams.containsKey("dueDate")) {
        request.setDueDate(RequestUtil.getDate(requestParams, "dueDate"));
    }
    if (requestParams.containsKey("dueBefore")) {
        request.setDueBefore(RequestUtil.getDate(requestParams, "dueBefore"));
    }
    if (requestParams.containsKey("dueAfter")) {
        request.setDueAfter(RequestUtil.getDate(requestParams, "dueAfter"));
    }
    if (requestParams.containsKey("active")) {
        request.setActive(Boolean.valueOf(requestParams.get("active")));
    }
    if (requestParams.containsKey("includeTaskLocalVariables")) {
        request.setIncludeTaskLocalVariables(Boolean.valueOf(requestParams.get("includeTaskLocalVariables")));
    }
    if (requestParams.containsKey("includeProcessVariables")) {
        request.setIncludeProcessVariables(Boolean.valueOf(requestParams.get("includeProcessVariables")));
    }
    if (requestParams.containsKey("tenantId")) {
        request.setTenantId(requestParams.get("tenantId"));
    }
    if (requestParams.containsKey("tenantIdLike")) {
        request.setTenantIdLike(requestParams.get("tenantIdLike"));
    }
    if (requestParams.containsKey("withoutTenantId") && Boolean.valueOf(requestParams.get("withoutTenantId"))) {
        request.setWithoutTenantId(Boolean.TRUE);
    }
    if (requestParams.containsKey("candidateOrAssigned")) {
        request.setCandidateOrAssigned(requestParams.get("candidateOrAssigned"));
    }
    DataResponse dataResponse = getTasksFromQueryRequest(request, uriInfo, requestParams);
    return Response.ok().entity(dataResponse).build();
// return getTasksFromQueryRequest(request, requestParams);
}
Also used : DataResponse(org.wso2.carbon.bpmn.rest.model.common.DataResponse)

Aggregations

HashMap (java.util.HashMap)42 ArrayList (java.util.ArrayList)32 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)32 Resource (org.wso2.carbon.registry.core.Resource)23 Map (java.util.Map)21 Test (org.junit.Test)21 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)21 DataResponse (org.wso2.carbon.bpmn.rest.model.common.DataResponse)17 API (org.wso2.carbon.apimgt.api.model.API)16 UserStoreException (org.wso2.carbon.user.api.UserStoreException)16 Path (javax.ws.rs.Path)14 Produces (javax.ws.rs.Produces)14 JSONObject (org.json.simple.JSONObject)14 APIIdentifier (org.wso2.carbon.apimgt.api.model.APIIdentifier)14 List (java.util.List)13 IOException (java.io.IOException)11 QName (javax.xml.namespace.QName)11 APIProductResource (org.wso2.carbon.apimgt.api.model.APIProductResource)11 Properties (java.util.Properties)10 GovernanceException (org.wso2.carbon.governance.api.exception.GovernanceException)10