public class DocumentDBConnectorUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
UserAgentSuffix |
Constructor and Description |
---|
DocumentDBConnectorUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addIdIfMissing(com.microsoft.azure.documentdb.Document doc)
If no id is provided, replace it with an auto generated guid id.
|
static com.microsoft.azure.documentdb.StoredProcedure |
CreateBulkImportStoredProcedure(com.microsoft.azure.documentdb.DocumentClient client,
String collectionLink)
Gets the bulk import stored procedure that will be used for writing documents ( if the sproc already exists, use it, otherwise create a new one.
|
static void |
executeWriteStoredProcedure(com.microsoft.azure.documentdb.DocumentClient client,
String collectionSelfLink,
com.microsoft.azure.documentdb.StoredProcedure sproc,
List<com.microsoft.azure.documentdb.Document> allDocs,
boolean upsert)
Executes the bulk import stored procedure for a list of documents.
|
static com.microsoft.azure.documentdb.Database |
GetDatabase(com.microsoft.azure.documentdb.DocumentClient client,
String databaseId) |
static com.microsoft.azure.documentdb.DocumentCollection |
GetDocumentCollection(com.microsoft.azure.documentdb.DocumentClient client,
String databaseSelfLink,
String collectionId) |
static com.microsoft.azure.documentdb.DocumentCollection |
getOrCreateOutputCollection(com.microsoft.azure.documentdb.DocumentClient client,
String databaseSelfLink,
String collectionName,
String[] rangeIndexes)
Gets an output collection with the passed name ( if the collection already exists return it, otherwise create new one
|
public static final String UserAgentSuffix
public static com.microsoft.azure.documentdb.DocumentCollection getOrCreateOutputCollection(com.microsoft.azure.documentdb.DocumentClient client, String databaseSelfLink, String collectionName, String[] rangeIndexes) throws com.microsoft.azure.documentdb.DocumentClientException
client
- The DocumentClient instance.databaseSelfLink
- the self link of the passed database.collectionName
- The id of the output collection.rangeIndexes
- An optional parameter that contain index paths for range indexes and it will be used to create an indexing policy.com.microsoft.azure.documentdb.DocumentClientException
public static com.microsoft.azure.documentdb.DocumentCollection GetDocumentCollection(com.microsoft.azure.documentdb.DocumentClient client, String databaseSelfLink, String collectionId)
public static com.microsoft.azure.documentdb.Database GetDatabase(com.microsoft.azure.documentdb.DocumentClient client, String databaseId)
public static com.microsoft.azure.documentdb.StoredProcedure CreateBulkImportStoredProcedure(com.microsoft.azure.documentdb.DocumentClient client, String collectionLink) throws com.microsoft.azure.documentdb.DocumentClientException
client
- the DocumentClient instance for DocumentDB.collectionLink
- the self-link of the collection to write to.com.microsoft.azure.documentdb.DocumentClientException
public static void executeWriteStoredProcedure(com.microsoft.azure.documentdb.DocumentClient client, String collectionSelfLink, com.microsoft.azure.documentdb.StoredProcedure sproc, List<com.microsoft.azure.documentdb.Document> allDocs, boolean upsert)
client
- The DocumentClient instance for DocumentDBcollectionSelfLink
- the self-link for the collection to write to.sproc
- The stored procedure to executeallDocs
- The list of documents to writeupsert
- Specifies whether to replace the document if exists or not. By default it's true.public static void addIdIfMissing(com.microsoft.azure.documentdb.Document doc)
doc
- The document to be checked for id.Copyright © 2015. All rights reserved.