本文整理汇总了Java中org.activiti.engine.identity.UserQuery类的典型用法代码示例。如果您正苦于以下问题:Java UserQuery类的具体用法?Java UserQuery怎么用?Java UserQuery使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UserQuery类属于org.activiti.engine.identity包,在下文中一共展示了UserQuery类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUserList
import org.activiti.engine.identity.UserQuery; //导入依赖的package包/类
@Override
public List<User> getUserList(QueryCondition condition, PageInfo pageInfo) {
String name = null;
String groupId = null;
if (condition != null) {
name = condition.getConditionMap().get("name").toString();
if (condition.getConditionMap().containsKey("groupId")) {
groupId = condition.getConditionMap().get("groupId").toString();
}
}
List<User> userList;
long count;
UserQuery query = identityService.createUserQuery();
if (!StrUtil.isEmpty(name)) {
query = query.userFirstNameLike(name);
}
if (!StrUtil.isEmpty(groupId)) {
query = query.memberOfGroup(groupId);
}
count = query.count();
userList = query.orderByUserId().asc().listPage((pageInfo.getPageNum() - 1) * pageInfo.getPageSize(),
pageInfo.getPageSize());
pageInfo.setCount((int) count);
return userList;
}
示例2: testQuerySorting
import org.activiti.engine.identity.UserQuery; //导入依赖的package包/类
public void testQuerySorting() {
// asc
assertEquals(3, identityService.createUserQuery().orderByUserId().asc().count());
assertEquals(3, identityService.createUserQuery().orderByUserEmail().asc().count());
assertEquals(3, identityService.createUserQuery().orderByUserFirstName().asc().count());
assertEquals(3, identityService.createUserQuery().orderByUserLastName().asc().count());
// desc
assertEquals(3, identityService.createUserQuery().orderByUserId().desc().count());
assertEquals(3, identityService.createUserQuery().orderByUserEmail().desc().count());
assertEquals(3, identityService.createUserQuery().orderByUserFirstName().desc().count());
assertEquals(3, identityService.createUserQuery().orderByUserLastName().desc().count());
// Combined with criteria
UserQuery query = identityService.createUserQuery().userLastNameLike("%ea%").orderByUserFirstName().asc();
List<User> users = query.list();
assertEquals(2,users.size());
assertEquals("Fozzie", users.get(0).getFirstName());
assertEquals("Gonzo", users.get(1).getFirstName());
}
示例3: findUsers
import org.activiti.engine.identity.UserQuery; //导入依赖的package包/类
/**
* 查询用户列表.
*
* @param groupId
* 群组Id.
* @param keyword
* 搜索关键字.
* @return
*/
@RequestMapping(value = "/user/find", method = RequestMethod.GET, produces = "application/json")
public List<AssignItemVo> findUsers(String groupId, String keyword) {
List<AssignItemVo> voItems = new ArrayList<AssignItemVo>();
if (groupId.equals("EXPRESSION")) {
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 {
UserQuery query = identityService.createUserQuery().memberOfGroup(groupId);
if (StringUtils.isNotEmpty(keyword)) {
query.userFullNameLike("%" + keyword + "%");
}
List<User> list = query.list();
for (User u : list) {
voItems.add(new AssignItemVo(u.getId(), u.getLastName() + "(" + u.getFirstName() + ")", "U"));
}
}
return voItems;
}
示例4: memberOfGroup
import org.activiti.engine.identity.UserQuery; //导入依赖的package包/类
@Override
public UserQuery memberOfGroup(final String groupId) {
try {
memberOf = Long.valueOf(groupId);
} catch (NumberFormatException e) {
}
return this;
}
示例5: loadItems
import org.activiti.engine.identity.UserQuery; //导入依赖的package包/类
public List<Item> loadItems(int start, int count) {
UserQuery query = identityService.createUserQuery().memberOfGroup(groupId);
if (sortby == null || "id".equals(sortby)) {
query.orderByUserId(); // default
} else if ("firstName".equals(sortby)){
query.orderByUserFirstName();
} else if ("lastName".equals(sortby)) {
query.orderByUserLastName();
} else if ("email".equals(sortby)) {
query.orderByUserEmail();
}
if (sortby == null || ascending) {
query.asc();
} else {
query.desc();
}
List<User> users = query.listPage(start, count);
List<Item> items = new ArrayList<Item>();
for (User user : users) {
items.add(new GroupMemberItem(user));
}
return items;
}
示例6: userId
import org.activiti.engine.identity.UserQuery; //导入依赖的package包/类
public UserQuery userId(String id) {
if (id == null) {
throw new ActivitiException("Provided id is null");
}
this.id = id;
return this;
}
示例7: userFirstNameLike
import org.activiti.engine.identity.UserQuery; //导入依赖的package包/类
public UserQuery userFirstNameLike(String firstNameLike) {
if (firstNameLike == null) {
throw new ActivitiException("Provided firstNameLike is null");
}
this.firstNameLike = firstNameLike;
return this;
}
示例8: userLastNameLike
import org.activiti.engine.identity.UserQuery; //导入依赖的package包/类
public UserQuery userLastNameLike(String lastNameLike) {
if (lastNameLike == null) {
throw new ActivitiException("Provided lastNameLike is null");
}
this.lastNameLike = lastNameLike;
return this;
}
示例9: userEmailLike
import org.activiti.engine.identity.UserQuery; //导入依赖的package包/类
public UserQuery userEmailLike(String emailLike) {
if (emailLike == null) {
throw new ActivitiException("Provided emailLike is null");
}
this.emailLike = emailLike;
return this;
}
示例10: memberOfGroup
import org.activiti.engine.identity.UserQuery; //导入依赖的package包/类
public UserQuery memberOfGroup(String groupId) {
if (groupId == null) {
throw new ActivitiException("Provided groupIds is null or empty");
}
this.groupId = groupId;
return this;
}
示例11: testQueryByInvalidId
import org.activiti.engine.identity.UserQuery; //导入依赖的package包/类
public void testQueryByInvalidId() {
UserQuery query = identityService.createUserQuery().userId("invalid");
verifyQueryResults(query, 0);
try {
identityService.createUserQuery().userId(null).singleResult();
fail();
} catch (ActivitiException e) { }
}
示例12: testQueryByFirstName
import org.activiti.engine.identity.UserQuery; //导入依赖的package包/类
public void testQueryByFirstName() {
UserQuery query = identityService.createUserQuery().userFirstName("Gonzo");
verifyQueryResults(query, 1);
User result = query.singleResult();
assertEquals("gonzo", result.getId());
}
示例13: testQueryByInvalidFirstName
import org.activiti.engine.identity.UserQuery; //导入依赖的package包/类
public void testQueryByInvalidFirstName() {
UserQuery query = identityService.createUserQuery().userFirstName("invalid");
verifyQueryResults(query, 0);
try {
identityService.createUserQuery().userFirstName(null).singleResult();
fail();
} catch (ActivitiException e) { }
}
示例14: testQueryByFirstNameLike
import org.activiti.engine.identity.UserQuery; //导入依赖的package包/类
public void testQueryByFirstNameLike() {
UserQuery query = identityService.createUserQuery().userFirstNameLike("%o%");
verifyQueryResults(query, 2);
query = identityService.createUserQuery().userFirstNameLike("Ker%");
verifyQueryResults(query, 1);
}
示例15: testQueryByInvalidFirstNameLike
import org.activiti.engine.identity.UserQuery; //导入依赖的package包/类
public void testQueryByInvalidFirstNameLike() {
UserQuery query = identityService.createUserQuery().userFirstNameLike("%mispiggy%");
verifyQueryResults(query, 0);
try {
identityService.createUserQuery().userFirstNameLike(null).singleResult();
fail();
} catch (ActivitiException e) { }
}