forked from sakaiproject/sakai
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KNL-1554 Refactor of time service to aid deprecation (sakaiproject#4895)
* KNL-1554 Refactor of time service to aid deprecation This splits out a new API called UserTimeService which is just responsible for getting the user’s timezone at the moment. This allows the main TimeService to be deprecated and any place that uses TimeService to just get the user’s timezone can switch to using UserTimeService. This also makes the current TimeService more testable as it doesn’t actually need the whole kernel to be running, just mock instances of 2 helpers that can be easily mocked with Mockito (or similar). This also makes the classes more focused (Single Responsibility Principal). * Fix space * Code formatting cleanup (brackets).
- Loading branch information
Showing
11 changed files
with
524 additions
and
364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
kernel/api/src/main/java/org/sakaiproject/time/api/UserTimeService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.sakaiproject.time.api; | ||
|
||
import java.util.TimeZone; | ||
|
||
/** | ||
* This is an extraction out the user timezone specific parts of the TimeService. Refactorings can then be | ||
* done to bind to this service when the rest of TimeService isn't needed. | ||
* | ||
* @see TimeService | ||
*/ | ||
public interface UserTimeService { | ||
|
||
/** | ||
* Access the users preferred local TimeZone. | ||
* | ||
* @return The user's local TimeZone. | ||
*/ | ||
TimeZone getLocalTimeZone(); | ||
|
||
/** | ||
* Clear local time zone for specified user. Should be called when locale or timezone for user is changed. | ||
* | ||
* @return true if successful | ||
*/ | ||
boolean clearLocalTimeZone(String userId); | ||
} |
Oops, something went wrong.