public void removeProduct(ProductDTO productDTO) {

    productDAO.setEm(em);

    Product product = em.find(Product.class, productDTO.getId());

    productDAO.removeTop5(product.getId());

    em.remove(product);
  }
  public ProductDTO getProductDetailById(Long id) {
    productDAO.setEm(em);
    Product product = em.find(Product.class, id);
    Top5 productTop5 = productDAO.getProductTop5(product.getId());

    ProductDTO productDTO = OMSMapper.mapProduct(product);
    if (productTop5 != null) {
      productDTO.setTop5(OMSMapper.mapTop5(productDAO.getTopProducts(productTop5)));
    }

    return productDTO;
  }
  public ProductDTO getProductDetail(Long prodId) {
    productDAO.setEm(em);
    Product product = productDAO.getProduct(prodId);
    Top5 productTop5 = productDAO.getProductTop5(product.getId());

    ProductDTO productDTO = OMSMapper.mapProduct(product);
    if (productTop5 != null) {
      productDTO.setTop5(OMSMapper.mapTop5(productDAO.getTopProducts(productTop5)));
    }

    return productDTO;
  }
  public TableResultDTO<ProductDTO> getProductsList(final TableFilterDTO filter) {

    productDAO.setEm(em);
    final TableResultDTO<Product> products = productDAO.getProducts(filter);

    final TableResultDTO<ProductDTO> tableResultDTO = new TableResultDTO<ProductDTO>();
    tableResultDTO.setTotalOfRecords(products.getTotalOfRecords());

    final List<ProductDTO> productDTOs = new ArrayList<ProductDTO>(products.getResult().size());

    for (final Product product : products.getResult()) {
      productDTOs.add(OMSMapper.mapProduct(product));
    }

    tableResultDTO.setResult(productDTOs);

    return tableResultDTO;
  }
 public Product getProduct(Long prodId) {
   productDAO.setEm(em);
   Product product = productDAO.getProduct(prodId);
   return product;
 }