Projekt

Obecné

Profil

« Předchozí | Další » 

Revize ea163a4c

Přidáno uživatelem Michal Linha před téměř 4 roky(ů)

changed parameter fetch type in assembly to LAZY, added comments, added table name check, changed in assembly template to always load table name

Zobrazit rozdíly:

src/main/java/vldc/aswi/domain/Assembly.java
39 39
    private List<Configuration> configurations;
40 40

  
41 41
    /** List of parameters, which using this assembly. */
42
    @OneToMany(mappedBy = "assembly", fetch = FetchType.EAGER)
42
    @OneToMany(mappedBy = "assembly", fetch = FetchType.LAZY)
43 43
    private List<Parameter> parameters;
44 44

  
45 45
    /**
src/main/java/vldc/aswi/model/table/contingencyTable/ContingencyTableRow.java
55 55

  
56 56
    /**
57 57
     * Get level of current cell.
58
     * @return
58
     * @return Level uf current cell.
59 59
     */
60 60
    public int getLevel() {
61 61
        return level;
src/main/java/vldc/aswi/service/LocationManager.java
17 17

  
18 18
    /**
19 19
     * Get location from database by ID.
20
     * @return location by ID.
20
     * @param id ID of the location.
21
     * @return Location by ID.
21 22
     */
22 23
    public Location getLocationById(long id);
23 24
}
src/main/java/vldc/aswi/service/LocationManagerImpl.java
59 59

  
60 60
    /**
61 61
     * Get location from database by ID.
62
     * @return location by ID.
62
     * @param id ID of the location.
63
     * @return Location by ID.
63 64
     */
64 65
    @Override
65 66
    public Location getLocationById(long id) {
src/main/java/vldc/aswi/service/SqlQueryManagerImpl.java
47 47
                generateFullSQLQuery(assembly.getSQLQuery(), parametersInConfiguration)
48 48
        );
49 49

  
50
        // there was an error in the query
50 51
        if (tableColumns == null) {
51 52
            return null;
52 53
        }
53 54

  
55
        // no rows were returned by query
54 56
        if (tableColumns.values().iterator().next().getValues().size() == 0) {
55 57
            return new ArrayList<>();
56 58
        }
src/main/java/vldc/aswi/service/UserManagerImpl.java
28 28
@Slf4j
29 29
public class UserManagerImpl implements UserManager, UserDetailsService {
30 30

  
31
    /** Autowired user password encoder */
31 32
    @Autowired
32 33
    private PasswordEncoder encoder;
33 34

  
......
105 106
     * Add new user into database.
106 107
     * @param username - login username for user.
107 108
     * @param password - password for user.
109
     * @param roleId ID of the role.
108 110
     * @return ID of newly created user.
109 111
     */
110 112
    @Override
src/main/java/vldc/aswi/service/parameter/ParameterInConfigurationManager.java
20 20
    /**
21 21
     * Delete all parameters in configuration by configuration id.
22 22
     * @param id - ID of parameter / configuration.
23
     * @param configurationUsed Stores if configuration was used.
23 24
     * @return List of deleted parameters in configuration.
24 25
     */
25 26
    boolean deleteParametersInConfiguration(Long id, boolean configurationUsed);
26 27

  
27 28
    /**
28 29
     * Add newly created parameters to all configurations, which are created from current assembly
30
     * @param parameters Parameters to be added.
29 31
     * @param assemblyId - ID of current assembly.
30 32
     */
31 33
    void addParameterIntoConfigurations(Long assemblyId, ArrayList<Parameter> parameters);
src/main/java/vldc/aswi/service/parameter/ParameterInConfigurationManagerImpl.java
70 70
    /**
71 71
     * Add newly created parameters to all configurations, which are created from current assembly
72 72
     * @param assemblyId - ID of current assembly.
73
     * @param parameters Parameters to be added.
73 74
     */
74 75
    @Override
75 76
    public void addParameterIntoConfigurations(Long assemblyId, ArrayList<Parameter> parameters) {
......
96 97
    /**
97 98
     * Delete all parameters in configuration by configuration id.
98 99
     * @param id - ID of parameter / configuration.
100
     * @param configurationUsed Stores if configuration is used.
99 101
     * @return List of deleted parameters in configuration.
100 102
     */
101 103
    @Override
src/main/java/vldc/aswi/service/parameter/ParameterValueManagerImpl.java
27 27
    @Autowired
28 28
    private ParameterValueRepository parameterValueRepository;
29 29

  
30
    @Autowired
31
    private ParameterRepository parameterRepository;
32

  
33 30
    /**
34 31
     * Initialization setup for parameter value manager.
35 32
     * Check if table "Parametr_hodnota" exists.
src/main/java/vldc/aswi/web/controller/AssemblyController.java
198 198
        {
199 199
            Assembly assembly = this.assemblyManager.getAssemblyById(Long.parseLong(id));
200 200
            newConfiguration.setAssembly(assembly);
201
            newConfiguration.setTableName(assembly.getName());
201

  
202
            if (newConfiguration.getTableName() == null || newConfiguration.getTableName().equals("")) {
203
                newConfiguration.setTableName(assembly.getName());
204
            }
202 205

  
203 206
            // If configuration name is empty, then replace it by assembly name.
204 207
            if (newConfiguration.getName().equals("")) {
src/main/java/vldc/aswi/web/controller/IndexController.java
90 90
		return modelAndView;
91 91
	}
92 92

  
93
	/**
94
	 * Post method for index.
95
	 * @param id ID of the assembly.
96
	 * @return ModelAndView.
97
	 */
93 98
	@PostMapping("/")
94 99
	public ModelAndView indexPost(@Valid @ModelAttribute("assemblyID") String id) {
95 100
		ModelAndView modelAndView = new ModelAndView();
......
128 133
		return attributes;
129 134
	}
130 135

  
136
	/**
137
	 * Saves order of assemblies.
138
	 * @param data Data string with order of assemblies.
139
	 * @return Success message.
140
	 */
131 141
	@ResponseBody
132 142
	@RequestMapping("/saveOrder")
133 143
	public String saveOrder(@RequestBody String data) {
src/main/webapp/WEB-INF/templates/assembly.html
27 27
                    <div class="col-md-12 form-group row">
28 28
                        <label th:for="${tableName}" class="name-input-label">Titulek tabulky:</label>
29 29
                        <input type="text" class="form-control name-input" th:field="*{tableName}"
30
                               th:value="${configuration?.tableName}">
30
                               th:value="${configuration.tableName}">
31 31
                    </div>
32 32
                    <span>Parametry:</span>
33 33
                    <div class="col-md-9">

Také k dispozici: Unified diff