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


Java GroupQuery.list方法代码示例

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


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

示例1: testQueryByMember

import org.activiti.engine.identity.GroupQuery; //导入方法依赖的package包/类
public void testQueryByMember() {
  GroupQuery query = identityService.createGroupQuery().groupMember("fozzie");
  verifyQueryResults(query, 2);
  
  query = identityService.createGroupQuery().groupMember("kermit");
  verifyQueryResults(query, 3);
  
  query = query.orderByGroupId().asc();
  List<Group> groups = query.list();
  assertEquals(3, groups.size());
  assertEquals("admin", groups.get(0).getId());
  assertEquals("frogs", groups.get(1).getId());
  assertEquals("muppets", groups.get(2).getId());

  query = query.groupType("user");
  groups = query.list();
  assertEquals(2, groups.size());
  assertEquals("frogs", groups.get(0).getId());
  assertEquals("muppets", groups.get(1).getId());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:21,代码来源:GroupQueryTest.java

示例2: testQuerySorting

import org.activiti.engine.identity.GroupQuery; //导入方法依赖的package包/类
public void testQuerySorting() {
  // asc
  assertEquals(4, identityService.createGroupQuery().orderByGroupId().asc().count());
  assertEquals(4, identityService.createGroupQuery().orderByGroupName().asc().count());
  assertEquals(4, identityService.createGroupQuery().orderByGroupType().asc().count());

  // desc
  assertEquals(4, identityService.createGroupQuery().orderByGroupId().desc().count());
  assertEquals(4, identityService.createGroupQuery().orderByGroupName().desc().count());
  assertEquals(4, identityService.createGroupQuery().orderByGroupType().desc().count());
  
  // Multiple sortings
  GroupQuery query = identityService.createGroupQuery().orderByGroupType().asc().orderByGroupName().desc();
  List<Group> groups = query.list();
  assertEquals(4, query.count());
  
  assertEquals("security", groups.get(0).getType());
  assertEquals("user", groups.get(1).getType());
  assertEquals("user", groups.get(2).getType());
  assertEquals("user", groups.get(3).getType());

  assertEquals("admin", groups.get(0).getId());
  assertEquals("muppets", groups.get(1).getId());
  assertEquals("mammals", groups.get(2).getId());
  assertEquals("frogs", groups.get(3).getId());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:27,代码来源:GroupQueryTest.java

示例3: findGroups

import org.activiti.engine.identity.GroupQuery; //导入方法依赖的package包/类
/**
 * 查询群组列表.
 * 
 * @param type
 *            D 部门, P 岗位, G 群组, R 角色, T 表达式分类, E 表达式.
 * @param keyword
 *            过滤名称关键字.
 */
@RequestMapping(value = "/group/find", method = RequestMethod.GET, produces = "application/json")
public List<AssignItemVo> findGroups(String type, String keyword) {

	List<AssignItemVo> voItems = new ArrayList<AssignItemVo>();

	if (type.equals("T")) {

		voItems.add(new AssignItemVo("EXPRESSION", "内部表达式", "T"));
	} else if (type.equals("E")) {

		HashMap<String, String> exprs = assignmenteExpr.getItems();
		for (String key : exprs.keySet()) {
			AssignItemVo assign = new AssignItemVo();
			assign.setValue("${" + key + "}");
			assign.setName(exprs.get(key) + "(" + assign.getValue() + ")");
			assign.setType("T");
			voItems.add(assign);
		}
	} else {

		GroupQuery query = identityService.createGroupQuery().groupType(type);
		if (StringUtils.isNotEmpty(keyword)) {
			query.groupNameLike("%" + keyword + "%");
		}
		List<Group> list = query.list();
		for (Group g : list) {
			voItems.add(new AssignItemVo(g.getId(), g.getName(), g.getType()));
		}
	}

	return voItems;
}
 
开发者ID:KayuraTeam,项目名称:kayura-activiti,代码行数:41,代码来源:IdentityRestResource.java

示例4: getTasksSummary

import org.activiti.engine.identity.GroupQuery; //导入方法依赖的package包/类
@Get
public ObjectNode getTasksSummary() {
  if(authenticate() == false) return null;
  
  String user = getQuery().getValues("user");
  if(user == null) {
    throw new ActivitiException("No user provided");
  }
  
  TaskService ts = ActivitiUtil.getTaskService();
  
  GroupQuery query = ActivitiUtil.getIdentityService()
    .createGroupQuery()
    .groupMember(user)
    .groupType("assignment");
  
  List<Group> groups = query.list();
  ObjectNode groupsJSON = new ObjectMapper().createObjectNode();
  for (Group group : groups) {
    long tasksInGroup = ts.createTaskQuery().taskCandidateGroup(group.getId()).count();
    groupsJSON.put(group.getName(), tasksInGroup);
  }
  
  ObjectNode summaryResponseJSON = new ObjectMapper().createObjectNode();
  
  ObjectNode totalAssignedJSON = new ObjectMapper().createObjectNode();
  totalAssignedJSON.put("total", ts.createTaskQuery().taskAssignee(user).count());
  summaryResponseJSON.put("assigned", totalAssignedJSON);
  
  ObjectNode totalUnassignedJSON = new ObjectMapper().createObjectNode();
  totalUnassignedJSON.put("total", ts.createTaskQuery().taskCandidateUser(user).count());
  totalUnassignedJSON.put("groups", groupsJSON);
  summaryResponseJSON.put("unassigned", totalUnassignedJSON);
  
  return summaryResponseJSON;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:37,代码来源:TasksSummaryResource.java


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