Package org.springframework.jdbc.core.namedparam

Examples of org.springframework.jdbc.core.namedparam.MapSqlParameterSource


        account.setPassword(encodePasswd(pcr.getUsername(), pcr.getPassword1()));
        this.store(account);
    }

    public List<QxAccount> loadAll() {
        return jdbcTemplate.query(queriesProperties.getProperty("user.select.star"), new MapSqlParameterSource(), new UserMapper());
    }
View Full Code Here


    public void delete(String username) {
        if (username.toLowerCase().equals("admin")) {
            throw new IllegalArgumentException("admin account can not be removed");
        }
        jdbcTemplate.update(queriesProperties.getProperty("user.delete"), new MapSqlParameterSource("username", username));
    }
View Full Code Here

        }
        jdbcTemplate.update(queriesProperties.getProperty("user.delete"), new MapSqlParameterSource("username", username));
    }

    private SqlParameterSource prepareParameterSource(QxAccount user) {
        return new MapSqlParameterSource(user.toParametersMap());
    }
View Full Code Here

    public void setDefaultHost(String defaultHost) {
        this.defaultHost = defaultHost;
    }

    public ClusterConfiguration get(String alias) {
        return jdbcTemplate.queryForObject(queriesProperties.getProperty("clusterconfig.get.by.alias"), new MapSqlParameterSource("alias", alias), new ClusterConfigurationMapper());
    }
View Full Code Here

    public ClusterConfiguration get(String alias) {
        return jdbcTemplate.queryForObject(queriesProperties.getProperty("clusterconfig.get.by.alias"), new MapSqlParameterSource("alias", alias), new ClusterConfigurationMapper());
    }

    public ClusterConfiguration getActive() {
        List<ClusterConfiguration> configuration = jdbcTemplate.query(queriesProperties.getProperty("clusterconfig.select.star.wa"), new MapSqlParameterSource("active", true), new ClusterConfigurationMapper());
       
        //tutaj zrobic inaczej
        //jesli defaultConn nie jest pusty to dodaj config nadpisujac
        if (CollectionUtils.isEmpty(configuration)) {
            this.createDefaultConfiguration();
View Full Code Here

        return configuration.get(0);
    }

    public List<ClusterConfiguration> loadAll() {
        return jdbcTemplate.query(queriesProperties.getProperty("clusterconfig.select.star"), new MapSqlParameterSource(), new ClusterConfigurationMapper());
    }
View Full Code Here

    private void createDefaultConfiguration() {
        jdbcTemplate.update(queriesProperties.getProperty("clusterconfig.insert"), prepareParameterSource(new ClusterConfiguration("default", defaultHost, defaultClusterName, true)));
    }

    private SqlParameterSource prepareParameterSource(ClusterConfiguration configuration) {
        return new MapSqlParameterSource(configuration.toParametersMap());
    }
View Full Code Here

        return new MapSqlParameterSource(configuration.toParametersMap());
    }

    public void store(ClusterConfiguration configuration) {
        if (configuration.isActive()) {
            jdbcTemplate.update(queriesProperties.getProperty("clusterconfig.update.all.active.false"), new MapSqlParameterSource());
        }
        jdbcTemplate.update(queriesProperties.getProperty("clusterconfig.merge"), prepareParameterSource(configuration));
    }
View Full Code Here

        }
        jdbcTemplate.update(queriesProperties.getProperty("clusterconfig.merge"), prepareParameterSource(configuration));
    }

    public void delete(String alias) {
        jdbcTemplate.update(queriesProperties.getProperty("clusterconfig.delete"), new MapSqlParameterSource("alias", alias));
    }
View Full Code Here

   * @see
   * com.odb.core.dao.ODBDAO#getDataSourceByDataSourceID(java.lang.String)
   */
  public DataSourceInfo getDataSourceByDataSourceID(String dsID) throws SQLException {
    String sql = "SELECT * FROM ODB_DATASOURCE_INFO WHERE DATASOURCE_ID=:dataSourceID";
    SqlParameterSource param = new MapSqlParameterSource("dataSourceID", dsID);
    return jdbcTemp.query(sql, param, new DataSourceInfoResultSetExtractor());
  }
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.core.namedparam.MapSqlParameterSource

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.