@@ -67,6 +67,7 @@ public final String addNewTaskToInboxGet(
6767 model .addAttribute ("mustChooseArea" , mustChooseContext );
6868 model .addAttribute ("breadcrumb" , breadcrumb );
6969 model .addAttribute ("task" , task );
70+ model .addAttribute ("userSession" , userSession );
7071 return "taskstate/task/add" ;
7172 }
7273
@@ -90,10 +91,12 @@ public final String addNewTaskToInboxPost(
9091 model .addAttribute ("mustChooseArea" , mustChooseArea );
9192 model .addAttribute ("breadcrumb" , breadcrumb );
9293 model .addAttribute ("task" , task );
94+ model .addAttribute ("userSession" , userSession );
9395 return "taskstate/task/add" ;
9496 } else {
9597 task = taskService .addToInbox (task );
9698 log .info (task .toString ());
99+ model .addAttribute ("userSession" , userSession );
97100 return "redirect:/taskstate/" + task .getTaskState ().name ().toLowerCase ();
98101 }
99102 }
@@ -105,27 +108,24 @@ public final String editTaskGet(
105108 Locale locale , Model model
106109 ) {
107110 log .info ("editTaskGet" );
108- if (task != null ) {
109- UserAccount userAccount = userAccountLoginSuccessService .retrieveCurrentUser ();
110- List <Context > contexts = contextService .getAllForUser (userAccount );
111- Project thisProject ;
112- if (task .getContext () == null ) {
113- thisProject = new Project ();
114- thisProject .setId (0L );
115- } else {
116- thisProject = task .getProject ();
117- }
118- Context thisContext = task .getContext ();
119- Breadcrumb breadcrumb = breadcrumbService .getBreadcrumbForTaskstate (task .getTaskState (),locale );
120- model .addAttribute ("breadcrumb" , breadcrumb );
121- model .addAttribute ("thisProject" , thisProject );
122- model .addAttribute ("thisContext" , thisContext );
123- model .addAttribute ("task" , task );
124- model .addAttribute ("contextss" , contexts );
125- return "taskstate/task/edit" ;
111+ UserAccount userAccount = userAccountLoginSuccessService .retrieveCurrentUser ();
112+ List <Context > contexts = contextService .getAllForUser (userAccount );
113+ Project thisProject ;
114+ if (task .getContext () == null ) {
115+ thisProject = new Project ();
116+ thisProject .setId (0L );
126117 } else {
127- return "redirect:/taskstate/inbox" ;
118+ thisProject = task . getProject () ;
128119 }
120+ Context thisContext = task .getContext ();
121+ Breadcrumb breadcrumb = breadcrumbService .getBreadcrumbForTaskstate (task .getTaskState (),locale );
122+ model .addAttribute ("breadcrumb" , breadcrumb );
123+ model .addAttribute ("thisProject" , thisProject );
124+ model .addAttribute ("thisContext" , thisContext );
125+ model .addAttribute ("task" , task );
126+ model .addAttribute ("contexts" , contexts );
127+ model .addAttribute ("userSession" , userSession );
128+ return "taskstate/task/edit" ;
129129 }
130130
131131 @ RequestMapping (path = "/{taskId}/edit" , method = RequestMethod .POST )
@@ -172,13 +172,15 @@ public final String editTaskPost(
172172 model .addAttribute ("thisContext" , thisContext );
173173 model .addAttribute ("task" , task );
174174 model .addAttribute ("contexts" , contexts );
175+ model .addAttribute ("userSession" , userSession );
175176 return "taskstate/task/edit" ;
176177 } else {
177178 task .unsetFocus ();
178179 task .setRootProject ();
179180 Task persistentTask = taskService .findOne (task .getId ());
180181 persistentTask .merge (task );
181182 task = taskService .updatedViaTaskstate (persistentTask );
183+ model .addAttribute ("userSession" , userSession );
182184 return task .getTaskState ().getUrl ();
183185 }
184186 }
@@ -222,6 +224,7 @@ public final String moveTaskToInbox(
222224 ) {
223225 log .info ("dragged and dropped " +task .getId ()+" to inbox" );
224226 task = taskService .moveTaskToInbox (task );
227+ model .addAttribute ("userSession" , userSession );
225228 return task .getTaskState ().getUrl ();
226229 }
227230
@@ -233,6 +236,7 @@ public final String moveTaskToToday(
233236 ) {
234237 log .info ("dragged and dropped " +task .getId ()+" to today" );
235238 task = taskService .moveTaskToToday (task );
239+ model .addAttribute ("userSession" , userSession );
236240 return task .getTaskState ().getUrl ();
237241 }
238242
@@ -244,6 +248,7 @@ public final String moveTaskToNext(
244248 ) {
245249 log .info ("dragged and dropped " +task .getId ()+" to next" );
246250 task = taskService .moveTaskToNext (task );
251+ model .addAttribute ("userSession" , userSession );
247252 return task .getTaskState ().getUrl ();
248253 }
249254
@@ -255,6 +260,7 @@ public final String moveTaskToWaiting(
255260 ) {
256261 log .info ("dragged and dropped " +task .getId ()+" to waiting" );
257262 task = taskService .moveTaskToWaiting (task );
263+ model .addAttribute ("userSession" , userSession );
258264 return task .getTaskState ().getUrl ();
259265 }
260266
@@ -266,6 +272,7 @@ public final String moveTaskToSomeday(
266272 ) {
267273 log .info ("dragged and dropped " +task .getId ()+" to someday" );
268274 task = taskService .moveTaskToSomeday (task );
275+ model .addAttribute ("userSession" , userSession );
269276 return task .getTaskState ().getUrl ();
270277 }
271278
@@ -277,6 +284,7 @@ public final String moveTaskToFocus(
277284 ) {
278285 log .info ("dragged and dropped " +task .getId ()+" to focus" );
279286 task = taskService .moveTaskToFocus (task );
287+ model .addAttribute ("userSession" , userSession );
280288 return task .getTaskState ().getUrl ();
281289 }
282290
@@ -288,6 +296,7 @@ public final String moveTaskToCompleted(
288296 ) {
289297 log .info ("dragged and dropped " +task .getId ()+" to completed" );
290298 task = taskService .moveTaskToCompleted (task );
299+ model .addAttribute ("userSession" , userSession );
291300 return task .getTaskState ().getUrl ();
292301 }
293302
@@ -299,6 +308,7 @@ public final String moveTaskToTrash(
299308 ) {
300309 log .info ("dragged and dropped " +task .getId ()+" to trash" );
301310 task = taskService .moveTaskToTrash (task );
311+ model .addAttribute ("userSession" , userSession );
302312 return task .getTaskState ().getUrl ();
303313 }
304314
@@ -309,6 +319,7 @@ public final String moveAllCompletedToTrash(
309319 ) {
310320 Context context = super .getContext (userSession );
311321 taskService .moveAllCompletedToTrash (context );
322+ model .addAttribute ("userSession" , userSession );
312323 return "redirect:/taskstate/trash" ;
313324 }
314325
@@ -319,6 +330,7 @@ public final String emptyTrash(
319330 ) {
320331 Context context = super .getContext (userSession );
321332 taskService .emptyTrash (context );
333+ model .addAttribute ("userSession" , userSession );
322334 return "redirect:/taskstate/trash" ;
323335 }
324336
@@ -330,10 +342,9 @@ public final String deleteTaskGet(
330342 Model model
331343 ) {
332344 log .info ("deleteTaskGet" );
333- if (task != null ){
334- task .delete ();
335- taskService .updatedViaTaskstate (task );
336- }
345+ task .delete ();
346+ taskService .updatedViaTaskstate (task );
347+ model .addAttribute ("userSession" , userSession );
337348 return "redirect:/taskstate/trash" ;
338349 }
339350
@@ -346,6 +357,7 @@ public final String undeleteTaskGet(
346357 log .info ("undeleteTaskGet" );
347358 task .undelete ();
348359 taskService .updatedViaTaskstate (task );
360+ model .addAttribute ("userSession" , userSession );
349361 return "redirect:/taskstate/completed" ;
350362 }
351363
@@ -356,7 +368,7 @@ public final String transformTaskIntoProjectGet(
356368 Model model
357369 ) {
358370 log .info ("transformTaskIntoProjectGet" );
359- return taskProjektService .transformTaskIntoProjectGet (task );
371+ return taskProjektService .transformTaskIntoProjectGet (task , userSession , model );
360372 }
361373
362374 @ RequestMapping (path = "/{taskId}/complete" , method = RequestMethod .GET )
@@ -369,6 +381,7 @@ public final String setDoneTaskGet(
369381 long maxOrderIdTaskState = taskService .getMaxOrderIdTaskState (TaskState .COMPLETED ,task .getContext ());
370382 task .setOrderIdTaskState (++maxOrderIdTaskState );
371383 task = taskService .updatedViaTaskstate (task );
384+ model .addAttribute ("userSession" , userSession );
372385 return task .getUrl ();
373386 }
374387
@@ -382,6 +395,7 @@ public final String unsetDoneTaskGet(
382395 long maxOrderIdTaskState = taskService .getMaxOrderIdTaskState (task .getTaskState (),task .getContext ());
383396 task .setOrderIdTaskState (++maxOrderIdTaskState );
384397 task = taskService .updatedViaTaskstate (task );
398+ model .addAttribute ("userSession" , userSession );
385399 return task .getUrl ();
386400 }
387401
@@ -393,6 +407,7 @@ public final String setFocusGet(
393407 ){
394408 task .setFocus ();
395409 task = taskService .updatedViaTaskstate (task );
410+ model .addAttribute ("userSession" , userSession );
396411 return task .getUrl ();
397412 }
398413
@@ -404,6 +419,7 @@ public final String unsetFocusGet(
404419 ){
405420 task .unsetFocus ();
406421 task = taskService .updatedViaTaskstate (task );
422+ model .addAttribute ("userSession" , userSession );
407423 return task .getUrl ();
408424 }
409425}
0 commit comments