Package org.springframework.data.domain.Sort

Examples of org.springframework.data.domain.Sort.Order


  public String dashboard(@PathVariable String id,
      @PathVariable int no, Model model,
      HttpServletRequest request, HttpSession session){
    Pageable pageable = new PageRequest(0,
        ApplicationConfig.pinCmtPageSize,
        new Sort(new Order(Direction.DESC, "createdAt")));
    Page<Forward> page = forwardRepository.findByAct(id, pageable);
    List<Forward> fwds = null;
    if(page!=null && page.hasContent()){
      fwds = new ArrayList<Forward>();
      for(Forward fwd: page){
View Full Code Here


  public String dashboard(@PathVariable String id,
      @PathVariable int no, Model model,
      HttpServletRequest request, HttpSession session){
    Pageable pageable = new PageRequest(0,
        ApplicationConfig.pinCmtPageSize,
        new Sort(new Order(Direction.DESC, "createdAt")));
    Page<Comment> page = commentRepository.findByAct(id, pageable);
    List<Comment> cmts = null;
    if(page!=null && page.hasContent()){
      cmts = new ArrayList<Comment>();
      for(Comment cmt: page){
View Full Code Here

      HttpSession session){
   
    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);
View Full Code Here

    String gender = request.getParameter("gender");
    String nameLike = request.getParameter("keyword");
    int no = Integer.parseInt(request.getParameter("no"));
    Pageable pageable = new PageRequest(Math.max(no, 0),
        ApplicationConfig.masonryPageSize,
        new Sort(new Order(Direction.DESC, "createdAt")));
    if(ApplicationConfig.defaultCityPinyin.equals(city)){
      city = "";
    }
    if(StringUtils.hasText(gender)){
      gender = gender.toUpperCase();
      try{
        Gender g = Gender.valueOf(gender);
        gender = g.name();
      }catch(RuntimeException re){
        logger.error(re.getMessage());
      }
    }
    Collection<PinUserVo> pins = new ArrayList<PinUserVo>();
    Page<User> users = null;
//    if(StringUtils.hasText(city) && g != null && StringUtils.hasText(keyword)){
//      users = userRepository.findByCityAndGenderAndNameLike(city, g, keyword, pageable);
//    }else if(StringUtils.hasText(city) && g!=null && !StringUtils.hasText(keyword)){
//      users = userRepository.findByCityAndGender(city, g, pageable);
//    }else if(StringUtils.hasText(city) && g==null && StringUtils.hasText(keyword)){
//      users = userRepository.findByCityAndNameLike(city, keyword, pageable);
//    }else if(!StringUtils.hasText(city) && g!=null && StringUtils.hasText(keyword)){
//      users = userRepository.findByGenderAndNameLike(g, keyword, pageable);
//    }else if(!StringUtils.hasText(city) && g==null && StringUtils.hasText(keyword)){
//      users = userRepository.findByNameLike(keyword, pageable);
//    }else if(!StringUtils.hasText(city) && g!=null && !StringUtils.hasText(keyword)){
//      users = userRepository.findByGender(g, pageable);
//    }else if(StringUtils.hasText(city) && g==null && !StringUtils.hasText(keyword)){
//      users = userRepository.findByCity(city, pageable);
//    }else{
//      users = userRepository.findAll(pageable);
//    }
    users = userRepository.search(StringUtils.trimWhitespace(city),
        StringUtils.trimWhitespace(gender),
        StringUtils.trimWhitespace(nameLike), pageable);
   
    pageable = new PageRequest(Math.max(no, 0),
        ApplicationConfig.masonryThumbPageSize,
        new Sort(new Order(Direction.DESC, "updatedAt")));
    if(users!=null){
      for(User user : users){
        Page<Spot> spots = spotRepository.findByCreatedBy(user.getId(), pageable);
        pins.add(PinUserVo.from(user, spots.getContent()));
      }
View Full Code Here

    List<String> types = new ArrayList<String>();
    types.add(ActivityType.SPOT.name());
    types.add(ActivityType.FORWARD.name());
    Pageable pageable = new PageRequest(Math.max(no, 0),
        ApplicationConfig.listPageSize,
        new Sort(new Order(Direction.DESC, "createdAt")));
    Iterable<Activity> acts = activityRepository
        .findByOwnerInAndTypeIn(ids, types, pageable);
    model.addAttribute("activities", toActVos(acts));
    return "dashboard/activities";
  }
View Full Code Here

    types.add(ActivityType.SPOT.name());
    types.add(ActivityType.FORWARD.name());
    types.add(ActivityType.COMMENT.name());
    Pageable pageable = new PageRequest(Math.max(no, 0),
        ApplicationConfig.listPageSize,
        new Sort(new Order(Direction.DESC, "createdAt")));
    Iterable<Activity> acts = activityRepository
        .findByTragetSpotInAndTypeIn(ids, types, pageable);
    model.addAttribute("activities", toActVos(acts));
    return "dashboard/activities";
  }
View Full Code Here

    for (Activity a: as){
      ids.add(a.getId());
    }
    Pageable pageable = new PageRequest(Math.max(no, 0),
        ApplicationConfig.listPageSize,
        new Sort(new Order(Direction.DESC, "createdAt")));
    types.clear();
    types.add(ActivityType.COMMENT.name());
    User signInUser = sessionUtil.getSignInUser(session);
    if(signInUser==null){
      throw new UnauthorizedOperationException();
View Full Code Here

  public String cmtFrom(@PathVariable String id,
      @PathVariable int no, Model model,
      HttpServletRequest request, HttpSession session){
    Pageable pageable = new PageRequest(Math.max(no, 0),
        ApplicationConfig.listPageSize,
        new Sort(new Order(Direction.DESC, "createdAt")));
    Iterable<Activity> acts = activityRepository.findByOwnerAndType(id,
        ActivityType.COMMENT, pageable);
    model.addAttribute("activities", toActVos(acts));
    return "dashboard/activities";
  }
View Full Code Here

  public String view(@PathVariable String id,
      @PathVariable int no, Model model,
      HttpServletRequest request, HttpSession session){
    Pageable pageable = new PageRequest(no >= 0 ? no : 0,
        ApplicationConfig.listPageSize,
        new Sort(new Order(Direction.DESC, "createdAt")));
    Iterable<Activity> acts = activityRepository.findByOwner(id, pageable);
    Collection<ActivityVo> activities = new ArrayList<ActivityVo>();
    for(Activity act : acts){
      ActivityVo vo = ActivityVo.from(act);
      if(act.getOwner()!=null){
View Full Code Here

    Iterable<Spot> spots = doSearch(request, false);
    Collection<PinVo> pins = new ArrayList<PinVo>();
    if(spots!=null){
      Pageable pageable = new PageRequest(0,
          ApplicationConfig.pinCmtPageSize,
          new Sort(new Order(Direction.DESC, "createdAt")));
      for(Spot spot : spots){
        try{
          Activity act = activityRepository.getByOwnerAndTargetSpotAndType(
              spot.getCreatedBy().getId(), spot.getId(), ActivityType.SPOT.name());
          Page<Comment> cmts = null;
View Full Code Here

TOP

Related Classes of org.springframework.data.domain.Sort.Order

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.