Database Reference
In-Depth Information
private String url;
private String tagstr;
private Long timestamp;
@Transient
private String userNameForPost;
@Transient
private String timestampAsStr;
@RelatedTo(type = GraphStoryConstants.HAS, direction =
Direction.OUTGOING, elementClass = Tag.class)
@JsonInclude(Include.NON_NULL)
private Set<Tag> tags;
@RelatedTo(type = GraphStoryConstants.CURRENTPOST, direction =
Direction.INCOMING, elementClass = User.class)
@JsonIgnore
private User user;
@RelatedTo(type = GraphStoryConstants.NEXTPOST, direction =
Direction.OUTGOING, elementClass = Content.class)
@JsonIgnore
private Content next;
// getters and setters
}
Getting the Status Updates
To display the first set of status updates, start with the home method inside of the SocialController . This method
accesses the getContent method within ContentImpl , which takes an argument of the GraphStory bean, the current
user's username, the page being requested, and the page size. The page refers to set number of objects within a
collection. In this instance the paging is zero-based, so we will request page 0 and limit the page size to 3 in order to
return the first page.
The MappedContentRepository contains a method that is also called getContent . This method, shown in the first
part of Listing 11-35, first determines whom the user is following and then matches that set of users with the status
updates starting with the CURRENTPOST . The CURRENTPOST is then matched on the next three status updates via the
[:NEXTPOST*0..3] section of the query.
Listing 11-34. The getContent Method in ContentImpl
public GraphStory getContent (GraphStory graphStory, String username, Integer page, Integer pagesize)
{
Page<MappedContent> mappedContent = mappedContentRepository.getContent (username,
new PageRequest(page, pagesize, new Sort(Direction.DESC, "p.timestamp")));
 
Search WWH ::




Custom Search