Class TimeTrackerSettingsService


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

      • TIME_TRACKER_SCOPE_NAME

        public static final java.lang.String TIME_TRACKER_SCOPE_NAME
        See Also:
        Constant Field Values
      • TIME_TRACKER_CONTEXT_NAME

        public static final java.lang.String TIME_TRACKER_CONTEXT_NAME
        See Also:
        Constant Field Values
      • 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 java.lang.String TIME_TRACKER_SETTINGS_KEY_NAME
        See Also:
        Constant Field Values
      • 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 Detail

      • TimeTrackerSettingsService

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

        Constructor for SettingsService.

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

      • createWorkTime

        public WorkTime createWorkTime​(WorkTime workTime)
                                throws java.lang.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:
        java.lang.Exception - when WorkTime already exists or an error occurs while creating WorkTime or its attached image
      • updateWorkTime

        public WorkTime updateWorkTime​(WorkTime workTime,
                                       java.lang.String username)
                                throws java.lang.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:
        java.lang.Exception - when Exception is thrown or an error occurs while saving WorkTime
      • deleteWorkTime

        public void deleteWorkTime​(java.lang.Long workTimeId,
                                   java.lang.String username)
                            throws javax.persistence.EntityNotFoundException,
                                   java.lang.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
        java.lang.IllegalAccessException - if user is not allowed to delete WorkTime
      • getWorkTimesList

        public java.util.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 java.lang.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:
        java.lang.Exception - when Location already exists or an error occurs while creating Location or its attached image
      • updateLocation

        public Location updateLocation​(Location Location,
                                       java.lang.String username)
                                throws java.lang.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:
        java.lang.Exception - when Exception is thrown or an error occurs while saving Location
      • deleteLocation

        public void deleteLocation​(java.lang.String code,
                                   java.lang.String username)
                            throws javax.persistence.EntityNotFoundException,
                                   java.lang.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
        java.lang.IllegalAccessException - if user is not allowed to delete Location
      • getLocationsList

        public java.util.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 java.lang.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:
        java.lang.Exception - when Office already exists or an error occurs while creating Office or its attached image
      • updateOffice

        public Office updateOffice​(Office office,
                                   java.lang.String username)
                            throws java.lang.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:
        java.lang.Exception - when Exception is thrown or an error occurs while saving Office
      • deleteOffice

        public void deleteOffice​(java.lang.String code,
                                 java.lang.String username)
                          throws javax.persistence.EntityNotFoundException,
                                 java.lang.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
        java.lang.IllegalAccessException - if user is not allowed to delete Office
      • getOfficesList

        public java.util.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
      • saveSettings

        public void saveSettings​(TimeTrackerSetting timeTrackerSetting)
                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • toJsonString

        public static final java.lang.String toJsonString​(java.lang.Object object)
      • fromJsonString

        public static final <T> T fromJsonString​(java.lang.String value,
                                                 java.lang.Class<T> resultClass)