Search in sources :

Example 26 with Activity

use of codeu.model.data.Activity in project codeu-2018-team12 by codeu-2018-team12.

the class ActivityServlet method doGet.

/**
 * This function fires when a user navigates to the activity feed page. It gets a list of all
 * current messages and forwards them to activityFeed.jsp.
 */
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
    User loggedInUser = userStore.getUser((String) request.getSession().getAttribute("user"));
    List<Activity> activitiesPermitted = loggedInUser == null ? sort(activityStore.getAllPublicActivities()) : sort(activityStore.getAllPermittedActivities(loggedInUser.getId()));
    List<Activity> activities = sort(activityStore.getActivitiesPerPrivacy(loggedInUser, activitiesPermitted));
    request.setAttribute("activities", activities);
    request.getRequestDispatcher("/WEB-INF/view/activityFeed.jsp").forward(request, response);
}
Also used : User(codeu.model.data.User) Activity(codeu.model.data.Activity)

Aggregations

Activity (codeu.model.data.Activity)26 User (codeu.model.data.User)16 Test (org.junit.Test)13 UUID (java.util.UUID)11 ArrayList (java.util.ArrayList)8 Conversation (codeu.model.data.Conversation)6 Message (codeu.model.data.Message)2 Email (codeu.utils.Email)2 Instant (java.time.Instant)2 ActivityStore (codeu.model.store.basic.ActivityStore)1 UserStore (codeu.model.store.basic.UserStore)1 ImageStorage (codeu.utils.ImageStorage)1 HashSet (java.util.HashSet)1 HttpSession (javax.servlet.http.HttpSession)1 Part (javax.servlet.http.Part)1