Search in sources :

Example 11 with TradeName

use of eu.ggnet.dwoss.rules.TradeName in project dwoss by gg-net.

the class UniqueUnitReporterOperation method buildContractorModel.

private List<Object[]> buildContractorModel(Step step, TradeName contractor, NavigableSet<TradeName> usedManufacturers, NavigableMap<Date, BrandContractorCount> revenue) {
    List<Object[]> rows = new ArrayList<>();
    for (Entry<Date, BrandContractorCount> e : revenue.entrySet()) {
        BrandContractorCount r = e.getValue();
        Object[] row = new Object[usedManufacturers.size() + 2];
        row[0] = step.format(e.getKey());
        int count = 1;
        for (TradeName manufacturer : usedManufacturers) {
            row[count] = r.countByContractorManufacturer(contractor, manufacturer);
            count++;
        }
        row[count] = r.countByContractor(contractor);
        rows.add(row);
    }
    return rows;
}
Also used : TradeName(eu.ggnet.dwoss.rules.TradeName) BrandContractorCount(eu.ggnet.dwoss.uniqueunit.ee.eao.BrandContractorCount)

Example 12 with TradeName

use of eu.ggnet.dwoss.rules.TradeName in project dwoss by gg-net.

the class ProductFormater method toSource.

public static String toSource(Product product) {
    String var = randomVar();
    String re = product.getClass().getSimpleName() + " " + var + " = new " + product.getClass().getName() + "();\n";
    for (TradeName id : product.getAdditionalPartNos().keySet()) {
        re += var + ".setAdditionalPartNo(TradeName." + id + ",\"" + product.getAdditionalPartNo(id) + "\");\n";
    }
    for (PriceType id : product.getPrices().keySet()) {
        re += var + ".setPrice(PriceType." + id + "," + product.getPrice(id) + ",\"formToSource\");\n";
    }
    if (!product.getFlags().isEmpty()) {
        re += var + ".setFlags(EnumSet.of(";
        for (Iterator<Product.Flag> it = product.getFlags().iterator(); it.hasNext(); ) {
            Product.Flag flag = it.next();
            re += "Product.Flag." + flag;
            if (it.hasNext())
                re += ",";
        }
        re += "));\n";
    }
    if (product.getName() != null)
        re += var + ".setName(\"" + product.getName() + "\");\n";
    if (product.getDescription() != null)
        re += var + ".setDescription(\"" + product.getDescription() + "\");\n";
    if (product.getPartNo() != null)
        re += var + ".setPartNo(\"" + product.getPartNo() + "\");\n";
    re += var + ".setGroup(ProductGroup." + product.getGroup() + ");\n";
    re += var + ".setTradeName(TradeName." + product.getTradeName() + ");\n";
    re += var + ".setGtin(" + product.getGtin() + ");\n";
    return re;
}
Also used : TradeName(eu.ggnet.dwoss.rules.TradeName) Product(eu.ggnet.dwoss.uniqueunit.ee.entity.Product) PriceType(eu.ggnet.dwoss.uniqueunit.ee.entity.PriceType)

Example 13 with TradeName

use of eu.ggnet.dwoss.rules.TradeName 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();
}
Also used : TradeName(eu.ggnet.dwoss.rules.TradeName) ProductGroup(eu.ggnet.dwoss.rules.ProductGroup) ProductSeriesEao(eu.ggnet.dwoss.spec.ee.eao.ProductSeriesEao) ProductSeries(eu.ggnet.dwoss.spec.ee.entity.ProductSeries) ProductSeriesEmo(eu.ggnet.dwoss.spec.ee.emo.ProductSeriesEmo) Test(org.junit.Test)

Example 14 with TradeName

use of eu.ggnet.dwoss.rules.TradeName 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();
}
Also used : TradeName(eu.ggnet.dwoss.rules.TradeName) ProductGroup(eu.ggnet.dwoss.rules.ProductGroup) ProductModelEmo(eu.ggnet.dwoss.spec.ee.emo.ProductModelEmo) ProductModel(eu.ggnet.dwoss.spec.ee.entity.ProductModel) Test(org.junit.Test)

Example 15 with TradeName

use of eu.ggnet.dwoss.rules.TradeName 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();
}
Also used : TradeName(eu.ggnet.dwoss.rules.TradeName) ProductGroup(eu.ggnet.dwoss.rules.ProductGroup) ProductModelEmo(eu.ggnet.dwoss.spec.ee.emo.ProductModelEmo) ProductFamilyEmo(eu.ggnet.dwoss.spec.ee.emo.ProductFamilyEmo) ProductModel(eu.ggnet.dwoss.spec.ee.entity.ProductModel) Test(org.junit.Test)

Aggregations

TradeName (eu.ggnet.dwoss.rules.TradeName)18 ProductGroup (eu.ggnet.dwoss.rules.ProductGroup)5 Test (org.junit.Test)4 SubMonitor (eu.ggnet.dwoss.progress.SubMonitor)3 ProductModelEmo (eu.ggnet.dwoss.spec.ee.emo.ProductModelEmo)3 ProductModel (eu.ggnet.dwoss.spec.ee.entity.ProductModel)3 BrandContractorCount (eu.ggnet.dwoss.uniqueunit.ee.eao.BrandContractorCount)3 FileJacket (eu.ggnet.dwoss.util.FileJacket)3 JExcelLucidCalcWriter (eu.ggnet.lucidcalc.jexcel.JExcelLucidCalcWriter)3 MonitorFactory (eu.ggnet.dwoss.progress.MonitorFactory)2 ReportLine (eu.ggnet.dwoss.report.ee.entity.ReportLine)2 SimpleReportLine (eu.ggnet.dwoss.report.ee.entity.partial.SimpleReportLine)2 ProductFamilyEmo (eu.ggnet.dwoss.spec.ee.emo.ProductFamilyEmo)2 ProductSeriesEmo (eu.ggnet.dwoss.spec.ee.emo.ProductSeriesEmo)2 ProductEao (eu.ggnet.dwoss.uniqueunit.ee.eao.ProductEao)2 CONTRACTOR_REFERENCE (eu.ggnet.dwoss.uniqueunit.ee.entity.PriceType.CONTRACTOR_REFERENCE)2 MANUFACTURER_COST (eu.ggnet.dwoss.uniqueunit.ee.entity.PriceType.MANUFACTURER_COST)2 ProductFormater (eu.ggnet.dwoss.uniqueunit.ee.format.ProductFormater)2 ISO (eu.ggnet.dwoss.util.DateFormats.ISO)2 eu.ggnet.lucidcalc (eu.ggnet.lucidcalc)2