Search in sources :

Example 11 with ProductSeries

use of eu.ggnet.dwoss.spec.ee.entity.ProductSeries in project dwoss by gg-net.

the class SimpleView method addModelButtonActionPerformed.

// GEN-LAST:event_familyBoxActionPerformed
private void addModelButtonActionPerformed(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_addModelButtonActionPerformed
    String modelName = (String) modelBox.getSelectedItem();
    if (StringUtils.isBlank(modelName)) {
        error("Keine Modellname hinterlegt!");
        return;
    }
    for (ProductSeries series : allSeries) {
        for (ProductFamily family : series.getFamilys()) {
            for (ProductModel model : family.getModels()) {
                if (model.getName().equals(modelName)) {
                    error("Modell " + modelName + " existiert schon in " + series.getName() + "/" + family.getName());
                    // Found an equal, so nothing to do
                    return;
                }
            }
        }
    }
    if (!getSelectedSeries().isPresent()) {
        if (!warn("Keine Serie und Familie ausgewählt, es werde Standartwerte verwendet."))
            return;
    } else if (!getSelectedFamily().isPresent()) {
        if (!warn("Keine Familie ausgewählt, es wird ein Standartwert verwendet."))
            return;
    }
    ProductModel model = productProcessor.create(getBrand(), getGroup(), getSelectedSeries().orElse(null), getSelectedFamily().orElse(null), modelName);
    // TODO: Add Model to local list in a better way
    // TODO: And show the active backgroundprogress.
    JOptionPane.showMessageDialog(this, "Modell " + model.getName() + " wurde hinzugefügt.\nAktualisiere Lokale Liste.");
    parent.setEnabled(false);
    allSeries = specAgent.findAll(ProductSeries.class);
    parent.setEnabled(true);
    updateSeries();
    updateFamily();
    updateModel();
    seriesBox.setSelectedItem(model.getFamily().getSeries().getName());
    familyBox.setSelectedItem(model.getFamily().getName());
    modelBox.setSelectedItem(model.getName());
    enableAddButtons();
}
Also used : ProductFamily(eu.ggnet.dwoss.spec.ee.entity.ProductFamily) ProductSeries(eu.ggnet.dwoss.spec.ee.entity.ProductSeries) ProductModel(eu.ggnet.dwoss.spec.ee.entity.ProductModel)

Example 12 with ProductSeries

use of eu.ggnet.dwoss.spec.ee.entity.ProductSeries in project dwoss by gg-net.

the class SimpleView method addFamilyButtonActionPerformed.

// GEN-LAST:event_addModelButtonActionPerformed
private void addFamilyButtonActionPerformed(java.awt.event.ActionEvent evt) {
    // GEN-FIRST:event_addFamilyButtonActionPerformed
    String familyName = (String) familyBox.getSelectedItem();
    if (StringUtils.isBlank(familyName)) {
        error("Keine Familienname hinterlegt!");
        return;
    }
    for (ProductSeries series : allSeries) {
        for (ProductFamily family : series.getFamilys()) {
            if (family.getName().equals(familyName)) {
                error("Familie " + familyName + " existiert schon in " + series.getName());
                // Found an equal, so nothing to do
                return;
            }
        }
    }
    if (!getSelectedSeries().isPresent()) {
        if (!warn("Keine Serie ausgewählt, es wird ein Standartwert verwendet."))
            return;
    }
    ProductFamily family = productProcessor.create(getBrand(), getGroup(), getSelectedSeries().orElse(null), familyName);
    // TODO: Add Family to local list in a better way
    // TODO: And show the active backgroundprogress.
    JOptionPane.showMessageDialog(this, "Familie " + family.getName() + " wurde hinzugefügt.\nAktualisiere Lokale Liste.");
    parent.setEnabled(false);
    allSeries = specAgent.findAll(ProductSeries.class);
    parent.setEnabled(true);
    updateSeries();
    updateFamily();
    updateModel();
    seriesBox.setSelectedItem(family.getSeries().getName());
    familyBox.setSelectedItem(family.getName());
    enableAddButtons();
}
Also used : ProductFamily(eu.ggnet.dwoss.spec.ee.entity.ProductFamily) ProductSeries(eu.ggnet.dwoss.spec.ee.entity.ProductSeries)

Example 13 with ProductSeries

use of eu.ggnet.dwoss.spec.ee.entity.ProductSeries in project dwoss by gg-net.

the class SimpleView method getFilteredSeries.

