Пример #1
0
  /**
   * asd.
   *
   * @return asd.
   */
  @Override
  public final List<Sale> findAllSales() {
    logger.debug("SaleServiceImpl.findAllSales starts");

    List<Sale> res = salesDao.find();

    logger.debug("SaleServiceImpl.findAllSales starts");

    return res;
  }
Пример #2
0
  /**
   * asd.
   *
   * @param sale asd.
   * @param products asd.
   * @param user asd.
   * @param store asd.
   */
  @Override
  @Transactional
  public final void addNewSale(
      Sale sale, final List<Product> products, final User user, final Store store) {

    logger.debug("SaleServiceImpl.addNewSale starts");

    getEntityManager().getTransaction().begin();

    sale.setCreatedAt(new Date());
    sale.setCreator(user);
    sale.setStore(store);
    sale = salesDao.save(sale);

    for (Product p : products) {
      p.setSale(sale);
      productsDao.save(p);
    }

    getEntityManager().getTransaction().commit();
  }
Пример #3
0
 /** {@inheritDoc} */
 @Override
 public long count() {
   return salesDao.count();
 }