use of eu.ggnet.dwoss.rules.ProductGroup in project dwoss by gg-net.
the class ProductModelEmoIT method testRequestBrandGroupNameByHand.
@Test
public void testRequestBrandGroupNameByHand() throws Exception {
TradeName sb = TradeName.HP;
ProductGroup sg = ProductGroup.PROJECTOR;
String sn = "SERIES";
String fn = "FAMILY";
String mn = "MODEL";
utx.begin();
em.joinTransaction();
new ProductSeriesEmo(em).request(sb, sg, sn);
utx.commit();
utx.begin();
em.joinTransaction();
new ProductFamilyEmo(em).request(sb, sg, sn, fn);
utx.commit();
utx.begin();
em.joinTransaction();
ProductModel model = new ProductModelEmo(em).request(sb, sg, sn, fn, mn);
assertNotNull(model);
utx.commit();
}
use of eu.ggnet.dwoss.rules.ProductGroup in project dwoss by gg-net.
the class ProductSeriesEmoIT method testRequestBrandGroupName.
@Test
public void testRequestBrandGroupName() throws Exception {
TradeName b1 = TradeName.APPLE;
ProductGroup g1 = ProductGroup.PROJECTOR;
String n1 = "SERIES";
TradeName b2 = TradeName.LENOVO;
ProductGroup g2 = ProductGroup.DESKTOP;
String n2 = "SERIES";
utx.begin();
em.joinTransaction();
em.persist(new ProductSeries(b1, g1, n1));
utx.commit();
utx.begin();
em.joinTransaction();
ProductSeriesEmo seriesEmo = new ProductSeriesEmo(em);
ProductSeries productSeries = seriesEmo.request(b1, g1, n1);
assertNotNull(productSeries);
assertEquals(b1, productSeries.getBrand());
assertEquals(g1, productSeries.getGroup());
assertEquals(n1, productSeries.getName());
utx.commit();
utx.begin();
em.joinTransaction();
productSeries = seriesEmo.request(b2, g2, n2);
assertNotNull(productSeries);
assertEquals(b2, productSeries.getBrand());
assertEquals(g2, productSeries.getGroup());
assertEquals(n2, productSeries.getName());
utx.commit();
utx.begin();
em.joinTransaction();
seriesEmo.request(b2, g2, n2);
seriesEmo.request(b2, g2, n2);
seriesEmo.request(b2, g2, n2);
List<ProductSeries> pss = new ProductSeriesEao(em).findAll();
assertNotNull(pss);
assertEquals("Only Two Elements should exist", 2, pss.size());
utx.commit();
}
use of eu.ggnet.dwoss.rules.ProductGroup in project dwoss by gg-net.
the class ProductModelEmoIT method testFullRequestBrandGroupName.
@Test
public void testFullRequestBrandGroupName() throws Exception {
TradeName sb = TradeName.HP;
ProductGroup sg = ProductGroup.PROJECTOR;
String sn = "SERIES";
String fn = "FAMILY";
String mn = "MODEL";
utx.begin();
em.joinTransaction();
ProductModelEmo modelEmo = new ProductModelEmo(em);
ProductModel model = modelEmo.request(sb, sg, sn, fn, mn);
assertNotNull(model);
assertEquals(mn, model.getName());
assertEquals(fn, model.getFamily().getName());
assertEquals(sb, model.getFamily().getSeries().getBrand());
assertEquals(sg, model.getFamily().getSeries().getGroup());
assertEquals(sn, model.getFamily().getSeries().getName());
long fid = model.getFamily().getId();
long mid = model.getId();
long sid = model.getFamily().getSeries().getId();
utx.commit();
utx.begin();
em.joinTransaction();
model = modelEmo.request(sb, sg, sn, fn, mn);
assertNotNull(model);
assertEquals(mid, model.getId());
assertEquals(fid, model.getFamily().getId());
assertEquals(sid, model.getFamily().getSeries().getId());
utx.commit();
}
use of eu.ggnet.dwoss.rules.ProductGroup in project dwoss by gg-net.
the class ProductModelEmoIT method testHalfRequestBrandGroupName.
@Test
public void testHalfRequestBrandGroupName() throws Exception {
TradeName sb = TradeName.HP;
ProductGroup sg = ProductGroup.PROJECTOR;
String sn = "SERIES";
String fn = "FAMILY";
String mn = "MODEL";
utx.begin();
em.joinTransaction();
new ProductFamilyEmo(em).request(sb, sg, sn, fn);
utx.commit();
utx.begin();
em.joinTransaction();
ProductModelEmo modelEmo = new ProductModelEmo(em);
ProductModel model = modelEmo.request(sb, sg, sn, fn, mn);
assertNotNull(model);
assertEquals(mn, model.getName());
assertEquals(fn, model.getFamily().getName());
assertEquals(sb, model.getFamily().getSeries().getBrand());
assertEquals(sg, model.getFamily().getSeries().getGroup());
assertEquals(sn, model.getFamily().getSeries().getName());
long fid = model.getFamily().getId();
long mid = model.getId();
long sid = model.getFamily().getSeries().getId();
utx.commit();
utx.begin();
em.joinTransaction();
model = modelEmo.request(sb, sg, sn, fn, mn);
assertNotNull(model);
assertEquals(mid, model.getId());
assertEquals(fid, model.getFamily().getId());
assertEquals(sid, model.getFamily().getSeries().getId());
utx.commit();
}
use of eu.ggnet.dwoss.rules.ProductGroup in project dwoss by gg-net.
the class TreeTableController method getProductGroups.
private ObservableList<TreeItem<DataWrapper>> getProductGroups(TradeName tradeName) {
ObservableList<TreeItem<DataWrapper>> result = FXCollections.observableArrayList();
for (ProductGroup group : ProductGroup.values()) {
TreeItem<DataWrapper> item = new TreeItem<>();
ProductGroupWrapper productGroupWrapper = new ProductGroupWrapper(group, tradeName, item);
item.setValue(productGroupWrapper);
item.getChildren().add(loading);
item.expandedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
if (productGroupWrapper.isLoading()) {
return;
}
productGroupWrapper.setLoading(true);
new Thread(new Runnable() {
@Override
public void run() {
item.getChildren().addAll(getCategoryProducts(productGroupWrapper.getTradeName(), productGroupWrapper.getProductGroup()));
item.getChildren().remove(loading);
}
}).start();
L.info("Products loaded");
}
});
result.add(item);
}
return result;
}
Aggregations