Class ActivityRecordService
java.lang.Object
org.exoplatform.timetracker.service.ActivityRecordService
A Service to access and store ActivityRecords
- Version:
- $Id: $Id
- Author:
- medamine
-
Constructor Summary
ConstructorsConstructorDescriptionActivityRecordService(ActivityRecordStorage activityRecordstorage, TimeTrackerSettingsService timeTrackerSettingsService, TeamService teamService) Constructor for ActivityRecordService. -
Method Summary
Modifier and TypeMethodDescriptionlongcountActivityRecords(String search, String activity, String type, String subType, String activityCode, String subActivityCode, String client, String project, String feature, String fromDate, String toDate, String userName, String location, String office) Retrieves the list of ActivityRecordsListAccess with offset, limit and a keyword that can be emptycreateActivityRecord(ActivityRecord activityRecord) Create new ActivityRecordvoiddeleteActivityRecord(Long activityRecordId, String username) Delete ActivityRecord identified by its id and check if username has permission to delete it.generateTSCode(List<Team> teams, ActivityRecord record, String exportType) Retrieves the list of ActivityRecords with offset, limit and a keyword that can be emptygetActivityRecordsList(String search, String activity, String type, String subType, String activityCode, String subActivityCode, String client, String project, String feature, String fromDate, String toDate, String userName, String location, String office, int offset, int limit, String sortBy, boolean sortDesc) Retrieves the list of ActivityRecordsListAccess with offset, limit and a keyword that can be emptygetDatesBetween(LocalDate startDate, LocalDate endDate) getLastActivityRecord(String userName) Retrieves the list of ActivityRecordsListAccess with offset, limit and a keyword that can be emptygetUserActivityRecords(String search, String activity, String type, String subType, String activityCode, String subActivityCode, String client, String project, String feature, String fromDate, String toDate, String userName, String location, String office, String sortBy, Boolean sortDesc, Boolean export, String exportType) getUserActivityRecordsList(String day, String userName) Retrieves the list of ActivityRecords wby dayupdateActivityRecord(ActivityRecord activityRecord, String username) Update an existing ActivityRecord on datasource.
-
Constructor Details
-
ActivityRecordService
public ActivityRecordService(ActivityRecordStorage activityRecordstorage, TimeTrackerSettingsService timeTrackerSettingsService, TeamService teamService) Constructor for ActivityRecordService.
- Parameters:
activityRecordstorage- aActivityRecordStorageobject.
-
-
Method Details
-
createActivityRecord
Create new ActivityRecord- Parameters:
activityRecord- ActivityRecord to create- Returns:
- stored
ActivityRecordin datasource - Throws:
Exception- when ActivityRecord already exists or an error occurs while creating ActivityRecord or its attached image
-
updateActivityRecord
public ActivityRecord updateActivityRecord(ActivityRecord activityRecord, String username) throws Exception Update an existing ActivityRecord on datasource. If the ActivityRecord doesn't exit anEntityNotFoundExceptionwill be thrown.- Parameters:
activityRecord- dto to update on storeusername- username storing ActivityRecord- Returns:
- stored
ActivityRecordin datasource - Throws:
Exception- whenExceptionis thrown or an error occurs while saving ActivityRecord
-
deleteActivityRecord
public void deleteActivityRecord(Long activityRecordId, String username) throws jakarta.persistence.EntityNotFoundException, IllegalAccessException Delete ActivityRecord identified by its id and check if username has permission to delete it.- Parameters:
activityRecordId- technical identifier of ActivityRecordusername- user currently deleting ActivityRecord- Throws:
jakarta.persistence.EntityNotFoundException- if ActivityRecord wasn't foundIllegalAccessException- if user is not allowed to delete ActivityRecord
-
getActivityRecords
Retrieves the list of ActivityRecords with offset, limit and a keyword that can be empty- Returns:
- List of
ActivityRecordthat contains the list of ActivityRecords
-
getActivityRecordsList
public RecordsAccessList getActivityRecordsList(String search, String activity, String type, String subType, String activityCode, String subActivityCode, String client, String project, String feature, String fromDate, String toDate, String userName, String location, String office, int offset, int limit, String sortBy, boolean sortDesc) Retrieves the list of ActivityRecordsListAccess with offset, limit and a keyword that can be empty- Parameters:
search- aStringobject.activity- aStringobject.type- aStringobject.subType- aStringobject.activityCode- aStringobject.subActivityCode- aStringobject.client- aStringobject.project- aStringobject.feature- aStringobject.fromDate- aStringobject.toDate- aStringobject.userName- aStringobject.location- aStringobject.office- aStringobject.offset- a int.limit- a int.sortBy- aStringobject.sortDesc- a boolean.- Returns:
- List of
ActivityRecordthat contains the list of ActivityRecords
-
getLastActivityRecord
Retrieves the list of ActivityRecordsListAccess with offset, limit and a keyword that can be empty- Parameters:
userName- aStringobject.- Returns:
- List of
ActivityRecordthat contains the list of ActivityRecords
-
countActivityRecords
public long countActivityRecords(String search, String activity, String type, String subType, String activityCode, String subActivityCode, String client, String project, String feature, String fromDate, String toDate, String userName, String location, String office) Retrieves the list of ActivityRecordsListAccess with offset, limit and a keyword that can be empty- Parameters:
search- aStringobject.activity- aStringobject.type- aStringobject.subType- aStringobject.activityCode- aStringobject.subActivityCode- aStringobject.client- aStringobject.project- aStringobject.feature- aStringobject.fromDate- aStringobject.toDate- aStringobject.userName- aStringobject.location- aStringobject.office- aStringobject.- Returns:
- List of
ActivityRecordthat contains the list of ActivityRecords
-
getUserActivityRecordsList
Retrieves the list of ActivityRecords wby day- Parameters:
day- day of activityuserName- aStringobject.- Returns:
- List of
ActivityRecordthat contains the list of ActivityRecords
-
generateTSCode
-
getUserActivityRecords
public List<ActivityRecord> getUserActivityRecords(String search, String activity, String type, String subType, String activityCode, String subActivityCode, String client, String project, String feature, String fromDate, String toDate, String userName, String location, String office, String sortBy, Boolean sortDesc, Boolean export, String exportType) -
getDatesBetween
-