Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.cosmos;
import com.azure.cosmos.implementation.batch.ItemBulkOperation;
import com.azure.cosmos.models.CosmosItemOperationType;
import com.azure.cosmos.models.PartitionKey;
import com.azure.cosmos.util.Beta;
import reactor.core.publisher.Flux;
import static com.azure.cosmos.implementation.guava25.base.Preconditions.checkNotNull;
/**
* @deprecated forRemoval = true, since = "4.19"
* This class is not necessary anymore and will be removed. Please use {@link com.azure.cosmos.models.CosmosBulkOperations}
*
* Utility for creating bulk operations which can be executed by calling
* {@link CosmosAsyncContainer#processBulkOperations(Flux, BulkExecutionOptions)} .
*
* Also while creating these operation, if some options which are only for individual operation can be provided by passing
* a {@link BulkItemRequestOptions} while creating the bulk operation.
*
* See also {@link BulkExecutionOptions}.
*/
@Beta(value = Beta.SinceVersion.V4_9_0, warningText = Beta.PREVIEW_SUBJECT_TO_CHANGE_WARNING)
@Deprecated() //forRemoval = true, since = "4.19"
public final class BulkOperations {
/**
* Instantiate an operation for Creating item in Bulk execution.
*
* @param The type of item to be created.
*
* @param item A JSON serializable object that must contain an id property.
* @param partitionKey the partition key for the operation
*
* @return the bulk operation.
*/
@Beta(value = Beta.SinceVersion.V4_9_0, warningText = Beta.PREVIEW_SUBJECT_TO_CHANGE_WARNING)
@Deprecated() //forRemoval = true, since = "4.19"
public static CosmosItemOperation getCreateItemOperation(T item, PartitionKey partitionKey) {
checkNotNull(item, "expected non-null item");
checkNotNull(partitionKey, "expected non-null partitionKey");
return getCreateItemOperation(item, partitionKey, new BulkItemRequestOptions(), null);
}
/**
* Instantiate an operation for Creating item in Bulk execution.
*
* @param The type of item to be created.
* @param The type of context to be used.
*
* @param item A JSON serializable object that must contain an id property.
* @param partitionKey the partition key for the operation
* @param context The caller provided context for this operation.
*
* @return the bulk operation.
*/
@Beta(value = Beta.SinceVersion.V4_18_0, warningText = Beta.PREVIEW_SUBJECT_TO_CHANGE_WARNING)
@Deprecated() //forRemoval = true, since = "4.19"
public static CosmosItemOperation getCreateItemOperation(
T item,
PartitionKey partitionKey,
TContext context) {
checkNotNull(item, "expected non-null item");
checkNotNull(partitionKey, "expected non-null partitionKey");
return getCreateItemOperation(item, partitionKey, new BulkItemRequestOptions(), context);
}
/**
* Instantiate an operation for Creating item in Bulk execution.
*
* @param The type of item to be created.
*
* @param item A JSON serializable object that must contain an id property.
* @param partitionKey the partition key for the operation.
* @param requestOptions The options for the item request.
*
* @return the bulk operation.
*/
@Beta(value = Beta.SinceVersion.V4_9_0, warningText = Beta.PREVIEW_SUBJECT_TO_CHANGE_WARNING)
@Deprecated() //forRemoval = true, since = "4.19"
public static CosmosItemOperation getCreateItemOperation(
T item,
PartitionKey partitionKey,
BulkItemRequestOptions requestOptions) {
checkNotNull(item, "expected non-null item");
checkNotNull(partitionKey, "expected non-null partitionKey");
return getCreateItemOperation(item, partitionKey, requestOptions, null);
}
/**
* Instantiate an operation for Creating item in Bulk execution.
*
* @param The type of item to be created.
* @param The type of context to be used.
*
* @param item A JSON serializable object that must contain an id property.
* @param partitionKey the partition key for the operation.
* @param requestOptions The options for the item request.
* @param context The caller provided context for this operation.
*
* @return the bulk operation.
*/
@Beta(value = Beta.SinceVersion.V4_18_0, warningText = Beta.PREVIEW_SUBJECT_TO_CHANGE_WARNING)
@Deprecated() //forRemoval = true, since = "4.19"
public static CosmosItemOperation getCreateItemOperation(
T item,
PartitionKey partitionKey,
BulkItemRequestOptions requestOptions,
TContext context) {
checkNotNull(item, "expected non-null item");
checkNotNull(partitionKey, "expected non-null partitionKey");
if (requestOptions == null) {
requestOptions = new BulkItemRequestOptions();
}
ItemBulkOperation ttContextItemBulkOperation = new ItemBulkOperation<>(
CosmosItemOperationType.CREATE,
null,
partitionKey,
requestOptions.toRequestOptions(),
item,
context
);
return BridgeInternal.toDeprecatedCosmosItemOperation(ttContextItemBulkOperation);
}
/**
* Instantiate an operation for deleting item in Bulk execution.
*
* @param id The unique id of the item.
* @param partitionKey the partition key for the operation.
*
* @return the bulk operation.
*/
@Beta(value = Beta.SinceVersion.V4_9_0, warningText = Beta.PREVIEW_SUBJECT_TO_CHANGE_WARNING)
@Deprecated() //forRemoval = true, since = "4.19"
public static CosmosItemOperation getDeleteItemOperation(String id, PartitionKey partitionKey) {
checkNotNull(id, "expected non-null id");
checkNotNull(partitionKey, "expected non-null partitionKey");
return getDeleteItemOperation(id, partitionKey, new BulkItemRequestOptions());
}
/**
* Instantiate an operation for deleting item in Bulk execution.
*
* @param The type of context to be used.
*
* @param id The unique id of the item.
* @param partitionKey the partition key for the operation.
* @param context The caller provided context for this operation.
*
* @return the bulk operation.
*/
@Beta(value = Beta.SinceVersion.V4_18_0, warningText = Beta.PREVIEW_SUBJECT_TO_CHANGE_WARNING)
@Deprecated() //forRemoval = true, since = "4.19"
public static CosmosItemOperation getDeleteItemOperation(
String id,
PartitionKey partitionKey,
TContext context) {
checkNotNull(id, "expected non-null id");
checkNotNull(partitionKey, "expected non-null partitionKey");
return getDeleteItemOperation(id, partitionKey, new BulkItemRequestOptions(), context);
}
/**
* Instantiate an operation for deleting item in Bulk execution.
*
* @param id The unique id of the item.
* @param partitionKey the partition key for the operation..
* @param requestOptions The options for the item request.
*
* @return the bulk operation.
*/
@Beta(value = Beta.SinceVersion.V4_9_0, warningText = Beta.PREVIEW_SUBJECT_TO_CHANGE_WARNING)
@Deprecated() //forRemoval = true, since = "4.19"
public static CosmosItemOperation getDeleteItemOperation(
String id,
PartitionKey partitionKey,
BulkItemRequestOptions requestOptions) {
checkNotNull(id, "expected non-null id");
checkNotNull(partitionKey, "expected non-null partitionKey");
if (requestOptions == null) {
requestOptions = new BulkItemRequestOptions();
}
return getDeleteItemOperation(id, partitionKey, requestOptions, null);
}
/**
* Instantiate an operation for deleting item in Bulk execution.
*
* @param The type of context to be used.
*
* @param id The unique id of the item.
* @param partitionKey the partition key for the operation..
* @param requestOptions The options for the item request.
* @param context The caller provided context for this operation.
*
* @return the bulk operation.
*/
@Beta(value = Beta.SinceVersion.V4_18_0, warningText = Beta.PREVIEW_SUBJECT_TO_CHANGE_WARNING)
@Deprecated() //forRemoval = true, since = "4.19"
public static CosmosItemOperation getDeleteItemOperation(
String id,
PartitionKey partitionKey,
BulkItemRequestOptions requestOptions,
TContext context) {
checkNotNull(id, "expected non-null id");
checkNotNull(partitionKey, "expected non-null partitionKey");
if (requestOptions == null) {
requestOptions = new BulkItemRequestOptions();
}
ItemBulkOperation