예제 #1
0
 @GET
 @Path("/unreadCount")
 @ApiOperation(
     value = "Get unread count for feed subscriptions",
     responseClass = "List[com.commafeed.frontend.model.UnreadCount]")
 public Response getUnreadCount() {
   Map<Long, UnreadCount> unreadCount = feedSubscriptionService.getUnreadCount(getUser());
   return Response.ok(Lists.newArrayList(unreadCount.values())).build();
 }
예제 #2
0
  @GET
  @Path("/get")
  @ApiOperation(
      value = "Get feed categories",
      notes = "Get all categories and subscriptions of the user",
      responseClass = "com.commafeed.frontend.model.Category")
  public Response getSubscriptions() {
    User user = getUser();

    Category root = cache.getUserRootCategory(user);
    if (root == null) {
      log.debug("tree cache miss for {}", user.getId());
      List<FeedCategory> categories = feedCategoryDAO.findAll(user);
      List<FeedSubscription> subscriptions = feedSubscriptionDAO.findAll(user);
      Map<Long, UnreadCount> unreadCount = feedSubscriptionService.getUnreadCount(user);

      root = buildCategory(null, categories, subscriptions, unreadCount);
      root.setId("all");
      root.setName("All");
      cache.setUserRootCategory(user, root);
    }

    return Response.ok(root).build();
  }