Class CodesService
- java.lang.Object
-
- org.exoplatform.timetracker.service.CodesService
-
public class CodesService extends java.lang.ObjectA Service to access and store Activities- Version:
- $Id: $Id
- Author:
- medamine
-
-
Constructor Summary
Constructors Constructor Description CodesService(CodesStorage codesStorage)Constructor for CodesService.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ActivityCodecreateActivityCode(ActivityCode activityCode)Create new ActivityCode.SubActivityCodecreateSubActivityCode(SubActivityCode subActivityCode)Create new SubActivityCode that will be available for all users.SubTypecreateSubType(SubType subType)Create new SubType that will be available for all users.TypecreateType(Type type)Create new Type that will be available for all users.voiddeleteActivityCode(java.lang.Long activityCodeId, java.lang.String username)Delete ActivityCode identified by its id and check if username has permission to delete it.voiddeleteSubActivityCode(java.lang.Long subActivityCodeId, java.lang.String username)Delete SubActivityCode identified by its id and check if username has permission to delete it.voiddeleteSubType(java.lang.Long subTypeId, java.lang.String username)Delete SubType identified by its id and check if username has permission to delete it.voiddeleteType(java.lang.Long typeId, java.lang.String username)Delete Type identified by its id and check if username has permission to delete it.java.util.List<ActivityCode>getActivityCodesList()Retrieves the list of Activities with offset, limit and a keyword that can be emptyjava.util.List<SubActivityCode>getSubActivityCodesList()Retrieves the list of Activities with offset, limit and a keyword that can be emptyjava.util.List<SubType>getSubTypesList()Retrieves the list of Activities with offset, limit and a keyword that can be emptyjava.util.List<Type>getTypesList()Retrieves the list of Activities with offset, limit and a keyword that can be emptyActivityCodeupdateActivityCode(ActivityCode activityCode, java.lang.String username)Update an existing ActivityCode on datasource.SubActivityCodeupdateSubActivityCode(SubActivityCode SubActivityCode, java.lang.String username)Update an existing SubActivityCode on datasource.SubTypeupdateSubType(SubType SubType, java.lang.String username)Update an existing SubType on datasource.TypeupdateType(Type type, java.lang.String username)Update an existing Type on datasource.
-
-
-
Constructor Detail
-
CodesService
public CodesService(CodesStorage codesStorage)
Constructor for CodesService.
- Parameters:
codesStorage- aCodesStorageobject.
-
-
Method Detail
-
createActivityCode
public ActivityCode createActivityCode(ActivityCode activityCode) throws java.lang.Exception
Create new ActivityCode. If the ActivityCode already exits anEntityExistsExceptionwill be thrown.- Parameters:
activityCode- ActivityCode to create- Returns:
- stored
ActivityCodein datasource - Throws:
java.lang.Exception- when ActivityCode already exists or an error occurs while creating ActivityCode or its attached image
-
updateActivityCode
public ActivityCode updateActivityCode(ActivityCode activityCode, java.lang.String username) throws java.lang.Exception
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:
java.lang.Exception- whenExceptionis thrown or an error occurs while saving ActivityCode
-
deleteActivityCode
public void deleteActivityCode(java.lang.Long activityCodeId, java.lang.String username) throws javax.persistence.EntityNotFoundException, java.lang.IllegalAccessExceptionDelete 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:
javax.persistence.EntityNotFoundException- if ActivityCode wasn't foundjava.lang.IllegalAccessException- if user is not allowed to delete ActivityCode
-
getActivityCodesList
public java.util.List<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
public SubActivityCode createSubActivityCode(SubActivityCode subActivityCode) throws java.lang.Exception
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:
java.lang.Exception- when SubActivityCode already exists or an error occurs while creating SubActivityCode or its attached image
-
updateSubActivityCode
public SubActivityCode updateSubActivityCode(SubActivityCode SubActivityCode, java.lang.String username) throws java.lang.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:
java.lang.Exception- whenExceptionis thrown or an error occurs while saving SubActivityCode
-
deleteSubActivityCode
public void deleteSubActivityCode(java.lang.Long subActivityCodeId, java.lang.String username) throws javax.persistence.EntityNotFoundException, java.lang.IllegalAccessExceptionDelete 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:
javax.persistence.EntityNotFoundException- if SubActivityCode wasn't foundjava.lang.IllegalAccessException- if user is not allowed to delete SubActivityCode
-
getSubActivityCodesList
public java.util.List<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
public Type createType(Type type) throws java.lang.Exception
Create new Type that will be available for all users. If the Type already exits anEntityExistsExceptionwill be thrown.- Parameters:
type- Type to create- Returns:
- stored
Typein datasource - Throws:
java.lang.Exception- when Type already exists or an error occurs while creating Type or its attached image
-
updateType
public Type updateType(Type type, java.lang.String username) throws java.lang.Exception
Update an existing Type on datasource. If the Type doesn't exit anEntityNotFoundExceptionwill be thrown.- Parameters:
type- dto to update on storeusername- username storing Type- Returns:
- stored
Typein datasource - Throws:
java.lang.Exception- whenExceptionis thrown or an error occurs while saving Type
-
deleteType
public void deleteType(java.lang.Long typeId, java.lang.String username) throws javax.persistence.EntityNotFoundException, java.lang.IllegalAccessExceptionDelete 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:
javax.persistence.EntityNotFoundException- if Type wasn't foundjava.lang.IllegalAccessException- if user is not allowed to delete Type
-
getTypesList
public java.util.List<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
public SubType createSubType(SubType subType) throws java.lang.Exception
Create new SubType that will be available for all users. If the SubType already exits anEntityExistsExceptionwill be thrown.- Parameters:
subType- SubType to create- Returns:
- stored
SubTypein datasource - Throws:
java.lang.Exception- when SubType already exists or an error occurs while creating SubType or its attached image
-
updateSubType
public SubType updateSubType(SubType SubType, java.lang.String username) throws java.lang.Exception
Update an existing SubType on datasource. If the SubType doesn't exit anEntityNotFoundExceptionwill be thrown.- Parameters:
SubType- dto to update on storeusername- username storing SubType- Returns:
- stored
SubTypein datasource - Throws:
java.lang.Exception- whenExceptionis thrown or an error occurs while saving SubType
-
deleteSubType
public void deleteSubType(java.lang.Long subTypeId, java.lang.String username) throws javax.persistence.EntityNotFoundException, java.lang.IllegalAccessExceptionDelete 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:
javax.persistence.EntityNotFoundException- if SubType wasn't foundjava.lang.IllegalAccessException- if user is not allowed to delete SubType
-
-