Skip to content

Commit

Permalink
Merge pull request #19 from baloise/replacedDeprecatedAPIuSage
Browse files Browse the repository at this point in the history
Replaced deprecated API usage
  • Loading branch information
culmat authored Jul 9, 2024
2 parents 3a2a828 + 9b03659 commit f94271c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.atlassian.confluence.util.i18n.Message;
import com.atlassian.confluence.util.velocity.VelocityUtils;
import com.atlassian.sal.api.message.I18nResolver;
import com.atlassian.sal.api.timezone.TimeZoneManager;
import com.baloise.confluence.dashboardplus.exception.ResourceNotFoundException;
import com.baloise.confluence.dashboardplus.exception.ServiceUnavailableException;
import com.baloise.confluence.dashboardplus.jenkins.JenkinsService;
Expand Down Expand Up @@ -81,9 +82,9 @@ public JenkinsJobStatusMacro(/* XhtmlContent xhtmlUtils, */
/* ApplicationLinkService applicationLinkService, */Renderer renderer,
UserAccessor userAccessor,
FormatSettingsManager formatSettingsManager,
LocaleManager localeManager, I18nResolver i18n) {
LocaleManager localeManager, TimeZoneManager timeZoneManager, I18nResolver i18n) {
super(renderer, userAccessor, formatSettingsManager, localeManager,
i18n);
timeZoneManager, i18n);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.atlassian.confluence.util.i18n.Message;
import com.atlassian.confluence.util.velocity.VelocityUtils;
import com.atlassian.sal.api.message.I18nResolver;
import com.atlassian.sal.api.timezone.TimeZoneManager;
import com.baloise.confluence.dashboardplus.exception.ResourceNotFoundException;
import com.baloise.confluence.dashboardplus.exception.ServiceUnavailableException;
import com.baloise.confluence.dashboardplus.sonar.SonarService;
Expand Down Expand Up @@ -66,9 +67,9 @@ public SonarTestStatusMacro(/* XhtmlContent xhtmlUtils, */
/* ApplicationLinkService applicationLinkService, */Renderer renderer,
UserAccessor userAccessor,
FormatSettingsManager formatSettingsManager,
LocaleManager localeManager, I18nResolver i18n) {
LocaleManager localeManager, TimeZoneManager timeZoneManager, I18nResolver i18n) {
super(renderer, userAccessor, formatSettingsManager, localeManager,
i18n);
timeZoneManager, i18n);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.atlassian.confluence.user.UserAccessor;
import com.atlassian.confluence.util.velocity.VelocityUtils;
import com.atlassian.sal.api.message.I18nResolver;
import com.atlassian.sal.api.timezone.TimeZoneManager;

public class StaticStatusLightMacro extends StatusLightBasedMacro {

Expand Down Expand Up @@ -38,9 +39,9 @@ public StaticStatusLightMacro(/* XhtmlContent xhtmlUtils, */
/* ApplicationLinkService applicationLinkService, */Renderer renderer,
UserAccessor userAccessor,
FormatSettingsManager formatSettingsManager,
LocaleManager localeManager, I18nResolver i18n) {
LocaleManager localeManager, TimeZoneManager timeZoneManager, I18nResolver i18n) {
super(renderer, userAccessor, formatSettingsManager, localeManager,
i18n);
timeZoneManager, i18n);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.atlassian.confluence.user.ConfluenceUserPreferences;
import com.atlassian.confluence.user.UserAccessor;
import com.atlassian.sal.api.message.I18nResolver;
import com.atlassian.sal.api.timezone.TimeZoneManager;
import com.atlassian.user.User;

public abstract class StatusLightBasedMacro implements Macro {
Expand All @@ -42,16 +43,18 @@ public abstract class StatusLightBasedMacro implements Macro {
protected final UserAccessor userAccessor;
protected final FormatSettingsManager formatSettingsManager;
protected final LocaleManager localeManager;
protected final TimeZoneManager timeZoneManager;
protected final I18nResolver i18n;

public StatusLightBasedMacro(Renderer renderer, UserAccessor userAccessor,
FormatSettingsManager formatSettingsManager,
LocaleManager localeManager, I18nResolver i18n) {
FormatSettingsManager formatSettingsManager, LocaleManager localeManager,
TimeZoneManager timeZoneManager, I18nResolver i18n) {
super();
this.renderer = renderer;
this.userAccessor = userAccessor;
this.formatSettingsManager = formatSettingsManager;
this.localeManager = localeManager;
this.timeZoneManager = timeZoneManager;
this.i18n = i18n;
}

Expand Down Expand Up @@ -157,11 +160,11 @@ protected static double parseDoubleParam(String paramValue, double minExcl,

protected FriendlyDateFormatter newFriendlyDateFormatter() {
// Get current user's timezone, or default one
User authUser = AuthenticatedUserThreadLocal.getUser();
User authUser = AuthenticatedUserThreadLocal.get();
TimeZone timeZone;
if (authUser == null) {
// anonymous
timeZone = TimeZone.getDefault();
timeZone = TimeZone.getInstance(timeZoneManager.getDefaultTimeZone());
} else {
ConfluenceUserPreferences prefs = userAccessor
.getConfluenceUserPreferences(authUser);
Expand All @@ -179,7 +182,7 @@ protected FriendlyDateFormatter newFriendlyDateFormatter() {

protected NumberFormat newNumberFormatter() {
// Get current user's timezone, or default one
User authUser = AuthenticatedUserThreadLocal.getUser();
User authUser = AuthenticatedUserThreadLocal.get();
NumberFormat result = null;
if (authUser != null) {
ConfluenceUserPreferences prefs = userAccessor
Expand Down

0 comments on commit f94271c

Please sign in to comment.