Class CosmosDb

java.lang.Object
io.inversion.Db<CosmosDb>
io.inversion.cosmosdb.CosmosDb

public class CosmosDb extends io.inversion.Db<CosmosDb>
  • Field Details

    • INDEX_TYPE_PARTITION_KEY

      public static final String INDEX_TYPE_PARTITION_KEY
      See Also:
      Constant Field Values
    • uri

      protected String uri
    • db

      protected String db
    • key

      protected String key
    • documentClient

      protected transient com.microsoft.azure.documentdb.DocumentClient documentClient
  • Constructor Details

    • CosmosDb

      public CosmosDb()
    • CosmosDb

      public CosmosDb(String name)
  • Method Details

    • buildDocumentClient

      public static com.microsoft.azure.documentdb.DocumentClient buildDocumentClient(String uri, String key)
    • doSelect

      public io.inversion.Results doSelect(io.inversion.Collection collection, List<io.inversion.rql.Term> columnMappedTerms) throws io.inversion.ApiException
      Finds the resource keys on the other side of the relationship
      Specified by:
      doSelect in class io.inversion.Db<CosmosDb>
      Parameters:
      collection - the collection to query
      columnMappedTerms - the query terms
      Returns:
      Map key=sourceResourceKey, value=relatedResourceKey
      Throws:
      io.inversion.ApiException - if selection fails for any reason
    • doUpsert

      public List<String> doUpsert(io.inversion.Collection table, List<Map<String,​Object>> rows) throws io.inversion.ApiException
      Specified by:
      doUpsert in class io.inversion.Db<CosmosDb>
      Throws:
      io.inversion.ApiException
    • upsertRow

      public String upsertRow(io.inversion.Collection collection, Map<String,​Object> row) throws io.inversion.ApiException
      Throws:
      io.inversion.ApiException
    • delete

      public void delete(io.inversion.Collection table, List<Map<String,​Object>> indexValues) throws io.inversion.ApiException
      Specified by:
      delete in class io.inversion.Db<CosmosDb>
      Throws:
      io.inversion.ApiException
    • deleteRow

      protected void deleteRow(io.inversion.Collection collection, Map<String,​Object> indexValues) throws io.inversion.ApiException
      Deletes a single specific resource.

      Rest url format for Cosmos deletions - https://{databaseaccount}.documents.azure.com/dbs/{db}/colls/{coll}/docs/{doc}

      Parameters:
      collection - the collection to delete
      indexValues - identifiers for the documents to delete
      Throws:
      io.inversion.ApiException
      See Also:
      CosmosDb Resource URI Syntax
    • getCollectionUri

      protected String getCollectionUri(io.inversion.Collection table)
    • getUri

      public String getUri()
    • withUri

      public CosmosDb withUri(String uri)
    • getDb

      public String getDb()
    • withDb

      public CosmosDb withDb(String db)
    • getKey

      public String getKey()
    • withKey

      public CosmosDb withKey(String key)
    • isAllowCrossPartitionQueries

      public boolean isAllowCrossPartitionQueries()
    • withAllowCrossPartitionQueries

      public CosmosDb withAllowCrossPartitionQueries(boolean allowCrossPartitionQueries)
    • withDocumentClient

      public CosmosDb withDocumentClient(com.microsoft.azure.documentdb.DocumentClient documentClient)
    • getDocumentClient

      public com.microsoft.azure.documentdb.DocumentClient getDocumentClient()