コード例 #1
0
 private OrderEntryModel createTestOrderEntry(final OrderModel order) {
   final OrderEntryModel entry1 = modelService.create(OrderEntryModel.class);
   entry1.setOrder(order);
   entry1.setQuantity(Long.valueOf(1));
   entry1.setUnit(productService.getOrderableUnit(product1));
   entry1.setProduct(product1);
   return entry1;
 }
コード例 #2
0
  private OrderModel createNewOrder() {
    final OrderModel order = modelService.create(OrderModel.class);

    final UserModel user = userService.getCurrentUser();

    order.setUser(user);

    order.setCurrency(commonI18NService.getBaseCurrency());
    order.setDate(new java.util.Date());
    order.setNet(Boolean.FALSE);

    final OrderEntryModel entry1 = modelService.create(OrderEntryModel.class);
    entry1.setOrder(order);
    entry1.setQuantity(Long.valueOf(1));
    entry1.setUnit(productService.getOrderableUnit(product1));
    entry1.setProduct(product1);
    entry1.setEntryNumber(Integer.valueOf(0));

    final OrderEntryModel entry2 = modelService.create(OrderEntryModel.class);
    entry2.setOrder(order);
    entry2.setQuantity(Long.valueOf(1));
    entry2.setUnit(productService.getOrderableUnit(product2));
    entry2.setProduct(product2);
    entry2.setEntryNumber(Integer.valueOf(1));

    final OrderEntryModel entry3 = modelService.create(OrderEntryModel.class);
    entry3.setOrder(order);
    entry3.setQuantity(Long.valueOf(1));
    entry3.setUnit(productService.getOrderableUnit(product3));
    entry3.setProduct(product3);
    entry3.setEntryNumber(Integer.valueOf(2));

    final OrderEntryModel entry4 = modelService.create(OrderEntryModel.class);
    entry4.setOrder(order);
    entry4.setQuantity(Long.valueOf(1));
    entry4.setUnit(productService.getOrderableUnit(product4));
    entry4.setProduct(product4);
    entry4.setEntryNumber(Integer.valueOf(3));

    order.setEntries((List) Arrays.asList(entry1, entry2, entry3, entry4));

    return order;
  }