Class CosmosDb

java.lang.Object
io.inversion.Rule<T>
io.inversion.Db<CosmosDb>
io.inversion.cosmosdb.CosmosDb
All Implemented Interfaces:
Comparable<CosmosDb>

public class CosmosDb extends io.inversion.Db<CosmosDb>
  • Nested Class Summary

    Nested classes/interfaces inherited from class io.inversion.Rule

    io.inversion.Rule.RuleMatcher
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected String
     
    protected com.microsoft.azure.documentdb.DocumentClient
     
    static final String
     
    protected String
     
    protected String
     

    Fields inherited from class io.inversion.Db

    bootstrap, collections, dryRun, excludeColumns, includeColumns, includeTables, log, reservedParams, type

    Fields inherited from class io.inversion.Rule

    ALL_METHODS, configMap, description, excludeMatchers, excludeOn, includeMatchers, includeOn, name, order, params
  • Constructor Summary

    Constructors
    Constructor
    Description
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.microsoft.azure.documentdb.DocumentClient
    buildDocumentClient(String uri, String key, com.microsoft.azure.documentdb.ConnectionPolicy connectionPolicy)
     
    protected void
    deleteRow(io.inversion.Collection collection, Map<String,Object> indexValues)
    Deletes a single specific resource.
    void
    doDelete(io.inversion.Collection table, List<Map<String,Object>> indexValues)
     
    io.inversion.Results
    doSelect(io.inversion.Collection collection, List<io.inversion.rql.Term> columnMappedTerms)
    Finds the resource keys on the other side of the relationship
    doUpsert(io.inversion.Collection table, List<Map<String,Object>> rows)
     
    protected String
    getCollectionUri(io.inversion.Collection table)
     
     
    com.microsoft.azure.documentdb.DocumentClient
     
     
     
    boolean
     
    upsertRow(io.inversion.Collection collection, Map<String,Object> row)
     
    withAllowCrossPartitionQueries(boolean allowCrossPartitionQueries)
     
     
    withDocumentClient(com.microsoft.azure.documentdb.DocumentClient documentClient)
     
     
     

    Methods inherited from class io.inversion.Db

    beautifyCollectionName, beautifyName, buildCollections, buildRelationships, castDbOutput, castJsonInput, castJsonInput, configApi, configDb, delete, doPatch, doShutdown, doShutdown, doStartup, excludeTable, filterOutJsonProperty, getCollection, getCollectionByTableName, getCollections, getProperty, getType, isBootstrap, isDryRun, isRunning, isType, makeRelationshipName, mapToColumnNames, mapToColumnNames, mapToJsonNames, patch, removeCollection, select, shutdown, shutdown, startup, upsert, withBootstrap, withCollection, withCollections, withDryRun, withExcludeColumns, withIncludeColumns, withIncludeTable, withIncludeTables, withType

    Methods inherited from class io.inversion.Rule

    afterWiringComplete, checkLazyConfig, compareTo, doLazyConfig, getAllExcludePaths, getAllIncludeMethods, getAllIncludePaths, getDefaultIncludeMatchers, getDescription, getExcludeMatchers, getIncludeMatchers, getName, getOrder, getParams, match, match, matches, matches, toString, withDescription, withExcludeOn, withExcludeOn, withIncludeOn, withIncludeOn, withName, withOrder, withParam, withParams

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • INDEX_TYPE_PARTITION_KEY

      public static final String INDEX_TYPE_PARTITION_KEY
      See Also:
    • 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, com.microsoft.azure.documentdb.ConnectionPolicy connectionPolicy)
    • 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
      Overrides:
      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
      Overrides:
      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
    • doDelete

      public void doDelete(io.inversion.Collection table, List<Map<String,Object>> indexValues) throws io.inversion.ApiException
      Overrides:
      doDelete 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:
    • 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()