0 Replies Latest reply: Jan 16, 2012 1:17 AM by Sunil Shettigar RSS

    Recent activity that displays current user's followed content.

    Sunil Shettigar

      You can display the recent activity based on the current user like so -

       

                ActivityManager activityManager = JiveApplication.getContext().getActivityManager();

                Iterable<Activity> activityList = activityManager.getRecentActivity(context.getUser());

       

      How does one get activity that the user is following? Eg: if the user is following a document or a discussion. Then when someone makes a comment on the discussion or replies to a thread, how do you get that in the activity feed. I tried the following, but it never returns any recent user activity filtered by type followed.  

       

      Sample code:

      ------------------------

      //Build the filter object, such that it returns followed activity        

      private Predicate<ActivityBean> isFollowedActivity = new Predicate<ActivityBean>() {

               @Override

               public boolean apply(ActivityBean theActivity) {

                   return (theActivity.getType() == ActivityConstants.Type.followed);

               }

      };

       

      //Get the recent user activity by passing followed filter

      Iterable<Activity> activityList = activityManager.getRecentActivity(context.getUser() , isFollowedActivity);

      //The activityList collection is always zero ???

                

      Any thoughts on how to get this to return results based on 'followed' activity for the current user? Thanks folks,

      ~Sunil