Package org.camunda.bpm.engine.impl

Examples of org.camunda.bpm.engine.impl.TaskQueryImpl$TaskQueryVariableValueComparable


    String testStringExpression = "${'" + expressionString + "'}";

    Date queryDate = new DateTime(now()).minusYears(1).toDate();
    String testDateExpression = "${now()}";

    TaskQueryImpl taskQuery = (TaskQueryImpl) taskQuery()
      .taskAssignee(queryString)
      .taskAssigneeExpression(testStringExpression)
      .taskAssigneeLike(queryString)
      .taskAssigneeLikeExpression(testStringExpression)
      .taskOwnerExpression(queryString)
      .taskOwnerExpression(expressionString)
      .taskInvolvedUser(queryString)
      .taskInvolvedUserExpression(expressionString)
      .taskCreatedBefore(queryDate)
      .taskCreatedBeforeExpression(testDateExpression)
      .taskCreatedOn(queryDate)
      .taskCreatedOnExpression(testDateExpression)
      .taskCreatedAfter(queryDate)
      .taskCreatedAfterExpression(testDateExpression)
      .dueBefore(queryDate)
      .dueBeforeExpression(testDateExpression)
      .dueDate(queryDate)
      .dueDateExpression(testDateExpression)
      .dueAfter(queryDate)
      .dueAfterExpression(testDateExpression)
      .followUpBefore(queryDate)
      .followUpBeforeExpression(testDateExpression)
      .followUpDate(queryDate)
      .followUpDateExpression(testDateExpression)
      .followUpAfter(queryDate)
      .followUpAfterExpression(testDateExpression);

    // execute query so expression will be evaluated
    taskQuery.count();

    assertEquals(expressionString, taskQuery.getAssignee());
    assertEquals(expressionString, taskQuery.getAssigneeLike());
    assertEquals(expressionString, taskQuery.getOwner());
    assertEquals(expressionString, taskQuery.getInvolvedUser());
    assertTrue(taskQuery.getCreateTimeBefore().after(queryDate));
    assertTrue(taskQuery.getCreateTime().after(queryDate));
    assertTrue(taskQuery.getCreateTimeAfter().after(queryDate));
    assertTrue(taskQuery.getDueBefore().after(queryDate));
    assertTrue(taskQuery.getDueDate().after(queryDate));
    assertTrue(taskQuery.getDueAfter().after(queryDate));
    assertTrue(taskQuery.getFollowUpBefore().after(queryDate));
    assertTrue(taskQuery.getFollowUpDate().after(queryDate));
    assertTrue(taskQuery.getFollowUpAfter().after(queryDate));

    // candidates has to be tested separately cause they have to be set exclusively

    taskQuery = (TaskQueryImpl) taskQuery()
      .taskCandidateGroup(queryString)
      .taskCandidateGroupExpression(testStringExpression);

    // execute query so expression will be evaluated
    taskQuery.count();

    assertEquals(expressionString, taskQuery.getCandidateGroup());

    taskQuery = (TaskQueryImpl) taskQuery()
      .taskCandidateUser(queryString)
      .taskCandidateUserExpression(testStringExpression);

    // execute query so expression will be evaluated
    taskQuery.count();

    assertEquals(expressionString, taskQuery.getCandidateUser());

    setCurrentUser(user);
    List<String> queryList = Arrays.asList("query");
    String testGroupsExpression = "${currentUserGroups()}";

    taskQuery = (TaskQueryImpl) taskQuery()
      .taskCandidateGroupIn(queryList)
      .taskCandidateGroupInExpression(testGroupsExpression);

    // execute query so expression will be evaluated
    taskQuery.count();

    assertEquals(2, taskQuery.getCandidateGroups().size());
  }
