@Override public Group newGroup(String groupId) { return getIdmIdentityService().newGroup(groupId); }
@Override public Group newGroup(String groupId) { return getIdmIdentityService().newGroup(groupId); }
protected Group createGroup(String id, String name, String type) { Group group = idmIdentityService.newGroup(id); group.setName(name); group.setType(type); idmIdentityService.saveGroup(group); return group; }
public Group createNewGroup(String id, String name, String type) { if (StringUtils.isBlank(name)) { throw new BadRequestException("Group name required"); } Group newGroup = identityService.newGroup(id); newGroup.setName(name); if (type == null) { newGroup.setType(GroupTypes.TYPE_ASSIGNMENT); } else { newGroup.setType(type); } identityService.saveGroup(newGroup); return newGroup; }
@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.") }) @PostMapping(value = "/groups", produces = "application/json") public GroupResponse createGroup(@RequestBody GroupRequest groupRequest, HttpServletRequest httpRequest, HttpServletResponse response) { if (groupRequest.getId() == null) { throw new FlowableIllegalArgumentException("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 FlowableConflictException("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()); if (restApiInterceptor != null) { restApiInterceptor.createNewGroup(created); } identityService.saveGroup(created); response.setStatus(HttpStatus.CREATED.value()); return restResponseFactory.createGroupResponse(created); }