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


Java QueryResult类代码示例

本文整理汇总了Java中me.prettyprint.hector.api.query.QueryResult的典型用法代码示例。如果您正苦于以下问题:Java QueryResult类的具体用法?Java QueryResult怎么用?Java QueryResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getCiStateHistory

import me.prettyprint.hector.api.query.QueryResult; //导入依赖的package包/类
public List<CiChangeStateEvent> getCiStateHistory(long ciId, Long startTime, Long endTime, Integer count) {

        if (count == null) count = 1000;
        List<CiChangeStateEvent> states = new ArrayList<CiChangeStateEvent>();
        SliceQuery<Long, Long, String> sliceQuery = HFactory.createSliceQuery(keyspace, longSerializer, longSerializer, stringSerializer);
        sliceQuery.setColumnFamily(SchemaBuilder.CI_STATE_HIST_CF);
        sliceQuery.setRange(startTime, endTime, false, count);
        sliceQuery.setKey(ciId);
        QueryResult<ColumnSlice<Long, String>> result = sliceQuery.execute();
        ColumnSlice<Long, String> resultCols = result.get();
        for (HColumn<Long, String> col : resultCols.getColumns()) {
            CiChangeStateEvent event = gson.fromJson(col.getValue(), CiChangeStateEvent.class);
            states.add(event);
        }
        return states;
    }
 
开发者ID:oneops,项目名称:oneops,代码行数:17,代码来源:OpsCiStateDao.java

示例2: getComponentStates

import me.prettyprint.hector.api.query.QueryResult; //导入依赖的package包/类
public Map<Long,Map<String,Long>> getComponentStates(List<Long> manifestIds) {
  	
  	Map<Long,Map<String,Long>> result = new HashMap<Long,Map<String,Long>>();
  	MultigetSliceCounterQuery<Long, String> query =  HFactory.createMultigetSliceCounterQuery(keyspace, longSerializer, stringSerializer);
  	
  	query.setKeys(manifestIds);		
  	query.setColumnFamily(SchemaBuilder.COMPONENT_STATE_CF);
  	query.setRange(null, null, false, 1000);
  	QueryResult<CounterRows<Long,String>> qResult = query.execute();

  	CounterRows<Long,String> rows = qResult.get();

for (CounterRow<Long, String> row : rows) {
    if (row.getColumnSlice().getColumns().size() >0) {
        if (!result.containsKey(row.getKey())) {
            result.put(row.getKey(), new HashMap<String,Long>());
        }
        
        for (HCounterColumn<String> col : row.getColumnSlice().getColumns()) {
        	result.get(row.getKey()).put(col.getName(), col.getValue());
        }
    }
}
  	
  	return result;
  }
 
开发者ID:oneops,项目名称:oneops,代码行数:27,代码来源:OpsCiStateDao.java

示例3: getNamespace

