Пример #1
0
 @Override
 public boolean update(Product product) {
   Article article =
       new Article(
           product.getParentId(),
           product.getType(),
           product.getClickCount(),
           product.getShareCount(),
           product.getCreateTime(),
           product.getCreator(),
           product.getTitle());
   article.setBrief(product.getBrief());
   article.setShown(product.getShown());
   article.setIndexImg(product.getIndexImg());
   article.setBrief(product.getBrief());
   article.setTop(product.getTop());
   try {
     articleDao.update(article);
     productDao.update(product);
   } catch (Exception e) {
     e.printStackTrace();
     return false;
   }
   return true;
 }
Пример #2
0
  @Override
  public String add(Product product) throws Exception {

    Article article =
        new Article(
            Article.TYPE_PRODUCT,
            0,
            0,
            product.getCreateTime(),
            product.getCreator(),
            product.getTitle(),
            product.getShown(),
            product.getBrief());
    article.setIndexImg(product.getIndexImg());
    article.setTop(new Long(0));
    Long articleId = (Long) articleDao.save(article);
    product.setParentId(articleId);
    return (String) productDao.save(product);
  }