Class TimeTrackerSettingsService
- java.lang.Object
-
- org.exoplatform.timetracker.service.TimeTrackerSettingsService
-
public class TimeTrackerSettingsService extends java.lang.ObjectA Service to access and store Activities- Version:
- $Id: $Id
- Author:
- medamine
-
-
Field Summary
Fields Modifier and Type Field Description static org.exoplatform.ws.frameworks.json.JsonGeneratorJSON_GENERATORstatic org.exoplatform.ws.frameworks.json.JsonParserJSON_PARSERstatic org.exoplatform.commons.api.settings.data.ContextTIME_TRACKER_CONTEXTstatic java.lang.StringTIME_TRACKER_CONTEXT_NAMEstatic org.exoplatform.commons.api.settings.data.ScopeTIME_TRACKER_SCOPEstatic java.lang.StringTIME_TRACKER_SCOPE_NAMEstatic java.lang.StringTIME_TRACKER_SETTINGS_KEY_NAME
-
Constructor Summary
Constructors Constructor Description TimeTrackerSettingsService(SettingsStorage settingsStorage, org.exoplatform.commons.api.settings.SettingService settingService)Constructor for SettingsService.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description LocationcreateLocation(Location location)Create new Location that will be available for all users.OfficecreateOffice(Office office)Create new Office that will be available for all users.WorkTimecreateWorkTime(WorkTime workTime)Create new WorkTime.voiddeleteLocation(java.lang.String code, java.lang.String username)Delete Location identified by its id and check if username has permission to delete it.voiddeleteOffice(java.lang.String code, java.lang.String username)Delete Office identified by its id and check if username has permission to delete it.voiddeleteWorkTime(java.lang.Long workTimeId, java.lang.String username)Delete WorkTime identified by its id and check if username has permission to delete it.static <T> TfromJsonString(java.lang.String value, java.lang.Class<T> resultClass)java.util.List<Location>getLocationsList()Retrieves the list of Activities with offset, limit and a keyword that can be emptyjava.util.List<Office>getOfficesList()Retrieves the list of Activities with offset, limit and a keyword that can be emptyTimeTrackerSettinggetSettings()java.util.List<WorkTime>getWorkTimesList()Retrieves the list of Activities with offset, limit and a keyword that can be emptyvoidsaveSettings(TimeTrackerSetting timeTrackerSetting)static java.lang.StringtoJsonString(java.lang.Object object)LocationupdateLocation(Location Location, java.lang.String username)Update an existing Location on datasource.OfficeupdateOffice(Office office, java.lang.String username)Update an existing Office on datasource.WorkTimeupdateWorkTime(WorkTime workTime, java.lang.String username)Update an existing WorkTime on datasource.
-
-
-
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-SettingsStorageobject.settingService-SettingServiceobject.
-
-
Method Detail
-
createWorkTime
public WorkTime createWorkTime(WorkTime workTime) throws java.lang.Exception
Create new WorkTime. If the WorkTime already exits anEntityExistsExceptionwill be thrown.- Parameters:
workTime- WorkTime to create- Returns:
- stored
WorkTimein 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 anEntityNotFoundExceptionwill be thrown.- Parameters:
workTime- to update on storeusername- username storing WorkTime- Returns:
- stored
WorkTimein datasource - Throws:
java.lang.Exception- whenExceptionis 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.IllegalAccessExceptionDelete WorkTime identified by its id and check if username has permission to delete it.- Parameters:
workTimeId- technical identifier of WorkTimeusername- user currently deleting WorkTime- Throws:
javax.persistence.EntityNotFoundException- if WorkTime wasn't foundjava.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
WorkTimethat 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 anEntityExistsExceptionwill be thrown.- Parameters:
location- Location to create- Returns:
- stored
Locationin 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 anEntityNotFoundExceptionwill be thrown.- Parameters:
Location- dto to update on storeusername- username storing Location- Returns:
- stored
Locationin datasource - Throws:
java.lang.Exception- whenExceptionis 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.IllegalAccessExceptionDelete Location identified by its id and check if username has permission to delete it.- Parameters:
code- technical identifier of Locationusername- user currently deleting Location- Throws:
javax.persistence.EntityNotFoundException- if Location wasn't foundjava.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
Locationthat 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 anEntityExistsExceptionwill be thrown.- Parameters:
office- Office to create- Returns:
- stored
Officein 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 anEntityNotFoundExceptionwill be thrown.- Parameters:
office- dto to update on storeusername- username storing Office- Returns:
- stored
Officein datasource - Throws:
java.lang.Exception- whenExceptionis 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.IllegalAccessExceptionDelete Office identified by its id and check if username has permission to delete it.- Parameters:
code- technical identifier of Officeusername- user currently deleting Office- Throws:
javax.persistence.EntityNotFoundException- if Office wasn't foundjava.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
Officethat contains the list of Activities
-
getSettings
public TimeTrackerSetting getSettings()
-
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)
-
-