@Override public Mblog addMblog(User user, String content) { user = userDAO.findById(user.getUserId()); Mblog mblog = new Mblog(user, content, new Timestamp(System.currentTimeMillis())); mblogDAO.save(mblog); return mblog; }
@Override public List<Mblog> getMyFoucs(User user) { // TODO Auto-generated method stub user = userDAO.findById(user.getUserId()); Set<Follow> myFollows = user.getFollowsForUserId(); List<Mblog> list = new ArrayList<Mblog>(); for (Follow follow : myFollows) { User us = follow.getUserByFollowedUserId(); List li = mblogDAO.findByProperty("user", us); list.addAll(li); } List li = mblogDAO.findByProperty("user", user); list.addAll(li); return sortByTime(list); }
@Override public List<Mblog> getByUser(User user) { user = userDAO.findById(user.getUserId()); List list = mblogDAO.findByProperty("user", user); return sortByTime(list); }