Search in sources :

Example 6 with SalesProduct

use of eu.ggnet.dwoss.redtape.ee.entity.SalesProduct in project dwoss by gg-net.

the class RedTapeAgentBean method remove.

/**
 * Removes the instance from the Database.
 * <p/>
 * @param salesProduct the instance to be removed.
 */
@Override
public void remove(SalesProduct salesProduct) {
    SalesProduct findById = new SalesProductEao(getEntityManager()).findById(salesProduct.getPartNo());
    getEntityManager().remove(findById);
}
Also used : SalesProductEao(eu.ggnet.dwoss.redtape.ee.eao.SalesProductEao) SalesProduct(eu.ggnet.dwoss.redtape.ee.entity.SalesProduct)

Example 7 with SalesProduct

use of eu.ggnet.dwoss.redtape.ee.entity.SalesProduct in project dwoss by gg-net.

the class SalesProductChooserCask method main.

// End of variables declaration//GEN-END:variables
public static void main(String[] args) {
    SalesProduct salesProduct1 = new SalesProduct("AS.ASASD.ASD", "Test SalesProduct", 10D, 1, "SalesProduct Test Descritpion");
    SalesProduct salesProduct2 = new SalesProduct("AS.1234.ASD", "Test SalesProduct2", 1D, 2, "SalesProduct Test Descritpion2");
    List<SalesProduct> products = new ArrayList<>();
    products.add(salesProduct1);
    products.add(salesProduct2);
    SalesProductChooserCask view = new SalesProductChooserCask(products);
    OkCancelDialog<SalesProductChooserCask> dialog = new OkCancelDialog<>("Sample", view);
    dialog.setVisible(true);
    System.out.println(view.getProduct());
}
Also used : ArrayList(java.util.ArrayList) OkCancelDialog(eu.ggnet.dwoss.util.OkCancelDialog) SalesProduct(eu.ggnet.dwoss.redtape.ee.entity.SalesProduct)

Example 8 with SalesProduct

use of eu.ggnet.dwoss.redtape.ee.entity.SalesProduct in project dwoss by gg-net.

the class SalesProductUpdateCask method main.

// End of variables declaration//GEN-END:variables
public static void main(String[] args) {
    SalesProduct product = new SalesProduct("none", "none", 0d, 0, "none");
    SalesProductUpdateCask cask = new SalesProductUpdateCask(product);
    OkCancelDialog<SalesProductUpdateCask> ocd = new OkCancelDialog<>("ProductBatchUpdateCask", cask);
    ocd.setVisible(true);
    SalesProduct finished = ocd.getSubContainer().salesProduct;
    System.out.println(finished);
}
Also used : OkCancelDialog(eu.ggnet.dwoss.util.OkCancelDialog) SalesProduct(eu.ggnet.dwoss.redtape.ee.entity.SalesProduct)

Example 9 with SalesProduct

use of eu.ggnet.dwoss.redtape.ee.entity.SalesProduct in project dwoss by gg-net.

the class SalesProductIT method testSalesProduct.

@Test
public void testSalesProduct() throws Exception {
    utx.begin();
    em.joinTransaction();
    SalesProduct product1 = new SalesProduct("This.IsPart.One", "Part One", 12d, 1, "This is a description");
    SalesProduct product2 = new SalesProduct("This.IsPart.Two", "Part Two", 12d, 2, "This is a descriptionThis is a description");
    SalesProduct product3 = new SalesProduct("This.IsPart.Three", "Part Three", 12d, 3, "This is a descriptionThis is a descriptionThis is a description");
    SalesProduct product4 = new SalesProduct("This.IsPart.Four", "Part Four", 12d, 4, "This is a descriptionThis is a descriptionThis is a descriptionThis is a descriptionThis is a description");
    em.persist(product1);
    em.persist(product2);
    em.persist(product3);
    em.persist(product4);
    utx.commit();
    utx.begin();
    em.joinTransaction();
    SalesProductEao eao = new SalesProductEao(em);
    SalesProduct findByPartNo = eao.findById("This.IsPart.One");
    assertEquals("FindbyPartNo returns a other Object as expected!", findByPartNo, product1);
    SalesProduct findByUniqueUnitProductId = eao.findByUniqueUnitProductId(3);
    assertEquals("Die Objekte der Methode findByUniqueUnitProductId waren nicht gleich", product3, findByUniqueUnitProductId);
    utx.commit();
}
Also used : SalesProductEao(eu.ggnet.dwoss.redtape.ee.eao.SalesProductEao) SalesProduct(eu.ggnet.dwoss.redtape.ee.entity.SalesProduct) Test(org.junit.Test)

Example 10 with SalesProduct

use of eu.ggnet.dwoss.redtape.ee.entity.SalesProduct in project dwoss by gg-net.

the class SalesProductEao method findByUniqueUnitProductId.

public SalesProduct findByUniqueUnitProductId(long uniqueUnitProductId) {
    Query createNamedQuery = em.createNamedQuery("byUniqueUnitProductId");
    createNamedQuery.setParameter(1, uniqueUnitProductId);
    try {
        return (SalesProduct) createNamedQuery.getSingleResult();
    } catch (NoResultException ex) {
        return null;
    }
}
Also used : Query(javax.persistence.Query) SalesProduct(eu.ggnet.dwoss.redtape.ee.entity.SalesProduct) NoResultException(javax.persistence.NoResultException)

Aggregations

SalesProduct (eu.ggnet.dwoss.redtape.ee.entity.SalesProduct)11 SalesProductEao (eu.ggnet.dwoss.redtape.ee.eao.SalesProductEao)2 ProductSpec (eu.ggnet.dwoss.spec.ee.entity.ProductSpec)2 OkCancelDialog (eu.ggnet.dwoss.util.OkCancelDialog)2 HtmlDialog (eu.ggnet.dwoss.util.HtmlDialog)1 ArrayList (java.util.ArrayList)1 NoResultException (javax.persistence.NoResultException)1 Query (javax.persistence.Query)1 Test (org.junit.Test)1