当前位置: 首页>>代码示例>>Java>>正文


Java MapSqlParameterSource.addValue方法代码示例

本文整理汇总了Java中org.springframework.jdbc.core.namedparam.MapSqlParameterSource.addValue方法的典型用法代码示例。如果您正苦于以下问题:Java MapSqlParameterSource.addValue方法的具体用法?Java MapSqlParameterSource.addValue怎么用?Java MapSqlParameterSource.addValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.jdbc.core.namedparam.MapSqlParameterSource的用法示例。


在下文中一共展示了MapSqlParameterSource.addValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createReferenceGenome

import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; //导入方法依赖的package包/类
/**
 * Persists a {@code Reference} entity in database with a specified ID
 * @param reference to persist
 * @param referenceId ID for the reference
 * @return saved {@code Reference} instance
 */
@Transactional(propagation = Propagation.MANDATORY)
public Reference createReferenceGenome(final Reference reference, final long referenceId) {

    reference.setBioDataItemId(reference.getId());
    reference.setId(referenceId);

    final MapSqlParameterSource params = new MapSqlParameterSource();
    params.addValue(GenomeParameters.REFERENCE_GENOME_ID.name(), reference.getId());
    params.addValue(GenomeParameters.BIO_DATA_ITEM_ID.name(), reference.getBioDataItemId());
    params.addValue(GenomeParameters.SIZE.name(), reference.getSize());
    params.addValue(GenomeParameters.INDEX_ID.name(), reference.getIndex().getId());
    params.addValue(GenomeParameters.GENE_ITEM_ID.name(), reference.getGeneFile() != null ?
                                                          reference.getGeneFile().getId() : null);

    getNamedParameterJdbcTemplate().update(createReferenceGenomeQuery, params);
    return reference;
}
 
开发者ID:epam,项目名称:NGB,代码行数:24,代码来源:ReferenceGenomeDao.java

示例2: insertStatsDirLocalSize

import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; //导入方法依赖的package包/类
@Override
@Transactional
public void insertStatsDirLocalSize(Map<Long, Long> dirLocalSize) throws SaodException {
	NamedParameterJdbcTemplate jdbcNamesTpl = new NamedParameterJdbcTemplate(this.jdbcTemplate);

	List<MapSqlParameterSource> batchArgs = new ArrayList<>();

	for (Entry<Long, Long> e : dirLocalSize.entrySet()) {
		MapSqlParameterSource parameters = new MapSqlParameterSource();
		parameters.addValue("node_id", e.getKey());
		parameters.addValue("local_size", e.getValue());
		batchArgs.add(parameters);
	}

	String query = sqlQueries.getQuery("insert_stats_dir_local_size.sql");
	jdbcNamesTpl.batchUpdate(query, batchArgs.toArray(new MapSqlParameterSource[dirLocalSize.size()]));
}
 
开发者ID:jeci-sarl,项目名称:stats-alfresco-on-database,代码行数:18,代码来源:LocalDaoImpl.java

示例3: getLinkedTableParameters

import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; //导入方法依赖的package包/类
/**
 * Creates a MapSqlParameterSource with common FeatureFile's ancestor's fields for future use in DB queries
 * @param idFieldName a name of ID fields of FeatureFile's ancestor's
 * @param featureFile a FeatureFile's ancestor's entity, which fields to add to parameters
 * @return a MapSqlParameterSource with common FeatureFile's ancestor's fields
 */
