Class ActivityService

java.lang.Object
org.exoplatform.timetracker.service.ActivityService

public class ActivityService extends Object
A Service to access and store Activities
Version:
$Id: $Id
Author:
medamine
  • Constructor Details

    • ActivityService

      public ActivityService(ActivityStorage activitiestorage)

      Constructor for ActivityService.

      Parameters:
      activitiestorage - a ActivityStorage object.
  • Method Details

    • createActivity

      public Activity createActivity(Activity activity) throws Exception
      Create new Activity that will be available for all users. If the Activity already exits an EntityExistsException will be thrown.
      Parameters:
      activity - Activity to create
      Returns:
      stored Activity in datasource
      Throws:
      Exception - when Activity already exists or an error occurs while creating Activity or its attached image
    • updateActivity

      public Activity updateActivity(Activity Activity, String username) throws Exception
      Update an existing Activity on datasource. If the Activity doesn't exit an EntityNotFoundException will be thrown.
      Parameters:
      Activity - dto to update on store
      username - username storing Activity
      Returns:
      stored Activity in datasource
      Throws:
      Exception - when Exception is thrown or an error occurs while saving Activity
    • deleteActivity

      public void deleteActivity(Long activityId, String username) throws jakarta.persistence.EntityNotFoundException, IllegalAccessException
      Delete Activity identified by its id and check if username has permission to delete it.
      Parameters:
      activityId - technical identifier of Activity
      username - user currently deleting Activity
      Throws:
      jakarta.persistence.EntityNotFoundException - if Activity wasn't found
      IllegalAccessException - if user is not allowed to delete Activity
    • getActivitiesList

      public List<Activity> getActivitiesList()
      Retrieves the list of Activities with offset, limit and a keyword that can be empty
      Returns:
      List of Activity that contains the list of Activities
    • getActivitiesforUser

      public List<Activity> getActivitiesforUser(List<String> teams)
      Retrieves the list of Activities with offset, limit and a keyword that can be empty
      Parameters:
      teams - a List object.
      Returns:
      List of Activity that contains the list of Activities