Class ActivityService
- java.lang.Object
-
- org.exoplatform.timetracker.service.ActivityService
-
public class ActivityService extends java.lang.ObjectA Service to access and store Activities- Version:
- $Id: $Id
- Author:
- medamine
-
-
Constructor Summary
Constructors Constructor Description ActivityService(ActivityStorage activitiestorage)Constructor for ActivityService.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ActivitycreateActivity(Activity activity)Create new Activity that will be available for all users.voiddeleteActivity(java.lang.Long activityId, java.lang.String username)Delete Activity identified by its id and check if username has permission to delete it.java.util.List<Activity>getActivitiesforUser(java.util.List<java.lang.String> teams)Retrieves the list of Activities with offset, limit and a keyword that can be emptyjava.util.List<Activity>getActivitiesList()Retrieves the list of Activities with offset, limit and a keyword that can be emptyActivityupdateActivity(Activity Activity, java.lang.String username)Update an existing Activity on datasource.
-
-
-
Constructor Detail
-
ActivityService
public ActivityService(ActivityStorage activitiestorage)
Constructor for ActivityService.
- Parameters:
activitiestorage- aActivityStorageobject.
-
-
Method Detail
-
createActivity
public Activity createActivity(Activity activity) throws java.lang.Exception
Create new Activity that will be available for all users. If the Activity already exits anEntityExistsExceptionwill be thrown.- Parameters:
activity- Activity to create- Returns:
- stored
Activityin datasource - Throws:
java.lang.Exception- when Activity already exists or an error occurs while creating Activity or its attached image
-
updateActivity
public Activity updateActivity(Activity Activity, java.lang.String username) throws java.lang.Exception
Update an existing Activity on datasource. If the Activity doesn't exit anEntityNotFoundExceptionwill be thrown.- Parameters:
Activity- dto to update on storeusername- username storing Activity- Returns:
- stored
Activityin datasource - Throws:
java.lang.Exception- whenExceptionis thrown or an error occurs while saving Activity
-
deleteActivity
public void deleteActivity(java.lang.Long activityId, java.lang.String username) throws javax.persistence.EntityNotFoundException, java.lang.IllegalAccessExceptionDelete Activity identified by its id and check if username has permission to delete it.- Parameters:
activityId- technical identifier of Activityusername- user currently deleting Activity- Throws:
javax.persistence.EntityNotFoundException- if Activity wasn't foundjava.lang.IllegalAccessException- if user is not allowed to delete Activity
-
getActivitiesList
public java.util.List<Activity> getActivitiesList()
Retrieves the list of Activities with offset, limit and a keyword that can be empty- Returns:
- List of
Activitythat contains the list of Activities
-
-