Merge branch 'master' into refactor-controller
# Conflicts: # src/main/java/mops/gruppen2/controller/WebController.java
This commit is contained in:
@ -32,14 +32,14 @@ public class AddUserEvent extends Event {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyEvent(Group group) throws EventException {
|
||||
protected void applyEvent(Group group) throws EventException {
|
||||
User user = new User(this.userId, this.givenname, this.familyname, this.email);
|
||||
|
||||
if (group.getMembers().contains(user)) {
|
||||
throw new UserAlreadyExistsException(this.getClass().toString());
|
||||
}
|
||||
|
||||
if (group.getMembers().size() == group.getUserMaximum()){
|
||||
if (group.getMembers().size() == group.getUserMaximum()) {
|
||||
throw new GroupFullException(this.getClass().toString());
|
||||
}
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ public class CreateGroupEvent extends Event {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyEvent(Group group) {
|
||||
protected void applyEvent(Group group) {
|
||||
group.setId(this.groupId);
|
||||
group.setParent(this.groupParent);
|
||||
group.setType(this.groupType);
|
||||
|
||||
@ -15,7 +15,7 @@ public class DeleteGroupEvent extends Event {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyEvent(Group group) {
|
||||
protected void applyEvent(Group group) {
|
||||
group.getRoles().clear();
|
||||
group.getMembers().clear();
|
||||
group.setTitle(null);
|
||||
|
||||
@ -21,7 +21,7 @@ public class DeleteUserEvent extends Event {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyEvent(Group group) throws EventException {
|
||||
protected void applyEvent(Group group) throws EventException {
|
||||
for (User user : group.getMembers()) {
|
||||
if (user.getId().equals(this.userId)) {
|
||||
group.getMembers().remove(user);
|
||||
|
||||
@ -24,7 +24,7 @@ public class UpdateGroupDescriptionEvent extends Event {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyEvent(Group group) {
|
||||
protected void applyEvent(Group group) {
|
||||
if (this.newGroupDescription.isEmpty()) {
|
||||
throw new NoValueException(this.getClass().toString());
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ public class UpdateGroupTitleEvent extends Event {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyEvent(Group group) {
|
||||
protected void applyEvent(Group group) {
|
||||
if (this.getNewGroupTitle().isEmpty()) {
|
||||
throw new NoValueException(this.getClass().toString());
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ public class UpdateRoleEvent extends Event {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyEvent(Group group) throws UserNotFoundException {
|
||||
protected void applyEvent(Group group) throws UserNotFoundException {
|
||||
if (group.getRoles().containsKey(this.userId)) {
|
||||
group.getRoles().put(this.userId, this.newRole);
|
||||
return;
|
||||
|
||||
@ -5,7 +5,7 @@ import org.springframework.http.HttpStatus;
|
||||
public class GroupFullException extends EventException {
|
||||
|
||||
public GroupFullException(String info) {
|
||||
super(HttpStatus.INTERNAL_SERVER_ERROR, "Der User existiert bereits.", info);
|
||||
super(HttpStatus.INTERNAL_SERVER_ERROR, "Die Gruppe hat die maximale Midgliederanzahl bereits erreicht!", info);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
package mops.gruppen2.domain.exception;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
public class NoAccessException extends EventException {
|
||||
|
||||
public NoAccessException(String info) {
|
||||
super(HttpStatus.FORBIDDEN, "Hier hast du leider keinen Zugriff!", info);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package mops.gruppen2.domain.exception;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
public class PageNotFoundException extends EventException {
|
||||
|
||||
public PageNotFoundException(String info) {
|
||||
super(HttpStatus.NOT_FOUND, "Die Seite wurde nicht gefunden!", info);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user