public AccessException(final Integer taskId, final AccessType accessType, final OperationType operationType) { this(ThreadLocalUserContext.getUser(), taskId, accessType, operationType); }
/** * @return Does not translation: returns the i18nKey itself. * @see ExportContext#getLocalizedString(java.lang.String) */ public String getLocalizedString(final String i18nKey) { return ThreadLocalUserContext.getLocalizedString(i18nKey); }
private ICalParser() { this.parseVEvent = new ArrayList<>(); // set user, timezone, locale this.user = ThreadLocalUserContext.getUser(); this.timeZone = ThreadLocalUserContext.getTimeZone(); this.locale = ThreadLocalUserContext.getLocale(); this.reset(); }
public static Calendar getCalendar(TimeZone timeZone, Locale locale) { if (locale == null) { locale = ThreadLocalUserContext.getLocale(); } if (timeZone == null) { timeZone = ThreadLocalUserContext.getTimeZone(); } return Calendar.getInstance(timeZone, locale); }
public CalendarFilter() { super(); timesheetUserId = ThreadLocalUserContext.getUserId(); selectedCalendar = Const.EVENT_CLASS_NAME; }
public void checkPartOfCurrentTenant(final BaseDO<?> obj) { if (tenantService.isMultiTenancyAvailable() == false) { return; } if (isPartOfCurrentTenant(obj) == false) { final TenantDO currentTenant = getCurrentTenant(); final String currentTenantString = currentTenant != null ? currentTenant.getName() : ThreadLocalUserContext .getLocalizedString("multitenancy.defaultTenant"); final TenantDO objectTenant = obj.getTenant(); final String objectTenantString = objectTenant != null ? objectTenant.getName() : ThreadLocalUserContext .getLocalizedString("multitenancy.defaultTenant"); throw new AccessException(ThreadLocalUserContext.getUser(), "access.exception.usersCurrentTenantDoesNotMatch", currentTenantString, objectTenantString); } }
public void initDatabase() { final PFUserDO origUser = ThreadLocalUserContext.getUser(); final PFUserDO initUser = new PFUserDO().setUsername("Init-database-pseudo-user"); initUser.setId(-1); initUser.addRight(new UserRightDO(UserRightId.HR_EMPLOYEE, UserRightValue.READWRITE)); ThreadLocalUserContext.setUser(getUserGroupCache(), initUser); initConfiguration(); initUsers(); initDatabaseDao.insertGlobalAddressbook(AbstractTestBase.ADMIN_USER); initGroups(); initTaskTree(); initAccess(); initKost2Arts(); initEmployees(); ThreadLocalUserContext.setUser(getUserGroupCache(), origUser); }
public final static DateTimeZone getDateTimeZone() { final TimeZone timeZone = getTimeZone(); return DateTimeZone.forTimeZone(timeZone); }
private void createDefaultEntry() { final TemplateEntry newTemplate = new TemplateEntry(); newTemplate.setName(ThreadLocalUserContext.getLocalizedString("default")); newTemplate.setTimesheetUserId(ThreadLocalUserContext.getUserId()).setShowBirthdays(true).setShowBreaks(true) .setShowPlanning(true) .setShowStatistics(true); add(newTemplate); }
protected void logoff() { ThreadLocalUserContext.setUser(getUserGroupCache(), null); }
public String getLocalizedMessage() { if (this == LOGIN_TIME_OFFSET) { // msgParam is seconds. return ThreadLocalUserContext.getLocalizedMessage(getI18nKey(), msgParams); } return ThreadLocalUserContext.getLocalizedString(getI18nKey()); }
DateTime holidaysFrom = new DateTime(ThreadLocalUserContext.getDateTimeZone()); holidaysFrom = holidaysFrom.dayOfYear().withMinimumValue().millisOfDay().withMinimumValue().minusYears(2); final DateTime holidayTo = holidaysFrom.plusYears(6); final String holidayInfo = dh.getHolidayInfo(); if (holidayInfo != null && holidayInfo.startsWith("calendar.holiday.") == true) { title = ThreadLocalUserContext.getLocalizedString(holidayInfo); } else { title = holidayInfo;
/** * @return the default locale of the system or the locale set by {@link #setLocale(Locale)}. * @see ExportContext#getLocale() */ public Locale getLocale() { if (this.locale != null) { locale = ThreadLocalUserContext.getLocale(); } return locale; }
Object parse(final String data) { try { final DateTimeFormatter parseFormat = DateTimeFormat.forPattern(ISO_FORMAT); final DateTime date = parseFormat.withZone(DateTimeZone.UTC).parseDateTime(data); final DateTimeZone dateTimeZone = ThreadLocalUserContext.getDateTimeZone(); return new DateTime(date, dateTimeZone); } catch (final Exception ex) { log.error("Can't parse DateMidnight: " + data); return new DateMidnight(); } }
/** * @return Short name of day represented by the giving day. The context user's locale and time zone is considered. */ public static final String formatShortNameOfDay(final Date date) { final DateFormat df = new SimpleDateFormat("EE", ThreadLocalUserContext.getLocale()); df.setTimeZone(ThreadLocalUserContext.getTimeZone()); return df.format(date); }
/** * @see org.projectforge.business.teamcal.filter.ICalendarFilter#setShowTimesheets(boolean) */ public TemplateEntry setShowTimesheets(final boolean showTimesheets) { this.timesheetUserId = ThreadLocalUserContext.getUserId(); return this; }
/** * @return The timeZone (ical4j) built of the default java timeZone of the user. * @see ThreadLocalUserContext#getTimeZone() */ public static TimeZone getUserTimeZone() { return registry.getTimeZone(ThreadLocalUserContext.getTimeZone().getID()); }
public void logon(final PFUserDO user) { ThreadLocalUserContext.setUser(getUserGroupCache(), user); }
/** * Uses the scale of the BigDecimal. Uses the ThreadLocalUserContext locale. * @param value */ public static String format(final int value) { final NumberFormat format = NumberFormat.getNumberInstance(ThreadLocalUserContext.getLocale()); return format.format(value); }