Package fr.soleil.salsa.persistence.model

Examples of fr.soleil.salsa.persistence.model.Configuration


        if (configuration == null || configuration.getId() == null) {
            return;
        }

        Configuration configResultat = null;

        // Load the config
        configResultat = getConfigById(configuration.getId());

        // Case when the entity is NULL
        if (configResultat == null || !configResultat.getTimestamp().equals(configuration.getTimestamp())) {
            throw new ScanConfigOutOfSyncException();
        }

        // delete the config
        deleteConfigNoCommitAux(configuration);
View Full Code Here


            CommonsJDBC.catchException(ex);
        }
    }

    public Configuration getConfigById(Integer id) {
        Configuration result = null;
        try {
            startOperation();
            result = getConfigByIdAux(id);
        } catch (SQLException e) {
            CommonsJDBC.catchException(e);
View Full Code Here

     * @param configId
     * @return Configuration
     */
    private Configuration getConfigByIdAux(Integer configId) throws SQLException {

        Configuration configuration = null;
        String query = "SELECT configid, name, type, data, directoryid, timestamp FROM config WHERE configid="
                + configId;

        if (stmt != null) {
            ResultSet rs = stmt.executeQuery(query);

            while (rs.next()) {

                configuration = new Configuration();

                configuration.setId(rs.getInt("configid"));
                configuration.setName(rs.getString("name"));
                configuration.setType(rs.getString("type"));
                configuration.setData(rs.getString("data"));
                int directoryid = rs.getInt("directoryid");
                configuration.setDirectoryId(directoryid);
                configuration.setTimestamp(rs.getTimestamp("timestamp"));
            }
            rs.close();
            stmt.clearBatch();
            if (configuration != null) {
                int directoryid = configuration.getDirectoryId();
                // System.out.println("directoryid=" + directoryid);
                IDirectory directory = getDirectoryById(directoryid, true);
                if (directory != null) {
                    // IDirectory parent = directory.getDirectory();
                    configuration.setDirectory(directory);
                }
            }

        }
        return configuration;
View Full Code Here

        try {
            startOperation();
            if (stmt != null) {
                ResultSet rs = stmt.executeQuery(query);

                Configuration config = null;
                while (rs.next()) {
                    config = new Configuration();

                    config.setId(rs.getInt("configid"));
                    config.setName(rs.getString("name"));
                    config.setType(rs.getString("type"));
                    config.setData(rs.getString("data"));
                    config.setDirectoryId(rs.getInt("directoryid"));
                    config.setTimestamp(rs.getTimestamp("timestamp"));
                    configList.add(config);
                    // System.out.println("Config name=" + config.getName());

                }
                rs.close();
View Full Code Here

        if (configuration == null || configuration.getId() == null) {
            return;
        }

        Configuration configResultat = null;

        // Load the config
        configResultat = getConfigById(configuration.getId());

        // Case when the entity is NULL
        if (configResultat == null
                || !configResultat.getTimestamp().equals(configuration.getTimestamp())) {
            throw new ScanConfigOutOfSyncException();
        }

        // delete the config
        deleteConfigNoCommitAux(configuration);
View Full Code Here

            CommonsJDBC.catchException(ex);
        }
    }

    public Configuration getConfigById(Integer id) {
        Configuration result = null;
        try {
            startOperation();
            result = getConfigByIdAux(id);
        }
        catch (SQLException e) {
View Full Code Here

     * @param configId
     * @return Configuration
     */
    private Configuration getConfigByIdAux(Integer configId) throws SQLException {

        Configuration configuration = null;
        String query = "SELECT configid, name, type, data, directoryid, timestamp FROM config WHERE configid="
                + configId;

        if (stmt != null) {
            ResultSet rs = stmt.executeQuery(query);

            while (rs.next()) {

                configuration = new Configuration();

                configuration.setId(rs.getInt("configid"));
                configuration.setName(rs.getString("name"));
                configuration.setType(rs.getString("type"));
                configuration.setData(rs.getString("data"));
                int directoryid = rs.getInt("directoryid");
                configuration.setDirectoryId(directoryid);
                configuration.setTimestamp(rs.getTimestamp("timestamp"));
            }
            rs.close();
            stmt.clearBatch();
            if (configuration != null) {
                configuration.setChartProperties(getChartPropertiesByIdAux(configId));
                configuration.setPlotPropertiesMap(getPlotPropertiesByIdAux(configId));

                int directoryid = configuration.getDirectoryId();
                // System.out.println("directoryid=" + directoryid);
                IDirectory directory = getDirectoryById(directoryid, true);
                if (directory != null) {
                    // IDirectory parent = directory.getDirectory();
                    configuration.setDirectory(directory);
                }
            }

        }
        return configuration;
View Full Code Here

    public void saveConfig(Configuration config, boolean forceSaving) throws OutOfSyncException {
        ScanConfigOutOfSyncException exception = null;
        if (config == null) {
            exception = new ScanConfigOutOfSyncException("Can't save a null configuration");
        } else {
            Configuration configuration = getConfigById(config.getId());
            boolean newConfig = (configuration == null);

            // If forceSaving = false test the synchronization
            if (!forceSaving) {
                // Modification of the timestamp when saved a new configuration
                Timestamp oldConfigTSP = config.getTimestamp();

                // Checking if the configuration is out of synchronization
                if (!newConfig && oldConfigTSP.before(configuration.getTimestamp())) {
                    exception = new ScanConfigOutOfSyncException("The configuration has been changed by other");
                }
            }

            if (exception == null) {
View Full Code Here

        try {
            startOperation();
            if (stmt != null) {
                ResultSet rs = stmt.executeQuery(query);

                Configuration config = null;
                while (rs.next()) {
                    config = new Configuration();

                    config.setId(rs.getInt("configid"));
                    config.setName(rs.getString("name"));
                    config.setType(rs.getString("type"));
                    config.setData(rs.getString("data"));
                    config.setDirectoryId(rs.getInt("directoryid"));
                    config.setTimestamp(rs.getTimestamp("timestamp"));
                    configList.add(config);
                    // System.out.println("Config name=" + config.getName());

                }
                rs.close();
View Full Code Here

        ScanConfigOutOfSyncException exception = null;
        if (config == null) {
            exception = new ScanConfigOutOfSyncException("Can't save a null configuration");
        }
        else {
            Configuration configuration = getConfigById(config.getId());
            boolean newConfig = (configuration == null);

            // If forceSaving = false test the synchronization
            if (!forceSaving) {
                // Modification of the timestamp when saved a new configuration
                Timestamp oldConfigTSP = config.getTimestamp();

                // Checking if the configuration is out of synchronization
                if (!newConfig && oldConfigTSP.before(configuration.getTimestamp())) {
                    exception = new ScanConfigOutOfSyncException(
                            "The configuration has been changed by other");
                }
            }
View Full Code Here

TOP

Related Classes of fr.soleil.salsa.persistence.model.Configuration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.