Revize a2e84e8c
Přidáno uživatelem Vojtěch Danišík před asi 4 roky(ů)
src/main/java/vldc/aswi/web/controller/AssemblyController.java | ||
---|---|---|
1 | 1 |
package vldc.aswi.web.controller; |
2 | 2 |
|
3 |
import oracle.jdbc.proxy.annotation.Post; |
|
3 | 4 |
import org.springframework.beans.factory.annotation.Autowired; |
4 | 5 |
import org.springframework.stereotype.Controller; |
5 | 6 |
import org.springframework.ui.ModelMap; |
... | ... | |
10 | 11 |
import org.springframework.web.servlet.ModelAndView; |
11 | 12 |
import org.springframework.web.servlet.mvc.support.RedirectAttributes; |
12 | 13 |
import vldc.aswi.domain.Assembly; |
13 |
import vldc.aswi.service.AssemblyManager; |
|
14 |
import vldc.aswi.service.SqlQueryManager; |
|
14 |
import vldc.aswi.domain.Role; |
|
15 |
import vldc.aswi.service.*; |
|
16 |
import vldc.aswi.service.parameter.ParameterTypeManager; |
|
15 | 17 |
|
16 | 18 |
import javax.validation.Valid; |
19 |
import java.util.ArrayList; |
|
20 |
import java.util.List; |
|
17 | 21 |
|
18 | 22 |
@Controller |
19 | 23 |
public class AssemblyController { |
... | ... | |
24 | 28 |
@Autowired |
25 | 29 |
private AssemblyManager assemblyManager; |
26 | 30 |
|
31 |
@Autowired |
|
32 |
private RoleManager roleManager; |
|
33 |
|
|
34 |
@Autowired |
|
35 |
private ParameterTypeManager parameterTypeManager; |
|
36 |
|
|
37 |
@Autowired |
|
38 |
private OperatorManager operatorManager; |
|
39 |
|
|
40 |
@Autowired |
|
41 |
private FunctionManager functionManager; |
|
42 |
|
|
43 |
@Autowired |
|
44 |
private LocationManager locationManager; |
|
45 |
|
|
27 | 46 |
@GetMapping("/assembly") |
28 | 47 |
public ModelAndView assemblyIndex(@Valid @ModelAttribute("assemblyID") String id) { |
29 | 48 |
ModelAndView modelAndView = new ModelAndView("assembly"); |
... | ... | |
46 | 65 |
ModelMap modelMap = modelAndView.getModelMap(); |
47 | 66 |
|
48 | 67 |
long assemblyID = assembly.getId(); |
49 |
System.out.println(assemblyID); |
|
50 |
Assembly assembly2 = assemblyManager.getAssemblyById(assemblyID); |
|
51 | 68 |
|
69 |
Assembly assembly2 = assemblyManager.getAssemblyById(assemblyID); |
|
52 | 70 |
|
53 | 71 |
modelMap.addAttribute("assemblies", assemblyManager.getAssemblies()); |
54 | 72 |
modelMap.addAttribute("assembly", assembly2); |
... | ... | |
59 | 77 |
|
60 | 78 |
@GetMapping("/assembly_edit") |
61 | 79 |
public ModelAndView assemblyEditIndex(@Valid @ModelAttribute("assemblyID") String id) { |
62 |
ModelAndView modelAndView = new ModelAndView("assembly_edit");
|
|
80 |
ModelAndView modelAndView = new ModelAndView("assembly_manage");
|
|
63 | 81 |
|
64 | 82 |
ModelMap modelMap = modelAndView.getModelMap(); |
65 | 83 |
|
66 | 84 |
Assembly assembly = assemblyManager.getAssemblyById(Long.parseLong(id)); |
67 | 85 |
|
68 |
modelMap.addAttribute("assemblies", assemblyManager.getAssemblies()); |
|
69 | 86 |
modelMap.addAttribute("assembly", assembly); |
87 |
modelMap.addAttribute("roles", roleManager.getRoles()); |
|
88 |
modelMap.addAttribute("rolesWithAccess", assembly.getRoles()); |
|
89 |
modelMap.addAttribute("parameters", assembly.getParameters()); |
|
90 |
modelMap.addAttribute("parameterTypes", parameterTypeManager.getParameterTypes()); |
|
91 |
modelMap.addAttribute("functions", functionManager.getFunctions()); |
|
92 |
modelMap.addAttribute("operators", operatorManager.getOperators()); |
|
93 |
modelMap.addAttribute("locations", locationManager.getLocations()); |
|
94 |
|
|
95 |
return modelAndView; |
|
96 |
} |
|
97 |
|
|
98 |
@GetMapping("/assembly_new") |
|
99 |
public ModelAndView assemblyNewIndex() { |
|
100 |
ModelAndView modelAndView = new ModelAndView("assembly_manage"); |
|
101 |
|
|
102 |
ModelMap modelMap = modelAndView.getModelMap(); |
|
103 |
|
|
104 |
modelMap.addAttribute("assembly", new Assembly()); |
|
105 |
modelMap.addAttribute("roles", roleManager.getRoles()); |
|
106 |
|
|
107 |
return modelAndView; |
|
108 |
} |
|
109 |
|
|
110 |
@PostMapping("/assembly_new") |
|
111 |
public ModelAndView assemblyNewIndexPost() { |
|
112 |
ModelAndView modelAndView = new ModelAndView("assembly_manage"); |
|
113 |
|
|
114 |
ModelMap modelMap = modelAndView.getModelMap(); |
|
115 |
|
|
116 |
modelMap.addAttribute("assembly", new Assembly()); |
|
117 |
modelMap.addAttribute("roles", roleManager.getRoles()); |
|
70 | 118 |
|
71 | 119 |
return modelAndView; |
72 | 120 |
} |
Také k dispozici: Unified diff
re #7886 Creating + Editing assembly
Not working: Adding new role to access list, Loading values for parameter, Adding new values for parameter, disabling functions + operators if data type = enumeration, deleting role from Access list, Deleting parameter. Saving new assembly + checking all form elements.
Added new sql script file for creating test records.
re #7888 Added back button for Creating + Editing assembly page and page for Generating contingency table.