1

Merge branch 'max_userNumber' of https://github.com/hhu-propra2/abschlussprojekt-it-bois into max_userNumber

This commit is contained in:
killerber4t
2020-03-19 15:40:16 +01:00
3 changed files with 22 additions and 5 deletions

View File

@ -7,6 +7,7 @@ import mops.gruppen2.domain.Group;
import mops.gruppen2.domain.Role;
import mops.gruppen2.domain.User;
import mops.gruppen2.domain.exception.EventException;
import mops.gruppen2.domain.exception.GroupFullException;
import mops.gruppen2.domain.exception.UserAlreadyExistsException;
/**
@ -37,7 +38,7 @@ public class AddUserEvent extends Event {
}
//andere exception
if (group.getMembers().size() == group.getUserMaximum()){
throw new UserAlreadyExistsException(this.getClass().toString());
throw new GroupFullException(this.getClass().toString());
}
group.getMembers().add(user);

View File

@ -0,0 +1,11 @@
package mops.gruppen2.domain.exception;
import org.springframework.http.HttpStatus;
public class GroupFullException extends EventException {
public GroupFullException(String info) {
super(HttpStatus.INTERNAL_SERVER_ERROR, "Der User existiert bereits.", info);
}
}