Beispiel #1
0
 @GET
 @Path("{userId}/friends/rec")
 public Response getFriendsRec(
     @PathParam("userId") String userId,
     @QueryParam(SIZE_QPARAM) @DefaultValue("10") final String size,
     @QueryParam(INCLUDE_FRIENDS_QPARAM) @DefaultValue("false") final String includeFriends) {
   // validations
   boolean isIncludeFriends = StringUtils.getBoolean(includeFriends);
   Integer sizeValue = StringUtils.getIntegerValue(size, 10);
   List<FriendRecommendation> friendRecommendations;
   if (isIncludeFriends) {
     friendRecommendations = userDao.getFriendsRecWithFriends(userId, size);
   } else {
     friendRecommendations = userDao.getFriendsRecWithCount(userId, size);
   }
   return Response.ok()
       .entity(
           new FriendRecommendationsPage(friendRecommendations, friendRecommendations.size(), 0))
       .build();
 }