View Full Code Here


    String testStringExpression = "${'" + expressionString + "'}";

    Date queryDate = new DateTime(now()).minusYears(1).toDate();
    String testDateExpression = "${now()}";

    TaskQueryImpl taskQuery = (TaskQueryImpl) taskQuery()
      .taskAssigneeExpression(testStringExpression)
      .taskAssignee(queryString)
      .taskAssigneeLikeExpression(testStringExpression)
      .taskAssigneeLike(queryString)
      .taskOwnerExpression(expressionString)
      .taskOwnerExpression(queryString)
      .taskInvolvedUserExpression(expressionString)
      .taskInvolvedUser(queryString)
      .taskCreatedBeforeExpression(testDateExpression)
      .taskCreatedBefore(queryDate)
      .taskCreatedOnExpression(testDateExpression)
      .taskCreatedOn(queryDate)
      .taskCreatedAfterExpression(testDateExpression)
      .taskCreatedAfter(queryDate)
      .dueBeforeExpression(testDateExpression)
      .dueBefore(queryDate)
      .dueDateExpression(testDateExpression)
      .dueDate(queryDate)
      .dueAfterExpression(testDateExpression)
      .dueAfter(queryDate)
      .followUpBeforeExpression(testDateExpression)
      .followUpBefore(queryDate)
      .followUpDateExpression(testDateExpression)
      .followUpDate(queryDate)
      .followUpAfterExpression(testDateExpression)
      .followUpAfter(queryDate);

    // execute query so expression will be evaluated
    taskQuery.count();

    assertEquals(queryString, taskQuery.getAssignee());
    assertEquals(queryString, taskQuery.getAssigneeLike());
    assertEquals(queryString, taskQuery.getOwner());
    assertEquals(queryString, taskQuery.getInvolvedUser());
    assertTrue(taskQuery.getCreateTimeBefore().equals(queryDate));
    assertTrue(taskQuery.getCreateTime().equals(queryDate));
    assertTrue(taskQuery.getCreateTimeAfter().equals(queryDate));
    assertTrue(taskQuery.getDueBefore().equals(queryDate));
    assertTrue(taskQuery.getDueDate().equals(queryDate));
    assertTrue(taskQuery.getDueAfter().equals(queryDate));
    assertTrue(taskQuery.getFollowUpBefore().equals(queryDate));
    assertTrue(taskQuery.getFollowUpDate().equals(queryDate));
    assertTrue(taskQuery.getFollowUpAfter().equals(queryDate));

    // candidates has to be tested separately cause they have to be set exclusively

    taskQuery = (TaskQueryImpl) taskQuery()
      .taskCandidateGroupExpression(testStringExpression)
      .taskCandidateGroup(queryString);

    // execute query so expression will be evaluated
    taskQuery.count();

    assertEquals(queryString, taskQuery.getCandidateGroup());

    taskQuery = (TaskQueryImpl) taskQuery()
      .taskCandidateUserExpression(testStringExpression)
      .taskCandidateUser(queryString);

    // execute query so expression will be evaluated
    taskQuery.count();

    assertEquals(queryString, taskQuery.getCandidateUser());

    setCurrentUser(user);
    List<String> queryList = Arrays.asList("query");
    String testGroupsExpression = "${currentUserGroups()}";

    taskQuery = (TaskQueryImpl) taskQuery()
      .taskCandidateGroupInExpression(testGroupsExpression)
      .taskCandidateGroupIn(queryList);

    // execute query so expression will be evaluated
    taskQuery.count();

    assertEquals(1, taskQuery.getCandidateGroups().size());
  }