public static MapSqlParameterSource getLinkedTableParameters(String idFieldName, FeatureFile featureFile) {
    MapSqlParameterSource params = new MapSqlParameterSource();

    params.addValue(idFieldName, featureFile.getId());
    params.addValue(BiologicalDataItemParameters.BIO_DATA_ITEM_ID.name(), featureFile.getBioDataItemId());
    params.addValue(REFERENCE_GENOME_ID.name(), featureFile.getReferenceId());
    params.addValue(INDEX_ID.name(), featureFile.getIndex() != null ? featureFile.getIndex().getId() : null);
    params.addValue(COMPRESSED.name(), featureFile.getCompressed());

    if (featureFile instanceof GeneFile) {
        GeneFile geneFile = (GeneFile) featureFile;
        params.addValue(EXTERNAL_DB_TYPE_ID.name(), geneFile.getExternalDBType() != null ?
                geneFile.getExternalDBType().getId() : null);
        params.addValue(EXTERNAL_DB_ID.name(), geneFile.getExternalDB() != null ?
                geneFile.getExternalDB().getId() : null);
        params.addValue(EXTERNAL_DB_ORGANISM.name(), geneFile.getExternalDBOrganism());
    }

    return params;
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:27,代码来源:BiologicalDataItemDao.java

示例4: getParameters

import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; //导入方法依赖的package包/类
private static MapSqlParameterSource[] getParameters(List<BiologicalDataItem> items, long bookmarkId, DaoHelper
        daoHelper, String bookmarkItemSequenceName) {
    MapSqlParameterSource[] params = new MapSqlParameterSource[items.size()];

    List<Long> ids = daoHelper.createIds(bookmarkItemSequenceName, items.size());

    for (int i = 0; i < items.size(); i++) {
        MapSqlParameterSource param = new MapSqlParameterSource();

        param.addValue(BOOKMARK_ITEM_ID.name(), ids.get(i));
        param.addValue(BOOKMARK_ID.name(), bookmarkId);
        param.addValue(BIOLOGICAL_ITEM_ID.name(), BiologicalDataItem.getBioDataItemId(
                items.get(i)));

        params[i] = param;
    }

    return params;
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:20,代码来源:BookmarkDao.java

示例5: getParamSource

import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; //导入方法依赖的package包/类
@Override
public MapSqlParameterSource getParamSource(W segment, Timestamp now) throws SQLException {
	MapSqlParameterSource args = new MapSqlParameterSource();
	args.addValue("id", segment.getId());
	args.addValue("geometry","SRID=4326;"+wktWriter.write(segment.getGeometry()));
	args.addValue("name", segment.getName());
	args.addValue("length", segment.getLength());
	args.addValue("streetType", segment.getStreetType());
	args.addValue("wayId", segment.getWayId());
	args.addValue("startNodeId", segment.getStartNodeId());
	args.addValue("startNodeIndex", segment.getStartNodeIndex());
	args.addValue("endNodeId", segment.getEndNodeId());
	args.addValue("endNodeIndex", segment.getEndNodeIndex());
	args.addValue("timestamp", now);
	args.addValue("tags", segment.getTags());		
	return args;
}
 
开发者ID:graphium-project,项目名称:graphium,代码行数:18,代码来源:WayBaseGraphWriteDaoImpl.java

示例6: createTempList

import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; //导入方法依赖的package包/类
@Transactional(propagation = Propagation.MANDATORY)
public Long createTempList(final Long listId, final Collection<? extends BaseEntity> list) {
    Assert.notNull(listId);
    Assert.isTrue(CollectionUtils.isNotEmpty(list));
    // creates a new local temporary table if it doesn't exists to handle temporary lists
    getJdbcTemplate().update(createTemporaryListQuery);
    // fills in a temporary list by given values
    int i = 0;
    final Iterator<? extends BaseEntity> iterator = list.iterator();
    final MapSqlParameterSource[] batchArgs = new MapSqlParameterSource[list.size()];
    while (iterator.hasNext()) {
        MapSqlParameterSource params = new MapSqlParameterSource();
        params.addValue(HelperParameters.LIST_ID.name(), listId);
        params.addValue(HelperParameters.LIST_VALUE.name(), iterator.next().getId());
        batchArgs[i] = params;
        i++;
    }
    getNamedParameterJdbcTemplate().batchUpdate(insertTemporaryListItemQuery, batchArgs);
    return listId;
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:21,代码来源:DaoHelper.java

示例7: createSamples

import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; //导入方法依赖的package包/类
/**
 * Saves sample metadata to the database.
 *
 * @param samples   {@code List&lt;Sample&gt;} samples to save
 * @param vcfFileId {@code long} file ID to save samples for
 */
@Transactional(propagation = Propagation.MANDATORY)
public void createSamples(List<VcfSample> samples, long vcfFileId) {
    List<Long> sampleIds = daoHelper.createIds(vcfSampleSequenceName, samples.size());
    for (int i = 0; i < samples.size(); i++) {
        samples.get(i).setId(sampleIds.get(i));
    }

    final List<MapSqlParameterSource> params = new ArrayList<>();
    for (VcfSample sample : samples) {

        MapSqlParameterSource param = new MapSqlParameterSource();
        param.addValue(SampleParameters.VCF_SAMPLE_ID.name(), sample.getId());
        param.addValue(SampleParameters.VCF_ID.name(), vcfFileId);
        param.addValue(SampleParameters.SAMPLE_NAME.name(), sample.getName());
        param.addValue(SampleParameters.ORDER_INDEX.name(), sample.getIndex());
        params.add(param);
    }

    getNamedParameterJdbcTemplate().batchUpdate(createSamplesForFileQuery, params.toArray(new
            MapSqlParameterSource[params.size()]));
}
 
开发者ID:epam,项目名称:NGB,代码行数:28,代码来源:VcfFileDao.java

示例8: createSamples

import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; //导入方法依赖的package包/类
/**
 * Saves sample metadata to the database.
 *
 * @param samples   {@code List&lt;Sample&gt;} samples to save
 * @param segFileId {@code long} file ID to save samples for
 */
@Transactional(propagation = Propagation.MANDATORY)
public void createSamples(List<SegSample> samples, long segFileId) {
    List<Long> sampleIds = daoHelper.createIds(segSampleSequenceName, samples.size());
    for (int i = 0; i < samples.size(); i++) {
        samples.get(i).setId(sampleIds.get(i));
    }

    final List<MapSqlParameterSource> params = new ArrayList<>();
    for (SegSample sample : samples) {

        MapSqlParameterSource param = new MapSqlParameterSource();
        param.addValue(SegSampleParameters.SEG_SAMPLE_ID.name(), sample.getId());
        param.addValue(SegSampleParameters.SEG_ID.name(), segFileId);
        param.addValue(SegSampleParameters.SAMPLE_NAME.name(), sample.getName());
        params.add(param);
    }

    getNamedParameterJdbcTemplate().batchUpdate(createSamplesForFileQuery, params.toArray(new
            MapSqlParameterSource[params.size()]));
}
 
开发者ID:epam,项目名称:NGB,代码行数:27,代码来源:SegFileDao.java

示例9: createTempStringList

import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; //导入方法依赖的package包/类
@Transactional(propagation = Propagation.MANDATORY)
public Long createTempStringList(final Long listId, final Collection<String> list) {
    Assert.notNull(listId);
    Assert.isTrue(CollectionUtils.isNotEmpty(list));
    // creates a new local temporary table if it doesn't exists to handle temporary lists
    getJdbcTemplate().update(createTemporaryStringListQuery);
    // fills in a temporary list by given values
    int i = 0;
    final Iterator<String> iterator = list.iterator();
    final MapSqlParameterSource[] batchArgs = new MapSqlParameterSource[list.size()];
    while (iterator.hasNext()) {
        MapSqlParameterSource params = new MapSqlParameterSource();
        params.addValue(HelperParameters.LIST_ID.name(), listId);
        params.addValue(HelperParameters.LIST_VALUE.name(), iterator.next());
        batchArgs[i] = params;
        i++;
    }
    getNamedParameterJdbcTemplate().batchUpdate(insertTemporaryStringListItemQuery, batchArgs);
    return listId;
}
 
开发者ID:epam,项目名称:NGB,代码行数:21,代码来源:DaoHelper.java

示例10: saveChromosomes

import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; //导入方法依赖的package包/类
/**
 * Saves {@code List} of {@code Chromosome} entities with a specified ID in the database
 * as one reference
 * @param referenceId for the chromosomes
 * @param chromosomes {@code List} of {@code Chromosome} entities to store int the database
 * @return an array containing the numbers of rows affected by each update in the batch
 */
@Transactional(propagation = Propagation.MANDATORY)
public int[] saveChromosomes(final Long referenceId, final List<Chromosome> chromosomes) {
    final int count = chromosomes.size();
    final List<Long> chromosomeIds = daoHelper.createIds(chromosomeSequenceName, count);
    final MapSqlParameterSource[] batchArgs = new MapSqlParameterSource[count];
    for (int i = 0; i < count; i++) {
        final Chromosome chromosome = chromosomes.get(i);
        chromosome.setId(chromosomeIds.get(i));
        chromosome.setReferenceId(referenceId);
        MapSqlParameterSource params = new MapSqlParameterSource();
        params.addValue(GenomeParameters.NAME.name(), chromosome.getName());
        params.addValue(GenomeParameters.SIZE.name(), chromosome.getSize());
        params.addValue(GenomeParameters.PATH.name(), chromosome.getPath());
        params.addValue(GenomeParameters.HEADER.name(), chromosome.getHeader());
        params.addValue(GenomeParameters.CHROMOSOME_ID.name(), chromosome.getId());
        params.addValue(GenomeParameters.REFERENCE_GENOME_ID.name(), chromosome.getReferenceId());
        batchArgs[i] = params;
    }
    return getNamedParameterJdbcTemplate().batchUpdate(createChromosomeQuery, batchArgs);
}
 
开发者ID:epam,项目名称:NGB,代码行数:28,代码来源:ReferenceGenomeDao.java

示例11: loadFilesByNameStrict

import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; //导入方法依赖的package包/类
/**
 * Finds files with a specified file name, checks name for strict, case sensitive equality
 * @param name search query
 * @return {@code List} of files with a matching name
 */
@Transactional(propagation = Propagation.MANDATORY)
public List<BiologicalDataItem> loadFilesByNameStrict(final String name) {
    final MapSqlParameterSource params = new MapSqlParameterSource();
    params.addValue(BiologicalDataItemParameters.NAME.name(), name);
    return getNamedParameterJdbcTemplate().query(loadBiologicalDataItemsByNameStrictQuery,
            params, getRowMapper());
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:13,代码来源:BiologicalDataItemDao.java

示例12: getParameters

import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; //导入方法依赖的package包/类
static MapSqlParameterSource getParameters(Project project, Long parentId) {
    MapSqlParameterSource params = new MapSqlParameterSource();

    params.addValue(PROJECT_ID.name(), project.getId());
    params.addValue(PROJECT_NAME.name(), project.getName());
    params.addValue(CREATED_BY.name(), project.getCreatedBy());
    params.addValue(CREATED_DATE.name(), project.getCreatedDate());
    params.addValue(PARENT_ID.name(), parentId);

    return params;
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:12,代码来源:ProjectDao.java

示例13: deleteProjectItem

import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; //导入方法依赖的package包/类
/**
 * Removes an item from a project, specified by ID
 * @param projectId {@code Long} ID of a project
 * @param biologicalItemId {@code Long} ID of an item to remove
 */
@Transactional(propagation = Propagation.MANDATORY)
public void deleteProjectItem(long projectId, long biologicalItemId) {
    List<Long> currentItemIds = getJdbcTemplate().query(loadProjectItemsIdsQuery, new SingleColumnRowMapper<>(),
            projectId);

    currentItemIds.remove(biologicalItemId);

    MapSqlParameterSource params = new MapSqlParameterSource();
    params.addValue(ProjectItemParameters.PROJECT_ID.name(), projectId);
    params.addValue(ProjectItemParameters.BIO_DATA_ITEM_ID.name(), biologicalItemId);

    getNamedParameterJdbcTemplate().update(deleteProjectItemQuery, params);

    ArrayList<MapSqlParameterSource> updateParams = new ArrayList<>();
    for (int i = 1; i <= currentItemIds.size(); i++) {
        MapSqlParameterSource param = new MapSqlParameterSource();
        param.addValue(ProjectItemParameters.PROJECT_ID.name(), projectId);
        param.addValue(ProjectItemParameters.BIO_DATA_ITEM_ID.name(), currentItemIds.get(i - 1));
        param.addValue(ProjectItemParameters.ORDINAL_NUMBER.name(), i);

        updateParams.add(param);
    }

    getNamedParameterJdbcTemplate().batchUpdate(updateProjectItemOrderingNumberQuery, updateParams.toArray(
            new MapSqlParameterSource[updateParams.size()]));
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:32,代码来源:ProjectDao.java

示例14: assignImpactDataset

import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; //导入方法依赖的package包/类
private static ImpactDataset assignImpactDataset(String idurn) {
    int level = Integer.parseInt(idurn.substring(0, idurn.indexOf("****")));
    String urn = idurn.substring(idurn.indexOf("****") + 4);
    ImpactDataset impD = new ImpactDataset();

    Map<String, Object> row = null;
    MapSqlParameterSource parameters = new MapSqlParameterSource();
    parameters.addValue("urn", urn);
    NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(getJdbcTemplate().getDataSource());

    try {
        row = namedParameterJdbcTemplate.queryForMap(GET_DATA_ATTR, parameters);
    } catch (IncorrectResultSizeDataAccessException irsdae) {
        Logger.error("Incorrect result size ", irsdae);
    } catch (DataAccessException dae) {
        Logger.error("SQL query failed ", dae);
    }

    impD.urn = urn;
    impD.level = level;
    impD.name = (String) row.get("name");
    impD.id = (Long) row.get("id");
    impD.datasetUrl = "#/datasets/" + impD.id;
    JsonNode prop = Json.parse((String) row.get("properties"));
    if (prop.has("valid") && (prop.get("valid").asText()) == "true") {
        impD.isValidDataset = true;
    } else {
        impD.isValidDataset = false;
    }
    return impD;
}
 
开发者ID:SirAeroWN,项目名称:premier-wherehows,代码行数:32,代码来源:LineageDAOLite.java

示例15: createReferenceGenome

import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; //导入方法依赖的package包/类
@Transactional(propagation = Propagation.MANDATORY)
public Reference createReferenceGenome(final Reference reference) {
    final MapSqlParameterSource params = new MapSqlParameterSource();
    params.addValue(GenomeParameters.REFERENCE_GENOME_ID.name(), reference.getId());
    params.addValue(GenomeParameters.BIO_DATA_ITEM_ID.name(), reference.getBioDataItemId());
    params.addValue(GenomeParameters.SIZE.name(), reference.getSize());
    params.addValue(GenomeParameters.INDEX_ID.name(), reference.getIndex().getId());
    params.addValue(GenomeParameters.GENE_ITEM_ID.name(), reference.getGeneFile() != null ?
            reference.getGeneFile().getId() : null);

    getNamedParameterJdbcTemplate().update(createReferenceGenomeQuery, params);
    return reference;
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:14,代码来源:ReferenceGenomeDao.java


注:本文中的org.springframework.jdbc.core.namedparam.MapSqlParameterSource.addValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。