当前位置: 首页>>代码示例>>Java>>正文


Java Filter.setQuery方法代码示例

本文整理汇总了Java中org.camunda.bpm.engine.filter.Filter.setQuery方法的典型用法代码示例。如果您正苦于以下问题:Java Filter.setQuery方法的具体用法?Java Filter.setQuery怎么用?Java Filter.setQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.camunda.bpm.engine.filter.Filter的用法示例。


在下文中一共展示了Filter.setQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testExtendStoredFilterByExpression

import org.camunda.bpm.engine.filter.Filter; //导入方法依赖的package包/类
public void testExtendStoredFilterByExpression() {

    // given a stored filter
    TaskQuery taskQuery = taskService.createTaskQuery().dueAfterExpression("${now()}");
    Filter filter = filterService.newTaskFilter("filter");
    filter.setQuery(taskQuery);
    filterService.saveFilter(filter);

    // it is possible to execute the stored query with an expression
    assertEquals(new Long(0), filterService.count(filter.getId()));
    assertEquals(0, filterService.list(filter.getId()).size());

    // but it is not possible to executed the filter with an extended query that uses expressions
    extendFilterAndValidateFailingQuery(filter, taskService.createTaskQuery().dueAfterExpression(STATE_MANIPULATING_EXPRESSION));

    // cleanup
    filterService.deleteFilter(filter.getId());
  }
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:TaskQueryDisabledAdhocExpressionsTest.java

示例2: testExtendStoredFilterByScalar

