Package net.baguajie.domains

Examples of net.baguajie.domains.User


  private SessionUtil sessionUtil;

  public boolean preHandle(HttpServletRequest request,
      HttpServletResponse response, Object handler) throws Exception {
    HttpSession session = request.getSession(true);
    User signInUser = sessionUtil.getSignInUser(session);
    UserPreference up = sessionUtil.getSignInUserPrefer(session);
    if (signInUser != null && signInUser.getStatus() == UserStatus.INVALID) {
      session.removeAttribute(ApplicationConstants.SESSION_SIGNIN_USER);
    } else {
      if (signInUser != null && up == null) {
        up = userPreferenceRepository.getByUser(signInUser);
        sessionUtil.setSignInUserPrefer(up, session);
View Full Code Here


 
  @RequestMapping(value="/{id}/fans/{no}", method=RequestMethod.GET)
  public String fans(@PathVariable String id,
      @PathVariable int no, Model model,
      HttpServletRequest request, HttpSession session){
    User user = userRepository.findOne(id);
    if(user==null){
      throw new RuntimeException("Invalid user id : " + id);
    }
    Pageable pageable = new PageRequest(Math.max(no, 0),
        ApplicationConfig.masonryPageSize,
View Full Code Here

 
  @RequestMapping(value="/{id}/follows/{no}", method=RequestMethod.GET)
  public String follows(@PathVariable String id,
      @PathVariable int no, Model model,
      HttpServletRequest request, HttpSession session){
    User user = userRepository.findOne(id);
    if(user==null){
      throw new RuntimeException("Invalid user id : " + id);
    }
    Pageable pageable = new PageRequest(Math.max(no, 0),
        ApplicationConfig.masonryPageSize,
View Full Code Here

 
  @RequestMapping(value="/{id}/basic", method=RequestMethod.GET)
  public String view(@PathVariable String id, Model model,
      HttpServletRequest request, HttpSession session){
   
    User user = userRepository.findOne(id);
    model.addAttribute("user", user);
    return "profiles/basic";
  }
View Full Code Here

  @RequestMapping(value = "/signin/validate", method = RequestMethod.POST)
  public @ResponseBody
  Object[] validateSignIn(@Valid SignInCredentialVo signInCredentialVo,
      BindingResult result, Model model, HttpSession session) {
    User existed = null;
    if (!result.hasFieldErrors("signInName")) {
      existed = userPepository.getByEmail(signInCredentialVo
          .getSignInName());
      if (existed == null) {
        result.addError(new FieldError("signInCredentialVo",
            "signInName", "注册邮箱不存在"));
      } else {
        if (!signInCredentialVo.getSignInPassword().equals(
            existed.getPassword())) {
          result.addError(new FieldError("signInCredentialVo",
              "signInPassword", "密码不正确"));
        }
        if(existed.getStatus() == UserStatus.INVALID){
          result.addError(new FieldError("signInCredentialVo",
              "signInName", "账号暂时不能登陆"));
        }
      }
    }
View Full Code Here

  }

  @RequestMapping(value = "/signin", method = RequestMethod.POST)
  public String signIn(@Valid SignInCredentialVo signInCredentialVo,
      BindingResult result, Model model, HttpSession session) {
    User existed = null;
    if (!result.hasFieldErrors("signInName")) {
      existed = userPepository.getByEmail(signInCredentialVo
          .getSignInName());
      if (existed == null) {
        result.addError(new FieldError("signInCredentialVo",
            "signInName", "注册邮箱不存在"));
      } else {
        if (!signInCredentialVo.getSignInPassword().equals(
            existed.getPassword())) {
          result.addError(new FieldError("signInCredentialVo",
              "signInPassword", "密码不正确"));
        }
        if(existed.getStatus() == UserStatus.INVALID){
          result.addError(new FieldError("signInCredentialVo",
              "signInName", "账号暂时不能登陆"));
        }
      }
    }
View Full Code Here

  @RequestMapping(value="/{id}/namecard", method=RequestMethod.GET)
  public String view(@PathVariable String id, Model model,
      HttpServletRequest request, HttpSession session){
   
    User user = userRepository.findOne(id);
    model.addAttribute("user", user);
    return "profiles/namecard";
  }
View Full Code Here

  }
 
  @RequestMapping(value="/dashboard/cmt", method=RequestMethod.GET)
  public String cmt(Model model,
      HttpServletRequest request, HttpSession session){
    User user = sessionUtil.getSignInUser(session);
    if(user == null){
      return "forward:/signin";
    }
    model.addAttribute("user", user);
    return "dashboard/dsb.cmt";
View Full Code Here

    String uid = request.getParameter("uid");
    String category = request.getParameter("category");
    Pageable pageable = new PageRequest(0,
        ApplicationConfig.categoryThumbPageSize, new Sort(new Order(
            Direction.DESC, "createdAt")));
    User user = userRepository.findOne(uid);
    Page<Spot> spots = spotRepository.findByCreatedByAndCategory(uid, category, pageable);
    model.addAttribute("category", category);
    model.addAttribute("user", user);
    if(spots!=null){
      model.addAttribute("total", spots.getTotalElements());
View Full Code Here

      return "redirect:/profiles/"+id;
    }
    if(ArrayUtils.indexOf(validViews, view) > 2){
      model.addAttribute("viewUser", true);
    }
    User user = userRepository.findOne(id);
    model.addAttribute("view", view);
    model.addAttribute("user", user);
    return "profiles/single";
  }
View Full Code Here

TOP

Related Classes of net.baguajie.domains.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.