コード例 #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
  private Client createClient() {
    UserAdmin user = new UserAdmin(1l, 0);

    Client client = new Client();
    client.setTier(new ClientTier(3l));
    client.setContractEnd(LocalDate.now().plusYears(1));
    client.setContractStart(LocalDate.now());
    client.setRegion(new ClientRegion(1l));
    client.setName("Test Client " + RandomStringUtils.randomAlphanumeric(18));
    client.setType(new ClientType(1l));
    client.setContractOwner(user);
    client.setActive(false);
    client.setSalesForceAccount(new SalesForce(RandomStringUtils.randomAlphanumeric(18)));
    clientService.create(client);
    return client;
  }
コード例 #4
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;
 }