public void setComponentLead(String componentLead) { if (TextUtils.stringSet(componentLead)) { this.componentLead = componentLead; } else { this.componentLead = null; } }
/** * Creates failure from a given text message, encoding the text message as a whole into html for the html message. * * @param message the failure message in text. */ public Failure(String message) { this(message, TextUtils.htmlEncode(message)); }
private boolean isEmail(final String name) { return TextUtils.verifyEmail(name); }
/** * Convert all URLs and E-mail addresses in a string into hyperlinks. * * @param text The block of text to hyperlink. * @param target The target attribute to use for href (optional). * @return the text with known uri formats hyperlinked * * @see #linkEmail(String) * @see #linkURL(String) */ public final static String hyperlink(String text, String target) { text = noNull(text); text = linkEmail(text); text = linkURL(text, target); return text; }
protected void doValidation() { log.debug("fullName = " + fullName); log.debug("email = " + email); // It is valid to not send a username because Crowd and LDAP do not let you edit the username // but we don't allow empty string because that is an internal user with a blank username. if (username != null && username.trim().isEmpty()) addError("username", getText("signup.error.username.required")); if (!TextUtils.stringSet(TextUtils.noNull(fullName).trim())) addError("fullName", getText("admin.errors.invalid.full.name.specified")); if (!TextUtils.verifyEmail(TextUtils.noNull(email))) addError("email", getText("admin.errors.invalid.email")); }
protected void doValidation() { // Validate email address if (TextUtils.stringSet(getFromAddress()) && !TextUtils.verifyEmail(getFromAddress())) { addError("fromAddress", getText("admin.errors.projectemail.enter.valid.address")); } }
public final static String plainTextToHtml(String str, String target) { return plainTextToHtml(str, target, true); }
/** * Return <code>string</code>, or <code>""</code> if <code>string</code> * is <code>null</code>. Never returns <code>null</code>. * <p>Examples:</p> * <pre> * // prints 0 * String s=null; * System.out.println(TextUtils.noNull(s).length()); * * // prints 1 * s="a"; * System.out.println(TextUtils.noNull(s).length()); * </pre> * @param string the String to check * @return a valid (non-null) string reference */ public final static String noNull(String string) { return noNull(string, ""); }
/** * Highlight a change log by breaking it into separate lines and highlighting each one */ public static String highlight(String body, String colour) { String htmlBody = TextUtils.plainTextToHtml(body); StringTokenizer st = new StringTokenizer(htmlBody, "\n"); StringBuilder buff = new StringBuilder(htmlBody.length()); while (st.hasMoreTokens()) { buff.append(highlightLine(st.nextToken() + "\n", colour)); } return TextUtils.closeTags(buff.toString()); }
@Override public Map getContextMap(ApplicationUser user, JiraHelper jiraHelper) { final List<Issue> history = userHistoryManager.getShortIssueHistory(user); int logoHeight = TextUtils.parseInt(applicationProperties.getDefaultBackedString(APKeys.JIRA_LF_LOGO_HEIGHT)); String historyHeight = String.valueOf(80 + logoHeight + (25 * history.size())); String filterHeight = String.valueOf(205 + logoHeight); return EasyMap.build("historyWindowHeight", historyHeight, "filtersWindowHeight", filterHeight); } }
public String textToHtml(String s) { return TextUtils.plainTextToHtml(s); }
/** * Return <code>string</code>, or <code>""</code> if <code>string</code> * is <code>null</code>. Never returns <code>null</code>. * <p>Examples:</p> * <pre> * // prints 0 * String s=null; * System.out.println(TextUtils.noNull(s).length()); * * // prints 1 * s="a"; * System.out.println(TextUtils.noNull(s).length()); * </pre> * @param string the String to check * @return a valid (non-null) string reference */ public final static String noNull(String string) { return noNull(string, ""); }
/** * Convert all URLs and E-mail addresses in a string into hyperlinks. * * @param text The block of text to hyperlink. * @param target The target attribute to use for href (optional). * @return the text with known uri formats hyperlinked * * @see #linkEmail(String) * @see #linkURL(String) */ public final static String hyperlink(String text, String target) { text = noNull(text); StringBuffer sb = new StringBuffer((int) (text.length() * 1.1)); sb.append(text); linkEmail(sb); linkURL(sb, target); return sb.toString(); }
public void setGroupName(String groupName) { if (TextUtils.stringSet(groupName)) { this.groupName = groupName; } else { this.groupName = null; } }
private String prepare(String value) { if (escape) { return TextUtils.htmlEncode(value); } else { return value; } } }
public final static String plainTextToHtml(String str, boolean encodeSpecialChars) { return plainTextToHtml(str, null, encodeSpecialChars); }
public SystemNavContextLayoutBean(HttpServletRequest request) { this.request = request; this.userAgent = TextUtils.noNull(request.getHeader("USER-AGENT")); }
public boolean doValidation(String key, Map parameters) { Object value = parameters.get(key); return (value != null && TextUtils.verifyEmail((String) value)); } }