Class TimeTrackerSettingsService

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

public class TimeTrackerSettingsService extends Object
A Service to access and store Activities
Version:
$Id: $Id
Author:
medamine
  • Field Details

    • TIME_TRACKER_SCOPE_NAME

      public static final String TIME_TRACKER_SCOPE_NAME
      See Also:
    • TIME_TRACKER_CONTEXT_NAME

      public static final String TIME_TRACKER_CONTEXT_NAME
      See Also:
    • TIME_TRACKER_CONTEXT

      public static final org.exoplatform.commons.api.settings.data.Context TIME_TRACKER_CONTEXT
    • TIME_TRACKER_SCOPE

      public static final org.exoplatform.commons.api.settings.data.Scope TIME_TRACKER_SCOPE
    • TIME_TRACKER_SETTINGS_KEY_NAME

      public static final String TIME_TRACKER_SETTINGS_KEY_NAME
      See Also:
    • JSON_PARSER

      public static final org.exoplatform.ws.frameworks.json.JsonParser JSON_PARSER
    • JSON_GENERATOR

      public static final org.exoplatform.ws.frameworks.json.JsonGenerator JSON_GENERATOR
  • Constructor Details

    • TimeTrackerSettingsService

      public TimeTrackerSettingsService(SettingsStorage settingsStorage, org.exoplatform.commons.api.settings.SettingService settingService)

      Constructor for SettingsService.

      Parameters:
      settingsStorage - SettingsStorage object.
      settingService - SettingService object.
  • Method Details

    • createWorkTime

      public WorkTime createWorkTime(WorkTime workTime) throws Exception
      Create new WorkTime. If the WorkTime already exits an EntityExistsException will be thrown.
      Parameters:
      workTime - WorkTime to create
      Returns:
      stored WorkTime in datasource
      Throws:
      Exception - when WorkTime already exists or an error occurs while creating WorkTime or its attached image
    • updateWorkTime

      public WorkTime updateWorkTime(WorkTime workTime, String username) throws Exception
      Update an existing WorkTime on datasource. If the WorkTime doesn't exit an EntityNotFoundException will be thrown.
      Parameters:
      workTime - to update on store
      username - username storing WorkTime
      Returns:
      stored WorkTime in datasource
      Throws:
      Exception - when Exception is thrown or an error occurs while saving WorkTime
    • deleteWorkTime

      public void deleteWorkTime(Long workTimeId, String username) throws javax.persistence.EntityNotFoundException, IllegalAccessException
      Delete WorkTime identified by its id and check if username has permission to delete it.
      Parameters:
      workTimeId - technical identifier of WorkTime
      username - user currently deleting WorkTime
      Throws:
      javax.persistence.EntityNotFoundException - if WorkTime wasn't found
      IllegalAccessException - if user is not allowed to delete WorkTime
    • getWorkTimesList

      public List<WorkTime> getWorkTimesList()
      Retrieves the list of Activities with offset, limit and a keyword that can be empty
      Returns:
      List of WorkTime that contains the list of Activities
    • createLocation

      public Location createLocation(Location location) throws Exception
      Create new Location that will be available for all users. If the Location already exits an EntityExistsException will be thrown.
      Parameters:
      location - Location to create
      Returns:
      stored Location in datasource
      Throws:
      Exception - when Location already exists or an error occurs while creating Location or its attached image
    • updateLocation

      public Location updateLocation(Location Location, String username) throws Exception
      Update an existing Location on datasource. If the Location doesn't exit an EntityNotFoundException will be thrown.
      Parameters:
      Location - dto to update on store
      username - username storing Location
      Returns:
      stored Location in datasource
      Throws:
      Exception - when Exception is thrown or an error occurs while saving Location
    • deleteLocation

      public void deleteLocation(String code, String username) throws javax.persistence.EntityNotFoundException, IllegalAccessException
      Delete Location identified by its id and check if username has permission to delete it.
      Parameters:
      code - technical identifier of Location
      username - user currently deleting Location
      Throws:
      javax.persistence.EntityNotFoundException - if Location wasn't found
      IllegalAccessException - if user is not allowed to delete Location
    • getLocationsList

      public List<Location> getLocationsList()
      Retrieves the list of Activities with offset, limit and a keyword that can be empty
      Returns:
      List of Location that contains the list of Activities
    • createOffice

      public Office createOffice(Office office) throws Exception
      Create new Office that will be available for all users. If the Office already exits an EntityExistsException will be thrown.
      Parameters:
      office - Office to create
      Returns:
      stored Office in datasource
      Throws:
      Exception - when Office already exists or an error occurs while creating Office or its attached image
    • updateOffice

      public Office updateOffice(Office office, String username) throws Exception
      Update an existing Office on datasource. If the Office doesn't exit an EntityNotFoundException will be thrown.
      Parameters:
      office - dto to update on store
      username - username storing Office
      Returns:
      stored Office in datasource
      Throws:
      Exception - when Exception is thrown or an error occurs while saving Office
    • deleteOffice

      public void deleteOffice(String code, String username) throws javax.persistence.EntityNotFoundException, IllegalAccessException
      Delete Office identified by its id and check if username has permission to delete it.
      Parameters:
      code - technical identifier of Office
      username - user currently deleting Office
      Throws:
      javax.persistence.EntityNotFoundException - if Office wasn't found
      IllegalAccessException - if user is not allowed to delete Office
    • getOfficesList

      public List<Office> getOfficesList()
      Retrieves the list of Activities with offset, limit and a keyword that can be empty
      Returns:
      List of Office that contains the list of Activities
    • getSettings

      public TimeTrackerSetting getSettings()
    • saveSettings

      public void saveSettings(TimeTrackerSetting timeTrackerSetting) throws Exception
      Throws:
      Exception
    • toJsonString

      public static final String toJsonString(Object object)
    • fromJsonString

      public static final <T> T fromJsonString(String value, Class<T> resultClass)