本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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() );
}
}
示例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;
}
示例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;
}
示例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;
}
示例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() );
}
}
示例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() );
}
}
示例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() );
}
}
示例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;
}
示例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();
}