19 package org.turro.financials.pos;
21 import java.util.stream.Stream;
22 import org.turro.financials.db.FinancialsPU;
23 import org.turro.financials.entity.Product;
24 import org.turro.jpa.Dao;
25 import org.turro.pos.collections.CategoryList;
26 import org.turro.pos.collections.ProductList;
27 import org.turro.pos.entities.PosProduct;
36 CategoryList cl =
new CategoryList();
38 ProductList pl =
new ProductList();
43 private static void addProducts(ProductList pl) {
45 try(Stream<Product> products = dao.stream(
Product.class,
"select p from Product p")) {
46 products.forEach((product) -> {
47 pl.add(generateProduct(product));
52 private static PosProduct generateProduct(Product product) {
53 PosProduct p =
new PosProduct();
54 p.setHeadquarters(
"1");
55 p.setIdentifier(product.getProductCode());
56 p.setName(product.getDescription());
57 p.setSellprice(product.getPrice());
58 p.setTax(product.getTax());
59 p.setCategory(CategoryList.defaultCategory().getIdentifier());