Class CosmosDb

  • All Implemented Interfaces:
    java.lang.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 java.lang.String db  
      protected com.microsoft.azure.documentdb.DocumentClient documentClient  
      static java.lang.String INDEX_TYPE_PARTITION_KEY  
      protected java.lang.String key  
      protected java.lang.String uri  
      • 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
      CosmosDb()  
      CosmosDb​(java.lang.String name)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static com.microsoft.azure.documentdb.DocumentClient buildDocumentClient​(java.lang.String uri, java.lang.String key, com.microsoft.azure.documentdb.ConnectionPolicy connectionPolicy)  
      protected void deleteRow​(io.inversion.Collection collection, java.util.Map<java.lang.String,​java.lang.Object> indexValues)
      Deletes a single specific resource.
      void doDelete​(io.inversion.Collection table, java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> indexValues)  
      io.inversion.Results doSelect​(io.inversion.Collection collection, java.util.List<io.inversion.rql.Term> columnMappedTerms)
      Finds the resource keys on the other side of the relationship
      java.util.List<java.lang.String> doUpsert​(io.inversion.Collection table, java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> rows)  
      protected java.lang.String getCollectionUri​(io.inversion.Collection table)  
      java.lang.String getDb()  
      com.microsoft.azure.documentdb.DocumentClient getDocumentClient()  
      java.lang.String getKey()  
      java.lang.String getUri()  
      boolean isAllowCrossPartitionQueries()  
      java.lang.String upsertRow​(io.inversion.Collection collection, java.util.Map<java.lang.String,​java.lang.Object> row)  
      CosmosDb withAllowCrossPartitionQueries​(boolean allowCrossPartitionQueries)  
      CosmosDb withDb​(java.lang.String db)  
      CosmosDb withDocumentClient​(com.microsoft.azure.documentdb.DocumentClient documentClient)  
      CosmosDb withKey​(java.lang.String key)  
      CosmosDb withUri​(java.lang.String uri)  
      • 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 Detail

      • INDEX_TYPE_PARTITION_KEY

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

        protected java.lang.String uri
      • db

        protected java.lang.String db
      • key

        protected java.lang.String key
      • documentClient

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

      • CosmosDb

        public CosmosDb()
      • CosmosDb

        public CosmosDb​(java.lang.String name)
    • Method Detail

      • buildDocumentClient

        public static com.microsoft.azure.documentdb.DocumentClient buildDocumentClient​(java.lang.String uri,
                                                                                        java.lang.String key,
                                                                                        com.microsoft.azure.documentdb.ConnectionPolicy connectionPolicy)
      • doSelect

        public io.inversion.Results doSelect​(io.inversion.Collection collection,
                                             java.util.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 java.util.List<java.lang.String> doUpsert​(io.inversion.Collection table,
                                                         java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> rows)
                                                  throws io.inversion.ApiException
        Overrides:
        doUpsert in class io.inversion.Db<CosmosDb>
        Throws:
        io.inversion.ApiException
      • upsertRow

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

        public void doDelete​(io.inversion.Collection table,
                             java.util.List<java.util.Map<java.lang.String,​java.lang.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,
                                 java.util.Map<java.lang.String,​java.lang.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 java.lang.String getCollectionUri​(io.inversion.Collection table)
      • getUri

        public java.lang.String getUri()
      • withUri

        public CosmosDb withUri​(java.lang.String uri)
      • getDb

        public java.lang.String getDb()
      • withDb

        public CosmosDb withDb​(java.lang.String db)
      • getKey

        public java.lang.String getKey()
      • withKey

        public CosmosDb withKey​(java.lang.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()