Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 50ee5dd5

Přidáno uživatelem Jan Čarnogurský před asi 4 roky(ů)

re #8114 - added redirect after edit

Zobrazit rozdíly:

src/main/java/vldc/aswi/web/controller/AssemblyController.java
6 6
import org.springframework.security.core.GrantedAuthority;
7 7
import org.springframework.security.core.context.SecurityContextHolder;
8 8
import org.springframework.stereotype.Controller;
9
import org.springframework.transaction.annotation.Propagation;
10
import org.springframework.transaction.annotation.Transactional;
9 11
import org.springframework.ui.ModelMap;
10 12
import org.springframework.validation.BindingResult;
11 13
import org.springframework.web.bind.WebDataBinder;
......
16 18
import org.springframework.web.bind.annotation.RequestParam;
17 19
import org.springframework.web.servlet.ModelAndView;
18 20
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
21
import org.springframework.web.servlet.view.RedirectView;
19 22
import vldc.aswi.domain.*;
20 23
import vldc.aswi.domain.parameter.Parameter;
21 24
import vldc.aswi.domain.parameter.ParameterInConfiguration;
......
262 265
     */
263 266
    @PostMapping("/assembly_edit")
264 267
    public ModelAndView assemblyEditPost(@Valid @ModelAttribute("assembly") Assembly assembly, BindingResult result,
265
                                              @Valid @ModelAttribute("checkboxPublic") String assemblyIsPublic) {
268
                                              @Valid @ModelAttribute("checkboxPublic") String assemblyIsPublic, RedirectAttributes redirectAttributes) {
266 269
        long startTime = System.currentTimeMillis();
267 270
        ModelAndView modelAndView = new ModelAndView("assembly_manage");
268 271
        ModelMap modelMap = modelAndView.getModelMap();
......
286 289
            modelMap.addAttribute(assemblyTitleName, assemblyEditTitleText + " " + updatedAssembly.getName());
287 290
        }
288 291

  
292
        long estimatedTime = System.currentTimeMillis() - startTime;
293
        System.out.println("EDIT POST estimated - " + ((double)estimatedTime / 1000) + " sekund ");
294

  
295
        redirectAttributes.addAttribute("assemblyID", assembly.getId());
296
        return new ModelAndView("redirect:/assembly_edit");
297
/*
289 298
        modelMap.addAttribute("allRoles", this.roleManager.getRoles());
290 299
        modelMap.addAttribute("allParameterTypes", this.parameterTypeManager.getParameterTypes());
291 300
        modelMap.addAttribute("allFunctions", this.functionManager.getFunctions());
292 301
        modelMap.addAttribute("allOperators", this.operatorManager.getOperators());
293 302
        modelMap.addAttribute("allLocations", this.locationManager.getLocations());
294
        long estimatedTime = System.currentTimeMillis() - startTime;
295
        System.out.println("EDIT POST estimated - " + ((double)estimatedTime / 1000) + " sekund ");
296 303

  
297
        return modelAndView;
304

  
305
        return modelAndView;*/
298 306
    }
299 307

  
300 308
    /**

Také k dispozici: Unified diff