Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 621e3fca

Přidáno uživatelem Vojtěch Danišík před asi 4 roky(ů)

Zobrazit rozdíly:

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

  

Také k dispozici: Unified diff