File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
src/main/java/de/rwth/idsg/steve/web/dto Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 1919package de .rwth .idsg .steve .web .dto ;
2020
2121import de .rwth .idsg .steve .NotificationFeature ;
22+ import jakarta .validation .constraints .AssertTrue ;
2223import lombok .Getter ;
2324import lombok .Setter ;
2425import lombok .ToString ;
26+ import org .apache .cxf .common .util .CollectionUtils ;
2527import org .joda .time .LocalDate ;
2628
2729import jakarta .validation .constraints .Email ;
@@ -60,4 +62,19 @@ public class UserForm {
6062
6163 private Address address ;
6264
65+ @ AssertTrue (message = "Some of the selected notification features cannot be enabled for a user" )
66+ public boolean isNotificationFeaturesForUser () {
67+ if (CollectionUtils .isEmpty (notificationFeatures )) {
68+ return true ;
69+ }
70+
71+ for (var selectedFeature : notificationFeatures ) {
72+ if (!selectedFeature .isForUser ()) {
73+ return false ;
74+ }
75+ }
76+
77+ return true ;
78+ }
79+
6380}
You can’t perform that action at this time.
0 commit comments