@Override public String getHtml() { try { Map<String, Object> builder = Maps.newHashMap(); builder.put("action", this); builder.put("textutils", new TextUtils()); final StringWriter stringWriter = new StringWriter(); templateRenderer.render(templatePath, ImmutableMap.copyOf(builder), stringWriter); return stringWriter.toString(); } catch (IOException e) { throw new RuntimeException(e); } }
public String getHtml(ApplicationUser profileUser) { final ApplicationUser user = authenticationContext.getUser(); final Map<String, Object> params = new HashMap<String, Object>(); DarkFeatures darkFeatures = featureManager.getDarkFeatures(); List<String> globalEnabledFeatures = Lists.newArrayList(darkFeatures.getGlobalEnabledFeatureKeys()); List<String> userEnabledFeatures = Lists.newArrayList(darkFeatures.getUserEnabledFeatures()); Collections.sort(globalEnabledFeatures); Collections.sort(userEnabledFeatures); params.put("textUtils", new TextUtils()); params.put("isAdmin", permissionManager.hasPermission(Permissions.SYSTEM_ADMIN, user)); params.put("globalEnabledFeatures", globalEnabledFeatures); params.put("userEnabledFeatures", userEnabledFeatures); return moduleDescriptor.getHtml(VIEW_TEMPLATE, params); } }
params.put("rendererType", renderer.getRendererType()); params.put("value", renderer.transformForEdit(value)); params.put("textutils", new TextUtils()); params.put("i18n", getI18nBean()); if (singleLine)
final TextUtils textUtils = new TextUtils();
params.put("textutils", new TextUtils());
/** * This will populate the passed in map with this object referenced as "action" and the rendered comment body as * "renderedContent". * @param params map of params to populate */ protected void populateVelocityParams(Map params) { params.put("action", this); params.put("velocityhelper", new JiraVelocityHelper(ComponentAccessor.getFieldManager())); params.put("requestContext", new DefaultVelocityRequestContextFactory(ComponentAccessor.getApplicationProperties()).getJiraVelocityRequestContext()); params.put("userformat", ComponentAccessor.getComponent(UserFormatManager.class)); params.put("textutils", new TextUtils()); try { FieldLayoutItem fieldLayoutItem = fieldLayoutManager.getFieldLayout(issue.getProjectObject(), issue.getIssueTypeId()).getFieldLayoutItem(IssueFieldConstants.COMMENT); if (fieldLayoutItem != null) { params.put("renderedContent", rendererManager.getRenderedContent(fieldLayoutItem.getRendererType(), comment.getBody(), issue.getIssueRenderContext())); } } catch (DataAccessException e) { log.error(e.getMessage(), e); } }
add("portals", portalPageService.getOwnedPortalPages(authenticationContext.getUser())). add("baseurl", requestContext.getBaseUrl()). add("textutils", new TextUtils()). add("i18n", authenticationContext.getI18nHelper()). add("displayParameters", MapBuilder.singletonMap("theme", "aui"));
contextParams.put("HTMLUtils", new HTMLUtils()); contextParams.put("build", ComponentAccessor.getComponent(BuildUtilsInfo.class)); contextParams.put("textutils", new TextUtils()); contextParams.put("webResourceManager", getWebResourceManager()); contextParams.put("urlModeAbsolute", UrlMode.ABSOLUTE);
private Map<String, Object> getTemplateVariables(final Action action, final Version version, final ApplicationUser user, final Project project) { final List<IssuesByType> issueTypes = newArrayList(); for (final IssueType issueType : constantsManager.getAllIssueTypeObjects()) { issueTypes.add(new IssuesByType(issueType, user, version.getId())); } return MapBuilder.<String,Object>newBuilder(). add("action", action). add("req", ExecutingHttpRequest.get()). add("issueTypes", issueTypes). add("appProps", applicationProperties). add("version", version.getName()). add("versionObj", version). add("project", project.getName()). add("textUtils", new TextUtils()). add("requestContext", new DefaultVelocityRequestContextFactory(applicationProperties).getJiraVelocityRequestContext()). add("constantsManager", constantsManager). add("customFieldManager", customFieldManager). toMutableMap(); }