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);
}
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());
}
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);
}
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();
}
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;
}
}
Aggregations