Database Reference
In-Depth Information
Filtering Consumption for Users
One practical use of the consumption model is to create a content trail for users, as shown in Figure 11-14 . As a user
clicks on items in the scrolling product stream, the interaction is captured using createUserView , which ultimately
returns a List of relationship objects of the VIEWED type called MappedProductUserViews , which are located in the
MappedProductUserViewsRepository .
Figure 11-14. The Scrolling Product and Product Trail page
In the ConsumptionController , take a look at the createUserProductViewRel method to see how the process
begins inside the controller. The controller method first saves the view and then returns the complete history of views
using the getProductTrail , which can be found in the MappedProductUserViewsRepository interface and is shown
in Listing 11-48. The process is started when the createUserProductViewRel function is called, which is located in
graphstory.js .
Listing 11-48. getProductTrail in the MappedProductUserViewsRepository
@Query("MATCH (u:User { username: {username} })-[r:VIEWED]->(p) " +
" RETURN p.title as title, r.dateAsStr as dateAsStr " +
" ORDER BY r.timestamp DESC ")
List<MappedProductUserViews> getProductTrail (@Param("username") String username);
 
Search WWH ::




Custom Search