View Full Code Here

    assertNotNull(filter.getQuery());
  }

  public void testTaskQuery() {
    // create query
    TaskQueryImpl query = new TaskQueryImpl();
    query.taskId(testString);
    query.taskName(testString);
    query.taskNameLike(testString);
    query.taskDescription(testString);
    query.taskDescriptionLike(testString);
    query.taskPriority(testInteger);
    query.taskMinPriority(testInteger);
    query.taskMaxPriority(testInteger);
    query.taskAssignee(testString);
    query.taskAssigneeExpression(testString);
    query.taskAssigneeLike(testString);
    query.taskAssigneeLikeExpression(testString);
    query.taskInvolvedUser(testString);
    query.taskInvolvedUserExpression(testString);
    query.taskOwner(testString);
    query.taskOwnerExpression(testString);
    query.taskUnassigned();
    query.taskDelegationState(testDelegationState);
    query.taskCandidateGroupIn(testCandidateGroups);
    query.taskCandidateGroupInExpression(testString);
    query.processInstanceId(testString);
    query.executionId(testString);
    query.activityInstanceIdIn(testActivityInstances);
    query.taskCreatedOn(testDate);
    query.taskCreatedOnExpression(testString);
    query.taskCreatedBefore(testDate);
    query.taskCreatedBeforeExpression(testString);
    query.taskCreatedAfter(testDate);
    query.taskCreatedAfterExpression(testString);
    query.taskDefinitionKey(testString);
    query.taskDefinitionKeyLike(testString);
    query.processDefinitionKey(testString);
    query.processDefinitionId(testString);
    query.processDefinitionName(testString);
    query.processDefinitionNameLike(testString);
    query.processInstanceBusinessKey(testString);
    query.processInstanceBusinessKeyLike(testString);

    // variables
    query.taskVariableValueEquals(variableNames[0], variableValues[0]);
    query.taskVariableValueGreaterThanOrEquals(variableNames[1], variableValues[1]);
    query.processVariableValueLessThan(variableNames[2], variableValues[2]);
    query.processVariableValueLike(variableNames[3], (String) variableValues[3]);
    query.caseInstanceVariableValueNotEquals(variableNames[4], variableValues[4]);
    query.caseInstanceVariableValueLessThanOrEquals(variableNames[5], variableValues[5]);

    query.dueDate(testDate);
    query.dueDateExpression(testString);
    query.dueBefore(testDate);
    query.dueBeforeExpression(testString);
    query.dueAfter(testDate);
    query.dueAfterExpression(testString);
    query.followUpDate(testDate);
    query.followUpDateExpression(testString);
    query.followUpBefore(testDate);
    query.followUpBeforeExpression(testString);
    query.followUpAfter(testDate);
    query.followUpAfterExpression(testString);
    query.excludeSubtasks();
    query.suspended();
    query.caseDefinitionKey(testString);
    query.caseDefinitionId(testString);
    query.caseDefinitionName(testString);
    query.caseDefinitionNameLike(testString);
    query.caseInstanceId(testString);
    query.caseInstanceBusinessKey(testString);
    query.caseInstanceBusinessKeyLike(testString);
    query.caseExecutionId(testString);

    // ordering
    query.orderByExecutionId().desc();
    query.orderByDueDate().asc();

    // save filter
    filter.setQuery(query);
    filterService.saveFilter(filter);

    // fetch from db
    filter = filterService.createTaskFilterQuery().singleResult();

    // test query
    query = filter.getQuery();
    assertEquals(testString, query.getTaskId());
    assertEquals(testString, query.getName());
    assertEquals(testString, query.getNameLike());
    assertEquals(testString, query.getDescription());
    assertEquals(testString, query.getDescriptionLike());
    assertEquals(testInteger, query.getPriority());
    assertEquals(testInteger, query.getMinPriority());
    assertEquals(testInteger, query.getMaxPriority());
    assertEquals(testString, query.getAssignee());
    assertEquals(testString, query.getExpressions().get("taskAssignee"));
    assertEquals(testString, query.getAssigneeLike());
    assertEquals(testString, query.getExpressions().get("taskAssigneeLike"));
    assertEquals(testString, query.getInvolvedUser());
    assertEquals(testString, query.getExpressions().get("taskInvolvedUser"));
    assertEquals(testString, query.getOwner());
    assertEquals(testString, query.getExpressions().get("taskOwner"));
    assertTrue(query.isUnassigned());
    assertEquals(testDelegationState, query.getDelegationState());
    assertEquals(testCandidateGroups, query.getCandidateGroups());
    assertEquals(testString, query.getExpressions().get("taskCandidateGroupIn"));
    assertEquals(testString, query.getProcessInstanceId());
    assertEquals(testString, query.getExecutionId());
    assertEquals(testActivityInstances.length, query.getActivityInstanceIdIn().length);
    for (int i = 0; i < query.getActivityInstanceIdIn().length; i++) {
      assertEquals(testActivityInstances[i], query.getActivityInstanceIdIn()[i]);
    }
    assertEquals(testDate, query.getCreateTime());
    assertEquals(testString, query.getExpressions().get("taskCreatedOn"));
    assertEquals(testDate, query.getCreateTimeBefore());
    assertEquals(testString, query.getExpressions().get("taskCreatedBefore"));
    assertEquals(testDate, query.getCreateTimeAfter());
    assertEquals(testString, query.getExpressions().get("taskCreatedAfter"));
    assertEquals(testString, query.getKey());
    assertEquals(testString, query.getKeyLike());
    assertEquals(testString, query.getProcessDefinitionKey());
    assertEquals(testString, query.getProcessDefinitionId());
    assertEquals(testString, query.getProcessDefinitionName());
    assertEquals(testString, query.getProcessDefinitionNameLike());
    assertEquals(testString, query.getProcessInstanceBusinessKey());
    assertEquals(testString, query.getProcessInstanceBusinessKeyLike());

    // variables
    List<TaskQueryVariableValue> variables = query.getVariables();
    for (int i = 0; i < variables.size(); i++) {
      TaskQueryVariableValue variable = variables.get(i);
      assertEquals(variableNames[i], variable.getName());
      assertEquals(variableValues[i], variable.getValue());
      assertEquals(variableOperators[i].toString(), variable.getOperator());
      assertEquals(isTaskVariable[i], variable.isLocal());
      assertEquals(isProcessVariable[i], variable.isProcessInstanceVariable());
    }

    assertEquals(testDate, query.getDueDate());
    assertEquals(testString, query.getExpressions().get("dueDate"));
    assertEquals(testDate, query.getDueBefore());
    assertEquals(testString, query.getExpressions().get("dueBefore"));
    assertEquals(testDate, query.getDueAfter());
    assertEquals(testString, query.getExpressions().get("dueAfter"));
    assertEquals(testDate, query.getFollowUpDate());
    assertEquals(testString, query.getExpressions().get("followUpDate"));
    assertEquals(testDate, query.getFollowUpBefore());
    assertEquals(testString, query.getExpressions().get("followUpBefore"));
    assertEquals(testDate, query.getFollowUpAfter());
    assertEquals(testString, query.getExpressions().get("followUpAfter"));
    assertTrue(query.isExcludeSubtasks());
    assertEquals(SuspensionState.SUSPENDED, query.getSuspensionState());
    assertEquals(testString, query.getCaseDefinitionKey());
    assertEquals(testString, query.getCaseDefinitionId());
    assertEquals(testString, query.getCaseDefinitionName());
    assertEquals(testString, query.getCaseDefinitionNameLike());
    assertEquals(testString, query.getCaseInstanceId());
    assertEquals(testString, query.getCaseInstanceBusinessKey());
    assertEquals(testString, query.getCaseInstanceBusinessKeyLike());
    assertEquals(testString, query.getCaseExecutionId());

    // ordering
    assertEquals(testOrderBy, query.getOrderBy());
  }
