@@ -155,7 +155,7 @@ public final String projectAddProjectGet(
155155 log .info ("private addNewProjectGet (GET) projectId=" +projectId );
156156 Context context = super .getContext (userSession );
157157 projectControllerService .addNewProject (projectId , userSession , context , locale , model );
158- return "project/id/add/ project" ;
158+ return "project/id/project/add " ;
159159 }
160160
161161 @ RequestMapping (path = "/project/add" , method = {RequestMethod .POST })
@@ -175,7 +175,7 @@ public final String projectAddProjectPost(
175175 result ,
176176 locale ,
177177 model ,
178- "/add /project"
178+ "project/id /project/add "
179179 );
180180 }
181181
@@ -191,8 +191,8 @@ public final String projectMoveToProjectGet(
191191 userSession .setLastProjectId (thisProject .getId ());
192192 model .addAttribute ("userSession" ,userSession );
193193 Project targetProject = projectService .findByProjectId (targetProjectId );
194- projectService .moveProjectToAnotherProject (thisProject , targetProject );
195- return "redirect:/project/" + thisProject .getId ();
194+ thisProject = projectService .moveProjectToAnotherProject (thisProject , targetProject );
195+ return thisProject .getUrl ();
196196 }
197197
198198 @ RequestMapping (path = "/edit" , method = RequestMethod .GET )
@@ -225,29 +225,32 @@ public final String projectEditPost(
225225 Context context = super .getContext (userSession );
226226 UserAccount thisUser = context .getUserAccount ();
227227 model .addAttribute ("userSession" , userSession );
228+ Project thisProject ;
228229 if (result .hasErrors ()) {
229230 for (ObjectError e : result .getAllErrors ()) {
230231 log .info (e .toString ());
231232 }
232- Project thisProject = projectService .findByProjectId (projectId );
233+ thisProject = projectService .findByProjectId (projectId );
233234 Breadcrumb breadcrumb = breadcrumbService .getBreadcrumbForShowOneProject (thisProject ,locale );
234235 model .addAttribute ("breadcrumb" , breadcrumb );
235236 return "project/id/edit" ;
236237 } else {
237- Project thisProject = projectService .findByProjectId (project .getId ());
238+ thisProject = projectService .findByProjectId (project .getId ());
238239 thisProject .setName (project .getName ());
239240 thisProject .setDescription (project .getDescription ());
240241 Context newContext = project .getContext ();
241242 boolean contextChanged = (newContext .getId ().longValue () != thisProject .getContext ().getId ().longValue ());
242243 if (contextChanged ){
243244 long newContextId = newContext .getId ();
244245 newContext = contextService .findByIdAndUserAccount (newContextId , thisUser );
245- projectService .moveProjectToAnotherContext (thisProject , newContext );
246- model . addAttribute ( "userSession" , new UserSessionBean ( newContextId ) );
246+ thisProject = projectService .moveProjectToAnotherContext (thisProject , newContext );
247+ userSession . setLastContextId ( newContextId );
247248 } else {
248- projectService .saveAndFlush (thisProject );
249+ thisProject = projectService .saveAndFlush (thisProject );
249250 }
250- return "redirect:/project/" + projectId ;
251+ userSession .setLastProjectId (thisProject .getId ());
252+ model .addAttribute ("userSession" , userSession );
253+ return thisProject .getUrl ();
251254 }
252255 }
253256
0 commit comments