public List<EventCalendar> getItems(String id, String zoneName) throws Exception { PersistenceManager pm = PMF.get().getPersistenceManager(); FetchPlan fp = pm.getFetchPlan().addGroup("userGroup"); fp.setMaxFetchDepth(1); User user = pm.detachCopy(pm.getObjectById(User.class, id)); pm.close(); EventCalendarDaoImpl eventDao = new EventCalendarDaoImpl(); List<EventCalendar> result = eventDao.getCalendarsById(user.getCalendarKeys(), 0); // addGeoLocatedCals(result, geoLoc, zoneName); return result; }
private List<EventCalendar> getFollowingCals(String userId) throws Exception { PersistenceManager pm = PMF.get().getPersistenceManager(); FetchPlan fp = pm.getFetchPlan().addGroup("userGroup"); fp.setMaxFetchDepth(2); User user = pm.detachCopy(pm.getObjectById(User.class, userId)); pm.close(); log.info("Loading feed"); EventCalendarDaoImpl eventDao = new EventCalendarDaoImpl(); List<EventCalendar> cals = eventDao.getCalendarsById(user.getCalendarKeys(), 1); log.info("Loading feed: following cals count: " + cals.size()); for (EventCalendar cal : cals) cal.setSource("following"); return cals; }