public List queryAggregateValues(String collectionLink, SqlQuerySpec querySpec, FeedOptions feedOptions)
Query for aggregation values in a document collection.
Parameters:
collectionLink
- the link to the parent document collection.
querySpec
- the SQL query specification.
feedOptions
- the feed options.
Returns:
a list containing the aggregation values
queryAggregateValues
public List queryAggregateValues(String collectionLink, SqlQuerySpec querySpec, FeedOptions feedOptions, Object partitionKey)
Query for aggregation values in a document collection.
Parameters:
collectionLink
- the link to the parent document collection.
querySpec
- the SQL query specification.
feedOptions
- the feed options.
partitionKey
- the partitionKey.
Returns:
a list containing the aggregation values
queryAggregateValues
public List queryAggregateValues(String collectionLink, String query, FeedOptions feedOptions)
Query for aggregation values in a document collection.
Parameters:
collectionLink
- the link to the parent document collection.
query
- the query string.
feedOptions
- the feed options.
Returns:
a list containing the aggregation values
queryAggregateValues
public List queryAggregateValues(String collectionLink, String query, FeedOptions feedOptions, String partitionKey)
Query for aggregation values in a document collection.
Parameters:
collectionLink
- the link to the parent document collection.
query
- the query string.
feedOptions
- the feed options.
partitionKey
- the partitionKey.
Returns:
a list containing the aggregation values
queryAttachments
public FeedResponse queryAttachments(String documentLink, SqlQuerySpec querySpec, FeedOptions options)
Query for attachments.
Parameters:
documentLink
- the document link.
querySpec
- the SQL query specification.
options
- the feed options.
Returns:
the feed response with the obtained attachments.
queryAttachments
public FeedResponse queryAttachments(String documentLink, String query, FeedOptions options)
Query for attachments.
Parameters:
documentLink
- the document link.
query
- the query.
options
- the feed options.
Returns:
the feed response with the obtained attachments.
queryCollections
public FeedResponse queryCollections(String databaseLink, SqlQuerySpec querySpec, FeedOptions options)
Query for document collections in a database.
Parameters:
databaseLink
- the database link.
querySpec
- the SQL query specification.
options
- the feed options.
Returns:
the feed response with the obtained collections.
queryCollections
public FeedResponse queryCollections(String databaseLink, String query, FeedOptions options)
Query for document collections in a database.
Parameters:
databaseLink
- the database link.
query
- the query.
options
- the feed options.
Returns:
the feed response with the obtained collections.
queryConflicts
public FeedResponse queryConflicts(String collectionLink, SqlQuerySpec querySpec, FeedOptions options)
Query for conflicts.
Parameters:
collectionLink
- the collection link.
querySpec
- the SQL query specification.
options
- the feed options.
Returns:
the feed response of the obtained conflicts.
queryConflicts
public FeedResponse queryConflicts(String collectionLink, String query, FeedOptions options)
Query for conflicts.
Parameters:
collectionLink
- the collection link.
query
- the query.
options
- the feed options.
Returns:
the feed response of the obtained conflicts.
queryDatabases
public FeedResponse queryDatabases(SqlQuerySpec querySpec, FeedOptions options)
Query for databases.
Parameters:
querySpec
- the SQL query specification.
options
- the feed options.
Returns:
the feed response with the obtained databases.
queryDatabases
public FeedResponse queryDatabases(String query, FeedOptions options)
Query for databases.
Parameters:
query
- the query.
options
- the feed options.
Returns:
the feed response with the obtained databases.
queryDocumentChangeFeed
public FeedResponse queryDocumentChangeFeed(String collectionLink, ChangeFeedOptions changeFeedOptions)
Query for documents change feed in a document collection.
Example:
String partitionKeyRangeId = "0"; // Use client.readPartitionKeyRanges() to obtain the ranges.
String checkpointContinuation = null;
ChangeFeedOptions options = new ChangeFeedOptions();
options.setPartitionKeyRangeId(partitionKeyRangeId);
options.setRequestContinuation(checkpointContinuation);
options.setStartFromBeginning(true);
FeedResponse<Document> query = client.queryDocumentChangeFeed(coll.getSelfLink(), options);
do {
List<Document> docs = query.getQueryIterable().fetchNextBlock();
// Process the documents
// Checkpoint query.getResponseContinuation()
} while (query.getQueryIterator().hasNext());
Parameters:
collectionLink
- the link to the parent document collection
changeFeedOptions
- the options for processing the query results feed
Returns:
the feed response with the obtained documents
queryDocuments
public FeedResponse queryDocuments(String collectionLink, SqlQuerySpec querySpec, FeedOptions options)
Query for documents in a document collection.
Parameters:
collectionLink
- the link to the parent document collection.
querySpec
- the SQL query specification.
options
- the feed options.
Returns:
the feed response with the obtained documents.
queryDocuments
public FeedResponse queryDocuments(String collectionLink, SqlQuerySpec querySpec, FeedOptions options, Object partitionKey)
Query for documents in a document collection.
Parameters:
collectionLink
- the link to the parent document collection.
querySpec
- the SQL query specification.
options
- the feed options.
partitionKey
- the partitionKey.
Returns:
the feed response with the obtained documents.
queryDocuments
public FeedResponse queryDocuments(String collectionLink, String query, FeedOptions options)
Query for documents in a document collection.
Parameters:
collectionLink
- the link to the parent document collection.
query
- the query.
options
- the feed options.
Returns:
the feed response with the obtained documents.
queryDocuments
public FeedResponse queryDocuments(String collectionLink, String query, FeedOptions options, Object partitionKey)
Query for documents in a document collection with a partitionKey
Parameters:
collectionLink
- the link to the parent document collection.
query
- the query.
options
- the feed options.
partitionKey
- the partitionKey.
Returns:
the feed response with the obtained documents.
queryOffers
public FeedResponse queryOffers(SqlQuerySpec querySpec, FeedOptions options)
Query for offers in a database.
Parameters:
querySpec
- the query specification.
options
- the feed options.
Returns:
the feed response with the obtained offers.
queryOffers
public FeedResponse queryOffers(String query, FeedOptions options)
Query for offers in a database.
Parameters:
query
- the query.
options
- the feed options.
Returns:
the feed response with the obtained offers.
queryPermissions
public FeedResponse queryPermissions(String permissionLink, SqlQuerySpec querySpec, FeedOptions options)
Query for permissions.
Parameters:
permissionLink
- the permission link.
querySpec
- the SQL query specification.
options
- the feed options.
Returns:
the feed response with the obtained permissions.
queryPermissions
public FeedResponse queryPermissions(String userLink, String query, FeedOptions options)
Query for permissions.
Parameters:
userLink
- the user link.
query
- the query.
options
- the feed options.
Returns:
the feed response with the obtained permissions.
queryStoredProcedures
public FeedResponse queryStoredProcedures(String collectionLink, SqlQuerySpec querySpec, FeedOptions options)
Query for stored procedures in a document collection.
Parameters:
collectionLink
- the collection link.
querySpec
- the SQL query specification.
options
- the feed options.
Returns:
the feed response with the obtained stored procedures.
queryStoredProcedures
public FeedResponse queryStoredProcedures(String collectionLink, String query, FeedOptions options)
Query for stored procedures in a document collection.
Parameters:
collectionLink
- the collection link.
query
- the query.
options
- the feed options.
Returns:
the feed response with the obtained stored procedures.
queryTriggers
public FeedResponse queryTriggers(String collectionLink, SqlQuerySpec querySpec, FeedOptions options)
Query for triggers.
Parameters:
collectionLink
- the collection link.
querySpec
- the SQL query specification.
options
- the feed options.
Returns:
the feed response with the obtained triggers.
queryTriggers
public FeedResponse queryTriggers(String collectionLink, String query, FeedOptions options)
Query for triggers.
Parameters:
collectionLink
- the collection link.
query
- the query.
options
- the feed options.
Returns:
the feed response with the obtained triggers.
queryUserDefinedFunctions
public FeedResponse queryUserDefinedFunctions(String collectionLink, SqlQuerySpec querySpec, FeedOptions options)
Query for user defined functions.
Parameters:
collectionLink
- the collection link.
querySpec
- the SQL query specification.
options
- the feed options.
Returns:
the feed response with the obtained user defined functions.
queryUserDefinedFunctions
public FeedResponse queryUserDefinedFunctions(String collectionLink, String query, FeedOptions options)
Query for user defined functions.
Parameters:
collectionLink
- the collection link.
query
- the query.
options
- the feed options.
Returns:
the feed response with the obtained user defined functions.
queryUsers
public FeedResponse queryUsers(String databaseLink, SqlQuerySpec querySpec, FeedOptions options)
Query for users.
Parameters:
databaseLink
- the database link.
querySpec
- the SQL query specification.
options
- the feed options.
Returns:
the feed response of the obtained users.
queryUsers
public FeedResponse queryUsers(String databaseLink, String query, FeedOptions options)
Query for users.
Parameters:
databaseLink
- the database link.
query
- the query.
options
- the feed options.
Returns:
the feed response of the obtained users.
readAttachment
public ResourceResponse readAttachment(String attachmentLink, RequestOptions options)
Reads an attachment.
Parameters:
attachmentLink
- the attachment link.
options
- the request options.
Returns:
the resource response with the read attachment.
Throws:
DocumentClientException
- the document client exception.
readAttachments
public FeedResponse readAttachments(String documentLink, FeedOptions options)
Reads all attachments in a document.
Parameters:
documentLink
- the document link.
options
- the feed options.
Returns:
the feed response with the read attachments.
readCollection
public ResourceResponse readCollection(String collectionLink, RequestOptions options)
Reads a document collection by the collection link.
Parameters:
collectionLink
- the collection link.
options
- the request options.
Returns:
the resource response with the read collection.
Throws:
DocumentClientException
- the document client exception.
readCollections
public FeedResponse readCollections(String databaseLink, FeedOptions options)
Reads all document collections in a database.
Parameters:
databaseLink
- the database link.
options
- the fee options.
Returns:
the feed response with the read collections.
readConflict
public ResourceResponse readConflict(String conflictLink, RequestOptions options)
Reads a conflict.
Parameters:
conflictLink
- the conflict link.
options
- the request options.
Returns:
the resource response with the read conflict.
Throws:
DocumentClientException
- the document client exception.
readConflicts
public FeedResponse readConflicts(String collectionLink, FeedOptions options)
Reads all conflicts in a document collection.
Parameters:
collectionLink
- the collection link.
options
- the feed options.
Returns:
the feed response with the read conflicts.
readDatabase
public ResourceResponse readDatabase(String databaseLink, RequestOptions options)
Reads a database.
Parameters:
databaseLink
- the database link.
options
- the request options.
Returns:
the resource response with the read database.
Throws:
DocumentClientException
- the document client exception.
readDatabases
public FeedResponse readDatabases(FeedOptions options)
Reads all databases.
Parameters:
options
- the feed options.
Returns:
the feed response with the read databases.
readDocument
public ResourceResponse readDocument(String documentLink, RequestOptions options)
Reads a document by the document link.
Parameters:
documentLink
- the document link.
options
- the request options.
Returns:
the resource response with the read document.
Throws:
DocumentClientException
- the document client exception.
readDocuments
public FeedResponse readDocuments(String collectionLink, FeedOptions options)
Reads all documents in a document collection.
Parameters:
collectionLink
- the collection link.
options
- the feed options.
Returns:
the feed response with read documents.
readMedia
public MediaResponse readMedia(String mediaLink)
Reads a media by the media link.
Parameters:
mediaLink
- the media link.
Returns:
the media response.
Throws:
DocumentClientException
- the document client exception.
readOffer
public ResourceResponse readOffer(String offerLink)
Reads an offer.
Parameters:
offerLink
- the offer link.
Returns:
the resource response with the read offer.
Throws:
DocumentClientException
- the document client exception.
readOffers
public FeedResponse readOffers(FeedOptions options)
Reads offers.
Parameters:
options
- the feed options.
Returns:
the feed response with the read offers.
readPartitionKeyRanges
public FeedResponse readPartitionKeyRanges(DocumentCollection documentCollection, FeedOptions options)
Reads all partition key ranges in a document collection.
Example:
FeedResponse<PartitionKeyRange> partitionKeyRanges = this.client.readPartitionKeyRanges(coll, null);
List<String> ids = new ArrayList<String>();
for (PartitionKeyRange range : partitionKeyRanges.getQueryIterable()) {
ids.add(range.getId());
}
Parameters:
documentCollection
- the document collection.
options
- the feed options.
Returns:
the feed response with the read partition key ranges.
readPartitionKeyRanges
public FeedResponse readPartitionKeyRanges(String collectionLink, FeedOptions options)
Reads all partition key ranges in a document collection.
Example:
FeedResponse<PartitionKeyRange> partitionKeyRanges = this.client.readPartitionKeyRanges(coll, null);
List<String> ids = new ArrayList<String>();
for (PartitionKeyRange range : partitionKeyRanges.getQueryIterable()) {
ids.add(range.getId());
}
Parameters:
collectionLink
- the collection link.
options
- the feed options.
Returns:
the feed response with the read partition key ranges.
readPartitionKeyRanges
public Collection readPartitionKeyRanges(String collectionLink, String query)
Reads all partition key ranges in a document collection for a provided query.
Parameters:
collectionLink
- the document collection link
query
- the query string
Returns:
the list of the serving partition key ranges for the query
Throws:
DocumentClientException
- from partition key ranges query
readPermission
public ResourceResponse readPermission(String permissionLink, RequestOptions options)
Reads a permission.
Parameters:
permissionLink
- the permission link.
options
- the request options.
Returns:
the resource response with the read permission.
Throws:
DocumentClientException
- the document client exception.
readPermissions
public FeedResponse readPermissions(String userLink, FeedOptions options)
Reads all permissions.
Parameters:
userLink
- the user link.
options
- the feed options.
Returns:
the feed response with the read permissions.
readStoredProcedure
public ResourceResponse readStoredProcedure(String storedProcedureLink, RequestOptions options)
Read a stored procedure by the stored procedure link.
Parameters:
storedProcedureLink
- the stored procedure link.
options
- the request options.
Returns:
the resource response with the read stored procedure.
Throws:
DocumentClientException
- the document client exception.
readStoredProcedures
public FeedResponse readStoredProcedures(String collectionLink, FeedOptions options)
Reads all stored procedures in a document collection link.
Parameters:
collectionLink
- the collection link.
options
- the feed options.
Returns:
the feed response with the read stored procedure.
readTrigger
public ResourceResponse readTrigger(String triggerLink, RequestOptions options)
Reads a trigger by the trigger link.
Parameters:
triggerLink
- the trigger link.
options
- the request options.
Returns:
the resource response with the read trigger.
Throws:
DocumentClientException
- the document client exception.
readTriggers
public FeedResponse readTriggers(String collectionLink, FeedOptions options)
Reads all triggers in a document collection.
Parameters:
collectionLink
- the collection link.
options
- the feed options.
Returns:
the feed response with the read triggers.
readUser
public ResourceResponse readUser(String userLink, RequestOptions options)
Reads a user.
Parameters:
userLink
- the user link.
options
- the request options.
Returns:
the resource response with the read user.
Throws:
DocumentClientException
- the document client exception.
readUserDefinedFunction
public ResourceResponse readUserDefinedFunction(String udfLink, RequestOptions options)
Read a user defined function.
Parameters:
udfLink
- the user defined function link.
options
- the request options.
Returns:
the resource response with the read user defined function.
Throws:
DocumentClientException
- the document client exception.
readUserDefinedFunctions
public FeedResponse readUserDefinedFunctions(String collectionLink, FeedOptions options)
Reads all user defined functions in a document collection.
Parameters:
collectionLink
- the collection link.
options
- the feed options.
Returns:
the feed response with the read user defined functions.
readUsers
public FeedResponse readUsers(String databaseLink, FeedOptions options)
Reads all users in a database.
Parameters:
databaseLink
- the database link.
options
- the feed options.
Returns:
the feed response with the read users.
registerPartitionResolver
public void registerPartitionResolver(String databaseLink, PartitionResolver partitionResolver)
Parameters:
databaseLink
partitionResolver
replaceAttachment
public ResourceResponse replaceAttachment(Attachment attachment, RequestOptions options)
Replaces an attachment.
Parameters:
attachment
- the attachment to use.
options
- the request options.
Returns:
the resource response with the replaced attachment.
Throws:
DocumentClientException
- the document client exception.
replaceCollection
public ResourceResponse replaceCollection(DocumentCollection collection, RequestOptions options)
Replaces a document collection.
Parameters:
collection
- the document collection to use.
options
- the request options.
Returns:
the resource response with the replaced document collection.
Throws:
DocumentClientException
- the document client exception.
replaceDocument
public ResourceResponse replaceDocument(Document document, RequestOptions options)
Replaces a document with the passed in document.
Parameters:
document
- the document to replace (containing the document id).
options
- the request options.
Returns:
the resource response with the replaced document.
Throws:
DocumentClientException
- the document client exception.
replaceDocument
public ResourceResponse replaceDocument(String documentLink, Object document, RequestOptions options)
Replaces a document using a POJO object.
Parameters:
documentLink
- the document link.
document
- the document represented as a POJO or Document object.
options
- the request options.
Returns:
the resource response with the replaced document.
Throws:
DocumentClientException
- the document client exception.
replaceOffer
public ResourceResponse replaceOffer(Offer offer)
Replaces an offer.
Parameters:
offer
- the offer to use.
Returns:
the resource response with the replaced offer.
Throws:
DocumentClientException
- the document client exception.
replacePermission
public ResourceResponse replacePermission(Permission permission, RequestOptions options)
Replaces a permission.
Parameters:
permission
- the permission to use.
options
- the request options.
Returns:
the resource response with the replaced permission.
Throws:
DocumentClientException
- the document client exception.
replaceStoredProcedure
public ResourceResponse replaceStoredProcedure(StoredProcedure storedProcedure, RequestOptions options)
Replaces a stored procedure.
Parameters:
storedProcedure
- the stored procedure to use.
options
- the request options.
Returns:
the resource response with the replaced stored procedure.
Throws:
DocumentClientException
- the document client exception.
replaceTrigger
public ResourceResponse replaceTrigger(Trigger trigger, RequestOptions options)
Replaces a trigger.
Parameters:
trigger
- the trigger to use.
options
- the request options.
Returns:
the resource response with the replaced trigger.
Throws:
DocumentClientException
- the document client exception.
replaceUser
public ResourceResponse replaceUser(User user, RequestOptions options)
Replaces a user.
Parameters:
user
- the user to use.
options
- the request options.
Returns:
the resource response with the replaced user.
Throws:
DocumentClientException
- the document client exception.
replaceUserDefinedFunction
public ResourceResponse replaceUserDefinedFunction(UserDefinedFunction udf, RequestOptions options)
Replaces a user defined function.
Parameters:
udf
- the user defined function.
options
- the request options.
Returns:
the resource response with the replaced user defined function.
Throws:
DocumentClientException
- the document client exception.
updateMedia
public MediaResponse updateMedia(String mediaLink, InputStream mediaStream, MediaOptions options)
Updates a media by the media link.
Parameters:
mediaLink
- the media link.
mediaStream
- the media stream to upload.
options
- the media options.
Returns:
the media response.
Throws:
DocumentClientException
- the document client exception.
upsertAttachment
public ResourceResponse upsertAttachment(String documentLink, Attachment attachment, RequestOptions options)
Upserts an attachment.
Parameters:
documentLink
- the document link.
attachment
- the attachment to upsert.
options
- the request options.
Returns:
the resource response with the upserted attachment.
Throws:
DocumentClientException
- the document client exception.
upsertAttachment
public ResourceResponse upsertAttachment(String documentLink, InputStream mediaStream, MediaOptions options)
Upserts an attachment to the media stream
Parameters:
documentLink
- the document link.
mediaStream
- the media stream for upserting the attachment.
options
- the media options.
Returns:
the resource response with the upserted attachment.
Throws:
DocumentClientException
- the document client exception.
upsertDocument
public ResourceResponse upsertDocument(String collectionLink, Object document, RequestOptions options, boolean disableAutomaticIdGeneration)
Upserts a document.
Parameters:
collectionLink
- the link to the parent document collection.
document
- the document represented as a POJO or Document object to upsert.
options
- the request options.
disableAutomaticIdGeneration
- the flag for disabling automatic id generation.
Returns:
the resource response with the upserted document.
Throws:
DocumentClientException
- the document client exception.
upsertPermission
public ResourceResponse upsertPermission(String userLink, Permission permission, RequestOptions options)
Upserts a permission.
Parameters:
userLink
- the user link.
permission
- the permission to upsert.
options
- the request options.
Returns:
the resource response with the upserted permission.
Throws:
DocumentClientException
- the document client exception.
upsertStoredProcedure
public ResourceResponse upsertStoredProcedure(String collectionLink, StoredProcedure storedProcedure, RequestOptions options)
Upserts a stored procedure.
Parameters:
collectionLink
- the collection link.
storedProcedure
- the stored procedure to upsert.
options
- the request options.
Returns:
the resource response with the upserted stored procedure.
Throws:
DocumentClientException
- the document client exception.
upsertTrigger
public ResourceResponse upsertTrigger(String collectionLink, Trigger trigger, RequestOptions options)
Upserts a trigger.
Parameters:
collectionLink
- the collection link.
trigger
- the trigger to upsert.
options
- the request options.
Returns:
the resource response with the upserted trigger.
Throws:
DocumentClientException
- the document client exception.
upsertUser
public ResourceResponse upsertUser(String databaseLink, User user, RequestOptions options)
Upserts a user.
Parameters:
databaseLink
- the database link.
user
- the user to upsert.
options
- the request options.
Returns:
the resource response with the upserted user.
Throws:
DocumentClientException
- the document client exception.
upsertUserDefinedFunction
public ResourceResponse upsertUserDefinedFunction(String collectionLink, UserDefinedFunction udf, RequestOptions options)
Upserts a user defined function.
Parameters:
collectionLink
- the collection link.
udf
- the user defined function to upsert.
options
- the request options.
Returns:
the resource response with the upserted user defined function.
Throws:
DocumentClientException
- the document client exception.
Applies to