Package com.skyline.user.model

Examples of com.skyline.user.model.User


  }

  @RequestMapping(value = "/list/user/{userId}", method = RequestMethod.GET)
  public ModelAndView listShareByUserId(@PathVariable Long userId, Page page) {
    ModelAndView mav = new ModelAndView();
    User user = personalInfoService.getPersonInfoByUserID(userId);
    if (user == null) {
      // TODO:对user不存在的情况进行处理
      return null;
    } else {
      mav.addObject("OWNER", user);
View Full Code Here


  @RequestMapping(value = "/list/user/{userId}/{shareType}", method = RequestMethod.GET)
  public ModelAndView listShareByUserId(@PathVariable Long userId,
      @PathVariable ShareType shareType, Page page) {
    ModelAndView mav = new ModelAndView();
    User user = personalInfoService.getPersonInfoByUserID(userId);
    if (user == null) {
      // TODO:对user不存在的情况进行处理
      return null;
    } else {
      mav.addObject("OWNER", user);
View Full Code Here

      return "redirect:/login" + URL_SUFFIX + "?requestFrom=" + requestFrom;
    } else if (ex instanceof NoOperatePermissionException) {
      // 如果没有操作权限而且没有登录,则需要重新登录,而且登录后直接进入首页
      // 对于删除类操作即使没有登录,重新登录后也不能继续做删除操作
      LOGGER.warn("系统发生业务异常,异常原因:没有操作权限", ex);
      User user = (User) WebHelper.getSessionAttribute(request, Constant.SESSION_USER);
      if (user == null) {
        return "redirect:/login" + URL_SUFFIX;
      }
    } else if (ex instanceof OperateFailedException) {
      LOGGER.warn("系统发生业务异常,异常原因:操作失败", ex);
View Full Code Here

   */
  @RequestMapping(value = "/list", method = RequestMethod.GET)
  public @ResponseBody
  List<Notification> getNotification() {

    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    if (user == null) {
      return null;
    } else {
      List<Notification> notifications = noticeService.getNotificationByOwnerId(user.getId());
      return notifications;
    }
  }
View Full Code Here

    return mav;
  }

  @RequestMapping(value = "add", method = RequestMethod.GET)
  public ModelAndView addArticleRequest() {
    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    ModelAndView mav = new ModelAndView();
    if (user != null) {
      mav.setViewName(ViewPaths.ARTICLE_ADDARTICLE);
      List<Category> categories = categoryService.getCategoryByOwnerId(user.getId());
      mav.addObject("CATEGORIES", categories);
    } else {
      mav.addObject("REQUEST_FROM", "article/add" + URL_SUFFIX);
      mav.setViewName(ViewPaths.USER_LOGIN);
    }
View Full Code Here

  }

  @RequestMapping(value = "add", method = RequestMethod.POST)
  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);
      }
      // //
      articleService.addArticle(article);
      mav.setViewName("redirect:" + "list/user/" + user.getId() + URL_SUFFIX);
    } else {
      mav.addObject("REQUEST_FROM", "article/add" + URL_SUFFIX);
      mav.setViewName(ViewPaths.USER_LOGIN);
    }
    return mav;
View Full Code Here

    return mav;
  }

  @RequestMapping(value = "delete/{articleId}", method = RequestMethod.GET)
  public ModelAndView deleteArticle(@PathVariable Long articleId) {
    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    ModelAndView mav = new ModelAndView();
    if (user != null) {
      articleService.deleteArticle(articleId, user.getId());
      mav.setViewName("redirect:" + "../list/user/" + user.getId() + URL_SUFFIX);
    } else {
      mav.addObject("REQUEST_FROM", "article/add" + URL_SUFFIX);
      mav.setViewName(ViewPaths.USER_LOGIN);
    }
    return mav;
View Full Code Here

    return mav;
  }

  @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 {
        mav.addObject("REQUEST_FROM", "article/modify/" + articleId + URL_SUFFIX);
View Full Code Here

  }

  @RequestMapping(value = "modify/{articleId}", method = RequestMethod.POST)
  public ModelAndView modifyArticleExecute(@PathVariable Long articleId, 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("modifyArticleForm", article);
      if (errMsg != null) {
        ModelAndView returnMav = modifyArticleRequest(articleId);
        return processValidationErrors("errMsg", errMsg, returnMav);
      }
      // //
      articleService.modifyArticle(articleId, authority, user.getId(), title, content, digest, categoryId, categoryName);
      mav.setViewName("redirect:../view/" + articleId + URL_SUFFIX);
    } else {
      mav.addObject("REQUEST_FROM", "article/modify/" + articleId + URL_SUFFIX);
      mav.setViewName(ViewPaths.USER_LOGIN);
    }
View Full Code Here

    articleService.down(articleId);
  }

  @RequestMapping(value = "category/manage", method = RequestMethod.GET)
  public ModelAndView manageCategory() {
    User user = (User) WebHelper.getSessionAttribute(null, Constant.SESSION_USER);
    ModelAndView mav = new ModelAndView();
    if (user != null) {
      List<Category> categories = categoryService.getCategoryByOwnerId(user.getId());
      mav.setViewName(ViewPaths.ARTICLE_MANAGECATEGORY);
      // mav.addObject(userid);
      mav.addObject("CATEGORIES", categories);
    } else {
      mav.addObject("REQUEST_FROM", requestFrom);
View Full Code Here

TOP

Related Classes of com.skyline.user.model.User

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.