@GET @Produces(MediaType.APPLICATION_JSON) public Response findAllByUser(@Context SecurityContext sc, @Context HttpServletRequest req) { User user = userBean.getUserByEmail(sc.getUserPrincipal().getName()); List<Activity> activityDetails = activityBean.getAllActivityByUser(user); GenericEntity<List<Activity>> projectActivities = new GenericEntity<List<Activity>>(activityDetails) {}; return noCacheResponse .getNoCacheResponseBuilder(Response.Status.OK) .entity(projectActivities) .build(); }
@GET @Path("{id}") @Produces(MediaType.APPLICATION_JSON) @AllowedRoles(roles = {AllowedRoles.DATA_SCIENTIST, AllowedRoles.DATA_OWNER}) public Response findAllByProject( @PathParam("id") Integer id, @Context SecurityContext sc, @Context HttpServletRequest req) { Project project = projectFacade.find(id); List<Activity> activityDetails = activityBean.getAllActivityOnProject(project); GenericEntity<List<Activity>> projectActivities = new GenericEntity<List<Activity>>(activityDetails) {}; return noCacheResponse .getNoCacheResponseBuilder(Response.Status.OK) .entity(projectActivities) .build(); }
@GET @Path("/query") @Produces(MediaType.APPLICATION_JSON) public Response findPaginatedByUser( @QueryParam("from") int from, @QueryParam("to") int to, @Context SecurityContext sc, @Context HttpServletRequest req) { User user = userBean.getUserByEmail(sc.getUserPrincipal().getName()); List<Activity> activityDetails = activityBean.getPaginatedActivityByUser(from, to, user); GenericEntity<List<Activity>> projectActivities = new GenericEntity<List<Activity>>(activityDetails) {}; return noCacheResponse .getNoCacheResponseBuilder(Response.Status.OK) .entity(projectActivities) .build(); }