forked from Azure/azure-sdk-for-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for accessing non partitioned collections using V3 SDK (A…
…zure#107) * NP->P changes
- Loading branch information
Srinath Narayanan
authored and
Christopher Anderson
committed
Jun 9, 2019
1 parent
ed98066
commit cdd68cf
Showing
119 changed files
with
5,298 additions
and
4,096 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,6 @@ hs_err_pid* | |
|
||
doc | ||
docs | ||
target | ||
bin | ||
test-output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
59 changes: 59 additions & 0 deletions
59
commons/src/main/java/com/microsoft/azure/cosmos/CosmosUserSettings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.microsoft.azure.cosmos; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
import com.microsoft.azure.cosmosdb.DocumentCollection; | ||
import com.microsoft.azure.cosmosdb.Resource; | ||
import com.microsoft.azure.cosmosdb.ResourceResponse; | ||
import com.microsoft.azure.cosmosdb.User; | ||
import com.microsoft.azure.cosmosdb.internal.Constants; | ||
|
||
public class CosmosUserSettings extends Resource { | ||
/** | ||
* Initialize a user object. | ||
*/ | ||
public CosmosUserSettings() { | ||
super(); | ||
} | ||
|
||
/** | ||
* Initialize a user object from json string. | ||
* | ||
* @param jsonString the json string that represents the database user. | ||
*/ | ||
public CosmosUserSettings(String jsonString) { | ||
super(jsonString); | ||
} | ||
|
||
CosmosUserSettings(ResourceResponse<User> response) { | ||
super(response.getResource().toJson()); | ||
} | ||
|
||
// Converting document collection to CosmosContainerSettings | ||
CosmosUserSettings(User user){ | ||
super(user.toJson()); | ||
} | ||
|
||
/** | ||
* Gets the self-link of the permissions associated with the user. | ||
* | ||
* @return the permissions link. | ||
*/ | ||
public String getPermissionsLink() { | ||
String selfLink = this.getSelfLink(); | ||
if (selfLink.endsWith("/")) { | ||
return selfLink + super.getString(Constants.Properties.PERMISSIONS_LINK); | ||
} else { | ||
return selfLink + "/" + super.getString(Constants.Properties.PERMISSIONS_LINK); | ||
} | ||
} | ||
|
||
public User getV2User() { | ||
return new User(this.toJson()); | ||
} | ||
|
||
static List<CosmosUserSettings> getFromV2Results(List<User> results) { | ||
return results.stream().map(CosmosUserSettings::new).collect(Collectors.toList()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.