View Full Code Here

    assertEquals(testOrderBy, query.getOrderBy());
  }

  public void testTaskQueryByFollowUpBeforeOrNotExistent() {
    // create query
    TaskQueryImpl query = new TaskQueryImpl();

    query.followUpBeforeOrNotExistent(testDate);

    // save filter
    filter.setQuery(query);
    filterService.saveFilter(filter);

    // fetch from db
    filter = filterService.createTaskFilterQuery().singleResult();

    // test query
    query = filter.getQuery();
    assertTrue(query.isFollowUpNullAccepted());
    assertEquals(testDate, query.getFollowUpBefore());
  }
View Full Code Here

    assertEquals(testDate, query.getFollowUpBefore());
  }

  public void testTaskQueryByFollowUpBeforeOrNotExistentExpression() {
    // create query
    TaskQueryImpl query = new TaskQueryImpl();

    query.followUpBeforeOrNotExistentExpression(testString);

    // save filter
    filter.setQuery(query);
    filterService.saveFilter(filter);

    // fetch from db
    filter = filterService.createTaskFilterQuery().singleResult();

    // test query
    query = filter.getQuery();
    assertTrue(query.isFollowUpNullAccepted());
    assertEquals(testString, query.getExpressions().get("followUpBefore"));
  }
View Full Code Here

    assertTrue(query.isFollowUpNullAccepted());
    assertEquals(testString, query.getExpressions().get("followUpBefore"));
  }

  public void testTaskQueryCandidateUser() {
    TaskQueryImpl query = new TaskQueryImpl();
    query.taskCandidateUser(testUser.getId());
    query.taskCandidateUserExpression(testUser.getId());

    filter.setQuery(query);
    query = filter.getQuery();

    assertEquals(testUser.getId(), query.getCandidateUser());
    assertEquals(testUser.getId(), query.getExpressions().get("taskCandidateUser"));
  }
View Full Code Here

    assertEquals(testUser.getId(), query.getCandidateUser());
    assertEquals(testUser.getId(), query.getExpressions().get("taskCandidateUser"));
  }

  public void testTaskQueryCandidateGroup() {
    TaskQueryImpl query = new TaskQueryImpl();
    query.taskCandidateGroup(testGroup.getId());
    query.taskCandidateGroupExpression(testGroup.getId());

    filter.setQuery(query);
    query = filter.getQuery();

    assertEquals(testGroup.getId(), query.getCandidateGroup());
    assertEquals(testGroup.getId(), query.getExpressions().get("taskCandidateGroup"));
  }
