コード例 #1
0
 private Group createGroup(Client client) {
   Group group = new Group();
   group.setName("Test Group" + RandomStringUtils.randomAlphanumeric(9));
   group.setClient(clientService.reload(client));
   groupService.save(group);
   return group;
 }
コード例 #2
0
 @Override
 @Transactional
 public UserClientTeamRole create(UserClientTeamRole userClientTeamRole) {
   if (userClientTeamRole == null
       || userClientTeamRole.getId() != null
       || userClientTeamRole.getClient() == null) {
     throw new InvalidDataAccessApiUsageException(
         "UserClientTeamRole can neither be null nor have an id and must have a client attached");
   }
   userClientTeamRole.setId(null);
   userClientTeamRole.setClient(clientService.reload(userClientTeamRole.getClient()));
   return userClientTeamRolePersistence.save(userClientTeamRole);
 }
コード例 #3
0
 @Override
 @Transactional(readOnly = true)
 public boolean hasDuplicateName(UserClientTeamRole userClientTeamRole) {
   if (userClientTeamRole == null || userClientTeamRole.getClient() == null) {
     throw new InvalidDataAccessApiUsageException(
         "UserClientTeamRole can neither be null nor have an id and must have a client attached");
   }
   userClientTeamRole.setClient(clientService.reload(userClientTeamRole.getClient()));
   if (userClientTeamRolePersistence.findDuplicateByName(userClientTeamRole) == null) {
     // Check the same name is not used in client role
     UserClientRole userClientRole = new UserClientRole();
     userClientRole.setName(userClientTeamRole.getName());
     userClientRole.setClient(userClientTeamRole.getClient());
     if (userClientRolePersistence.findDuplicateByName(userClientRole) == null) {
       return false;
     }
   }
   return true;
 }