private void addError(ApplicationUser searcher, MessageSet messageset, String key, Object...values) { if (messageset != null) { final I18nHelper i18n = factory.getInstance(searcher); messageset.addErrorMessage(i18n.getText(key, values)); } } }
/** * Creates a new error collection with contents copied from the supplied argument. * * @param errorCollection error collection to copy * @return a new instance of error collection with the same contents as argument */ public static ErrorCollection copyOf(ErrorCollection errorCollection) { ErrorCollection result = empty(); result.addErrorCollection(errorCollection); return result; }
@Override public String resolveText(final Locale locale, final String key, final Serializable[] arguments) { final I18nHelper bean = beanFactory.getInstance(locale); return bean.getText(key, arguments); }
void addErrorKey(String key, String errorValue, ErrorCollection.Reason reason) { simpleErrorCollection.addErrorMessage(key, reason); if (errorCollection != null) { errorCollection.addErrorMessage(componentService.translateKeyToMessage(key, errorValue), reason); } }
Locale getLocale(final ApplicationUser searcher) { return beanFactory.getInstance(searcher).getLocale(); } ///CLOVER:ON
public static boolean isIe456Or7(String userAgent) { if (StringUtils.isBlank(userAgent)) { return false; } UserAgentUtil userAgentUtil = new UserAgentUtilImpl(); final UserAgentUtil.UserAgent userAgentInfo = userAgentUtil.getUserAgentInfo(userAgent); final UserAgentUtil.Browser browser = userAgentInfo.getBrowser(); return browser.getBrowserFamily() == MSIE && browser.getBrowserMajorVersion().compareTo(MSIE8) < 0; }
@Override public String getRawText(final Locale locale, final String key) { final I18nHelper bean = beanFactory.getInstance(locale); return bean.getUnescapedText(key); }
public String format(Long duration, Locale locale) { return format(duration, locator.getHelper(locale).getResourceBundle()); }
public String format(Long duration) { return format(duration, locator.getHelper().getDefaultResourceBundle()); }
/** * Converts the given time duration into days and formats it based on the given user's locale. If the duration * given is a negative number, returns an empty string. * * @param duration time duration to format * @param locale user's locale * @return formatted time duration or an empty string */ public String format(Long duration, Locale locale) { return format(duration, locator.getHelper(locale), TimeFormatWithPrecision.Scale.DEFAULT); }
/** * Converts the given time duration into hours and formats it based on the system locale. If the duration given * is a negative number, returns an empty string. * * @param duration time duration to format * @return formatted time duration or an empty string */ public String format(Long duration) { return format(duration, locator.getHelper(), TimeFormatWithPrecision.Scale.DEFAULT); }
/** * Validates the given project key and returns true if valid, false otherwise. * * @param key project key to validate * @return True if the supplied project key is valid */ public static boolean validProjectKey(final String key) { return getKeyMatcher().isValidProjectKey(key); }
/** * Determines whether any JIRA issue key is in the given string * * @param s string to check * @return true if a key was found, false otherwise */ public static boolean isKeyInString(final String s) { return getKeyMatcher().isKeyInString(s); }
/** * Validates the given issue key. * * @param key issue key * @return True if the supplied issue key starts with a valid project key, and ends with a number */ public static boolean validIssueKey(final String key) { return getKeyMatcher().isValidIssueKey(key); }
/** * Converts the given time duration into days and formats it based on the system locale. If the duration given * is a negative number, returns an empty string. * * @param duration time duration to format * @return formatted time duration or an empty string */ public String format(Long duration) { return format(duration, locator.getHelper(), TimeFormatWithPrecision.Scale.DEFAULT); }
/** * Converts the given time duration into hours and formats it based on the given user's locale. If the duration * given is a negative number, returns an empty string. * * @param duration time duration to format * @param locale user's locale * @return formatted time duration or an empty string */ public String format(Long duration, Locale locale) { return format(duration, locator.getHelper(locale), TimeFormatWithPrecision.Scale.DEFAULT); }