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

com.dft.api.shopify.model.ShopifyOrders Maven / Gradle / Ivy

There is a newer version: 2024.07.13
Show newest version
package com.dft.api.shopify.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ShopifyOrders {

	private final Map orderToShopifyOrder;

	public ShopifyOrders(final List shopifyOrders) {
		orderToShopifyOrder = new HashMap<>(shopifyOrders.size());
		shopifyOrders.stream().forEach(shopifyOrder -> {
			orderToShopifyOrder.put(shopifyOrder.getId(), shopifyOrder);
		});
	}

	public ShopifyOrder get(final String orderId) {
		return orderToShopifyOrder.get(orderId);
	}

	public List values() {
		return new ArrayList<>(orderToShopifyOrder.values());
	}

//	public List getVariants() {
//		final Collection shopifyProducts = productIdToShopifyProduct.values();
//		final List shopifyVariants = new ArrayList<>(shopifyProducts.size());
//		for (ShopifyProduct shopifyProduct : shopifyProducts) {
//			shopifyVariants.addAll(shopifyProduct.getVariants());
//		}
//		return shopifyVariants;
//	}

	public int size() {
		return orderToShopifyOrder.size();
	}

	public boolean containsKey(final String orderId) {
		return orderToShopifyOrder.containsKey(orderId);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy