本文整理汇总了Java中com.microsoft.azure.storage.table.TableQuery类的典型用法代码示例。如果您正苦于以下问题:Java TableQuery类的具体用法?Java TableQuery怎么用?Java TableQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TableQuery类属于com.microsoft.azure.storage.table包,在下文中一共展示了TableQuery类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: partitionRangeQuery
import com.microsoft.azure.storage.table.TableQuery; //导入依赖的package包/类
/**
* Demonstrate a partition range query whereby we are searching within a partition for a set of entities that are within a specific range.
*
* @param table The {@link CloudTable} object
* @param partitionKey The partition within which to search
* @param startRowKey The lowest bound of the row key range within which to search
* @param endRowKey The highest bound of the row key range within which to search
*
* @throws StorageException
*/
private static void partitionRangeQuery(CloudTable table, String partitionKey, String startRowKey, String endRowKey) throws StorageException {
// Create the range scan query
TableQuery<CustomerEntity> rangeQuery = TableQuery.from(CustomerEntity.class).where(
TableQuery.combineFilters(
TableQuery.generateFilterCondition("PartitionKey", QueryComparisons.EQUAL, partitionKey),
TableQuery.Operators.AND,
TableQuery.combineFilters(
TableQuery.generateFilterCondition("RowKey", QueryComparisons.GREATER_THAN_OR_EQUAL, startRowKey),
TableQuery.Operators.AND,
TableQuery.generateFilterCondition("RowKey", QueryComparisons.LESS_THAN_OR_EQUAL, endRowKey))));
// Iterate through the results
for (CustomerEntity entity : table.execute(rangeQuery)) {
System.out.println(String.format("\tCustomer: %s,%s\t%s\t%s\t%s", entity.getPartitionKey(), entity.getRowKey(), entity.getEmail(), entity.getHomePhoneNumber(), entity.getWorkPhoneNumber()));
}
}
开发者ID:Azure-Samples,项目名称:storage-table-java-getting-started,代码行数:28,代码来源:TableBasics.java
示例2: generateCombinedFilterConditions
import com.microsoft.azure.storage.table.TableQuery; //导入依赖的package包/类
public String generateCombinedFilterConditions() {
String filter = "";
if (isValidFilterExpession()) {
for (int idx = 0; idx < column.getValue().size(); idx++) {
String c = column.getValue().get(idx);
String cfn = function.getValue().get(idx);
String cop = predicate.getValue().get(idx);
String typ = fieldType.getValue().get(idx);
String f = Comparison.getQueryComparisons(cfn);
String v = operand.getValue().get(idx);
String p = Predicate.getOperator(cop);
EdmType t = SupportedFieldType.getEdmType(typ);
String flt = TableQuery.generateFilterCondition(c, f, v, t);
if (!filter.isEmpty()) {
filter = TableQuery.combineFilters(filter, p, flt);
} else {
filter = flt;
}
}
}
return filter;
}
开发者ID:Talend,项目名称:components,代码行数:27,代码来源:FilterExpressionTable.java
示例3: getEndpointSchema
import com.microsoft.azure.storage.table.TableQuery; //导入依赖的package包/类
@Override
public Schema getEndpointSchema(RuntimeContainer container, String schemaName) throws IOException {
try {
AzureStorageTableService tableService = new AzureStorageTableService(getAzureConnection(container));
TableQuery<DynamicTableEntity> partitionQuery;
partitionQuery = TableQuery.from(DynamicTableEntity.class).take(1);
Iterable<DynamicTableEntity> entities = tableService.executeQuery(schemaName, partitionQuery);
if (entities.iterator().hasNext()) {
DynamicTableEntity result = entities.iterator().next();
return AzureStorageAvroRegistry.get().inferSchema(result);
} else {
return null;
}
} catch (InvalidKeyException | URISyntaxException | StorageException e) {
LOGGER.error(e.getLocalizedMessage());
throw new ComponentException(e);
}
}
开发者ID:Talend,项目名称:components,代码行数:21,代码来源:AzureStorageTableSourceOrSink.java
示例4: createFilter
import com.microsoft.azure.storage.table.TableQuery; //导入依赖的package包/类
public String createFilter(final Integer minLevel, final String traceId, final String exceptionId)
{
final List<String> filters = new ArrayList<>();
if (minLevel != null)
filters.add(TableQuery.generateFilterCondition("level", TableQuery.QueryComparisons.GREATER_THAN_OR_EQUAL, minLevel));
if (traceId != null)
{
filters.add(TableQuery.generateFilterCondition("traceId",
TableQuery.QueryComparisons.GREATER_THAN_OR_EQUAL,
traceId));
filters.add(TableQuery.generateFilterCondition("traceId", TableQuery.QueryComparisons.LESS_THAN, increment(traceId)));
}
if (exceptionId != null)
filters.add(TableQuery.generateFilterCondition("exception-id", TableQuery.QueryComparisons.EQUAL, exceptionId));
return andFilters(filters);
}
开发者ID:petergeneric,项目名称:stdlib,代码行数:21,代码来源:AzureLogStore.java
示例5: search
import com.microsoft.azure.storage.table.TableQuery; //导入依赖的package包/类
public List<LogLineTableEntity> search(final DateTime from, DateTime to, final String filter, final long limit)
{
final String partitionAndRowQuery = createPartitionAndRowQuery(from, to);
final String logLineFilter = andFilters(partitionAndRowQuery, filter);
if (log.isTraceEnabled())
log.trace("Search logs: " + logLineFilter);
final Iterable<LogLineTableEntity> resultset = logdata.execute(TableQuery.from(LogLineTableEntity.class)
.where(logLineFilter));
// Fetch back the requested number of results
// N.B. we need to sort them according to when they were emitted because in Azure they're broken up
// by service by time
List<LogLineTableEntity> results = StreamSupport.stream(resultset.spliterator(), false)
.limit(limit)
.sorted(Comparator.comparing(LogLineTableEntity:: getDateTimeWhen))
.collect(Collectors.toList());
return results;
}
开发者ID:petergeneric,项目名称:stdlib,代码行数:23,代码来源:AzureLogStore.java
示例6: BasicQuery
import com.microsoft.azure.storage.table.TableQuery; //导入依赖的package包/类
/**
* Illustrates how to form and execute a query operation.
*
* @throws StorageException
*/
public static void BasicQuery() throws StorageException {
// Retrieve a single entity.
// Retrieve the entity with partition key of "Smith" and row key of "Jeff".
TableOperation retrieveSmithJeff = TableOperation.retrieve("Smith", "Jeff", CustomerEntity.class);
// Submit the operation to the table service and get the specific entity.
@SuppressWarnings("unused")
CustomerEntity specificEntity = table.execute(retrieveSmithJeff).getResultAsType();
// Retrieve all entities in a partition.
// Create a filter condition where the partition key is "Smith".
String partitionFilter = TableQuery.generateFilterCondition("PartitionKey", QueryComparisons.EQUAL, "Smith");
// Specify a partition query, using "Smith" as the partition key filter.
TableQuery<CustomerEntity> partitionQuery = TableQuery.from(CustomerEntity.class).where(partitionFilter);
// Loop through the results, displaying information about the entity.
for (CustomerEntity entity : table.execute(partitionQuery)) {
System.out.println(entity.getPartitionKey() + " " + entity.getRowKey() + "\t" + entity.getEmail() + "\t"
+ entity.getPhoneNumber());
}
}
开发者ID:Azure,项目名称:azure-storage-java,代码行数:28,代码来源:TableBasics.java
示例7: getUserForTimLocalId
import com.microsoft.azure.storage.table.TableQuery; //导入依赖的package包/类
@Override
public Optional<User> getUserForTimLocalId(String userId) throws AuthenticationUnavailableException {
String query = "(PartitionKey eq 'users') and (id eq '" + userId + "')";
Iterator<DynamicTableEntity> users = table.execute(TableQuery.from(DynamicTableEntity.class)
.where(query)
.take(2)).iterator();
if (users.hasNext()) {
Optional<User> result = Optional.of(propsToObject(users.next()));
if (users.hasNext()) {
LOG.error("Multiple items found for query " + query);
}
return result;
} else {
return Optional.empty();
}
}
开发者ID:HuygensING,项目名称:timbuctoo,代码行数:17,代码来源:AzureUserAccess.java
示例8: deleteVreAuthorizations
import com.microsoft.azure.storage.table.TableQuery; //导入依赖的package包/类
@Override
public void deleteVreAuthorizations(String vreId) throws AuthorizationUnavailableException {
String condition = TableQuery.generateFilterCondition(
"PartitionKey",
TableQuery.QueryComparisons.EQUAL,
vreId
);
TableBatchOperation deletes = new TableBatchOperation();
for (DynamicTableEntity entity : table.execute(TableQuery.from(DynamicTableEntity.class).where(condition))) {
deletes.delete(entity);
}
try {
table.execute(deletes);
} catch (StorageException e) {
LOG.error("deleteVreAuthorizations failed", e);
throw new AuthorizationUnavailableException("Could not delete authorizations");
}
}
开发者ID:HuygensING,项目名称:timbuctoo,代码行数:21,代码来源:AzureVreAuthorizationAccess.java
示例9: partitionScan
import com.microsoft.azure.storage.table.TableQuery; //导入依赖的package包/类
/**
* Demonstrate a partition scan whereby we are searching for all the entities within a partition.
* Note this is not as efficient as a range scan - but definitely more efficient than a full table scan.
*
* @param table The {@link CloudTable} object
* @param partitionKey The partition within which to search
*
* @throws StorageException
*/
private static void partitionScan(CloudTable table, String partitionKey) throws StorageException {
// Create the partition scan query
TableQuery<CustomerEntity> partitionScanQuery = TableQuery.from(CustomerEntity.class).where(
(TableQuery.generateFilterCondition("PartitionKey", QueryComparisons.EQUAL, partitionKey)));
// Iterate through the results
for (CustomerEntity entity : table.execute(partitionScanQuery)) {
System.out.println(String.format("\tCustomer: %s,%s\t%s\t%s\t%s", entity.getPartitionKey(), entity.getRowKey(), entity.getEmail(), entity.getHomePhoneNumber(), entity.getWorkPhoneNumber()));
}
}
开发者ID:Azure-Samples,项目名称:storage-table-java-getting-started,代码行数:21,代码来源:TableBasics.java
示例10: start
import com.microsoft.azure.storage.table.TableQuery; //导入依赖的package包/类
@Override
public boolean start() throws IOException {
String tableName = properties.tableName.getValue();
String filter = "";
if (properties.useFilterExpression.getValue()) {
filter = properties.filterExpression.generateCombinedFilterConditions();
LOGGER.debug(i18nMessages.getMessage("debug.FilterApplied", filter));
}
try {
TableQuery<DynamicTableEntity> partitionQuery;
if (filter.isEmpty()) {
partitionQuery = TableQuery.from(DynamicTableEntity.class);
} else {
partitionQuery = TableQuery.from(DynamicTableEntity.class).where(filter);
}
// Using execute will automatically and lazily follow the continuation tokens from page to page of results.
// So, we bypass the 1000 entities limit.
Iterable<DynamicTableEntity> entities = tableService.executeQuery(tableName, partitionQuery);
recordsIterator = entities.iterator();
if (recordsIterator.hasNext()) {
started = true;
result.totalCount++;
current = recordsIterator.next();
}
} catch (InvalidKeyException | URISyntaxException | StorageException e) {
LOGGER.error(e.getLocalizedMessage());
if (properties.dieOnError.getValue()) {
throw new ComponentException(e);
}
}
return started;
}
开发者ID:Talend,项目名称:components,代码行数:35,代码来源:AzureStorageTableReader.java
示例11: allDependenciesFor
import com.microsoft.azure.storage.table.TableQuery; //导入依赖的package包/类
@Override
public Collection<DependencyModel> allDependenciesFor(DependencyId dependencyId, ServiceId serviceId) {
try (Timer.Context timerContext = dependencyConfigs.time()) {
return Entities.toDependencyModelList(tableClient.search(
TableId.DEPENDENCY, TableQuery
.from(DependencyEntity.class)
.where(TableQuery.combineFilters(
partitionEquals(dependencyId),
TableQuery.Operators.AND,
serviceIdEquals(serviceId)))));
}
}
开发者ID:yammer,项目名称:breakerbox,代码行数:13,代码来源:AzureStore.java
示例12: allServiceEntities
import com.microsoft.azure.storage.table.TableQuery; //导入依赖的package包/类
private ImmutableList<ServiceEntity> allServiceEntities(ServiceId serviceId) {
try (Timer.Context timerContext = listService.time()) {
return tableClient.search(TableId.SERVICE, TableQuery
.from(ServiceEntity.class)
.where(partitionKeyEquals(serviceId)));
}
}
开发者ID:yammer,项目名称:breakerbox,代码行数:8,代码来源:AzureStore.java
示例13: partitionKeyEquals
import com.microsoft.azure.storage.table.TableQuery; //导入依赖的package包/类
private static String partitionKeyEquals(ServiceId serviceId) {
return TableQuery
.generateFilterCondition(
PARTITION_KEY,
TableQuery.QueryComparisons.EQUAL,
serviceId.getId());
}
开发者ID:yammer,项目名称:breakerbox,代码行数:8,代码来源:AzureStore.java
示例14: getConfiguration
import com.microsoft.azure.storage.table.TableQuery; //导入依赖的package包/类
private ImmutableList<DependencyEntity> getConfiguration(DependencyId dependencyId, long targetTimeStamp) {
try (Timer.Context timerContext = dependencyConfigs.time()) {
return tableClient.search(TableId.DEPENDENCY, TableQuery
.from(DependencyEntity.class)
.where(TableQuery.combineFilters(
partitionEquals(dependencyId),
TableQuery.Operators.AND,
timestampEquals(targetTimeStamp))));
}
}
开发者ID:yammer,项目名称:breakerbox,代码行数:11,代码来源:AzureStore.java
示例15: timestampEquals
import com.microsoft.azure.storage.table.TableQuery; //导入依赖的package包/类
private static String timestampEquals(long timestamp) {
return TableQuery.generateFilterCondition(
ROW_KEY,
TableQuery.QueryComparisons.EQUAL,
String.valueOf(timestamp)
);
}
开发者ID:yammer,项目名称:breakerbox,代码行数:8,代码来源:AzureStore.java
示例16: createPartitionAndRowQuery
import com.microsoft.azure.storage.table.TableQuery; //导入依赖的package包/类
/**
* Create a filter condition that returns log lines between two dates. Designed to be used in addition to other criteria
*
* @param from
* @param to
*
* @return
*/
public String createPartitionAndRowQuery(final DateTime from, final DateTime to)
{
final String parMin = TableQuery.generateFilterCondition("PartitionKey",
TableQuery.QueryComparisons.GREATER_THAN_OR_EQUAL,
from.toLocalDate().toString());
final String rowMin = TableQuery.generateFilterCondition("RowKey",
TableQuery.QueryComparisons.GREATER_THAN_OR_EQUAL,
LogLineTableEntity.toRowKey(from, null));
if (to == null || from.toLocalDate().equals(to.toLocalDate()) || to.isAfterNow())
{
// There's no upper bound (or the upper bound doesn't make sense to include in the query)
return andFilters(parMin, rowMin);
}
else
{
// From and To required
final String parMax = TableQuery.generateFilterCondition("PartitionKey",
TableQuery.QueryComparisons.LESS_THAN,
to.toLocalDate().plusDays(1).toString());
final String rowMax = TableQuery.generateFilterCondition("RowKey",
TableQuery.QueryComparisons.LESS_THAN,
LogLineTableEntity.toRowKey(to.plusSeconds(1), null));
return andFilters(parMin, parMax, rowMin, rowMax);
}
}
开发者ID:petergeneric,项目名称:stdlib,代码行数:39,代码来源:AzureLogStore.java
示例17: getEntitiesWithPartition
import com.microsoft.azure.storage.table.TableQuery; //导入依赖的package包/类
/**
* Retrieve all rows in a table with the given partition key.
* @param partitionKey Job model version of the processors to be retrieved.
* @return Iterable list of processor entities.
*/
public Iterable<ProcessorEntity> getEntitiesWithPartition(String partitionKey) {
String partitionFilter = TableQuery.generateFilterCondition(PARTITION_KEY, TableQuery.QueryComparisons.EQUAL, partitionKey);
TableQuery<ProcessorEntity> partitionQuery = TableQuery.from(ProcessorEntity.class).where(partitionFilter);
return table.execute(partitionQuery);
}
开发者ID:apache,项目名称:samza,代码行数:11,代码来源:TableUtils.java
示例18: getAll
import com.microsoft.azure.storage.table.TableQuery; //导入依赖的package包/类
@Override
public Iterable<TaskEntity> getAll() {
TableQuery<TaskEntity> query =
TableQuery.from(TaskEntity.class);
return table.execute(query);
}
开发者ID:freeuni-sdp,项目名称:todo-core,代码行数:7,代码来源:CloudRepository.java
示例19: executeQuery
import com.microsoft.azure.storage.table.TableQuery; //导入依赖的package包/类
public Iterable<DynamicTableEntity> executeQuery(String tableName, TableQuery<DynamicTableEntity> partitionQuery)
throws InvalidKeyException, URISyntaxException, StorageException {
CloudTable cloudTable = connection.getCloudStorageAccount().createCloudTableClient().getTableReference(tableName);
return cloudTable.execute(partitionQuery);
}
开发者ID:Talend,项目名称:components,代码行数:7,代码来源:AzureStorageTableService.java
示例20: serviceIdEquals
import com.microsoft.azure.storage.table.TableQuery; //导入依赖的package包/类
private static String serviceIdEquals(ServiceId serviceId) {
return TableQuery.generateFilterCondition(
"ServiceName",
TableQuery.QueryComparisons.EQUAL,
serviceId.getId());
}
开发者ID:yammer,项目名称:breakerbox,代码行数:7,代码来源:AzureStore.java
注:本文中的com.microsoft.azure.storage.table.TableQuery类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论