private List<ProductSeries> getFilteredSeries() {
    List<ProductSeries> filteredSerieses = new ArrayList<>();
    for (ProductSeries series : allSeries) {
        if (series.getBrand().equals(getSelectedBrand()) && series.getGroup().equals(getSelectedGroup())) {
            filteredSerieses.add(series);
        }
    }
    Collections.sort(filteredSerieses, INAMED_COMPARATOR);
    return filteredSerieses;
}
Also used : ProductSeries(eu.ggnet.dwoss.spec.ee.entity.ProductSeries)

Example 14 with ProductSeries

use of eu.ggnet.dwoss.spec.ee.entity.ProductSeries in project dwoss by gg-net.

the class ProductProcessorStub method create.

@Override
public Reply<ProductSeries> create(TradeName brand, ProductGroup group, String seriesName) {
    ProductSeries series = soc.newProductSeries(brand, group, SpecPu.DEFAULT_NAME);
    serieses.add(series);
    return Reply.success(series);
}
Also used : ProductSeries(eu.ggnet.dwoss.spec.ee.entity.ProductSeries)

Example 15 with ProductSeries

use of eu.ggnet.dwoss.spec.ee.entity.ProductSeries in project dwoss by gg-net.

the class ProductProcessorStub method create.

/**
 * Creates a new ProductModel and Persists it.
 *
 * How this works: If series is null, family is also as null asumed. - so a default series and a default family is selected. If family is null, a default
 * one is selecte at the series. In both cases, if no default exists, create on. Now create a ProductModel with the family.
 *
 * @param brand     may not be null
 * @param group     may not be null
 * @param series    if null, default is used
 * @param family    if null, default is used
 * @param modelName the name of the model
 * @return
 */
@Override
public ProductModel create(final TradeName brand, final ProductGroup group, ProductSeries series, ProductFamily family, final String modelName) {
    if (series == null) {
        // implies, that family is also null
        for (ProductSeries s : serieses) {
            if (s.getBrand().equals(brand) && s.getGroup().equals(group) && s.getName().equals(SpecPu.DEFAULT_NAME)) {
                series = s;
            }
        }
        if (series == null) {
            series = soc.newProductSeries(brand, group, SpecPu.DEFAULT_NAME);
            serieses.add(series);
        }
    }
    if (family == null) {
        for (ProductFamily f : series.getFamilys()) {
            if (f.getName().equals(SpecPu.DEFAULT_NAME)) {
                family = f;
            }
        }
        if (family == null) {
            family = soc.newProductFamily();
            family.setName(SpecPu.DEFAULT_NAME);
            series.addFamily(family);
        }
    }
    // TODO: Check if name exists, just to be sure
    ProductModel model = soc.newProductModel();
    model.setName(modelName);
    model.setFamily(family);
    return model;
}
Also used : ProductFamily(eu.ggnet.dwoss.spec.ee.entity.ProductFamily) ProductSeries(eu.ggnet.dwoss.spec.ee.entity.ProductSeries) ProductModel(eu.ggnet.dwoss.spec.ee.entity.ProductModel)

Aggregations

ProductSeries (eu.ggnet.dwoss.spec.ee.entity.ProductSeries)32 ProductFamily (eu.ggnet.dwoss.spec.ee.entity.ProductFamily)23 Test (org.junit.Test)17 ProductModel (eu.ggnet.dwoss.spec.ee.entity.ProductModel)15 Cpu (eu.ggnet.dwoss.spec.ee.entity.piece.Cpu)8 Gpu (eu.ggnet.dwoss.spec.ee.entity.piece.Gpu)8 ProductSeriesEao (eu.ggnet.dwoss.spec.ee.eao.ProductSeriesEao)7 ProductSpec (eu.ggnet.dwoss.spec.ee.entity.ProductSpec)7 Notebook (eu.ggnet.dwoss.spec.ee.entity.Notebook)6 Display (eu.ggnet.dwoss.spec.ee.entity.piece.Display)6 ProductFamilyEao (eu.ggnet.dwoss.spec.ee.eao.ProductFamilyEao)4 Desktop (eu.ggnet.dwoss.spec.ee.entity.Desktop)3 EntityManager (javax.persistence.EntityManager)3 TradeName (eu.ggnet.dwoss.rules.TradeName)2 ProductModelEao (eu.ggnet.dwoss.spec.ee.eao.ProductModelEao)2 ProductSpecEao (eu.ggnet.dwoss.spec.ee.eao.ProductSpecEao)2 Product (eu.ggnet.dwoss.uniqueunit.ee.entity.Product)2 Mandators (eu.ggnet.dwoss.mandator.Mandators)1 eu.ggnet.dwoss.mandator.api.value (eu.ggnet.dwoss.mandator.api.value)1 ProductProcessor (eu.ggnet.dwoss.receipt.ee.ProductProcessor)1