.addOption(QueryOption.TOP_RESULTS) .addOption(QueryOption.SORT) .orderDescending(ResourceMetrics.FIELD_NAME_TIMESTAMP, TypeName.LONG) .setResultLimit(RAW_METRICS_LIMIT) .setQuery(overallQueryBuilder.build()).build();
.orderDescending(BookState.FIELD_NAME_SOLD, ServiceDocumentDescription.TypeName.LONG)
.orderDescending(ServiceDocument.FIELD_NAME_SELF_LINK, TypeName.STRING) .setResultLimit(1)
.orderDescending(ServiceDocument.FIELD_NAME_SELF_LINK, TypeName.STRING) .setResultLimit(1)
.orderDescending(propertyName, propertyType) .addOption(QueryOption.EXPAND_CONTENT) .setResultLimit(resultLimit);
.orderDescending(propertyName, propertyType) .addOption(QueryOption.EXPAND_CONTENT) .setResultLimit(resultLimit);
QueryTask task = QueryTask.Builder.createDirectTask() .addOption(QueryOption.SORT) .orderDescending(ServiceDocument.FIELD_NAME_SELF_LINK, TypeName.STRING) .addOption(QueryOption.TOP_RESULTS)
QueryTask task = QueryTask.Builder.createDirectTask() .addOption(QueryOption.SORT) .orderDescending(ServiceDocument.FIELD_NAME_SELF_LINK, TypeName.STRING) .addOption(QueryOption.TOP_RESULTS)
QueryTask task = queryTaskBuilder .setQuery(kindClause) .orderDescending(ExampleServiceState.FIELD_NAME_SORTED_COUNTER, TypeName.LONG) .orderAscending(ExampleServiceState.FIELD_NAME_NAME, TypeName.STRING) .build();
QueryTask task = queryTaskBuilder .setQuery(kindClause) .orderDescending(ExampleServiceState.FIELD_NAME_SORTED_COUNTER, TypeName.LONG) .orderAscending(ExampleServiceState.FIELD_NAME_NAME, TypeName.STRING) .build();
.addOption(QueryOption.EXPAND_CONTENT) .addOption(QueryOption.SORT) .orderDescending(ServiceDocument.FIELD_NAME_SELF_LINK, TypeName.STRING) .setQuery(Query.Builder.create() .addKindFieldClause(ResourceMetrics.class)
.addOption(QueryOption.EXPAND_CONTENT) .addOptions(queryOptions) .orderDescending(ServiceDocument.FIELD_NAME_SELF_LINK, ServiceDocumentDescription.TypeName.STRING) .setResultLimit((int) this.serviceCount)
.addOption(QueryOption.EXPAND_CONTENT) .addOptions(queryOptions) .orderDescending(ServiceDocument.FIELD_NAME_SELF_LINK, ServiceDocumentDescription.TypeName.STRING) .setResultLimit((int) this.serviceCount)
private static Operation buildLatestNonTransactionQueryTaskOp(StatefulService s, AuthorizationContext authContext) { Query.Builder queryBuilder = Query.Builder.create(); queryBuilder.addFieldClause(ServiceDocument.FIELD_NAME_SELF_LINK, s.getSelfLink()); queryBuilder.addFieldClause(ServiceDocument.FIELD_NAME_TRANSACTION_ID, "*", MatchType.WILDCARD, Occurance.MUST_NOT_OCCUR); QueryTask.Builder queryTaskBuilder = QueryTask.Builder.createDirectTask() .setQuery(queryBuilder.build()); queryTaskBuilder.addOption(QueryOption.EXPAND_CONTENT); queryTaskBuilder.addOption(QueryOption.INCLUDE_ALL_VERSIONS); queryTaskBuilder.orderDescending(ServiceDocument.FIELD_NAME_VERSION, TypeName.LONG); QueryTask task = queryTaskBuilder.build(); Operation returnOp = Operation .createPost(s.getHost(), ServiceUriPaths.CORE_QUERY_TASKS) .setBody(task); returnOp.setAuthorizationContext(authContext); return returnOp; }
private static Operation buildLatestInTransactionQueryTaskOp(StatefulService s, String txid, AuthorizationContext authContext) { Query.Builder queryBuilder = Query.Builder.create(); queryBuilder.addFieldClause(ServiceDocument.FIELD_NAME_SELF_LINK, s.getSelfLink()); queryBuilder.addFieldClause(ServiceDocument.FIELD_NAME_TRANSACTION_ID, txid); QueryTask.Builder queryTaskBuilder = QueryTask.Builder.createDirectTask() .setQuery(queryBuilder.build()); queryTaskBuilder.addOption(QueryOption.EXPAND_CONTENT); queryTaskBuilder.addOption(QueryOption.INCLUDE_ALL_VERSIONS); queryTaskBuilder.orderDescending(ServiceDocument.FIELD_NAME_VERSION, TypeName.LONG); QueryTask task = queryTaskBuilder.build(); Operation returnOp = Operation .createPost(s.getHost(), ServiceUriPaths.CORE_QUERY_TASKS) .setBody(task); returnOp.setAuthorizationContext(authContext); return returnOp; }