domainUserRequestDao.add(domainUserRequest);
}
@Override
public DomainUserRequest createDomainUserRequest(User user, String accessCode) {
DomainUserRequest domainUserRequest = null;
if (user != null && accessCode != null && !accessCode.isEmpty()) {
Domain domain = domainService.getByUUID(accessCode);
if (domain != null) {
//Check if user is already in group or not
if (userDomainService.get(user, domain.getId()) == null) {
//Check if there is already a pendingRequest for this given user and this group
if (!doesRequestExist(user, domain, Status.PENDING)) {
domainUserRequest = new DomainUserRequest();
domainUserRequest.setDomain(domain);
domainUserRequest.setUser(user);
domainUserRequest.setStatus(Status.PENDING);
add(domainUserRequest);
}
}