Search in sources :

Example 1 with DelegationState

use of org.camunda.bpm.engine.task.DelegationState in project camunda-bpm-platform by camunda.

the class TaskDto method updateTask.

public void updateTask(Task task) {
    task.setName(getName());
    task.setDescription(getDescription());
    task.setPriority(getPriority());
    task.setAssignee(getAssignee());
    task.setOwner(getOwner());
    DelegationState state = null;
    if (getDelegationState() != null) {
        DelegationStateConverter converter = new DelegationStateConverter();
        state = converter.convertQueryParameterToType(getDelegationState());
    }
    task.setDelegationState(state);
    task.setDueDate(getDue());
    task.setFollowUpDate(getFollowUp());
    task.setParentTaskId(getParentTaskId());
    task.setCaseInstanceId(getCaseInstanceId());
    task.setTenantId(getTenantId());
}
Also used : DelegationState(org.camunda.bpm.engine.task.DelegationState) DelegationStateConverter(org.camunda.bpm.engine.rest.dto.converter.DelegationStateConverter)

Example 2 with DelegationState

use of org.camunda.bpm.engine.task.DelegationState in project camunda-bpm-platform by camunda.

the class TaskQueryDto method applyFilters.

@Override
protected void applyFilters(TaskQuery query) {
    if (orQueries != null) {
        for (TaskQueryDto orQueryDto : orQueries) {
            TaskQueryImpl orQuery = new TaskQueryImpl();
            orQuery.setOrQueryActive();
            orQueryDto.applyFilters(orQuery);
            ((TaskQueryImpl) query).addOrQuery(orQuery);
        }
    }
    if (processInstanceBusinessKey != null) {
        query.processInstanceBusinessKey(processInstanceBusinessKey);
    }
    if (processInstanceBusinessKeyExpression != null) {
        query.processInstanceBusinessKeyExpression(processInstanceBusinessKeyExpression);
    }
    if (processInstanceBusinessKeyIn != null && processInstanceBusinessKeyIn.length > 0) {
        query.processInstanceBusinessKeyIn(processInstanceBusinessKeyIn);
    }
    if (processInstanceBusinessKeyLike != null) {
        query.processInstanceBusinessKeyLike(processInstanceBusinessKeyLike);
    }
    if (processInstanceBusinessKeyLikeExpression != null) {
        query.processInstanceBusinessKeyLikeExpression(processInstanceBusinessKeyLikeExpression);
    }
    if (processDefinitionKey != null) {
        query.processDefinitionKey(processDefinitionKey);
    }
    if (processDefinitionKeyIn != null && processDefinitionKeyIn.length > 0) {
        query.processDefinitionKeyIn(processDefinitionKeyIn);
    }
    if (processDefinitionId != null) {
        query.processDefinitionId(processDefinitionId);
    }
    if (executionId != null) {
        query.executionId(executionId);
    }
    if (activityInstanceIdIn != null && activityInstanceIdIn.length > 0) {
        query.activityInstanceIdIn(activityInstanceIdIn);
    }
    if (tenantIdIn != null && tenantIdIn.length > 0) {
        query.tenantIdIn(tenantIdIn);
    }
    if (TRUE.equals(withoutTenantId)) {
        query.withoutTenantId();
    }
    if (processDefinitionName != null) {
        query.processDefinitionName(processDefinitionName);
    }
    if (processDefinitionNameLike != null) {
        query.processDefinitionNameLike(processDefinitionNameLike);
    }
    if (processInstanceId != null) {
        query.processInstanceId(processInstanceId);
    }
    if (assignee != null) {
        query.taskAssignee(assignee);
    }
    if (assigneeExpression != null) {
        query.taskAssigneeExpression(assigneeExpression);
    }
    if (assigneeLike != null) {
        query.taskAssigneeLike(assigneeLike);
    }
    if (assigneeLikeExpression != null) {
        query.taskAssigneeLikeExpression(assigneeLikeExpression);
    }
    if (candidateGroup != null) {
        query.taskCandidateGroup(candidateGroup);
    }
    if (candidateGroupExpression != null) {
        query.taskCandidateGroupExpression(candidateGroupExpression);
    }
    if (withCandidateGroups != null && withCandidateGroups) {
        query.withCandidateGroups();
    }
    if (withoutCandidateGroups != null && withoutCandidateGroups) {
        query.withoutCandidateGroups();
    }
    if (withCandidateUsers != null && withCandidateUsers) {
        query.withCandidateUsers();
    }
    if (withoutCandidateUsers != null && withoutCandidateUsers) {
        query.withoutCandidateUsers();
    }
    if (candidateUser != null) {
        query.taskCandidateUser(candidateUser);
    }
    if (candidateUserExpression != null) {
        query.taskCandidateUserExpression(candidateUserExpression);
    }
    if (taskDefinitionKeyIn != null && taskDefinitionKeyIn.length > 0) {
        query.taskDefinitionKeyIn(taskDefinitionKeyIn);
    }
    if (taskDefinitionKey != null) {
        query.taskDefinitionKey(taskDefinitionKey);
    }
    if (taskDefinitionKeyLike != null) {
        query.taskDefinitionKeyLike(taskDefinitionKeyLike);
    }
    if (description != null) {
        query.taskDescription(description);
    }
    if (descriptionLike != null) {
        query.taskDescriptionLike(descriptionLike);
    }
    if (involvedUser != null) {
        query.taskInvolvedUser(involvedUser);
    }
    if (involvedUserExpression != null) {
        query.taskInvolvedUserExpression(involvedUserExpression);
    }
    if (maxPriority != null) {
        query.taskMaxPriority(maxPriority);
    }
    if (minPriority != null) {
        query.taskMinPriority(minPriority);
    }
    if (name != null) {
        query.taskName(name);
    }
    if (nameNotEqual != null) {
        query.taskNameNotEqual(nameNotEqual);
    }
    if (nameLike != null) {
        query.taskNameLike(nameLike);
    }
    if (nameNotLike != null) {
        query.taskNameNotLike(nameNotLike);
    }
    if (owner != null) {
        query.taskOwner(owner);
    }
    if (ownerExpression != null) {
        query.taskOwnerExpression(ownerExpression);
    }
    if (priority != null) {
        query.taskPriority(priority);
    }
    if (parentTaskId != null) {
        query.taskParentTaskId(parentTaskId);
    }
    if (assigned != null && assigned) {
        query.taskAssigned();
    }
    if (unassigned != null && unassigned) {
        query.taskUnassigned();
    }
    if (dueAfter != null) {
        query.dueAfter(dueAfter);
    }
    if (dueAfterExpression != null) {
        query.dueAfterExpression(dueAfterExpression);
    }
    if (dueBefore != null) {
        query.dueBefore(dueBefore);
    }
    if (dueBeforeExpression != null) {
        query.dueBeforeExpression(dueBeforeExpression);
    }
    if (dueDate != null) {
        query.dueDate(dueDate);
    }
    if (dueDateExpression != null) {
        query.dueDateExpression(dueDateExpression);
    }
    if (followUpAfter != null) {
        query.followUpAfter(followUpAfter);
    }
    if (followUpAfterExpression != null) {
        query.followUpAfterExpression(followUpAfterExpression);
    }
    if (followUpBefore != null) {
        query.followUpBefore(followUpBefore);
    }
    if (followUpBeforeExpression != null) {
        query.followUpBeforeExpression(followUpBeforeExpression);
    }
    if (followUpBeforeOrNotExistent != null) {
        query.followUpBeforeOrNotExistent(followUpBeforeOrNotExistent);
    }
    if (followUpBeforeOrNotExistentExpression != null) {
        query.followUpBeforeOrNotExistentExpression(followUpBeforeOrNotExistentExpression);
    }
    if (followUpDate != null) {
        query.followUpDate(followUpDate);
    }
    if (followUpDateExpression != null) {
        query.followUpDateExpression(followUpDateExpression);
    }
    if (createdAfter != null) {
        query.taskCreatedAfter(createdAfter);
    }
    if (createdAfterExpression != null) {
        query.taskCreatedAfterExpression(createdAfterExpression);
    }
    if (createdBefore != null) {
        query.taskCreatedBefore(createdBefore);
    }
    if (createdBeforeExpression != null) {
        query.taskCreatedBeforeExpression(createdBeforeExpression);
    }
    if (createdOn != null) {
        query.taskCreatedOn(createdOn);
    }
    if (createdOnExpression != null) {
        query.taskCreatedOnExpression(createdOnExpression);
    }
    if (delegationState != null) {
        DelegationStateConverter converter = new DelegationStateConverter();
        DelegationState state = converter.convertQueryParameterToType(delegationState);
        query.taskDelegationState(state);
    }
    if (candidateGroups != null) {
        query.taskCandidateGroupIn(candidateGroups);
    }
    if (candidateGroupsExpression != null) {
        query.taskCandidateGroupInExpression(candidateGroupsExpression);
    }
    if (includeAssignedTasks != null && includeAssignedTasks) {
        query.includeAssignedTasks();
    }
    if (active != null && active) {
        query.active();
    }
    if (suspended != null && suspended) {
        query.suspended();
    }
    if (caseDefinitionId != null) {
        query.caseDefinitionId(caseDefinitionId);
    }
    if (caseDefinitionKey != null) {
        query.caseDefinitionKey(caseDefinitionKey);
    }
    if (caseDefinitionName != null) {
        query.caseDefinitionName(caseDefinitionName);
    }
    if (caseDefinitionNameLike != null) {
        query.caseDefinitionNameLike(caseDefinitionNameLike);
    }
    if (caseExecutionId != null) {
        query.caseExecutionId(caseExecutionId);
    }
    if (caseInstanceBusinessKey != null) {
        query.caseInstanceBusinessKey(caseInstanceBusinessKey);
    }
    if (caseInstanceBusinessKeyLike != null) {
        query.caseInstanceBusinessKeyLike(caseInstanceBusinessKeyLike);
    }
    if (caseInstanceId != null) {
        query.caseInstanceId(caseInstanceId);
    }
    if (taskVariables != null) {
        for (VariableQueryParameterDto variableQueryParam : taskVariables) {
            String variableName = variableQueryParam.getName();
            String op = variableQueryParam.getOperator();
            Object variableValue = variableQueryParam.resolveValue(objectMapper);
            if (op.equals(VariableQueryParameterDto.EQUALS_OPERATOR_NAME)) {
                query.taskVariableValueEquals(variableName, variableValue);
            } else if (op.equals(VariableQueryParameterDto.NOT_EQUALS_OPERATOR_NAME)) {
                query.taskVariableValueNotEquals(variableName, variableValue);
            } else if (op.equals(VariableQueryParameterDto.GREATER_THAN_OPERATOR_NAME)) {
                query.taskVariableValueGreaterThan(variableName, variableValue);
            } else if (op.equals(VariableQueryParameterDto.GREATER_THAN_OR_EQUALS_OPERATOR_NAME)) {
                query.taskVariableValueGreaterThanOrEquals(variableName, variableValue);
            } else if (op.equals(VariableQueryParameterDto.LESS_THAN_OPERATOR_NAME)) {
                query.taskVariableValueLessThan(variableName, variableValue);
            } else if (op.equals(VariableQueryParameterDto.LESS_THAN_OR_EQUALS_OPERATOR_NAME)) {
                query.taskVariableValueLessThanOrEquals(variableName, variableValue);
            } else if (op.equals(VariableQueryParameterDto.LIKE_OPERATOR_NAME)) {
                query.taskVariableValueLike(variableName, String.valueOf(variableValue));
            } else {
                throw new InvalidRequestException(Status.BAD_REQUEST, "Invalid task variable comparator specified: " + op);
            }
        }
    }
    if (processVariables != null) {
        for (VariableQueryParameterDto variableQueryParam : processVariables) {
            String variableName = variableQueryParam.getName();
            String op = variableQueryParam.getOperator();
            Object variableValue = variableQueryParam.resolveValue(objectMapper);
            if (op.equals(VariableQueryParameterDto.EQUALS_OPERATOR_NAME)) {
                query.processVariableValueEquals(variableName, variableValue);
            } else if (op.equals(VariableQueryParameterDto.NOT_EQUALS_OPERATOR_NAME)) {
                query.processVariableValueNotEquals(variableName, variableValue);
            } else if (op.equals(VariableQueryParameterDto.GREATER_THAN_OPERATOR_NAME)) {
                query.processVariableValueGreaterThan(variableName, variableValue);
            } else if (op.equals(VariableQueryParameterDto.GREATER_THAN_OR_EQUALS_OPERATOR_NAME)) {
                query.processVariableValueGreaterThanOrEquals(variableName, variableValue);
            } else if (op.equals(VariableQueryParameterDto.LESS_THAN_OPERATOR_NAME)) {
                query.processVariableValueLessThan(variableName, variableValue);
            } else if (op.equals(VariableQueryParameterDto.LESS_THAN_OR_EQUALS_OPERATOR_NAME)) {
                query.processVariableValueLessThanOrEquals(variableName, variableValue);
            } else if (op.equals(VariableQueryParameterDto.LIKE_OPERATOR_NAME)) {
                query.processVariableValueLike(variableName, String.valueOf(variableValue));
            } else {
                throw new InvalidRequestException(Status.BAD_REQUEST, "Invalid process variable comparator specified: " + op);
            }
        }
    }
    if (caseInstanceVariables != null) {
        for (VariableQueryParameterDto variableQueryParam : caseInstanceVariables) {
            String variableName = variableQueryParam.getName();
            String op = variableQueryParam.getOperator();
            Object variableValue = variableQueryParam.resolveValue(objectMapper);
            if (op.equals(VariableQueryParameterDto.EQUALS_OPERATOR_NAME)) {
                query.caseInstanceVariableValueEquals(variableName, variableValue);
            } else if (op.equals(VariableQueryParameterDto.NOT_EQUALS_OPERATOR_NAME)) {
                query.caseInstanceVariableValueNotEquals(variableName, variableValue);
            } else if (op.equals(VariableQueryParameterDto.GREATER_THAN_OPERATOR_NAME)) {
                query.caseInstanceVariableValueGreaterThan(variableName, variableValue);
            } else if (op.equals(VariableQueryParameterDto.GREATER_THAN_OR_EQUALS_OPERATOR_NAME)) {
                query.caseInstanceVariableValueGreaterThanOrEquals(variableName, variableValue);
            } else if (op.equals(VariableQueryParameterDto.LESS_THAN_OPERATOR_NAME)) {
                query.caseInstanceVariableValueLessThan(variableName, variableValue);
            } else if (op.equals(VariableQueryParameterDto.LESS_THAN_OR_EQUALS_OPERATOR_NAME)) {
                query.caseInstanceVariableValueLessThanOrEquals(variableName, variableValue);
            } else if (op.equals(VariableQueryParameterDto.LIKE_OPERATOR_NAME)) {
                query.caseInstanceVariableValueLike(variableName, String.valueOf(variableValue));
            } else {
                throw new InvalidRequestException(Status.BAD_REQUEST, "Invalid case variable comparator specified: " + op);
            }
        }
    }
}
Also used : DelegationState(org.camunda.bpm.engine.task.DelegationState) DelegationStateConverter(org.camunda.bpm.engine.rest.dto.converter.DelegationStateConverter) TaskQueryImpl(org.camunda.bpm.engine.impl.TaskQueryImpl) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) VariableQueryParameterDto(org.camunda.bpm.engine.rest.dto.VariableQueryParameterDto)

Aggregations

DelegationStateConverter (org.camunda.bpm.engine.rest.dto.converter.DelegationStateConverter)2 DelegationState (org.camunda.bpm.engine.task.DelegationState)2 TaskQueryImpl (org.camunda.bpm.engine.impl.TaskQueryImpl)1 VariableQueryParameterDto (org.camunda.bpm.engine.rest.dto.VariableQueryParameterDto)1 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)1