All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.cosmos.implementation.ItemOperations Maven / Gradle / Ivy

Go to download

This Package contains Microsoft Azure Cosmos SDK (with Reactive Extension Reactor support) for Azure Cosmos DB SQL API

There is a newer version: 4.61.1
Show newest version
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.cosmos.implementation;

import com.azure.cosmos.CosmosAsyncContainer;
import com.azure.cosmos.CosmosBridgeInternal;
import com.azure.cosmos.CosmosContainer;
import com.azure.cosmos.models.CosmosItemIdentity;
import com.azure.cosmos.models.FeedResponse;
import com.azure.cosmos.models.PartitionKey;
import com.azure.cosmos.implementation.apachecommons.lang.tuple.Pair;
import reactor.core.publisher.Mono;

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

final public class ItemOperations {

    /**
     * Note: this method is deprecated - please use CosmosContainer.readMany instead
     * 

* Reads many documents. * * @param the type parameter * @param container the cosmos async container * @param itemKeyList document id and partition key pair that needs to be read * @param classType class type * @return a feed response of cosmos items */ public static FeedResponse readMany(CosmosContainer container, List> itemKeyList, Class classType) { return readManyAsync(CosmosBridgeInternal.getCosmosAsyncContainer(container), itemKeyList, classType).block(); } /** * Note: this method is deprecated - please use CosmosAsyncContainer.readMany instead *

* Reads many documents. * * @param the type parameter * @param container the cosmos async container * @param itemKeyList document id and partition key pair that needs to be read * @param classType class type * @return a Mono with feed response of cosmos items */ public static Mono> readManyAsync(CosmosAsyncContainer container, List> itemKeyList, Class classType) { if (container == null) { throw new IllegalArgumentException("Parameter container is required and cannot be null."); } return container.readMany(convertItemKeyList(itemKeyList), classType); } private static List convertItemKeyList( List> itemKeyList) { if (itemKeyList != null) { List itemIdentities = new ArrayList<>(itemKeyList.size()); for (int i = 0; i < itemKeyList.size(); i++) { itemIdentities.add( new CosmosItemIdentity( itemKeyList.get(i).getRight(), itemKeyList.get(i).getLeft())); } return itemIdentities; } return new ArrayList<>(); } private ItemOperations() {} }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy