@Override public String apply(final IssueConstant input) { return input.getId(); } };
private String makeImageMarkup(final IssueConstant constant, final String url) { final String name = TextUtils.htmlEncode(constant.getNameTranslation()); String result = "<img src=\"" + url + "\" height=\"16\" width=\"16\" alt=\"" + name + "\" title=\"" + name + " - "; final String descTranslation = constant.getDescTranslation() == null ? "" : constant.getDescTranslation(); result += TextUtils.htmlEncode(descTranslation) + "\"/>"; return result; }
public AbstractRemoteConstant(IssueConstant gv) { super(gv.getId(), gv.getName()); this.description = gv.getDescription(); this.icon = gv.getIconUrl(); if (TextUtils.stringSet(icon) && !this.icon.startsWith("http://")) { this.icon = ComponentAccessor.getApplicationProperties().getString(APKeys.JIRA_BASEURL) + icon; } }
public String getHtml(IssueConstant issueConstant, String imgClass) { String iconUrl = StringEscapeUtils.escapeHtml4(issueConstant.getCompleteIconUrl()); if (iconUrl == null) { return ""; } else { final String title = StringUtils.isNotBlank(issueConstant.getDescTranslation()) ? TextUtils.htmlEncode(issueConstant.getNameTranslation(), false) + " - " + TextUtils.htmlEncode(issueConstant.getDescTranslation(), false) : TextUtils.htmlEncode(issueConstant.getNameTranslation(), false); final String fullImgClass = StringUtils.isBlank(imgClass) ? "" : "class=\"" + imgClass + "\""; return "<img " + fullImgClass + " alt=\"\" height=\"16\" src=\"" + iconUrl + "\" title=\"" + title + "\" width=\"16\" />"; } } public String getHtml(IssueConstant issueConstant)
@Override public String apply(final IssueConstant input) { return input.getNameTranslation(); } };
issueTypes.add(issueConstant.getNameTranslation()); if (!validOptionIds.contains(issueConstant.getId())) invalidIssueTypes.add(issueConstant.getNameTranslation());
public String get(final IssueConstant input) { return input.getName(); } };
public String doDefault() throws Exception { final T constant = getConstant(); if (constant == null) { addErrorMessage(getText("admin.errors.no.id.set")); return Action.ERROR; } else { name = constant.getName(); description = constant.getDescription(); iconurl = constant.getIconUrl(); } return super.doDefault(); }
private boolean valueOnIssueConstantIsTheDefault(IssueConstant issueConstant, boolean name) { I18nHelper defaultI18n = beanFactory.getInstance(Locale.ROOT); String key = getI18NTranslationKey(issueConstant, name); String defaultValue = defaultI18n.getResourceBundle().containsKey(key) ? defaultI18n.getResourceBundle().getString(key) : null; if (name) { return issueConstant.getName() != null && issueConstant.getName().equals(defaultValue); } return issueConstant.getDescription() != null && issueConstant.getDescription().equals(defaultValue); }
@Override public int compare(final IssueConstant issueConstant, final IssueConstant t1) { return issueConstant.getSequence().compareTo(t1.getSequence()); } }).immutableSortedCopy(priorityList);
public String getImagePath() { return constant.getIconUrl(); }
public String getDescription() { return constant.getDescTranslation(); }
public String getName() { return constant.getNameTranslation(); }
/** * For a Collection of Generic Values, return the one that has * <code>genericValue.getString("name")</code> equal to <code>name</code> */ protected static IssueConstant getIssueConstantByName(final Collection<? extends IssueConstant> values, String name) { for (final IssueConstant value : values) { if (name.equalsIgnoreCase(value.getName())) { return value; } } return null; }
private String getTranslationFromI18nResources(IssueConstant issueConstant, I18nHelper i18n, boolean name) { if (i18n == null) { i18n = authenticationContext.getI18nHelper(); } String key = getI18NTranslationKey(issueConstant, name); String translation = i18n.getText(key); if (translation != null && !translation.contains(key)) { return translation; } return name ? issueConstant.getName() : issueConstant.getDescription(); }
public int compare(IssueConstant constant1, IssueConstant constant2) { // If these are the same object then quickly get out of here. // When doing issue search sorting Issue Constants are cached and reused so this will often be true. if (constant1 == constant2) return 0; if (constant1 == null) return -1; if (constant2 == null) return 1; Long key1 = constant1.getSequence(); Long key2 = constant2.getSequence(); if (key1 == null && key2 == null) return 0; else if (key1 == null) return 1; else if (key2 == null) return -1; return key1.compareTo(key2); } }
@Override public String apply(@Nullable final IssueConstant issueConstant) { return issueConstant.getIconUrl(); } });
/** * @deprecated Use {@link ConstantsManager} instead. Since v6.0. */ public String getDescTranslation(IssueConstant issueConstant) { if (issueConstant != null) { return issueConstant.getDescTranslation(); } else { return null; } }
@Override public String apply(final IssueConstant input) { return input != null ? input.getId() : "-1"; } });
private String makeConstantMarkup(final IssueConstant constant, final String url) { return makeConstantIconMarkup(constant) + makeMarkupForCellWithHtmlUnsafeDescriptionAndText(constant.getNameTranslation(), constant.getDescTranslation(), url); }