refactor, templates need fixing
This commit is contained in:
38
src/main/java/mops/gruppen2/domain/event/SetLimitEvent.java
Normal file
38
src/main/java/mops/gruppen2/domain/event/SetLimitEvent.java
Normal file
@ -0,0 +1,38 @@
|
||||
package mops.gruppen2.domain.event;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Value;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import mops.gruppen2.domain.exception.BadArgumentException;
|
||||
import mops.gruppen2.domain.exception.NoAccessException;
|
||||
import mops.gruppen2.domain.model.group.Group;
|
||||
import mops.gruppen2.domain.model.group.wrapper.Limit;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Log4j2
|
||||
@Value
|
||||
@AllArgsConstructor
|
||||
public class SetLimitEvent extends Event {
|
||||
|
||||
@JsonProperty("limit")
|
||||
Limit limit;
|
||||
|
||||
public SetLimitEvent(Group group, String exec, @Valid Limit limit) {
|
||||
super(group.getId(), exec, null);
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyEvent(Group group) throws BadArgumentException, NoAccessException {
|
||||
group.setLimit(exec, limit);
|
||||
|
||||
log.trace("\t\t\t\t\tNeues UserLimit: {}", group.getLimit());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return EventType.SETLIMIT.toString();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user