import me.prettyprint.hector.api.query.QueryResult; //导入依赖的package包/类
protected Namespace getNamespace( String repositoryId, String namespaceId )
{

    QueryResult<OrderedRows<String, String, String>> result = HFactory //
        .createRangeSlicesQuery( keyspace, ss, ss, ss ) //
        .setColumnFamily( cassandraArchivaManager.getNamespaceFamilyName() ) //
        .setColumnNames( REPOSITORY_NAME.toString(), NAME.toString() ) //
        .addEqualsExpression( REPOSITORY_NAME.toString(), repositoryId ) //
        .addEqualsExpression( NAME.toString(), namespaceId ) //
        .execute();
    if ( result.get().getCount() > 0 )
    {
        ColumnSlice<String, String> columnSlice = result.get().getList().get( 0 ).getColumnSlice();
        return new Namespace( getStringValue( columnSlice, NAME.toString() ), //
                              new Repository( getStringValue( columnSlice, REPOSITORY_NAME.toString() ) ) );

    }
    return null;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:20,代码来源:CassandraMetadataRepository.java

示例4: getRootNamespaces

import me.prettyprint.hector.api.query.QueryResult; //导入依赖的package包/类
@Override
public Collection<String> getRootNamespaces( final String repoId )
    throws MetadataResolutionException
{

    QueryResult<OrderedRows<String, String, String>> result = HFactory //
        .createRangeSlicesQuery( keyspace, ss, ss, ss ) //
        .setColumnFamily( cassandraArchivaManager.getNamespaceFamilyName() ) //
        .setColumnNames( NAME.toString() ) //
        .addEqualsExpression( REPOSITORY_NAME.toString(), repoId ) //
        .execute();

    Set<String> namespaces = new HashSet<String>( result.get().getCount() );

    for ( Row<String, String, String> row : result.get() )
    {
        namespaces.add( StringUtils.substringBefore( getStringValue( row.getColumnSlice(), NAME.toString() ), "." ) );
    }

    return namespaces;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:22,代码来源:CassandraMetadataRepository.java

示例5: getNamespaces

import me.prettyprint.hector.api.query.QueryResult; //导入依赖的package包/类
protected List<String> getNamespaces( final String repoId )
    throws MetadataResolutionException
{

    QueryResult<OrderedRows<String, String, String>> result = HFactory //
        .createRangeSlicesQuery( keyspace, ss, ss, ss ) //
        .setColumnFamily( cassandraArchivaManager.getNamespaceFamilyName() ) //
        .setColumnNames( NAME.toString() ) //
        .addEqualsExpression( REPOSITORY_NAME.toString(), repoId ) //
        .execute();

    List<String> namespaces = new ArrayList<>( result.get().getCount() );

    for ( Row<String, String, String> row : result.get() )
    {
        namespaces.add( getStringValue( row.getColumnSlice(), NAME.toString() ) );
    }

    return namespaces;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:21,代码来源:CassandraMetadataRepository.java

示例6: getProjects

import me.prettyprint.hector.api.query.QueryResult; //导入依赖的package包/类
@Override
public Collection<String> getProjects( final String repoId, final String namespace )
    throws MetadataResolutionException
{

    QueryResult<OrderedRows<String, String, String>> result = HFactory //
        .createRangeSlicesQuery( keyspace, ss, ss, ss ) //
        .setColumnFamily( cassandraArchivaManager.getProjectFamilyName() ) //
        .setColumnNames( PROJECT_ID.toString() ) //
        .addEqualsExpression( REPOSITORY_NAME.toString(), repoId ) //
        .addEqualsExpression( NAMESPACE_ID.toString(), namespace ) //
        .execute();

    final Set<String> projects = new HashSet<String>( result.get().getCount() );

    for ( Row<String, String, String> row : result.get() )
    {
        projects.add( getStringValue( row.getColumnSlice(), PROJECT_ID.toString() ) );
    }

    return projects;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:23,代码来源:CassandraMetadataRepository.java

示例7: removeMailingList

import me.prettyprint.hector.api.query.QueryResult; //导入依赖的package包/类
protected void removeMailingList( String projectVersionMetadataKey )
{

    QueryResult<OrderedRows<String, String, String>> result =
        HFactory.createRangeSlicesQuery( cassandraArchivaManager.getKeyspace(), ss, ss, ss ) //
            .setColumnFamily( cassandraArchivaManager.getMailingListFamilyName() ) //
            .setColumnNames( NAME.toString() ) //
            .setRowCount( Integer.MAX_VALUE ) //
            .addEqualsExpression( "projectVersionMetadataModel.key", projectVersionMetadataKey ) //
            .execute();

    if ( result.get().getCount() < 1 )
    {
        return;
    }

    for ( Row<String, String, String> row : result.get() )
    {
        this.mailingListTemplate.deleteRow( row.getKey() );
    }

}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:23,代码来源:CassandraMetadataRepository.java

示例8: getLicenses

import me.prettyprint.hector.api.query.QueryResult; //导入依赖的package包/类
protected List<License> getLicenses( String projectVersionMetadataKey )
{
    List<License> licenses = new ArrayList<>();

    QueryResult<OrderedRows<String, String, String>> result =
        HFactory.createRangeSlicesQuery( cassandraArchivaManager.getKeyspace(), ss, ss, ss ) //
            .setColumnFamily( cassandraArchivaManager.getLicenseFamilyName() ) //
            .setColumnNames( "projectVersionMetadataModel.key" ) //
            .setRowCount( Integer.MAX_VALUE ) //
            .addEqualsExpression( "projectVersionMetadataModel.key", projectVersionMetadataKey ) //
            .execute();

    for ( Row<String, String, String> row : result.get() )
    {
        ColumnFamilyResult<String, String> columnFamilyResult = this.licenseTemplate.queryColumns( row.getKey() );

        licenses.add(
            new License( columnFamilyResult.getString( NAME.toString() ), columnFamilyResult.getString( URL.toString() ) ) );
    }

    return licenses;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:23,代码来源:CassandraMetadataRepository.java

示例9: getArtifactVersions

import me.prettyprint.hector.api.query.QueryResult; //导入依赖的package包/类
@Override
public Collection<String> getArtifactVersions( final String repoId, final String namespace, final String projectId,
                                               final String projectVersion )
    throws MetadataResolutionException
{

    QueryResult<OrderedRows<String, String, String>> result = HFactory //
        .createRangeSlicesQuery( keyspace, ss, ss, ss ) //
        .setColumnFamily( cassandraArchivaManager.getProjectVersionMetadataFamilyName() ) //
        .setColumnNames( VERSION.toString() ) //
        .addEqualsExpression( REPOSITORY_NAME.toString(), repoId ) //
        .addEqualsExpression( NAMESPACE_ID.toString(), namespace ) //
        .addEqualsExpression( PROJECT_ID.toString(), projectId ) //
        .addEqualsExpression( PROJECT_VERSION.toString(), projectVersion ) //
        .execute();

    final Set<String> versions = new HashSet<String>();

    for ( Row<String, String, String> row : result.get() )
    {
        versions.add( getStringValue( row.getColumnSlice(), VERSION.toString() ) );
    }

    return versions;

}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:27,代码来源:CassandraMetadataRepository.java

示例10: getMetadataFacets

import me.prettyprint.hector.api.query.QueryResult; //导入依赖的package包/类
@Override
public List<String> getMetadataFacets( final String repositoryId, final String facetId )
    throws MetadataRepositoryException
{

    QueryResult<OrderedRows<String, String, String>> result = HFactory //
        .createRangeSlicesQuery( keyspace, ss, ss, ss ) //
        .setColumnFamily( cassandraArchivaManager.getMetadataFacetFamilyName() ) //
        .setColumnNames( NAME.toString() ) //
        .addEqualsExpression( REPOSITORY_NAME.toString(), repositoryId ) //
        .addEqualsExpression( FACET_ID.toString(), facetId ) //
        .execute();

    final List<String> facets = new ArrayList<>();

    for ( Row<String, String, String> row : result.get() )
    {
        facets.add( getStringValue( row.getColumnSlice(), NAME.toString() ) );
    }
    return facets;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:22,代码来源:CassandraMetadataRepository.java

示例11: removeMetadataFacets

import me.prettyprint.hector.api.query.QueryResult; //导入依赖的package包/类
@Override
public void removeMetadataFacets( final String repositoryId, final String facetId )
    throws MetadataRepositoryException
{

    QueryResult<OrderedRows<String, String, String>> result = HFactory //
        .createRangeSlicesQuery( keyspace, ss, ss, ss ) //
        .setColumnFamily( cassandraArchivaManager.getMetadataFacetFamilyName() ) //
        .setColumnNames( KEY.toString(), VALUE.toString() ) //
        .addEqualsExpression( REPOSITORY_NAME.toString(), repositoryId ) //
        .addEqualsExpression( FACET_ID.toString(), facetId ) //
        .execute();

    for ( Row<String, String, String> row : result.get() )
    {
        this.metadataFacetTemplate.deleteRow( row.getKey() );
    }

}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:20,代码来源:CassandraMetadataRepository.java

示例12: removeMetadataFacet

import me.prettyprint.hector.api.query.QueryResult; //导入依赖的package包/类
@Override
public void removeMetadataFacet( final String repositoryId, final String facetId, final String name )
    throws MetadataRepositoryException
{

    QueryResult<OrderedRows<String, String, String>> result = HFactory //
        .createRangeSlicesQuery( keyspace, ss, ss, ss ) //
        .setColumnFamily( cassandraArchivaManager.getMetadataFacetFamilyName() ) //
        .setColumnNames( KEY.toString(), VALUE.toString() ) //
        .addEqualsExpression( REPOSITORY_NAME.toString(), repositoryId ) //
        .addEqualsExpression( FACET_ID.toString(), facetId ) //
        .addEqualsExpression( NAME.toString(), name ) //
        .execute();

    for ( Row<String, String, String> row : result.get() )
    {
        this.metadataFacetTemplate.deleteRow( row.getKey() );
    }
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:20,代码来源:CassandraMetadataRepository.java

示例13: removeArtifact

import me.prettyprint.hector.api.query.QueryResult; //导入依赖的package包/类
@Override
public void removeArtifact( final String repositoryId, final String namespace, final String project,
                            final String version, final MetadataFacet metadataFacet )
    throws MetadataRepositoryException
{

    RangeSlicesQuery<String, String, String> query = HFactory //
        .createRangeSlicesQuery( keyspace, ss, ss, ss ) //
        .setColumnFamily( cassandraArchivaManager.getArtifactMetadataFamilyName() ) //
        .setColumnNames( NAMESPACE_ID.toString() ); //

    query = query.addEqualsExpression( REPOSITORY_NAME.toString(), repositoryId ) //
        .addEqualsExpression( NAMESPACE_ID.toString(), namespace ) //
        .addEqualsExpression( PROJECT.toString(), project ) //
        .addEqualsExpression( VERSION.toString(), version );

    QueryResult<OrderedRows<String, String, String>> result = query.execute();

    for ( Row<String, String, String> row : result.get() )
    {
        this.artifactMetadataTemplate.deleteRow( row.getKey() );
    }
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:24,代码来源:CassandraMetadataRepository.java

示例14: getArtifacts

import me.prettyprint.hector.api.query.QueryResult; //导入依赖的package包/类
@Override
public List<ArtifactMetadata> getArtifacts( final String repositoryId )
    throws MetadataRepositoryException
{

    RangeSlicesQuery<String, String, String> query = HFactory //
        .createRangeSlicesQuery( keyspace, ss, ss, ss ) //
        .setColumnFamily( cassandraArchivaManager.getArtifactMetadataFamilyName() ) //
        .setColumnNames( ArtifactMetadataModel.COLUMNS ); //

    query = query.addEqualsExpression( REPOSITORY_NAME.toString(), repositoryId );

    QueryResult<OrderedRows<String, String, String>> result = query.execute();

    List<ArtifactMetadata> artifactMetadatas = new ArrayList<>( result.get().getCount() );

    for ( Row<String, String, String> row : result.get() )
    {
        ColumnSlice<String, String> columnSlice = row.getColumnSlice();

        artifactMetadatas.add( mapArtifactMetadataStringColumnSlice( columnSlice ) );

    }

    return artifactMetadatas;
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:27,代码来源:CassandraMetadataRepository.java

示例15: executeSuper

import me.prettyprint.hector.api.query.QueryResult; //导入依赖的package包/类
public List<SuperRow<K, String, ByteBuffer, ByteBuffer>> executeSuper(CassandraQuery<K, T> cassandraQuery, String family) {
  String[] columnNames = cassandraQuery.getColumns(family);
  Query<K, T> query = cassandraQuery.getQuery();
  int limit = (int) query.getLimit();
  if (limit < 1) {
    limit = Integer.MAX_VALUE;
  }
  K startKey = query.getStartKey();
  K endKey = query.getEndKey();
  
  RangeSuperSlicesQuery<K, String, ByteBuffer, ByteBuffer> rangeSuperSlicesQuery = HFactory.createRangeSuperSlicesQuery
      (this.keyspace, this.keySerializer, StringSerializer.get(), ByteBufferSerializer.get(), ByteBufferSerializer.get());
  rangeSuperSlicesQuery.setColumnFamily(family);    
  rangeSuperSlicesQuery.setKeys(startKey, endKey);
  rangeSuperSlicesQuery.setRange("", "", false, GoraRecordReader.BUFFER_LIMIT_READ_VALUE);
  rangeSuperSlicesQuery.setRowCount(limit);
  rangeSuperSlicesQuery.setColumnNames(columnNames);
  
  
  QueryResult<OrderedSuperRows<K, String, ByteBuffer, ByteBuffer>> queryResult = rangeSuperSlicesQuery.execute();
  OrderedSuperRows<K, String, ByteBuffer, ByteBuffer> orderedRows = queryResult.get();
  return orderedRows.getList();


}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:26,代码来源:CassandraClient.java


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