Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -4,7 +4,7 @@

import com.azure.cosmos.implementation.Paths;
import com.azure.cosmos.implementation.RequestOptions;
import com.azure.cosmos.models.CosmosAsyncConflictResponse;
import com.azure.cosmos.models.CosmosConflictResponse;
import com.azure.cosmos.models.CosmosConflictRequestOptions;
import com.azure.cosmos.models.ModelBridgeInternal;
import reactor.core.publisher.Mono;
Expand Down Expand Up @@ -59,13 +59,13 @@ CosmosAsyncConflict setId(String id) {
* @return a {@link Mono} containing the single resource response with the read
* conflict or an error.
*/
public Mono<CosmosAsyncConflictResponse> read(CosmosConflictRequestOptions options) {
public Mono<CosmosConflictResponse> read(CosmosConflictRequestOptions options) {
if (options == null) {
options = new CosmosConflictRequestOptions();
}
RequestOptions requestOptions = ModelBridgeInternal.toRequestOptions(options);
return this.container.getDatabase().getDocClientWrapper().readConflict(getLink(), requestOptions)
.map(response -> ModelBridgeInternal.createCosmosAsyncConflictResponse(response, container)).single();
.map(response -> ModelBridgeInternal.createCosmosConflictResponse(response)).single();

}

Expand All @@ -80,13 +80,13 @@ public Mono<CosmosAsyncConflictResponse> read(CosmosConflictRequestOptions optio
* @return a {@link Mono} containing one or several feed response pages of the
* read conflicts or an error.
*/
public Mono<CosmosAsyncConflictResponse> delete(CosmosConflictRequestOptions options) {
public Mono<CosmosConflictResponse> delete(CosmosConflictRequestOptions options) {
if (options == null) {
options = new CosmosConflictRequestOptions();
}
RequestOptions requestOptions = ModelBridgeInternal.toRequestOptions(options);
return this.container.getDatabase().getDocClientWrapper().deleteConflict(getLink(), requestOptions)
.map(response -> ModelBridgeInternal.createCosmosAsyncConflictResponse(response, container)).single();
.map(response -> ModelBridgeInternal.createCosmosConflictResponse(response)).single();
}

String getURIPathSegment() {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.cosmos.models;

import com.azure.cosmos.implementation.Conflict;
import com.azure.cosmos.implementation.ResourceResponse;
import com.azure.cosmos.implementation.apachecommons.lang.StringUtils;

/**
* The type Cosmos conflict response.
*/
public class CosmosConflictResponse extends CosmosResponse<CosmosConflictProperties> {

CosmosConflictResponse(ResourceResponse<Conflict> response) {
super(response);
String bodyAsString = response.getBodyAsString();
if (StringUtils.isEmpty(bodyAsString)) {
super.setProperties(null);
} else {
CosmosConflictProperties props = new CosmosConflictProperties(bodyAsString);
super.setProperties(props);
}
}

/**
* Get conflict properties object representing the resource on the server
*
* @return the conflict properties
*/
public CosmosConflictProperties getProperties() {
return super.getProperties();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ public final class ModelBridgeInternal {
private ModelBridgeInternal() {}

@Warning(value = INTERNAL_USE_ONLY_WARNING)
public static CosmosAsyncConflictResponse createCosmosAsyncConflictResponse(ResourceResponse<Conflict> response,
CosmosAsyncContainer container) {
return new CosmosAsyncConflictResponse(response, container);
public static CosmosConflictResponse createCosmosConflictResponse(ResourceResponse<Conflict> response) {
return new CosmosConflictResponse(response);
}

@Warning(value = INTERNAL_USE_ONLY_WARNING)
Expand Down