1
Files
lecture-professional-softwa…/src/main/java/mops/gruppen2/domain/event/UpdateGroupDescriptionEvent.java
Christoph 1c5139da8c Merge refactor into error-handling + fix merge errors
Co-authored-by: [Mahgs] <maxoerter@gmx.de>
Co-authored-by: Christoph <tobi@urpost.de>
2020-03-18 23:45:07 +01:00

33 lines
869 B
Java

package mops.gruppen2.domain.event;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import mops.gruppen2.domain.Group;
import mops.gruppen2.domain.exception.NoValueException;
/**
* Ändert nur die Gruppenbeschreibung.
*/
@Getter
@AllArgsConstructor
@NoArgsConstructor // For Jackson
public class UpdateGroupDescriptionEvent extends Event {
private String newGroupDescription;
public UpdateGroupDescriptionEvent(Long groupId, String userId, String newGroupDescription) {
super(groupId, userId);
this.newGroupDescription = newGroupDescription;
}
@Override
public void applyEvent(Group group) {
if (this.newGroupDescription.isEmpty()) {
throw new NoValueException(this.getClass().toString());
}
group.setDescription(this.newGroupDescription);
}
}