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