org.activiti.engine.identity.Group.setId()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(71)

本文整理了Java中org.activiti.engine.identity.Group.setId()方法的一些代码示例,展示了Group.setId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Group.setId()方法的具体详情如下:
包路径:org.activiti.engine.identity.Group
类名称:Group
方法名:setId

Group.setId介绍

暂无

代码示例

代码示例来源:origin: bill1012/AdminEAP

@Override
public List<Group> findGroupsByUser(String userId) {
  String sql = "select r.id id,name,code from tbl_role r" +
      " left join tbl_user_role ur on r.id=ur.roleid" +
      " where ur.userid=:userid";
  Map<String, Object> param = new HashMap<>();
  param.put("userid", userId);
  List<Map<String, Object>> maps = super.findMapBySql(sql, param);
  List<Group> groups = new ArrayList<>();
  for (Map<String, Object> map : maps) {
    Group group = new GroupEntity();
    group.setId(map.get("id").toString());
    group.setName(map.get("name").toString());
    group.setType(map.get("code").toString());
    groups.add(group);
  }
  return groups;
}

代码示例来源:origin: org.activiti/activiti-rest

@ApiOperation(value = "Create a group", tags = {"Groups"})
@ApiResponses(value = {
  @ApiResponse(code = 201, message = "Indicates the group was created."),
  @ApiResponse(code = 400, message = "Indicates the id of the group was missing.")
})
@RequestMapping(value = "/identity/groups", method = RequestMethod.POST, produces = "application/json")
public GroupResponse createGroup(@RequestBody GroupRequest groupRequest, HttpServletRequest httpRequest, HttpServletResponse response) {
 if (groupRequest.getId() == null) {
  throw new ActivitiIllegalArgumentException("Id cannot be null.");
 }
 // Check if a user with the given ID already exists so we return a
 // CONFLICT
 if (identityService.createGroupQuery().groupId(groupRequest.getId()).count() > 0) {
  throw new ActivitiConflictException("A group with id '" + groupRequest.getId() + "' already exists.");
 }
 Group created = identityService.newGroup(groupRequest.getId());
 created.setId(groupRequest.getId());
 created.setName(groupRequest.getName());
 created.setType(groupRequest.getType());
 identityService.saveGroup(created);
 response.setStatus(HttpStatus.CREATED.value());
 return restResponseFactory.createGroupResponse(created);
}

相关文章

微信公众号

最新文章

更多