Package com.skyline.wo.model

Examples of com.skyline.wo.model.Article


  @RequestMapping(value = "/view/{articleId}", method = RequestMethod.GET)
  public ModelAndView viewArticleByArticleId(@PathVariable Long articleId) {
    // Date d1=new Date();
    ModelAndView mav = new ModelAndView();
    Article article = articleService.getArticleById(articleId);
    Integer authority = AuthorityUtil.getAuthority(null, article.getOwnerId());
    if (authority < article.getAuthority()) {
      throw new NoVisitPermissionException();
    } else {
      articleService.addVisitNum(articleId);
    }
    mav.addObject("ARTICLE", article);
View Full Code Here


  @RequestMapping(value = "/prior/{categoryId}/{articleId}/{readAuthority}", method = RequestMethod.GET)
  public ModelAndView viewPriorArticle(@PathVariable Long articleId, @PathVariable Long categoryId, @PathVariable Integer readAuthority) {
    // Date d1=new Date();
    ModelAndView mav = new ModelAndView();
    Article article = articleService.getPriorArticle(categoryId, articleId, readAuthority);
    if (article != null) {
      Integer authority = AuthorityUtil.getAuthority(null, article.getOwnerId());
      if (authority < readAuthority || authority < article.getAuthority()) {
        throw new NoVisitPermissionException();
      } else {
        mav.addObject("AUTHORITY", authority);
        articleService.addVisitNum(articleId);
      }
View Full Code Here

  }

  @RequestMapping(value = "/next/{categoryId}/{articleId}/{readAuthority}", method = RequestMethod.GET)
  public ModelAndView viewNextArticle(@PathVariable Long articleId, @PathVariable Long categoryId, @PathVariable Integer readAuthority) {
    ModelAndView mav = new ModelAndView();
    Article article = articleService.getNextArticle(categoryId, articleId, readAuthority);
    if (article != null) {
      Integer authority = AuthorityUtil.getAuthority(null, article.getOwnerId());
      if (authority < readAuthority || authority < article.getAuthority()) {
        throw new NoVisitPermissionException();
      } else {
        mav.addObject("AUTHORITY", authority);
        articleService.addVisitNum(articleId);
      }
View Full Code Here

          photo.getOwnerId(), photo.getOwnerNickname(), photo.getOwnerPortrait(), photo.getAlbumId(), photo.getAlbumName());
    }
  }

  private void addArticleShare(Long sharerId, String sharerNickname, String sharerPortrait, Long resourceId) {
    Article article = articleService.getArticleById(resourceId);
    if (article != null) {
      shareDao.insertShare(sharerId, sharerNickname, sharerPortrait, ShareType.ARTICLE, resourceId, article.getTitle(),
          article.getDigest(), article.getOwnerId(), article.getOwnerNickname(), article.getOwnerPortrait(),
          article.getCategoryId(), article.getCategoryName());
      // resourceDao.updateShareNumOfOne(ResourceType.ARTICLE,
      // resourceId);
    }
  }
View Full Code Here

  @Override
  public Share getShareById(Long id) {
    Share share = shareDao.queryShareById(id);
    if (share != null) {
      if (share.getShareType().equals(ShareType.ARTICLE)) {
        Article article = articleService.getArticleById(share.getResourceId());
        if (article != null) {
          share.setResourceContent(article.getContent());
          share.setTotalShareNum(article.getShareNum());
        }
      }
    }
    return share;
  }
View Full Code Here

      return mav;

    } else if (ref.getRefrenceType() == SpotRefrenceType.TRAVELNOTE) {

    } else {
      Article article = articleService.getArticleById(id);
      ModelAndView v = new ModelAndView(ViewPaths.SPOTREFRENCE_DETAIL);
      v.addObject("article", article);

      return v;
    }
View Full Code Here

  public Article getNextArticle(Long categoryId, Long id, Integer authority) {
    return articleDao.queryNextArticleById(categoryId, id, authority);
  }

  public Article getArticleById(Long id) {
    Article article = articleDao.queryArticleById(id);
    if (article == null) {
      throw new NoResourceException();
    } else {

      return article;
View Full Code Here

  public void addVisitNum(Long id) {
    articleDao.updateArticleVisitNum(id);
  }

  public void deleteArticle(Long id, Long actionerId) {
    Article article = articleDao.queryArticleById(id);
    if (article != null) {
      articleDao.deleteArticle(id, actionerId);
      categoryDao.updateArticleNumMinus(article.getCategoryId(), actionerId, 1);
    }
  }
View Full Code Here

  public ModelAndView addArticleExecute(String title, String content, String digest, Long categoryId, String categoryName,
      Integer authority, String submitToken) {
    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    ModelAndView mav = new ModelAndView();
    if (user != null) {
      Article article = new Article(authority, user.getId(), user.getPortrait(), user.getNickname(), title, content, digest,
          categoryId, categoryName);
      article.setSubmitToken(submitToken);
      // //
      String errMsg = validateForm("addArticleForm", article);
      if (errMsg != null) {
        ModelAndView returnMav = addArticleRequest();
        return processValidationErrors("errMsg", errMsg, returnMav);
View Full Code Here

  @RequestMapping(value = "modify/{articleId}", method = RequestMethod.GET)
  public ModelAndView modifyArticleRequest(@PathVariable Long articleId) {
    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    ModelAndView mav = new ModelAndView();
    if (user != null) {
      Article article = articleService.getArticleById(articleId);
      if (article != null && article.getOwnerId().equals(user.getId())) {
        List<Category> categories = categoryService.getCategoryByOwnerId(user.getId());
        mav.addObject("ARTICLE", article);
        mav.addObject("CATEGORIES", categories);
        mav.setViewName(ViewPaths.ARTICLE_MODIFYARTICLE);
      } else {
View Full Code Here

TOP

Related Classes of com.skyline.wo.model.Article

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.