@@ -44,7 +44,7 @@ public TaskStateTaskController(
4444
4545 @ RequestMapping (path = "/add" , method = RequestMethod .GET )
4646 public final String addNewTaskToInboxGet (
47- @ ModelAttribute ("userSession" ) UserSessionBean userSession ,
47+ @ NotNull @ ModelAttribute ("userSession" ) UserSessionBean userSession ,
4848 Locale locale , Model model
4949 ) {
5050 log .info ("addNewTaskToInboxGet" );
@@ -190,85 +190,122 @@ public String changeTaskOrderId(
190190 @ NotNull @ ModelAttribute ("userSession" ) UserSessionBean userSession ,
191191 Model model
192192 ){
193- userSession .setLastTaskState (sourceTask .getTaskState ());
194- model .addAttribute ("userSession" , userSession );
195193 log .info ("------------- changeTaskOrderId -------------" );
196194 log .info ("source Task: " +sourceTask .toString ());
197195 log .info ("---------------------------------------------" );
198196 log .info ("destination Task: " +destinationTask .toString ());
199197 log .info ("---------------------------------------------" );
200198 taskStateControllerService .moveTaskToTaskAndChangeTaskOrderInTaskstate (sourceTask , destinationTask );
199+ userSession .setLastTaskState (sourceTask .getTaskState ());
200+ model .addAttribute ("userSession" , userSession );
201201 return sourceTask .getTaskState ().getUrl ();
202202 }
203203
204204 @ RequestMapping (path = "/{taskId}/move/to/project/{projectId}" , method = RequestMethod .GET )
205205 public final String moveTaskToAnotherProject (
206206 @ NotNull @ PathVariable ("taskId" ) Task task ,
207- @ NotNull @ PathVariable ("projectId" ) Project project
207+ @ NotNull @ PathVariable ("projectId" ) Project project ,
208+ @ NotNull @ ModelAttribute ("userSession" ) UserSessionBean userSession ,
209+ Model model
208210 ) {
209211 task = taskService .moveTaskToAnotherProject (task ,project );
212+ userSession .setLastProjectId (project .getId ());
213+ model .addAttribute ("userSession" ,userSession );
210214 return project .getUrl ();
211215 }
212216
213217 @ RequestMapping (path = "/{taskId}/move/to/taskstate/inbox" , method = RequestMethod .GET )
214- public final String moveTaskToInbox (@ NotNull @ PathVariable ("taskId" ) Task task ) {
218+ public final String moveTaskToInbox (
219+ @ NotNull @ PathVariable ("taskId" ) Task task ,
220+ @ NotNull @ ModelAttribute ("userSession" ) UserSessionBean userSession ,
221+ Model model
222+ ) {
215223 log .info ("dragged and dropped " +task .getId ()+" to inbox" );
216224 task = taskService .moveTaskToInbox (task );
217225 return task .getTaskState ().getUrl ();
218226 }
219227
220228 @ RequestMapping (path = "/{taskId}/move/to/taskstate/today" , method = RequestMethod .GET )
221- public final String moveTaskToToday (@ NotNull @ PathVariable ("taskId" ) Task task ) {
229+ public final String moveTaskToToday (
230+ @ NotNull @ PathVariable ("taskId" ) Task task ,
231+ @ NotNull @ ModelAttribute ("userSession" ) UserSessionBean userSession ,
232+ Model model
233+ ) {
222234 log .info ("dragged and dropped " +task .getId ()+" to today" );
223235 task = taskService .moveTaskToToday (task );
224236 return task .getTaskState ().getUrl ();
225237 }
226238
227239 @ RequestMapping (path = "/{taskId}/move/to/taskstate/next" , method = RequestMethod .GET )
228- public final String moveTaskToNext (@ NotNull @ PathVariable ("taskId" ) Task task ) {
240+ public final String moveTaskToNext (
241+ @ NotNull @ PathVariable ("taskId" ) Task task ,
242+ @ NotNull @ ModelAttribute ("userSession" ) UserSessionBean userSession ,
243+ Model model
244+ ) {
229245 log .info ("dragged and dropped " +task .getId ()+" to next" );
230246 task = taskService .moveTaskToNext (task );
231247 return task .getTaskState ().getUrl ();
232248 }
233249
234250 @ RequestMapping (path = "/{taskId}/move/to/taskstate/waiting" , method = RequestMethod .GET )
235- public final String moveTaskToWaiting (@ NotNull @ PathVariable ("taskId" ) Task task ) {
251+ public final String moveTaskToWaiting (
252+ @ NotNull @ PathVariable ("taskId" ) Task task ,
253+ @ NotNull @ ModelAttribute ("userSession" ) UserSessionBean userSession ,
254+ Model model
255+ ) {
236256 log .info ("dragged and dropped " +task .getId ()+" to waiting" );
237257 task = taskService .moveTaskToWaiting (task );
238258 return task .getTaskState ().getUrl ();
239259 }
240260
241261 @ RequestMapping (path = "/{taskId}/move/to/taskstate/someday" , method = RequestMethod .GET )
242- public final String moveTaskToSomeday (@ NotNull @ PathVariable ("taskId" ) Task task ) {
262+ public final String moveTaskToSomeday (
263+ @ NotNull @ PathVariable ("taskId" ) Task task ,
264+ @ NotNull @ ModelAttribute ("userSession" ) UserSessionBean userSession ,
265+ Model model
266+ ) {
243267 log .info ("dragged and dropped " +task .getId ()+" to someday" );
244268 task = taskService .moveTaskToSomeday (task );
245269 return task .getTaskState ().getUrl ();
246270 }
247271
248272 @ RequestMapping (path = "/{taskId}/move/to/taskstate/focus" , method = RequestMethod .GET )
249- public final String moveTaskToFocus (@ NotNull @ PathVariable ("taskId" ) Task task ) {
273+ public final String moveTaskToFocus (
274+ @ NotNull @ PathVariable ("taskId" ) Task task ,
275+ @ NotNull @ ModelAttribute ("userSession" ) UserSessionBean userSession ,
276+ Model model
277+ ) {
250278 log .info ("dragged and dropped " +task .getId ()+" to focus" );
251279 task = taskService .moveTaskToFocus (task );
252280 return task .getTaskState ().getUrl ();
253281 }
254282
255283 @ RequestMapping (path = "/{taskId}/move/to/taskstate/completed" , method = RequestMethod .GET )
256- public final String moveTaskToCompleted (@ NotNull @ PathVariable ("taskId" ) Task task ) {
284+ public final String moveTaskToCompleted (
285+ @ NotNull @ PathVariable ("taskId" ) Task task ,
286+ @ NotNull @ ModelAttribute ("userSession" ) UserSessionBean userSession ,
287+ Model model
288+ ) {
257289 log .info ("dragged and dropped " +task .getId ()+" to completed" );
258290 task = taskService .moveTaskToCompleted (task );
259291 return task .getTaskState ().getUrl ();
260292 }
261293
262294 @ RequestMapping (path = "/{taskId}/move/to/taskstate/trash" , method = RequestMethod .GET )
263- public final String moveTaskToTrash (@ NotNull @ PathVariable ("taskId" ) Task task ) {
295+ public final String moveTaskToTrash (
296+ @ NotNull @ PathVariable ("taskId" ) Task task ,
297+ @ NotNull @ ModelAttribute ("userSession" ) UserSessionBean userSession ,
298+ Model model
299+ ) {
264300 log .info ("dragged and dropped " +task .getId ()+" to trash" );
265301 task = taskService .moveTaskToTrash (task );
266302 return task .getTaskState ().getUrl ();
267303 }
268304
269305 @ RequestMapping (path = "/completed/move/to/trash" , method = RequestMethod .GET )
270306 public final String moveAllCompletedToTrash (
271- @ ModelAttribute ("userSession" ) UserSessionBean userSession
307+ @ ModelAttribute ("userSession" ) UserSessionBean userSession ,
308+ Model model
272309 ) {
273310 Context context = super .getContext (userSession );
274311 taskService .moveAllCompletedToTrash (context );
@@ -277,7 +314,8 @@ public final String moveAllCompletedToTrash(
277314
278315 @ RequestMapping (path = "/trash/empty" , method = RequestMethod .GET )
279316 public final String emptyTrash (
280- @ ModelAttribute ("userSession" ) UserSessionBean userSession
317+ @ ModelAttribute ("userSession" ) UserSessionBean userSession ,
318+ Model model
281319 ) {
282320 Context context = super .getContext (userSession );
283321 taskService .emptyTrash (context );
@@ -286,7 +324,11 @@ public final String emptyTrash(
286324
287325
288326 @ RequestMapping (path = "/{taskId}/delete" , method = RequestMethod .GET )
289- public final String deleteTaskGet (@ NotNull @ PathVariable ("taskId" ) Task task ) {
327+ public final String deleteTaskGet (
328+ @ NotNull @ PathVariable ("taskId" ) Task task ,
329+ @ NotNull @ ModelAttribute ("userSession" ) UserSessionBean userSession ,
330+ Model model
331+ ) {
290332 log .info ("deleteTaskGet" );
291333 if (task != null ){
292334 task .delete ();
@@ -296,22 +338,32 @@ public final String deleteTaskGet(@NotNull @PathVariable("taskId") Task task) {
296338 }
297339
298340 @ RequestMapping (path = "/{taskId}/undelete" , method = RequestMethod .GET )
299- public final String undeleteTaskGet (@ NotNull @ PathVariable ("taskId" ) Task task ) {
341+ public final String undeleteTaskGet (
342+ @ NotNull @ PathVariable ("taskId" ) Task task ,
343+ @ NotNull @ ModelAttribute ("userSession" ) UserSessionBean userSession ,
344+ Model model
345+ ) {
300346 log .info ("undeleteTaskGet" );
301347 task .undelete ();
302348 taskService .updatedViaTaskstate (task );
303349 return "redirect:/taskstate/completed" ;
304350 }
305351
306352 @ RequestMapping (path = "/{taskId}/transform" , method = RequestMethod .GET )
307- public final String transformTaskIntoProjectGet (@ NotNull @ PathVariable ("taskId" ) Task task ) {
353+ public final String transformTaskIntoProjectGet (
354+ @ NotNull @ PathVariable ("taskId" ) Task task ,
355+ @ NotNull @ ModelAttribute ("userSession" ) UserSessionBean userSession ,
356+ Model model
357+ ) {
308358 log .info ("transformTaskIntoProjectGet" );
309359 return taskProjektService .transformTaskIntoProjectGet (task );
310360 }
311361
312362 @ RequestMapping (path = "/{taskId}/complete" , method = RequestMethod .GET )
313363 public final String setDoneTaskGet (
314- @ NotNull @ PathVariable ("taskId" ) Task task
364+ @ NotNull @ PathVariable ("taskId" ) Task task ,
365+ @ NotNull @ ModelAttribute ("userSession" ) UserSessionBean userSession ,
366+ Model model
315367 ) {
316368 task .complete ();
317369 long maxOrderIdTaskState = taskService .getMaxOrderIdTaskState (TaskState .COMPLETED ,task .getContext ());
@@ -322,7 +374,9 @@ public final String setDoneTaskGet(
322374
323375 @ RequestMapping (path = "/{taskId}/incomplete" , method = RequestMethod .GET )
324376 public final String unsetDoneTaskGet (
325- @ NotNull @ PathVariable ("taskId" ) Task task
377+ @ NotNull @ PathVariable ("taskId" ) Task task ,
378+ @ NotNull @ ModelAttribute ("userSession" ) UserSessionBean userSession ,
379+ Model model
326380 ) {
327381 task .incomplete ();
328382 long maxOrderIdTaskState = taskService .getMaxOrderIdTaskState (task .getTaskState (),task .getContext ());
@@ -333,7 +387,9 @@ public final String unsetDoneTaskGet(
333387
334388 @ RequestMapping (path = "/{taskId}/setfocus" , method = RequestMethod .GET )
335389 public final String setFocusGet (
336- @ NotNull @ PathVariable ("taskId" ) Task task
390+ @ NotNull @ PathVariable ("taskId" ) Task task ,
391+ @ NotNull @ ModelAttribute ("userSession" ) UserSessionBean userSession ,
392+ Model model
337393 ){
338394 task .setFocus ();
339395 task = taskService .updatedViaTaskstate (task );
@@ -342,7 +398,9 @@ public final String setFocusGet(
342398
343399 @ RequestMapping (path = "/{taskId}/unsetfocus" , method = RequestMethod .GET )
344400 public final String unsetFocusGet (
345- @ NotNull @ PathVariable ("taskId" ) Task task
401+ @ NotNull @ PathVariable ("taskId" ) Task task ,
402+ @ NotNull @ ModelAttribute ("userSession" ) UserSessionBean userSession ,
403+ Model model
346404 ){
347405 task .unsetFocus ();
348406 task = taskService .updatedViaTaskstate (task );
0 commit comments