Revize 621e3fca
Přidáno uživatelem Vojtěch Danišík před asi 4 roky(ů)
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 |
|
Také k dispozici: Unified diff
re #8144 #8143 #8148