1

Merge branch 'master' into refactor-controller

# Conflicts:
#	src/main/java/mops/gruppen2/controller/WebController.java
This commit is contained in:
Christoph
2020-03-25 13:03:22 +01:00
22 changed files with 438 additions and 39 deletions

View File

@ -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());
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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());
}

View File

@ -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());
}

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}