* @return
* @throws Exception
*/
@RequestMapping
public ModelAndView latestActivity(@RequestParam(defaultValue="0") Integer latestId,@RequestParam(defaultValue="0") Integer pageNum,HttpServletRequest request) throws Exception {
Person currentUser = accountService.getPerson(request);
List<Notification> latest = notificationService.loadNotificationsForUser(currentUser, pageNum);
JsonObject returnObj = new JsonObject();
if (!latest.isEmpty()) {
JsonArray array = new JsonArray();
boolean startRecording = (latestId == 0l);
for (int i = latest.size() - 1; i >= 0; i--) {
if (latest.get(i).getActivity() == null) {
continue;
}
Activity a = latest.get(i).getActivity();
if (startRecording) {
JsonObject o = jsonService.convertToJson(a);
o.addProperty("isOwner", currentUser.equals(a.getRaisedBy()));
array.add(o);
}
// check whether to update status from here
if (a.getId().equals(latestId)) {