public static Map<String, Object> createVelocityParams(final JiraAuthenticationContext authenticationContext) { // lazy master builder for the parameters final Map<String, Object> localParams = new HashMap<>(); localParams.put("currentCalendar", new LazyCalendar(authenticationContext.getLocale(), ComponentAccessor.getComponentOfType(ApplicationProperties.class))); localParams.put("authcontext", authenticationContext); localParams.put("outlookdate", authenticationContext.getOutlookDate()); localParams.put("dateFormatter", dateTimeFormatter().withStyle(COMPLETE).forLoggedInUser()); localParams.put("dateutils", new DateUtils(authenticationContext)); // an bean to help with concise permission checks (done as part of JRA-13469) but needed in general localParams.put("permissionCheck", new PermissionCheckBean(authenticationContext, ComponentAccessor.getPermissionManager())); localParams.put("featureManager", ComponentAccessor.getComponent(FeatureManager.class)); localParams.put("soyRenderer", ComponentAccessor.getComponent(SoyTemplateRendererProvider.class).getRenderer()); if (ExecutingHttpRequest.get() != null) { localParams.put("req", ExecutingHttpRequest.get()); } return MASTER.combine(JiraMailQueueUtils.getContextParamsMaster()).toMap(localParams); }