Merge pull request #126 from hhu-propra2/slight-chganges
decrease visibility of applyEvent methods + new testbuilder
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;
|
||||
|
||||
Reference in New Issue
Block a user