本文整理汇总了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());
}
示例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());
}
示例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;
}
示例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;
}