Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ DocumentCollection getCollectionDefinitionWithRangeRangeIndex() {
List<IncludedPath> includedPaths = new ArrayList<>();
IncludedPath includedPath = new IncludedPath();
includedPath.setPath("/*");
Collection<Index> indexes = new ArrayList<>();
List<Index> indexes = new ArrayList<>();
Index stringIndex = Index.range(DataType.STRING);
BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(stringIndex), "precision", -1);
Comment thread
xinlian12 marked this conversation as resolved.
Outdated
indexes.add(stringIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ DocumentCollection getCollectionDefinitionWithRangeRangeIndex() {
List<IncludedPath> includedPaths = new ArrayList<>();
IncludedPath includedPath = new IncludedPath();
includedPath.setPath("/*");
Collection<Index> indexes = new ArrayList<>();
List<Index> indexes = new ArrayList<>();
Index stringIndex = Index.range(DataType.STRING);
BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(stringIndex), "precision", -1);
indexes.add(stringIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ private DocumentCollection getMultiPartitionCollectionDefinition() {
List<IncludedPath> includedPaths = new ArrayList<>();
IncludedPath includedPath = new IncludedPath();
includedPath.setPath("/*");
Collection<Index> indexes = new ArrayList<>();
List<Index> indexes = new ArrayList<>();
Index stringIndex = Index.range(DataType.STRING);
BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(stringIndex), "getPrecision", -1);
indexes.add(stringIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ private DocumentCollection getMultiPartitionCollectionDefinition() {
List<IncludedPath> includedPaths = new ArrayList<>();
IncludedPath includedPath = new IncludedPath();
includedPath.setPath("/*");
Collection<Index> indexes = new ArrayList<>();
List<Index> indexes = new ArrayList<>();
Index stringIndex = Index.range(DataType.STRING);
BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(stringIndex), "precision", -1);
indexes.add(stringIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ public ExcludedPath() {
/**
* Constructor.
*
* @param jsonString the json string that represents the excluded path.
* @param path the excluded path.
*/
ExcludedPath(String jsonString) {
this.jsonSerializable = new JsonSerializable(jsonString);
public ExcludedPath(String path) {
Comment thread
xinlian12 marked this conversation as resolved.
this();
this.setPath(path);
}

/**
Expand All @@ -51,7 +52,7 @@ public String getPath() {
* Sets path.
*
* @param path the path.
* @return the Exculded path.
* @return the excluded path.
*/
public ExcludedPath setPath(String path) {
this.jsonSerializable.set(Constants.Properties.PATH, path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
import com.azure.cosmos.implementation.Constants;
import com.azure.cosmos.implementation.IndexKind;
import com.azure.cosmos.implementation.JsonSerializable;
import com.azure.cosmos.implementation.apachecommons.lang.StringUtils;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.azure.cosmos.implementation.apachecommons.lang.StringUtils;
import com.fasterxml.jackson.databind.node.ObjectNode;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
* Represents an included path of the IndexingPolicy in the Azure Cosmos DB database service.
*/
public final class IncludedPath {
private Collection<Index> indexes;
private List<Index> indexes;
private JsonSerializable jsonSerializable;

/**
Expand All @@ -31,10 +31,11 @@ public IncludedPath() {
/**
* Constructor.
*
* @param jsonString the json string that represents the included path.
* @param path the included path.
*/
public IncludedPath(String jsonString) {
this.jsonSerializable = new JsonSerializable(jsonString);
public IncludedPath(String path) {
this();
this.setPath(path);
}

/**
Expand Down Expand Up @@ -71,7 +72,7 @@ public IncludedPath setPath(String path) {
*
* @return the included paths.
*/
public Collection<Index> getIndexes() {
public List<Index> getIndexes() {
if (this.indexes == null) {
this.indexes = this.getIndexCollection();

Expand All @@ -89,15 +90,15 @@ public Collection<Index> getIndexes() {
* @param indexes the indexes
* @return the indexes
*/
public IncludedPath setIndexes(Collection<Index> indexes) {
public IncludedPath setIndexes(List<Index> indexes) {
this.indexes = indexes;
return this;
}

private Collection<Index> getIndexCollection() {
private List<Index> getIndexCollection() {
if (this.jsonSerializable.getPropertyBag() != null && this.jsonSerializable.getPropertyBag().has(Constants.Properties.INDEXES)) {
ArrayNode jsonArray = (ArrayNode) this.jsonSerializable.getPropertyBag().get(Constants.Properties.INDEXES);
Collection<Index> result = new ArrayList<Index>();
List<Index> result = new ArrayList<Index>();

for (int i = 0; i < jsonArray.size(); i++) {
JsonNode jsonObject = jsonArray.get(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ static protected DocumentCollection getCollectionDefinitionWithRangeRangeIndex()
List<IncludedPath> includedPaths = new ArrayList<>();
IncludedPath includedPath = new IncludedPath();
includedPath.setPath("/*");
Collection<Index> indexes = new ArrayList<>();
List<Index> indexes = new ArrayList<>();
Index stringIndex = Index.range(DataType.STRING);
BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(stringIndex), "precision", -1);
indexes.add(stringIndex);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static protected CosmosContainerProperties getCollectionDefinition() {
List<IncludedPath> includedPaths = new ArrayList<>();
IncludedPath includedPath = new IncludedPath();
includedPath.setPath("/*");
Collection<Index> indexes = new ArrayList<>();
List<Index> indexes = new ArrayList<>();
Index stringIndex = Index.range(DataType.STRING);
BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(stringIndex), "getPrecision", -1);
indexes.add(stringIndex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ static protected CosmosContainerProperties getCollectionDefinitionWithRangeRange
List<IncludedPath> includedPaths = new ArrayList<>();
IncludedPath includedPath = new IncludedPath();
includedPath.setPath("/*");
Collection<Index> indexes = new ArrayList<>();
List<Index> indexes = new ArrayList<>();
Index stringIndex = Index.range(DataType.STRING);
BridgeInternal.setProperty(ModelBridgeInternal.getJsonSerializable(stringIndex), "getPrecision", -1);
indexes.add(stringIndex);
Expand Down