Search in sources :

Example 6 with ProductGroup

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

the class ProductSpecMatches method execute.

@Override
public ChainLink.Result<String> execute(String value) {
    ProductSpec spec = specAgent.findProductSpecByPartNoEager(value);
    if (spec == null)
        return new ChainLink.Result<>(value, ValidationStatus.ERROR, "ProductSpec existiert noch nicht, bitte anlegen");
    TradeName isBrand = spec.getModel().getFamily().getSeries().getBrand();
    if (isBrand != mustBrand)
        return new ChainLink.Result<>(value, ValidationStatus.ERROR, "ProductSpec ist von der Marke " + isBrand.getName() + ", muss aber von der Marke " + mustBrand.getName() + " sein");
    ProductGroup isGroup = spec.getModel().getFamily().getSeries().getGroup();
    if (isGroup != mustGroup)
        return new ChainLink.Result<>(value, ValidationStatus.ERROR, "ProductSpec ist aus der Warengruppe " + isGroup.getName() + ", muss aber aus der Warengruppe " + mustGroup.getName() + " sein");
    return new ChainLink.Result<>(value);
}
Also used : TradeName(eu.ggnet.dwoss.rules.TradeName) ProductGroup(eu.ggnet.dwoss.rules.ProductGroup) ChainLink(eu.ggnet.dwoss.receipt.unit.chain.ChainLink) ProductSpec(eu.ggnet.dwoss.spec.ee.entity.ProductSpec)

Aggregations

ProductGroup (eu.ggnet.dwoss.rules.ProductGroup)6 TradeName (eu.ggnet.dwoss.rules.TradeName)5 Test (org.junit.Test)4 ProductModelEmo (eu.ggnet.dwoss.spec.ee.emo.ProductModelEmo)3 ProductModel (eu.ggnet.dwoss.spec.ee.entity.ProductModel)3 ProductFamilyEmo (eu.ggnet.dwoss.spec.ee.emo.ProductFamilyEmo)2 ProductSeriesEmo (eu.ggnet.dwoss.spec.ee.emo.ProductSeriesEmo)2 ChainLink (eu.ggnet.dwoss.receipt.unit.chain.ChainLink)1 ProductSeriesEao (eu.ggnet.dwoss.spec.ee.eao.ProductSeriesEao)1 ProductSeries (eu.ggnet.dwoss.spec.ee.entity.ProductSeries)1 ProductSpec (eu.ggnet.dwoss.spec.ee.entity.ProductSpec)1 TreeItem (javafx.scene.control.TreeItem)1