From 302200828e48932dba38dc36fd41dd23fb6dfc76 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 5 Sep 2018 20:10:55 +0300 Subject: ActivityStreams: Collection first page is uri --- .../main/java/com/juick/server/api/activity/Profile.java | 15 +++------------ .../server/api/activity/model/OrderedCollection.java | 6 +++--- 2 files changed, 6 insertions(+), 15 deletions(-) (limited to 'juick-server/src/main') diff --git a/juick-server/src/main/java/com/juick/server/api/activity/Profile.java b/juick-server/src/main/java/com/juick/server/api/activity/Profile.java index d5b67433..c0dcc3f6 100644 --- a/juick-server/src/main/java/com/juick/server/api/activity/Profile.java +++ b/juick-server/src/main/java/com/juick/server/api/activity/Profile.java @@ -67,10 +67,7 @@ public class Profile { OrderedCollection blog = new OrderedCollection(); blog.setId(ServletUriComponentsBuilder.fromCurrentRequestUri().toUriString()); blog.setTotalItems(userService.getStatsMessages(user.getUid())); - Link first = new Link(); - uriComponentsBuilder.path(String.format("/u/%s/blog", userName)); - first.setHref(uriComponentsBuilder.toUriString()); - blog.setFirst(first); + blog.setFirst(uriComponentsBuilder.path(String.format("/u/%s/blog", userName)).toUriString()); return blog; } throw new HttpNotFoundException(); @@ -131,10 +128,7 @@ public class Profile { OrderedCollection followers = new OrderedCollection(); followers.setId(ServletUriComponentsBuilder.fromCurrentRequestUri().toUriString()); followers.setTotalItems(userService.getStatsMyReaders(user.getUid())); - Link first = new Link(); - uriComponentsBuilder.path(String.format("/u/%s/followers", userName)); - first.setHref(uriComponentsBuilder.toUriString()); - followers.setFirst(first); + followers.setFirst(uriComponentsBuilder.path(String.format("/u/%s/followers", userName)).toUriString()); return followers; } throw new HttpNotFoundException(); @@ -177,10 +171,7 @@ public class Profile { OrderedCollection following = new OrderedCollection(); following.setId(ServletUriComponentsBuilder.fromCurrentRequestUri().toUriString()); following.setTotalItems(userService.getUserFriends(user.getUid()).size()); - Link first = new Link(); - uriComponentsBuilder.path(String.format("/u/%s/followers", userName)); - first.setHref(uriComponentsBuilder.toUriString()); - following.setFirst(first); + following.setFirst(uriComponentsBuilder.path(String.format("/u/%s/followers", userName)).toUriString()); return following; } throw new HttpNotFoundException(); diff --git a/juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollection.java b/juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollection.java index d4f6b7c5..90f04de3 100644 --- a/juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollection.java +++ b/juick-server/src/main/java/com/juick/server/api/activity/model/OrderedCollection.java @@ -11,13 +11,13 @@ public class OrderedCollection extends ActivityObject { public void setTotalItems(int totalItems) { this.totalItems = totalItems; } - private Link first; + private String first; - public Link getFirst() { + public String getFirst() { return first; } - public void setFirst(Link first) { + public void setFirst(String first) { this.first = first; } } -- cgit v1.2.3