Package projectatlast.tracking

Examples of projectatlast.tracking.Activity


  @Override
  public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws IOException {

    Student student = AuthController.getCurrentStudent();
    Activity activity = StudentController.getCurrentActivity(student);

    // Remove current activity in student
    StudentController.setCurrentActivity(student, null);

    // Cancel current activity
View Full Code Here


    for (ActivitySlice slice : slices) {
      // Get activity identifier
      Key<Activity> activityKey = slice.getActivity();
      Long activityId = activityKey.getId();
      // Get full activity
      Activity fullActivity = fullActivities.get(activityKey);
      if (fullActivity == null)
        continue;
      List<Activity> activities;
      Activity activity;

      if (map.containsKey(activityId)) {
        // Get the current list of activities for this key
        activities = map.get(activityId);
        // Try to use the last activity
        activity = activities.get(activities.size() - 1);
      } else {
        // Create a new list of activities for this key
        activities = new ArrayList<Activity>();
        // Clone this activity
        activity = (Activity) fullActivity.clone();
        // Make it start at the same date as the slice
        // but with a zero duration
        activity.setStart(slice.getDate());
        activity.setEnd(slice.getDate());
        // Store in list and map
        activities.add(activity);
        map.put(activityId, activities);
      }

      // Try to append the slice
      boolean isAppended = activity.addSlice(slice);
      if (!isAppended) {
        // The slice could not be added to the activity
        // Clone the activity and make it match
        // the time span of the slice
        activity = (Activity) activity.clone();
        activity.setStart(slice.getDate());
        activity.setDuration(slice.getDuration());
        activities.add(activity);
      }
    }

    // Unite all activity lists into one flat list
View Full Code Here

TOP

Related Classes of projectatlast.tracking.Activity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.