import org.camunda.bpm.engine.filter.Filter; //导入方法依赖的package包/类
public void testExtendStoredFilterByScalar() {
  // given a stored filter
  TaskQuery taskQuery = taskService.createTaskQuery().dueAfterExpression("${now()}");
  Filter filter = filterService.newTaskFilter("filter");
  filter.setQuery(taskQuery);
  filterService.saveFilter(filter);

  // it is possible to execute the stored query with an expression
  assertEquals(new Long(0), filterService.count(filter.getId()));
  assertEquals(0, filterService.list(filter.getId()).size());

  // and it is possible to extend the filter query when not using an expression
  assertEquals(new Long(0), filterService.count(filter.getId(), taskService.createTaskQuery().dueAfter(new Date())));
  assertEquals(0, filterService.list(filter.getId(), taskService.createTaskQuery().dueAfter(new Date())).size());

  // cleanup
  filterService.deleteFilter(filter.getId());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:TaskQueryDisabledAdhocExpressionsTest.java

示例3: testUpdateFilterWithExpression

import org.camunda.bpm.engine.filter.Filter; //导入方法依赖的package包/类
public void testUpdateFilterWithExpression() {
  // given a stored filter
  TaskQuery taskQuery = taskService.createTaskQuery().dueAfter(new Date());
  Filter filter = filterService.newTaskFilter("filter");
  filter.setQuery(taskQuery);
  filterService.saveFilter(filter);

  // updating the filter with an expression does not suceed
  filter.setQuery(taskQuery.dueBeforeExpression(STATE_MANIPULATING_EXPRESSION));
  assertEquals(1, filterService.createFilterQuery().count());

  try {
    filterService.saveFilter(filter);
  } catch (ProcessEngineException e) {
    assertTextPresent(EXPECTED_STORED_QUERY_FAILURE_MESSAGE, e.getMessage());
  }
  assertTrue(fieldIsUnchanged());

  // cleanup
  filterService.deleteFilter(filter.getId());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:22,代码来源:TaskQueryDisabledStoredExpressionsTest.java

示例4: testTaskQueryByBusinessKeyExpression

import org.camunda.bpm.engine.filter.Filter; //导入方法依赖的package包/类
public void testTaskQueryByBusinessKeyExpression() {
  // given
  String aBusinessKey = "business key";
  Mocks.register("aBusinessKey", aBusinessKey);

  createDeploymentWithBusinessKey(aBusinessKey);

  // when
  TaskQueryImpl extendedQuery = (TaskQueryImpl)taskService.createTaskQuery()
    .processInstanceBusinessKeyExpression("${ " + Mocks.getMocks().keySet().toArray()[0] + " }");

  Filter filter = filterService.newTaskFilter("aFilterName");
  filter.setQuery(extendedQuery);
  filterService.saveFilter(filter);

  TaskQueryImpl filterQuery = filterService.getFilter(filter.getId()).getQuery();

  // then
  assertEquals(extendedQuery.getExpressions().get("processInstanceBusinessKey"),
    filterQuery.getExpressions().get("processInstanceBusinessKey"));
  assertEquals(1, filterService.list(filter.getId()).size());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:23,代码来源:FilterTaskQueryTest.java

示例5: testTaskQueryByBusinessKeyExpressionInAdhocQuery

import org.camunda.bpm.engine.filter.Filter; //导入方法依赖的package包/类
public void testTaskQueryByBusinessKeyExpressionInAdhocQuery() {
  // given
  processEngineConfiguration.setEnableExpressionsInAdhocQueries(true);

  String aBusinessKey = "business key";
  Mocks.register("aBusinessKey", aBusinessKey);

  createDeploymentWithBusinessKey(aBusinessKey);

  // when
  Filter filter = filterService.newTaskFilter("aFilterName");
  filter.setQuery(taskService.createTaskQuery());
  filterService.saveFilter(filter);

  TaskQueryImpl extendingQuery = (TaskQueryImpl)taskService.createTaskQuery()
    .processInstanceBusinessKeyExpression("${ " + Mocks.getMocks().keySet().toArray()[0] + " }");

  // then
  assertEquals(extendingQuery.getExpressions().get("processInstanceBusinessKey"),
    "${ " + Mocks.getMocks().keySet().toArray()[0] + " }");
  assertEquals(1, filterService.list(filter.getId(), extendingQuery).size());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:23,代码来源:FilterTaskQueryTest.java

示例6: testTaskQueryByBusinessKeyLikeExpression

import org.camunda.bpm.engine.filter.Filter; //导入方法依赖的package包/类
public void testTaskQueryByBusinessKeyLikeExpression() {
  // given
  String aBusinessKey = "business key";
  Mocks.register("aBusinessKeyLike", "%" + aBusinessKey.substring(5));

  createDeploymentWithBusinessKey(aBusinessKey);

  // when
  TaskQueryImpl extendedQuery = (TaskQueryImpl)taskService.createTaskQuery()
    .processInstanceBusinessKeyLikeExpression("${ " + Mocks.getMocks().keySet().toArray()[0] + " }");

  Filter filter = filterService.newTaskFilter("aFilterName");
  filter.setQuery(extendedQuery);
  filterService.saveFilter(filter);

  TaskQueryImpl filterQuery = filterService.getFilter(filter.getId()).getQuery();

  // then
  assertEquals(extendedQuery.getExpressions().get("processInstanceBusinessKeyLike"),
    filterQuery.getExpressions().get("processInstanceBusinessKeyLike"));
  assertEquals(1, filterService.list(filter.getId()).size());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:23,代码来源:FilterTaskQueryTest.java

示例7: testTaskQueryByBusinessKeyLikeExpressionInAdhocQuery

import org.camunda.bpm.engine.filter.Filter; //导入方法依赖的package包/类
public void testTaskQueryByBusinessKeyLikeExpressionInAdhocQuery() {
  // given
  processEngineConfiguration.setEnableExpressionsInAdhocQueries(true);

  String aBusinessKey = "business key";
  Mocks.register("aBusinessKeyLike", "%" + aBusinessKey.substring(5));

  createDeploymentWithBusinessKey(aBusinessKey);

  // when
  Filter filter = filterService.newTaskFilter("aFilterName");
  filter.setQuery(taskService.createTaskQuery());
  filterService.saveFilter(filter);

  TaskQueryImpl extendingQuery = (TaskQueryImpl)taskService.createTaskQuery()
    .processInstanceBusinessKeyLikeExpression("${ " + Mocks.getMocks().keySet().toArray()[0] + " }");

  // then
  assertEquals(extendingQuery.getExpressions().get("processInstanceBusinessKeyLike"),
    "${ " + Mocks.getMocks().keySet().toArray()[0] + " }");
  assertEquals(1, filterService.list(filter.getId(), extendingQuery).size());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:23,代码来源:FilterTaskQueryTest.java

示例8: testExtendTaskQueryWithCandidateUserExpressionAndIncludeAssignedTasks

import org.camunda.bpm.engine.filter.Filter; //导入方法依赖的package包/类
public void testExtendTaskQueryWithCandidateUserExpressionAndIncludeAssignedTasks() {
  // create an empty query and save it as a filter
  TaskQuery emptyQuery = taskService.createTaskQuery();
  Filter emptyFilter = filterService.newTaskFilter("empty");
  emptyFilter.setQuery(emptyQuery);

  // create a query with candidate user expression and include assigned tasks
  // and save it as filter
  TaskQuery query = taskService.createTaskQuery();
  query.taskCandidateUserExpression("${'test'}").includeAssignedTasks();
  Filter filter = filterService.newTaskFilter("filter");
  filter.setQuery(query);

  // extend empty query by query with candidate user expression and include assigned tasks
  Filter extendedFilter = emptyFilter.extend(query);
  TaskQueryImpl extendedQuery = extendedFilter.getQuery();
  assertEquals("${'test'}", extendedQuery.getExpressions().get("taskCandidateUser"));
  assertTrue(extendedQuery.isIncludeAssignedTasks());

  // extend query with candidate user expression and include assigned tasks with empty query
  extendedFilter = filter.extend(emptyQuery);
  extendedQuery = extendedFilter.getQuery();
  assertEquals("${'test'}", extendedQuery.getExpressions().get("taskCandidateUser"));
  assertTrue(extendedQuery.isIncludeAssignedTasks());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:FilterTaskQueryTest.java

示例9: testExtendTaskQueryWithCandidateGroupExpressionAndIncludeAssignedTasks

import org.camunda.bpm.engine.filter.Filter; //导入方法依赖的package包/类
public void testExtendTaskQueryWithCandidateGroupExpressionAndIncludeAssignedTasks() {
  // create an empty query and save it as a filter
  TaskQuery emptyQuery = taskService.createTaskQuery();
  Filter emptyFilter = filterService.newTaskFilter("empty");
  emptyFilter.setQuery(emptyQuery);

  // create a query with candidate group expression and include assigned tasks
  // and save it as filter
  TaskQuery query = taskService.createTaskQuery();
  query.taskCandidateGroupExpression("${'test'}").includeAssignedTasks();
  Filter filter = filterService.newTaskFilter("filter");
  filter.setQuery(query);

  // extend empty query by query with candidate group expression and include assigned tasks
  Filter extendedFilter = emptyFilter.extend(query);
  TaskQueryImpl extendedQuery = extendedFilter.getQuery();
  assertEquals("${'test'}", extendedQuery.getExpressions().get("taskCandidateGroup"));
  assertTrue(extendedQuery.isIncludeAssignedTasks());

  // extend query with candidate group expression and include assigned tasks with empty query
  extendedFilter = filter.extend(emptyQuery);
  extendedQuery = extendedFilter.getQuery();
  assertEquals("${'test'}", extendedQuery.getExpressions().get("taskCandidateGroup"));
  assertTrue(extendedQuery.isIncludeAssignedTasks());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:FilterTaskQueryTest.java

示例10: testExtendTaskQueryWithCandidateGroupInAndCandidateGroup

import org.camunda.bpm.engine.filter.Filter; //导入方法依赖的package包/类
public void testExtendTaskQueryWithCandidateGroupInAndCandidateGroup() {
  // create an query with candidate group in and save it as a filter
  TaskQueryImpl candidateGroupInQuery = (TaskQueryImpl)taskService.createTaskQuery().taskCandidateGroupIn(Arrays.asList("testGroup", "testGroup2"));
  assertEquals(2, candidateGroupInQuery.getCandidateGroups().size());
  assertEquals("testGroup", candidateGroupInQuery.getCandidateGroups().get(0));
  assertEquals("testGroup2", candidateGroupInQuery.getCandidateGroups().get(1));
  Filter candidateGroupInFilter = filterService.newTaskFilter("Groups filter");
  candidateGroupInFilter.setQuery(candidateGroupInQuery);

  // create a query with candidate group
  // and save it as filter
  TaskQuery candidateGroupQuery = taskService.createTaskQuery().taskCandidateGroup("testGroup2");

  // extend candidate group in filter by query with candidate group
  Filter extendedFilter = candidateGroupInFilter.extend(candidateGroupQuery);
  TaskQueryImpl extendedQuery = extendedFilter.getQuery();
  assertEquals(1, extendedQuery.getCandidateGroups().size());
  assertEquals("testGroup2", extendedQuery.getCandidateGroups().get(0));
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:20,代码来源:FilterTaskQueryTest.java

示例11: testExtendTaskQueryWithCandidateGroupInExpressionAndIncludeAssignedTasks

import org.camunda.bpm.engine.filter.Filter; //导入方法依赖的package包/类
public void testExtendTaskQueryWithCandidateGroupInExpressionAndIncludeAssignedTasks() {
  // create an empty query and save it as a filter
  TaskQuery emptyQuery = taskService.createTaskQuery();
  Filter emptyFilter = filterService.newTaskFilter("empty");
  emptyFilter.setQuery(emptyQuery);

  // create a query with candidate group in expression and include assigned tasks
  // and save it as filter
  TaskQuery query = taskService.createTaskQuery();
  query.taskCandidateGroupInExpression("${'test'}").includeAssignedTasks();
  Filter filter = filterService.newTaskFilter("filter");
  filter.setQuery(query);

  // extend empty query by query with candidate group in expression and include assigned tasks
  Filter extendedFilter = emptyFilter.extend(query);
  TaskQueryImpl extendedQuery = extendedFilter.getQuery();
  assertEquals("${'test'}", extendedQuery.getExpressions().get("taskCandidateGroupIn"));
  assertTrue(extendedQuery.isIncludeAssignedTasks());

  // extend query with candidate group in expression and include assigned tasks with empty query
  extendedFilter = filter.extend(emptyQuery);
  extendedQuery = extendedFilter.getQuery();
  assertEquals("${'test'}", extendedQuery.getExpressions().get("taskCandidateGroupIn"));
  assertTrue(extendedQuery.isIncludeAssignedTasks());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:FilterTaskQueryTest.java

示例12: testOrderByVariables

import org.camunda.bpm.engine.filter.Filter; //导入方法依赖的package包/类
public void testOrderByVariables() {
  // given
  TaskQueryImpl query = (TaskQueryImpl) taskService.createTaskQuery()
      .orderByProcessVariable("foo", ValueType.STRING).asc()
      .orderByExecutionVariable("foo", ValueType.STRING).asc()
      .orderByCaseInstanceVariable("foo", ValueType.STRING).asc()
      .orderByCaseExecutionVariable("foo", ValueType.STRING).asc()
      .orderByTaskVariable("foo", ValueType.STRING).asc();

  Filter filter = filterService.newTaskFilter("extendedOrFilter");
  filter.setQuery(query);
  filterService.saveFilter(filter);

  // when
  filter = filterService.getFilter(filter.getId());

  // then
  List<QueryOrderingProperty> expectedOrderingProperties =
      new ArrayList<QueryOrderingProperty>(query.getOrderingProperties());

  verifyOrderingProperties(expectedOrderingProperties, ((TaskQueryImpl) filter.getQuery()).getOrderingProperties());

  for (QueryOrderingProperty prop : ((TaskQueryImpl) filter.getQuery()).getOrderingProperties()) {
    assertTrue(prop instanceof VariableOrderProperty);
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:27,代码来源:FilterTaskQueryTest.java

示例13: createAssignedTaskQuery

import org.camunda.bpm.engine.filter.Filter; //导入方法依赖的package包/类
/**
 * creates a task query to select task to the logged in user.
 * Otherwise you would have to manually create a filter in TaskList after each boot up
 */
private void createAssignedTaskQuery() {
    TaskQuery query = taskService.createTaskQuery().taskAssignee(adminUsername);
    Filter taskFilter = filterService.newTaskFilter("assigned Tasks");
    taskFilter.setOwner(adminUsername);
    taskFilter.setQuery(query);
    filterService.saveFilter(taskFilter);
}
 
开发者ID:Educama,项目名称:Showcase,代码行数:12,代码来源:DefaultUserLifecycleBean.java

示例14: testStoreFilterWithoutExpression

import org.camunda.bpm.engine.filter.Filter; //导入方法依赖的package包/类
public void testStoreFilterWithoutExpression() {
  TaskQuery taskQuery = taskService.createTaskQuery().dueAfter(new Date());
  Filter filter = filterService.newTaskFilter("filter");
  filter.setQuery(taskQuery);

  // saving the filter suceeds
  filterService.saveFilter(filter);
  assertEquals(1, filterService.createFilterQuery().count());

  // cleanup
  filterService.deleteFilter(filter.getId());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:13,代码来源:TaskQueryDisabledStoredExpressionsTest.java

示例15: testStoreFilterWithExpression

import org.camunda.bpm.engine.filter.Filter; //导入方法依赖的package包/类
public void testStoreFilterWithExpression() {
  TaskQuery taskQuery = taskService.createTaskQuery().dueAfterExpression(STATE_MANIPULATING_EXPRESSION);
  Filter filter = filterService.newTaskFilter("filter");
  filter.setQuery(taskQuery);

  try {
    filterService.saveFilter(filter);
  } catch (ProcessEngineException e) {
    assertTextPresent(EXPECTED_STORED_QUERY_FAILURE_MESSAGE, e.getMessage());
  }
  assertTrue(fieldIsUnchanged());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:13,代码来源:TaskQueryDisabledStoredExpressionsTest.java


注:本文中的org.camunda.bpm.engine.filter.Filter.setQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。