public List<ShopOrder> priceOrders(List<ShopOrder> allOrders) {

    Marketplace lmp = null;

    System.out.println("priceOrders:allOrders" + allOrders);

    for (ShopOrder odr : allOrders) {

      if (lmp == null)
        lmp =
            (Marketplace)
                wirc.getByID("localhost:8180", "Marketplace", new Long(odr.getMarketIdSrc()));

      Marketplace fmp =
          (Marketplace)
              wirc.getByID("localhost:8180", "Marketplace", new Long(odr.getMarketIdTgt()));

      if (odr.getMarketIdSrc().equals(odr.getMarketIdTgt())) {
        calculatePriceLocal(odr);
        odr.setTotalPrice(odr.getPrice().intValue());
      } else {

        calculatePriceLocal(odr);

        FXRate rt =
            (FXRate)
                wirc.getByPath(
                    "localhost:8180",
                    FXRate.class.getSimpleName(),
                    "convert/" + lmp.getCCY(),
                    fmp.getCCY());

        Product fprd =
            (Product) wirc.getByID(fmp.getURL(), "Product", new Long(odr.getProductID()));

        System.out.println("fprd:" + fprd);
        System.out.println("rate:" + rt);

        double rate = rt.getRate();

        odr.setRate(rate);

        odr.setFrgPrice(new Long((long) (odr.getQty() * rate * fprd.getPrice())));
        odr.setShippingCosts((int) fmp.getShippingCosts());

        odr.setTotalPrice((int) (odr.getFrgPrice() + odr.getShippingCosts()));
      }
    }

    return allOrders;
  }
  public static List<ShopOrder> assembleOffer(ShopOrder lo) {

    System.out.println("assembleOffer:" + lo);

    OrderService os = new OrderService();

    Stock ls = (Stock) wirc.getByPath("localhost:8180", "Stock", "prdid", lo.getProductID());
    Product lp = (Product) wirc.getByID("localhost:8180", "Product", new Long(lo.getProductID()));

    List<ShopOrder> folist = new ArrayList<ShopOrder>();

    System.out.println("assembleOffer:folist:" + folist);

    int itemsLocal = 0;

    if (ls != null && ls.getQty() > 0) {

      itemsLocal = (lo.getQty() > ls.getQty()) ? ls.getQty() : lo.getQty();

      ShopOrder nol = new ShopOrder();

      nol.setProductID(lo.getProductID());
      nol.setMarketIdSrc(lo.getMarketIdSrc());
      nol.setMarketIdTgt(lo.getMarketIdSrc()); // eq.
      nol.setQty(itemsLocal);
      nol.setPrice(lp.getPrice() * itemsLocal);
      nol.setFrgPrice((long) 0);
      nol.setRate(1);
      nol.setUser(lo.getUser());
      nol.setUserEmail(lo.getUserEmail());
      nol.setBusinessKey(lo.getBusinessKey());

      System.out.println("LocalpartialOrder:" + nol);

      folist.add(nol);

      System.out.println("assembleOffer:folist:nol:" + folist);
    }

    System.out.println("assembleOffer:folist:getCompoundOrders:" + folist);
    folist = os.getCompoundOrders(lo, itemsLocal, folist);

    System.out.println("assembleOffer:folist:getCompoundOrders:" + folist);

    return folist;
  }
  Long calculatePriceLocal(ShopOrder order) {
    order.setShippingCosts(0);
    /* order.setMarketIdTgt(order.getMarketIdSrc());*/
    order.setRate(1.0);
    order.setShippingCosts(0);
    order.setFrgPrice((long) 0);

    Product prd =
        (Product) wirc.getByID("localhost:8180", "Product", new Long(order.getProductID()));
    Long itemPrice = prd.getPrice();

    System.out.println("localhostItemPrice: " + itemPrice);

    order.setPrice(order.getQty() * itemPrice);

    return new Long(itemPrice);
  }