View Full Code Here

  public void testExtendingSorting() {
    String sortByNameAsc = TaskQueryProperty.NAME.getName() + " " + Direction.ASCENDING.getName();
    String sortByAssigneeDesc = TaskQueryProperty.ASSIGNEE.getName() + " " + Direction.DESCENDING.getName();

    // create empty query
    TaskQueryImpl query = (TaskQueryImpl) taskService.createTaskQuery();
    saveQuery(query);

    // assert default sorting
    query = filter.getQuery();
    String orderBy = query.getOrderBy();
    assertEquals(AbstractQuery.DEFAULT_ORDER_BY, orderBy);

    // extend query by new task query with sorting
    TaskQuery sortQuery = taskService.createTaskQuery().orderByTaskName().asc();
    Filter extendedFilter = filter.extend(sortQuery);
    query = extendedFilter.getQuery();
    orderBy = query.getOrderBy();

    assertEquals(sortByNameAsc, orderBy);

    // extend query by new task query with additional sorting
    TaskQuery extendingQuery = taskService.createTaskQuery().orderByTaskAssignee().desc();
    extendedFilter = extendedFilter.extend(extendingQuery);
    query = extendedFilter.getQuery();
    orderBy = query.getOrderBy();

    assertEquals(sortByNameAsc + ", " + sortByAssigneeDesc, orderBy);

    // extend query by incomplete sorting query (sorting should not change)
    sortQuery = taskService.createTaskQuery().orderByCaseExecutionId();
    extendedFilter = extendedFilter.extend(sortQuery);
    query = extendedFilter.getQuery();
    orderBy = query.getOrderBy();

    assertEquals(sortByNameAsc + ", " + sortByAssigneeDesc, orderBy);
  }
View Full Code Here

    TaskQuery extendingQuery = taskService.createTaskQuery()
      .taskVariableValueEquals("hello", "world")
      .caseInstanceVariableValueEquals("hello", "world");

    Filter extendedFilter = filter.extend(extendingQuery);
    TaskQueryImpl extendedQuery = extendedFilter.getQuery();
    List<TaskQueryVariableValue> variables = extendedQuery.getVariables();

    assertEquals(3, variables.size());

    // assert variables (ordering: extending variables are inserted first)
    assertEquals("hello", variables.get(0).getName());
    assertEquals("world", variables.get(0).getValue());
    assertEquals(QueryOperator.EQUALS.toString(), variables.get(0).getOperator());
    assertFalse(variables.get(0).isProcessInstanceVariable());
    assertTrue(variables.get(0).isLocal());
    assertEquals("hello", variables.get(1).getName());
    assertEquals("world", variables.get(1).getValue());
    assertEquals(QueryOperator.EQUALS.toString(), variables.get(1).getOperator());
    assertFalse(variables.get(1).isProcessInstanceVariable());
    assertFalse(variables.get(1).isLocal());
    assertEquals("hello", variables.get(2).getName());
    assertEquals("world", variables.get(2).getValue());
    assertEquals(QueryOperator.EQUALS.toString(), variables.get(2).getOperator());
    assertTrue(variables.get(2).isProcessInstanceVariable());
    assertFalse(variables.get(2).isLocal());

    // variables will override variables with same name in same scope
    extendingQuery = taskService.createTaskQuery()
      .processVariableValueLessThan("hello", 42)
      .taskVariableValueLessThan("hello", 42)
      .caseInstanceVariableValueLessThan("hello", 42);

    extendedFilter = filter.extend(extendingQuery);
    extendedQuery = extendedFilter.getQuery();
    variables = extendedQuery.getVariables();

    assertEquals(3, variables.size());

    // assert variables (ordering: extending variables are inserted first)
    assertEquals("hello", variables.get(0).getName());
View Full Code Here

      .taskName("newName")
      .taskOwner("newOwner");
    Filter newFilter = filter.extend(extendingQuery);
    assertNull(newFilter.getId());

    TaskQueryImpl filterQuery = newFilter.getQuery();
    assertEquals("newName", filterQuery.getName());
    assertEquals("newOwner", filterQuery.getOwner());
  }
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.impl.TaskQueryImpl$TaskQueryVariableValueComparable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.