@@ -32,63 +32,63 @@ public class NotificationController {
3232
3333 @ Autowired
3434 private NotificationRepo notificationRepo ;
35-
35+
3636 @ ApiMapping ("/all" )
37- @ Auth (role = "ROLE_STAFF" )
37+ @ Auth (role = "ROLE_STAFF" )
3838 public ApiResponse getAllNotifications () {
3939 return new ApiResponse (SUCCESS , notificationRepo .findAll ());
4040 }
41-
41+
4242 @ ApiMapping ("/{id}" )
43- @ Auth (role = "ROLE_STAFF" )
43+ @ Auth (role = "ROLE_STAFF" )
4444 public ApiResponse getNotification (@ ApiVariable Long id ) {
4545 return new ApiResponse (SUCCESS , notificationRepo .findOne (id ));
4646 }
47-
47+
4848 @ ApiMapping ("/create" )
49- @ Auth (role = "ROLE_WEB_MANAGER" )
49+ @ Auth (role = "ROLE_WEB_MANAGER" )
5050 @ ApiValidation (business = { @ ApiValidation .Business (value = CREATE ), @ ApiValidation .Business (value = EXISTS ) })
5151 public ApiResponse create (@ ApiValidatedModel Notification notification ) {
52- notification = notificationRepo .create (notification . getName (), notification . getBody (), notification . getIsActive (), notification . getLocations () );
52+ notification = notificationRepo .create (notification );
5353 return new ApiResponse (SUCCESS , notification );
5454 }
55-
55+
5656 @ ApiMapping ("/update" )
57- @ Auth (role = "ROLE_WEB_MANAGER" )
57+ @ Auth (role = "ROLE_WEB_MANAGER" )
5858 @ ApiValidation (business = { @ ApiValidation .Business (value = UPDATE ), @ ApiValidation .Business (value = NONEXISTS ) })
5959 public ApiResponse update (@ ApiValidatedModel Notification notification ) {
6060 notification = notificationRepo .update (notification );
6161 return new ApiResponse (SUCCESS , notification );
6262 }
63-
63+
6464 @ ApiMapping ("/remove" )
65- @ Auth (role = "ROLE_WEB_MANAGER" )
65+ @ Auth (role = "ROLE_WEB_MANAGER" )
6666 @ ApiValidation (business = { @ ApiValidation .Business (value = DELETE ), @ ApiValidation .Business (value = NONEXISTS ) })
6767 public ApiResponse remove (@ ApiValidatedModel Notification notification ) {
6868 notificationRepo .delete (notification );
6969 return new ApiResponse (SUCCESS );
7070 }
71-
71+
7272 @ SkipAop
7373 @ RequestMapping ("/notification/active" )
7474 public String getActiveNotifications (@ RequestParam (value = "location" , defaultValue = "ALL" ) String locationString ) {
7575 String notificationString = "" ;
7676 List <Notification > notificationList ;
7777 if (locationString .equals ("ALL" )) {
78- notificationList = notificationRepo .findByIsActive (true );
78+ notificationList = notificationRepo .findByActive (true );
7979 } else {
8080 try {
8181 NotificationLocation location = NotificationLocation .valueOf (locationString );
82- notificationList = notificationRepo .findByIsActiveAndLocations (true , location );
82+ notificationList = notificationRepo .findByActiveAndLocations (true , location );
8383 } catch (IllegalArgumentException e ) {
8484 notificationList = new ArrayList <Notification >();
8585 }
8686 }
8787 for (Notification notification : notificationList ) {
8888 notificationString += "<p>" + notification .getBody () + "</p>" ;
8989 }
90-
90+
9191 return notificationString ;
9292 }
93-
93+
9494}
0 commit comments