Class ActivityRecordService

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

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

  • Method Details

    • createActivityRecord

      public ActivityRecord createActivityRecord(ActivityRecord activityRecord) throws Exception
      Create new ActivityRecord
      Parameters:
      activityRecord - ActivityRecord to create
      Returns:
      stored ActivityRecord in 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 an EntityNotFoundException will be thrown.
      Parameters:
      activityRecord - dto to update on store
      username - username storing ActivityRecord
      Returns:
      stored ActivityRecord in datasource
      Throws:
      Exception - when Exception is 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 ActivityRecord
      username - user currently deleting ActivityRecord
      Throws:
      jakarta.persistence.EntityNotFoundException - if ActivityRecord wasn't found
      IllegalAccessException - if user is not allowed to delete ActivityRecord
    • getActivityRecords

      public List<ActivityRecord> getActivityRecords()
      Retrieves the list of ActivityRecords with offset, limit and a keyword that can be empty
      Returns:
      List of ActivityRecord that 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 - a String object.
      activity - a String object.
      type - a String object.
      subType - a String object.
      activityCode - a String object.
      subActivityCode - a String object.
      client - a String object.
      project - a String object.
      feature - a String object.
      fromDate - a String object.
      toDate - a String object.
      userName - a String object.
      location - a String object.
      office - a String object.
      offset - a int.
      limit - a int.
      sortBy - a String object.
      sortDesc - a boolean.
      Returns:
      List of ActivityRecord that contains the list of ActivityRecords
    • getLastActivityRecord

      public ActivityRecord getLastActivityRecord(String userName)
      Retrieves the list of ActivityRecordsListAccess with offset, limit and a keyword that can be empty
      Parameters:
      userName - a String object.
      Returns:
      List of ActivityRecord that 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 - a String object.
      activity - a String object.
      type - a String object.
      subType - a String object.
      activityCode - a String object.
      subActivityCode - a String object.
      client - a String object.
      project - a String object.
      feature - a String object.
      fromDate - a String object.
      toDate - a String object.
      userName - a String object.
      location - a String object.
      office - a String object.
      Returns:
      List of ActivityRecord that contains the list of ActivityRecords
    • getUserActivityRecordsList

      public List<ActivityRecord> getUserActivityRecordsList(String day, String userName)
      Retrieves the list of ActivityRecords wby day
      Parameters:
      day - day of activity
      userName - a String object.
      Returns:
      List of ActivityRecord that contains the list of ActivityRecords
    • generateTSCode

      public String generateTSCode(List<Team> teams, ActivityRecord record, String exportType)
    • 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

      public static List<LocalDate> getDatesBetween(LocalDate startDate, LocalDate endDate)