Class CodesService
java.lang.Object
org.exoplatform.timetracker.service.CodesService
A Service to access and store Activities
- Version:
- $Id: $Id
- Author:
- medamine
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateActivityCode(ActivityCode activityCode) Create new ActivityCode.createSubActivityCode(SubActivityCode subActivityCode) Create new SubActivityCode that will be available for all users.createSubType(SubType subType) Create new SubType that will be available for all users.createType(Type type) Create new Type that will be available for all users.voiddeleteActivityCode(Long activityCodeId, String username) Delete ActivityCode identified by its id and check if username has permission to delete it.voiddeleteSubActivityCode(Long subActivityCodeId, String username) Delete SubActivityCode identified by its id and check if username has permission to delete it.voiddeleteSubType(Long subTypeId, String username) Delete SubType identified by its id and check if username has permission to delete it.voiddeleteType(Long typeId, String username) Delete Type identified by its id and check if username has permission to delete it.Retrieves the list of Activities with offset, limit and a keyword that can be emptyRetrieves the list of Activities with offset, limit and a keyword that can be emptyRetrieves the list of Activities with offset, limit and a keyword that can be emptyRetrieves the list of Activities with offset, limit and a keyword that can be emptyupdateActivityCode(ActivityCode activityCode, String username) Update an existing ActivityCode on datasource.updateSubActivityCode(SubActivityCode SubActivityCode, String username) Update an existing SubActivityCode on datasource.updateSubType(SubType SubType, String username) Update an existing SubType on datasource.updateType(Type type, String username) Update an existing Type on datasource.
-
Constructor Details
-
CodesService
Constructor for CodesService.
- Parameters:
codesStorage- aCodesStorageobject.
-
-
Method Details
-
createActivityCode
Create new ActivityCode. If the ActivityCode already exits anEntityExistsExceptionwill be thrown.- Parameters:
activityCode- ActivityCode to create- Returns:
- stored
ActivityCodein datasource - Throws:
Exception- when ActivityCode already exists or an error occurs while creating ActivityCode or its attached image
-
updateActivityCode
Update an existing ActivityCode on datasource. If the ActivityCode doesn't exit anEntityNotFoundExceptionwill be thrown.- Parameters:
activityCode- to update on storeusername- username storing ActivityCode- Returns:
- stored
ActivityCodein datasource - Throws:
Exception- whenExceptionis thrown or an error occurs while saving ActivityCode
-
deleteActivityCode
public void deleteActivityCode(Long activityCodeId, String username) throws jakarta.persistence.EntityNotFoundException, IllegalAccessException Delete ActivityCode identified by its id and check if username has permission to delete it.- Parameters:
activityCodeId- technical identifier of ActivityCodeusername- user currently deleting ActivityCode- Throws:
jakarta.persistence.EntityNotFoundException- if ActivityCode wasn't foundIllegalAccessException- if user is not allowed to delete ActivityCode
-
getActivityCodesList
Retrieves the list of Activities with offset, limit and a keyword that can be empty- Returns:
- List of
ActivityCodethat contains the list of Activities
-
createSubActivityCode
Create new SubActivityCode that will be available for all users. If the SubActivityCode already exits anEntityExistsExceptionwill be thrown.- Parameters:
subActivityCode- SubActivityCode to create- Returns:
- stored
SubActivityCodein datasource - Throws:
Exception- when SubActivityCode already exists or an error occurs while creating SubActivityCode or its attached image
-
updateSubActivityCode
public SubActivityCode updateSubActivityCode(SubActivityCode SubActivityCode, String username) throws Exception Update an existing SubActivityCode on datasource. If the SubActivityCode doesn't exit anEntityNotFoundExceptionwill be thrown.- Parameters:
SubActivityCode- dto to update on storeusername- username storing SubActivityCode- Returns:
- stored
SubActivityCodein datasource - Throws:
Exception- whenExceptionis thrown or an error occurs while saving SubActivityCode
-
deleteSubActivityCode
public void deleteSubActivityCode(Long subActivityCodeId, String username) throws jakarta.persistence.EntityNotFoundException, IllegalAccessException Delete SubActivityCode identified by its id and check if username has permission to delete it.- Parameters:
subActivityCodeId- technical identifier of SubActivityCodeusername- user currently deleting SubActivityCode- Throws:
jakarta.persistence.EntityNotFoundException- if SubActivityCode wasn't foundIllegalAccessException- if user is not allowed to delete SubActivityCode
-
getSubActivityCodesList
Retrieves the list of Activities with offset, limit and a keyword that can be empty- Returns:
- List of
SubActivityCodethat contains the list of Activities
-
createType
Create new Type that will be available for all users. If the Type already exits anEntityExistsExceptionwill be thrown. -
updateType
Update an existing Type on datasource. If the Type doesn't exit anEntityNotFoundExceptionwill be thrown. -
deleteType
public void deleteType(Long typeId, String username) throws jakarta.persistence.EntityNotFoundException, IllegalAccessException Delete Type identified by its id and check if username has permission to delete it.- Parameters:
typeId- technical identifier of Typeusername- user currently deleting Type- Throws:
jakarta.persistence.EntityNotFoundException- if Type wasn't foundIllegalAccessException- if user is not allowed to delete Type
-
getTypesList
Retrieves the list of Activities with offset, limit and a keyword that can be empty- Returns:
- List of
Typethat contains the list of Activities
-
createSubType
Create new SubType that will be available for all users. If the SubType already exits anEntityExistsExceptionwill be thrown. -
updateSubType
Update an existing SubType on datasource. If the SubType doesn't exit anEntityNotFoundExceptionwill be thrown. -
deleteSubType
public void deleteSubType(Long subTypeId, String username) throws jakarta.persistence.EntityNotFoundException, IllegalAccessException Delete SubType identified by its id and check if username has permission to delete it.- Parameters:
subTypeId- technical identifier of SubTypeusername- user currently deleting SubType- Throws:
jakarta.persistence.EntityNotFoundException- if SubType wasn't foundIllegalAccessException- if user is not allowed to delete SubType
-
getSubTypesList
Retrieves the list of Activities with offset, limit and a keyword that can be empty- Returns:
- List of
SubTypethat contains the list of Activities
-