Пример #1
0
 private WorkoutsData<DisciplineData.Count> fetchStatisticsData(
     final Group group, final int firstIndex, String discipline) {
   if (discipline != null && discipline.length() == 0) discipline = null;
   final PaginatedCollection<Workout> workouts =
       workoutStore.getWorkouts(group, discipline, firstIndex, 10);
   final Double globalDistance = fetchGlobalDistance(group);
   final List<DisciplineData<DisciplineData.Count>> disciplineData =
       aggregateByDiscipline(group, DisciplineAggregator.COUNT_AGGREGATOR);
   return new WorkoutsData<DisciplineData.Count>(workouts, globalDistance, disciplineData);
 }
Пример #2
0
 private WorkoutsData<DisciplineData.Count> fetchStatisticsData(
     final User user,
     final Collection<String> disciplines,
     final int firstIndex,
     final int pageSize) {
   final PaginatedCollection<Workout> workouts =
       workoutStore.getWorkouts(user, disciplines, firstIndex, pageSize);
   final Double globalDistance = fetchGlobalDistance(user);
   final List<DisciplineData<DisciplineData.Count>> disciplineData =
       aggregateByDiscipline(user, DisciplineAggregator.COUNT_AGGREGATOR);
   return new WorkoutsData<DisciplineData.Count>(workouts, globalDistance, disciplineData);
 }
Пример #3
0
 public BibPageData fetchBibPageData(
     final User currentUser,
     final Long targetUserId,
     final int workoutStartIndex,
     final int privateMessagesPageIndex)
     throws UserNotFoundException {
   final User target;
   final PaginatedCollection<PrivateMessage> privateMessages;
   if (currentUser == null) {
     target = fetchUser(targetUserId);
     privateMessages = emptyPage();
   } else {
     target = currentUser.getId().equals(targetUserId) ? currentUser : fetchUser(targetUserId);
     privateMessages =
         fetchPrivateConversation(currentUser, targetUserId, privateMessagesPageIndex);
   }
   final PaginatedCollection<Workout> workouts =
       workoutStore.getWorkouts(target, EMPTY_STRING_LIST, workoutStartIndex, 10);
   return new BibPageData(target, privateMessages, workouts);
 }
Пример #4
0
 public WorkoutPageData fetchWorkoutPageData(
     final User currentUser,
     final Long workoutId,
     final int similarPage,
     final int workoutStartIndex,
     final int messagesStartIndex,
     final int privateMessagesPageIndex)
     throws WorkoutNotFoundException {
   final Workout workout = workoutStore.fetchWorkout(workoutId);
   final PaginatedCollection<PrivateMessage> emptyPage = emptyPage();
   final PaginatedCollection<PrivateMessage> privateConversation =
       currentUser == null
           ? emptyPage
           : fetchPrivateConversation(
               currentUser, workout.getUser().getId(), privateMessagesPageIndex);
   return new WorkoutPageData(
       workout,
       fetchPublicMessages(Topic.Kind.WORKOUT, workoutId, 5, messagesStartIndex),
       getSimilarWorkouts(workout, similarPage),
       workoutStore.getWorkouts(workout.getUser(), EMPTY_STRING_LIST, workoutStartIndex, 10),
       privateConversation);
 }