Revize 621e3fca
Přidáno uživatelem Vojtěch Danišík před téměř 5 roky(ů)
src/main/java/vldc/aswi/domain/Assembly.java | ||
---|---|---|
44 | 44 |
|
45 | 45 |
/** |
46 | 46 |
* Creating new table with M:N relationship between Assembly and Role. |
47 |
* Every assembly can be used by 0 - every role. |
|
48 | 47 |
*/ |
49 | 48 |
@ManyToMany |
50 | 49 |
@JoinTable( |
src/main/java/vldc/aswi/domain/parameter/Parameter.java | ||
---|---|---|
47 | 47 |
private List<ParameterInConfiguration> parametersInConfiguration; |
48 | 48 |
|
49 | 49 |
/** List of parametersInConfiguration, which using this parameter. */ |
50 |
@OneToMany(mappedBy = "parameter") |
|
50 |
@OneToMany(mappedBy = "parameter", fetch = FetchType.EAGER)
|
|
51 | 51 |
private List<ParameterValue> parameterValues; |
52 | 52 |
|
53 | 53 |
/** |
src/main/java/vldc/aswi/service/AssemblyManagerImpl.java | ||
---|---|---|
5 | 5 |
import org.springframework.context.event.ContextRefreshedEvent; |
6 | 6 |
import org.springframework.context.event.EventListener; |
7 | 7 |
import org.springframework.core.annotation.Order; |
8 |
import org.springframework.dao.InvalidDataAccessResourceUsageException; |
|
8 | 9 |
import org.springframework.stereotype.Service; |
9 | 10 |
import vldc.aswi.dao.AssemblyRepository; |
10 | 11 |
import vldc.aswi.dao.RoleRepository; |
... | ... | |
42 | 43 |
private ParameterManager parameterManager; |
43 | 44 |
|
44 | 45 |
/** |
45 |
* Initialization setup for assembly manager. Check if assembly repository contains
|
|
46 |
* records and if not, initialize default values.
|
|
46 |
* Initialization setup for assembly manager. |
|
47 |
* Check if table "Sestava" exists.
|
|
47 | 48 |
*/ |
48 | 49 |
@EventListener(classes = { |
49 | 50 |
ContextRefreshedEvent.class |
... | ... | |
51 | 52 |
@Order(1) |
52 | 53 |
@Transactional |
53 | 54 |
public void setup() { |
54 |
if (this.assemblyRepository.count() == 0) { |
|
55 |
log.info("No assembly present, creating items."); |
|
56 |
|
|
55 |
try { |
|
56 |
if (this.assemblyRepository.count() == 0) { |
|
57 |
// Just checking if table exists. |
|
58 |
} |
|
59 |
} |
|
60 |
catch (InvalidDataAccessResourceUsageException e) { |
|
61 |
log.error("Table \"Sestava\" did not exists in database!"); |
|
62 |
System.exit(1); |
|
57 | 63 |
} |
58 | 64 |
} |
59 | 65 |
|
src/main/java/vldc/aswi/service/ConfigurationManagerImpl.java | ||
---|---|---|
5 | 5 |
import org.springframework.context.event.ContextRefreshedEvent; |
6 | 6 |
import org.springframework.context.event.EventListener; |
7 | 7 |
import org.springframework.core.annotation.Order; |
8 |
import org.springframework.dao.InvalidDataAccessResourceUsageException; |
|
8 | 9 |
import org.springframework.stereotype.Service; |
9 | 10 |
import vldc.aswi.dao.*; |
10 | 11 |
import vldc.aswi.dao.parameter.ParameterInConfigurationRepository; |
... | ... | |
59 | 60 |
private ParameterInConfigurationManager parameterInConfigurationManager; |
60 | 61 |
|
61 | 62 |
/** |
62 |
* Initialization setup for configuration manager. Check if configuration repository contains
|
|
63 |
* records and if not, initialize default values.
|
|
63 |
* Initialization setup for configuration manager. |
|
64 |
* Check if table "Konfigurace" exists.
|
|
64 | 65 |
*/ |
65 | 66 |
@EventListener(classes = { |
66 | 67 |
ContextRefreshedEvent.class |
67 | 68 |
}) |
68 |
@Order(1)
|
|
69 |
@Order(3)
|
|
69 | 70 |
@Transactional |
70 | 71 |
public void setup() { |
71 |
if (this.configurationRepository.count() == 0) { |
|
72 |
log.info("No configuration present, creating items."); |
|
73 |
|
|
72 |
try { |
|
73 |
if (this.configurationRepository.count() == 0) { |
|
74 |
// Just checking if table exists. |
|
75 |
} |
|
76 |
} |
|
77 |
catch (InvalidDataAccessResourceUsageException e) { |
|
78 |
log.error("Table \"Konfigurace\" did not exists in database!"); |
|
79 |
System.exit(1); |
|
74 | 80 |
} |
75 | 81 |
} |
76 | 82 |
|
... | ... | |
174 | 180 |
Configuration savedConfiguration = configurationRepository.save(configuration); |
175 | 181 |
|
176 | 182 |
savedConfiguration.setParametersInConfiguration(new ArrayList<>()); |
177 |
for(int i = 0; i < newConfiguration.getParametersInConfiguration().size(); i++) { |
|
178 |
ParameterInConfiguration parameterInConfiguration = new ParameterInConfiguration(); |
|
179 |
parameterInConfiguration.setParameter(assembly.getParameters().get(i)); |
|
180 |
parameterInConfiguration.setConfiguration(savedConfiguration); |
|
181 |
parameterInConfiguration.setParameterOrder(newConfiguration.getParametersInConfiguration().get(i).getParameterOrder()); |
|
182 |
parameterInConfiguration.setOperatorValue(newConfiguration.getParametersInConfiguration().get(i).getOperatorValue()); |
|
183 |
parameterInConfiguration.setColumnName(assembly.getParameters().get(i).getName()); |
|
184 |
if(newConfiguration.getParametersInConfiguration().get(i).getColumnName() != null && |
|
185 |
!newConfiguration.getParametersInConfiguration().get(i).getColumnName().equals("")) { |
|
186 |
parameterInConfiguration.setColumnName(newConfiguration.getParametersInConfiguration().get(i).getColumnName()); |
|
187 |
} |
|
188 |
if(newConfiguration.getParametersInConfiguration().get(i).getLocation() != null) { |
|
189 |
parameterInConfiguration.setLocation(locationRepository.getById( |
|
190 |
newConfiguration.getParametersInConfiguration().get(i).getLocation().getId())); |
|
191 |
} |
|
192 |
if(newConfiguration.getParametersInConfiguration().get(i).getOperator() != null) { |
|
193 |
parameterInConfiguration.setOperator(operatorRepository.getByName( |
|
194 |
newConfiguration.getParametersInConfiguration().get(i).getOperator().getName())); |
|
195 |
} |
|
196 |
if(newConfiguration.getParametersInConfiguration().get(i).getFunctions() != null) { |
|
197 |
parameterInConfiguration.setFunctions(new ArrayList<>()); |
|
198 |
for (Function function : newConfiguration.getParametersInConfiguration().get(i).getFunctions()) { |
|
199 |
parameterInConfiguration.getFunctions().add(functionRepository.getByName(function.getName())); |
|
183 |
|
|
184 |
if (newConfiguration.getParametersInConfiguration() != null) { |
|
185 |
for (int i = 0; i < newConfiguration.getParametersInConfiguration().size(); i++) { |
|
186 |
ParameterInConfiguration parameterInConfiguration = new ParameterInConfiguration(); |
|
187 |
parameterInConfiguration.setParameter(assembly.getParameters().get(i)); |
|
188 |
parameterInConfiguration.setConfiguration(savedConfiguration); |
|
189 |
parameterInConfiguration.setParameterOrder(newConfiguration.getParametersInConfiguration().get(i).getParameterOrder()); |
|
190 |
parameterInConfiguration.setOperatorValue(newConfiguration.getParametersInConfiguration().get(i).getOperatorValue()); |
|
191 |
parameterInConfiguration.setColumnName(assembly.getParameters().get(i).getName()); |
|
192 |
if (newConfiguration.getParametersInConfiguration().get(i).getColumnName() != null && |
|
193 |
!newConfiguration.getParametersInConfiguration().get(i).getColumnName().equals("")) { |
|
194 |
parameterInConfiguration.setColumnName(newConfiguration.getParametersInConfiguration().get(i).getColumnName()); |
|
195 |
} |
|
196 |
if (newConfiguration.getParametersInConfiguration().get(i).getLocation() != null) { |
|
197 |
parameterInConfiguration.setLocation(locationRepository.getById( |
|
198 |
newConfiguration.getParametersInConfiguration().get(i).getLocation().getId())); |
|
199 |
} |
|
200 |
if (newConfiguration.getParametersInConfiguration().get(i).getOperator() != null) { |
|
201 |
parameterInConfiguration.setOperator(operatorRepository.getByName( |
|
202 |
newConfiguration.getParametersInConfiguration().get(i).getOperator().getName())); |
|
203 |
} |
|
204 |
if (newConfiguration.getParametersInConfiguration().get(i).getFunctions() != null) { |
|
205 |
parameterInConfiguration.setFunctions(new ArrayList<>()); |
|
206 |
for (Function function : newConfiguration.getParametersInConfiguration().get(i).getFunctions()) { |
|
207 |
parameterInConfiguration.getFunctions().add(functionRepository.getByName(function.getName())); |
|
208 |
} |
|
200 | 209 |
} |
210 |
ParameterInConfiguration savedParameterInConfiguration = parameterInConfigurationRepository.save( |
|
211 |
parameterInConfiguration); |
|
212 |
savedConfiguration.getParametersInConfiguration().add(savedParameterInConfiguration); |
|
201 | 213 |
} |
202 |
ParameterInConfiguration savedParameterInConfiguration = parameterInConfigurationRepository.save( |
|
203 |
parameterInConfiguration); |
|
204 |
savedConfiguration.getParametersInConfiguration().add(savedParameterInConfiguration); |
|
205 | 214 |
} |
206 | 215 |
savedConfiguration = configurationRepository.save(savedConfiguration); |
207 | 216 |
|
src/main/java/vldc/aswi/service/FunctionManagerImpl.java | ||
---|---|---|
5 | 5 |
import org.springframework.context.event.ContextRefreshedEvent; |
6 | 6 |
import org.springframework.context.event.EventListener; |
7 | 7 |
import org.springframework.core.annotation.Order; |
8 |
import org.springframework.dao.InvalidDataAccessResourceUsageException; |
|
8 | 9 |
import org.springframework.stereotype.Service; |
9 | 10 |
import vldc.aswi.dao.FunctionRepository; |
10 | 11 |
import vldc.aswi.domain.Function; |
... | ... | |
25 | 26 |
private FunctionRepository functionRepository; |
26 | 27 |
|
27 | 28 |
/** |
28 |
* Initialization setup for function manager. Check if function repository contains
|
|
29 |
* records and if not, initialize default values.
|
|
29 |
* Initialization setup for function manager. |
|
30 |
* Check if table "Funkce" exists.
|
|
30 | 31 |
*/ |
31 | 32 |
@EventListener(classes = { |
32 | 33 |
ContextRefreshedEvent.class |
... | ... | |
34 | 35 |
@Order(1) |
35 | 36 |
@Transactional |
36 | 37 |
public void setup() { |
37 |
if (this.functionRepository.count() == 0) { |
|
38 |
log.info("No function present, creating items."); |
|
39 |
|
|
38 |
try { |
|
39 |
if (this.functionRepository.count() == 0) { |
|
40 |
// Just checking if table exists. |
|
41 |
} |
|
42 |
} |
|
43 |
catch (InvalidDataAccessResourceUsageException e) { |
|
44 |
log.error("Table \"Funkce\" did not exists in database!"); |
|
45 |
System.exit(1); |
|
40 | 46 |
} |
41 | 47 |
} |
42 | 48 |
|
src/main/java/vldc/aswi/service/LocationManagerImpl.java | ||
---|---|---|
5 | 5 |
import org.springframework.context.event.ContextRefreshedEvent; |
6 | 6 |
import org.springframework.context.event.EventListener; |
7 | 7 |
import org.springframework.core.annotation.Order; |
8 |
import org.springframework.dao.InvalidDataAccessResourceUsageException; |
|
8 | 9 |
import org.springframework.stereotype.Service; |
9 | 10 |
import vldc.aswi.dao.LocationRepository; |
10 | 11 |
import vldc.aswi.domain.Location; |
... | ... | |
25 | 26 |
private LocationRepository locationRepository; |
26 | 27 |
|
27 | 28 |
/** |
28 |
* Initialization setup for location manager. Check if location repository contains
|
|
29 |
* records and if not, initialize default values.
|
|
29 |
* Initialization setup for location manager. |
|
30 |
* Check if table "Umisteni" exists.
|
|
30 | 31 |
*/ |
31 | 32 |
@EventListener(classes = { |
32 | 33 |
ContextRefreshedEvent.class |
... | ... | |
34 | 35 |
@Order(1) |
35 | 36 |
@Transactional |
36 | 37 |
public void setup() { |
37 |
if (this.locationRepository.count() == 0) { |
|
38 |
log.info("No location present, creating items."); |
|
39 |
|
|
38 |
try { |
|
39 |
if (this.locationRepository.count() == 0) { |
|
40 |
// Just checking if table exists. |
|
41 |
} |
|
42 |
} |
|
43 |
catch (InvalidDataAccessResourceUsageException e) { |
|
44 |
log.error("Table \"Umisteni\" did not exists in database!"); |
|
45 |
System.exit(1); |
|
40 | 46 |
} |
41 | 47 |
} |
42 | 48 |
|
src/main/java/vldc/aswi/service/OperatorManagerImpl.java | ||
---|---|---|
5 | 5 |
import org.springframework.context.event.ContextRefreshedEvent; |
6 | 6 |
import org.springframework.context.event.EventListener; |
7 | 7 |
import org.springframework.core.annotation.Order; |
8 |
import org.springframework.dao.InvalidDataAccessResourceUsageException; |
|
8 | 9 |
import org.springframework.stereotype.Service; |
9 | 10 |
import vldc.aswi.dao.OperatorRepository; |
10 | 11 |
import vldc.aswi.domain.Operator; |
... | ... | |
25 | 26 |
private OperatorRepository operatorRepository; |
26 | 27 |
|
27 | 28 |
/** |
28 |
* Initialization setup for operator manager. Check if operator repository contains
|
|
29 |
* records and if not, initialize default values.
|
|
29 |
* Initialization setup for operator manager. |
|
30 |
* Check if table "Operator" exists.
|
|
30 | 31 |
*/ |
31 | 32 |
@EventListener(classes = { |
32 | 33 |
ContextRefreshedEvent.class |
... | ... | |
34 | 35 |
@Order(1) |
35 | 36 |
@Transactional |
36 | 37 |
public void setup() { |
37 |
if (this.operatorRepository.count() == 0) { |
|
38 |
log.info("No operator present, creating items."); |
|
39 |
|
|
38 |
try { |
|
39 |
if (this.operatorRepository.count() == 0) { |
|
40 |
// Just checking if table exists. |
|
41 |
} |
|
42 |
} |
|
43 |
catch (InvalidDataAccessResourceUsageException e) { |
|
44 |
log.error("Table \"Operator\" did not exists in database!"); |
|
45 |
System.exit(1); |
|
40 | 46 |
} |
41 | 47 |
} |
42 | 48 |
|
src/main/java/vldc/aswi/service/RoleManagerImpl.java | ||
---|---|---|
5 | 5 |
import org.springframework.context.event.ContextRefreshedEvent; |
6 | 6 |
import org.springframework.context.event.EventListener; |
7 | 7 |
import org.springframework.core.annotation.Order; |
8 |
import org.springframework.dao.InvalidDataAccessResourceUsageException; |
|
8 | 9 |
import org.springframework.stereotype.Service; |
9 | 10 |
import vldc.aswi.dao.RoleRepository; |
10 | 11 |
import vldc.aswi.domain.Role; |
... | ... | |
25 | 26 |
private RoleRepository roleRepository; |
26 | 27 |
|
27 | 28 |
/** |
28 |
* Initialization setup for role manager. Check if role repository contains records and if not, initialize default values. |
|
29 |
* Initialization setup for role manager. |
|
30 |
* Check if table "Role" exists. |
|
29 | 31 |
*/ |
30 |
/* |
|
31 | 32 |
@EventListener(classes = { |
32 | 33 |
ContextRefreshedEvent.class |
33 | 34 |
}) |
34 | 35 |
@Order(1) |
35 | 36 |
@Transactional |
36 | 37 |
public void setup() { |
37 |
if (this.roleRepository.count() == 0) { |
|
38 |
log.info("No role present, creating 'Admin', 'Studijni referentka', 'Prorektor'."); |
|
39 |
this.addRole("Admin"); |
|
40 |
this.addRole("Studijni referentka"); |
|
41 |
this.addRole("Prorektor"); |
|
38 |
try { |
|
39 |
if (this.roleRepository.count() == 0) { |
|
40 |
// Just checking if table exists. |
|
41 |
} |
|
42 |
} |
|
43 |
catch (InvalidDataAccessResourceUsageException e) { |
|
44 |
log.error("Table \"Role\" did not exists in database!"); |
|
45 |
System.exit(1); |
|
42 | 46 |
} |
43 | 47 |
} |
44 |
*/ |
|
45 | 48 |
|
46 | 49 |
/** |
47 | 50 |
* Add newly created role into database. |
src/main/java/vldc/aswi/service/UserManagerImpl.java | ||
---|---|---|
5 | 5 |
import org.springframework.context.event.ContextRefreshedEvent; |
6 | 6 |
import org.springframework.context.event.EventListener; |
7 | 7 |
import org.springframework.core.annotation.Order; |
8 |
import org.springframework.dao.InvalidDataAccessResourceUsageException; |
|
8 | 9 |
import org.springframework.security.core.userdetails.UserDetails; |
9 | 10 |
import org.springframework.security.core.userdetails.UserDetailsService; |
10 | 11 |
import org.springframework.security.core.userdetails.UsernameNotFoundException; |
... | ... | |
39 | 40 |
private RoleRepository roleRepository; |
40 | 41 |
|
41 | 42 |
/** |
42 |
* Initialization setup for user manager. Check if user repository contains records and if not, initialize default values. |
|
43 |
* Initialization setup for user manager. |
|
44 |
* Check if table "Uzivatel" exists. |
|
43 | 45 |
*/ |
44 | 46 |
@EventListener(classes = { |
45 |
ContextRefreshedEvent.class |
|
47 |
ContextRefreshedEvent.class,
|
|
46 | 48 |
}) |
47 |
@Order(1)
|
|
49 |
@Order(2)
|
|
48 | 50 |
@Transactional |
49 | 51 |
public void setup() { |
50 |
if (this.userRepository.count() == 0) {
|
|
51 |
log.info("No user present");
|
|
52 |
/*
|
|
53 |
this.addUser("administrator", "demo", (long) 1);
|
|
54 |
this.addUser("fakulta", "demo", (long) 2);
|
|
55 |
this.addUser("referentka", "demo", (long) 3);
|
|
56 |
this.addUser("prorektor", "demo", (long) 4);
|
|
57 |
*/
|
|
52 |
try {
|
|
53 |
if (this.userRepository.count() == 0) {
|
|
54 |
// Just checking if table exists.
|
|
55 |
}
|
|
56 |
}
|
|
57 |
catch (InvalidDataAccessResourceUsageException e) {
|
|
58 |
log.error("Table \"Uzivatel\" did not exists in database!");
|
|
59 |
System.exit(1);
|
|
58 | 60 |
} |
59 | 61 |
} |
60 | 62 |
|
src/main/java/vldc/aswi/service/parameter/ParameterInConfigurationManagerImpl.java | ||
---|---|---|
5 | 5 |
import org.springframework.context.event.ContextRefreshedEvent; |
6 | 6 |
import org.springframework.context.event.EventListener; |
7 | 7 |
import org.springframework.core.annotation.Order; |
8 |
import org.springframework.dao.InvalidDataAccessResourceUsageException; |
|
8 | 9 |
import org.springframework.stereotype.Service; |
9 | 10 |
import vldc.aswi.dao.parameter.ParameterInConfigurationRepository; |
10 | 11 |
import vldc.aswi.domain.Function; |
... | ... | |
27 | 28 |
private ParameterInConfigurationRepository parameterInConfigurationRepository; |
28 | 29 |
|
29 | 30 |
/** |
30 |
* Initialization setup for parameter in configuration manager. Check if parameter in configuration repository
|
|
31 |
* contains records and if not, initialize default values.
|
|
31 |
* Initialization setup for parameter in configuration manager. |
|
32 |
* Check if table "Parametr_konfigurace" exists.
|
|
32 | 33 |
*/ |
33 | 34 |
@EventListener(classes = { |
34 | 35 |
ContextRefreshedEvent.class |
35 | 36 |
}) |
36 |
@Order(1)
|
|
37 |
@Order(4)
|
|
37 | 38 |
@Transactional |
38 | 39 |
public void setup() { |
39 |
if (this.parameterInConfigurationRepository.count() == 0) { |
|
40 |
log.info("No parameter in configuration present, creating items."); |
|
41 |
|
|
40 |
try { |
|
41 |
if (this.parameterInConfigurationRepository.count() == 0) { |
|
42 |
// Just checking if table exists. |
|
43 |
} |
|
44 |
} |
|
45 |
catch (InvalidDataAccessResourceUsageException e) { |
|
46 |
log.error("Table \"Parametr_konfigurace\" did not exists in database!"); |
|
47 |
System.exit(1); |
|
42 | 48 |
} |
43 | 49 |
} |
44 | 50 |
|
src/main/java/vldc/aswi/service/parameter/ParameterManagerImpl.java | ||
---|---|---|
5 | 5 |
import org.springframework.context.event.ContextRefreshedEvent; |
6 | 6 |
import org.springframework.context.event.EventListener; |
7 | 7 |
import org.springframework.core.annotation.Order; |
8 |
import org.springframework.dao.InvalidDataAccessResourceUsageException; |
|
8 | 9 |
import org.springframework.stereotype.Service; |
9 | 10 |
import vldc.aswi.dao.AssemblyRepository; |
10 | 11 |
import vldc.aswi.dao.FunctionRepository; |
... | ... | |
64 | 65 |
private ParameterInConfigurationManager parameterInConfigurationManager; |
65 | 66 |
|
66 | 67 |
/** |
67 |
* Initialization setup for parameter manager. Check if parameter repository contains
|
|
68 |
* records and if not, initialize default values.
|
|
68 |
* Initialization setup for parameter manager. |
|
69 |
* Check if table "Parametr" exists.
|
|
69 | 70 |
*/ |
70 | 71 |
@EventListener(classes = { |
71 | 72 |
ContextRefreshedEvent.class |
72 | 73 |
}) |
73 |
@Order(1)
|
|
74 |
@Order(2)
|
|
74 | 75 |
@Transactional |
75 | 76 |
public void setup() { |
76 |
if (this.parameterRepository.count() == 0) { |
|
77 |
log.info("No parameter present, creating items."); |
|
78 |
|
|
77 |
try { |
|
78 |
if (this.parameterRepository.count() == 0) { |
|
79 |
// Just checking if table exists. |
|
80 |
} |
|
81 |
} |
|
82 |
catch (InvalidDataAccessResourceUsageException e) { |
|
83 |
log.error("Table \"Parametr\" did not exists in database!"); |
|
84 |
System.exit(1); |
|
79 | 85 |
} |
80 | 86 |
} |
81 | 87 |
|
src/main/java/vldc/aswi/service/parameter/ParameterTypeManagerImpl.java | ||
---|---|---|
5 | 5 |
import org.springframework.context.event.ContextRefreshedEvent; |
6 | 6 |
import org.springframework.context.event.EventListener; |
7 | 7 |
import org.springframework.core.annotation.Order; |
8 |
import org.springframework.dao.InvalidDataAccessResourceUsageException; |
|
8 | 9 |
import org.springframework.stereotype.Service; |
9 | 10 |
import vldc.aswi.dao.parameter.ParameterTypeRepository; |
10 | 11 |
import vldc.aswi.domain.parameter.ParameterType; |
... | ... | |
25 | 26 |
private ParameterTypeRepository parameterTypeRepository; |
26 | 27 |
|
27 | 28 |
/** |
28 |
* Initialization setup for parameter type manager. Check if parameter type repository contains
|
|
29 |
* records and if not, initialize default values.
|
|
29 |
* Initialization setup for parameter type manager. |
|
30 |
* Check if table "Parametr_typ" exists.
|
|
30 | 31 |
*/ |
31 | 32 |
@EventListener(classes = { |
32 | 33 |
ContextRefreshedEvent.class |
... | ... | |
34 | 35 |
@Order(1) |
35 | 36 |
@Transactional |
36 | 37 |
public void setup() { |
37 |
if (this.parameterTypeRepository.count() == 0) { |
|
38 |
log.info("No parameter type present, creating items."); |
|
39 |
|
|
38 |
try { |
|
39 |
if (this.parameterTypeRepository.count() == 0) { |
|
40 |
// Just checking if table exists. |
|
41 |
} |
|
42 |
} |
|
43 |
catch (InvalidDataAccessResourceUsageException e) { |
|
44 |
log.error("Table \"Parametr_typ\" did not exists in database!"); |
|
45 |
System.exit(1); |
|
40 | 46 |
} |
41 | 47 |
} |
42 | 48 |
|
src/main/java/vldc/aswi/service/parameter/ParameterValueManagerImpl.java | ||
---|---|---|
5 | 5 |
import org.springframework.context.event.ContextRefreshedEvent; |
6 | 6 |
import org.springframework.context.event.EventListener; |
7 | 7 |
import org.springframework.core.annotation.Order; |
8 |
import org.springframework.dao.InvalidDataAccessResourceUsageException; |
|
8 | 9 |
import org.springframework.stereotype.Service; |
9 | 10 |
import vldc.aswi.dao.parameter.ParameterRepository; |
10 | 11 |
import vldc.aswi.dao.parameter.ParameterValueRepository; |
... | ... | |
30 | 31 |
private ParameterRepository parameterRepository; |
31 | 32 |
|
32 | 33 |
/** |
33 |
* Initialization setup for parameter value manager. Check if parameter value repository contains
|
|
34 |
* records and if not, initialize default values.
|
|
34 |
* Initialization setup for parameter value manager. |
|
35 |
* Check if table "Parametr_hodnota" exists.
|
|
35 | 36 |
*/ |
36 | 37 |
@EventListener(classes = { |
37 | 38 |
ContextRefreshedEvent.class |
38 | 39 |
}) |
39 |
@Order(1)
|
|
40 |
@Order(3)
|
|
40 | 41 |
@Transactional |
41 | 42 |
public void setup() { |
42 |
if (this.parameterValueRepository.count() == 0) { |
|
43 |
log.info("No parameter value present, creating items."); |
|
44 |
|
|
43 |
try { |
|
44 |
if (this.parameterValueRepository.count() == 0) { |
|
45 |
// Just checking if table exists. |
|
46 |
} |
|
47 |
} |
|
48 |
catch (InvalidDataAccessResourceUsageException e) { |
|
49 |
log.error("Table \"Parametr_hodnota\" did not exists in database!"); |
|
50 |
System.exit(1); |
|
45 | 51 |
} |
46 | 52 |
} |
47 | 53 |
|
src/main/java/vldc/aswi/validators/AssemblyValidator.java | ||
---|---|---|
41 | 41 |
// Get assembly values. |
42 | 42 |
Assembly assembly = (Assembly) obj; |
43 | 43 |
|
44 |
// Replace ";" with blank char -> semicolon is automatically added to statement before execution, |
|
45 |
// so if SQL query already contains semicolon, it will raise exception. |
|
46 |
assembly.setSQLQuery(assembly.getSQLQuery().replace(";", "")); |
|
47 |
|
|
44 | 48 |
// Validate SQL Query. |
45 | 49 |
List<String> columnNames = this.sqlQueryManager.getNameOfColumnsFromQuery(assembly.getSQLQuery()); |
46 | 50 |
|
Také k dispozici: Unified diff
re #8144 #8143 #8148