@Restrict(Mupi.USER_ROLE) public static Result nextPublications(Long last) { final models.Profile p = Mupi.getLocalUser(session()).profile; Long i = getLocalInterest(); Long l = getLocalLocation(); models.Interest iObj = null; models.Location lObj = null; if (i != null) iObj = models.Interest.find.byId(i); if (l != null) lObj = models.Location.find.byId(l); List<models.Publication> pubs = new ArrayList<models.Publication>(); if (i == null || i == -1) { if (l == null || l == -1) { pubs = Publication.findByInterests(models.Interest.getIds(p.getInterests()), last).getList(); } else { pubs = Publication.findByInterestsLocation(models.Interest.getIds(p.getInterests()), l, last) .getList(); } } else { if (l == null || l == -1) { pubs = Publication.findByInterest(i, last).getList(); } else { pubs = Publication.findByInterestLocation(i, l, last).getList(); } } if (pubs.isEmpty()) return AjaxResponse.build(2, ""); else return AjaxResponse.build(0, pubList.render(pubs, iObj, lObj).body()); }
@Restrict(Mupi.USER_ROLE) public static Result selectFeed(Long i, Long l) { final models.Profile p = Mupi.getLocalUser(session()).profile; return renderFeedContent( 0, Publication.findByInterestLocation(i, l, 0, 10, "created desc"), Promotion.findByInterestLocation(i, l, 0, 5, "date, time"), models.Interest.find.byId(i), models.Location.find.byId(l)); }