/** * {@inheritDoc} */ @Override public String getResource(String messageKey, String defaultValue, Object... objects) { Locale locale = RequestContextUtils.getLocale(request); String message = null; // Both title and titleKey attributes are not used if (messageKey == null || StringUtils.isBlank(messageKey) && StringUtils.isNotBlank(defaultValue)) { message = StringUtils.capitalize(defaultValue); } // the titleKey attribute is used else { try { message = messageSource.getMessage(messageKey, null, locale); } catch (NoSuchMessageException e) { logger.warn("No message found with the key {} and locale {}.", messageKey, locale); if (StringUtils.isBlank(message)) { message = UNDEFINED_KEY + messageKey + UNDEFINED_KEY; } } } return message; } }
@Override public String toString() { StringBuilder js = new StringBuilder(); js.append("function("); js.append((args != null ? StringUtils.join(args, ",") : "")); js.append("){"); js.append((hasReturn ? "return " : "")); js.append(code); js.append("}"); return js.toString(); }
if (StringUtils.isNotBlank(this.rowIdPrefix)) { rowId.append(StringUtils.escape(this.escapeXml, this.rowIdPrefix)); if (StringUtils.isNotBlank(this.rowIdBase)) { try { Object propertyValue = PropertyUtils.getNestedProperty(this.currentObject, StringUtils.escape(this.escapeXml, this.rowIdBase)); rowId.append(propertyValue != null ? propertyValue : ""); if (StringUtils.isNotBlank(this.rowIdSuffix)) { rowId.append(StringUtils.escape(this.escapeXml, this.rowIdSuffix));
if (StringUtils.isBlank(activeProfile) || Arrays.asList(DEV_ALIASES).contains(activeProfile)) { return DEFAULT_DEV_PROFILE; else if (StringUtils.isNotBlank(activeProfile) && Arrays.asList(PROD_ALIASES).contains(activeProfile)) { return DEFAULT_PROD_PROFILE;
/** * <p> * Appends some code to the {@link #content}. * </p> * * @param code * Some code to append to the content of the asset. */ public void appendTo(String code) { if (StringUtils.isNotBlank(code)) { content.append(code); } }
/** * <p> * Checks if a String is not empty (""), not null and not whitespace only. * </p> * * <pre> * StringUtils.isNotBlank(null) = false * StringUtils.isNotBlank("") = false * StringUtils.isNotBlank(" ") = false * StringUtils.isNotBlank("bob") = true * StringUtils.isNotBlank(" bob ") = true * </pre> * * @param str * the String to check, may be null * @return <code>true</code> if the String is not empty and not null and not * whitespace * @since 2.0 */ public static boolean isNotBlank(String str) { return !StringUtils.isBlank(str); }
if (StringUtils.isNotBlank(this.property) && parent.getCurrentObject() != null) { if (StringUtils.isNotBlank(this.format) && propertyValue != null) { else if (StringUtils.isBlank(this.format) && propertyValue != null) { return StringUtils.escape(propertyValue.toString()); if (StringUtils.isNotBlank(this.defaultValue)) { return this.defaultValue.trim(); if (StringUtils.isNotBlank(defaultValue)) { return defaultValue.trim();
@Override protected Map<String, Object> getPageContext() { Map<Locale, Map<String, Map<Option<?>, Object>>> store = TableConfigurationFactory.getConfigurationStore(); Locale currentLocale = DatatableConfigurator.getLocaleResolver().resolveLocale(context.getRequest()); List<Map<String, Object>> groupsJson = new ArrayList<Map<String, Object>>(); int index = 0; for (Entry<String, Map<Option<?>, Object>> entry : store.get(currentLocale).entrySet()) { Map<String, Object> groupJson = new HashMap<String, Object>(); groupJson.put("groupName", StringUtils.capitalize(entry.getKey())); groupJson.put("options", getGroupOptions(entry.getValue())); groupJson.put("active", index == 0 ? "active" : ""); groupsJson.add(groupJson); index++; } Map<String, Object> pageContext = new HashMap<String, Object>(); pageContext.put("groups", groupsJson); pageContext.put("page-header", PAGE_NAME); return pageContext; }
/** * <p> * Escapes the characters in a {@code String} using XML entities only if the * passed boolean is {@code true}. * * @param str * the {@code String} to escape. * @return a new escaped {@code String} if {@code shouldEscape} is set to * {@code true}, an unchanged {@code String} otherwise. */ public static String escape(boolean shouldEscape, String src) { if (shouldEscape) { return escape(src); } return src; }
/** * <p> * Appends some code to the {@link #content}. * </p> * * @param code * Some code to append to the content of the asset. */ public void appendTo(String code) { if (StringUtils.isNotBlank(code)) { content.append(code); } }
/** * <p> * Checks if a String is not empty (""), not null and not whitespace only. * </p> * * <pre> * StringUtils.isNotBlank(null) = false * StringUtils.isNotBlank("") = false * StringUtils.isNotBlank(" ") = false * StringUtils.isNotBlank("bob") = true * StringUtils.isNotBlank(" bob ") = true * </pre> * * @param str * the String to check, may be null * @return <code>true</code> if the String is not empty and not null and not * whitespace * @since 2.0 */ public static boolean isNotBlank(String str) { return !StringUtils.isBlank(str); }
if (StringUtils.isNotBlank(this.property) && parent.getCurrentObject() != null) { if (StringUtils.isNotBlank(this.format) && propertyValue != null) { else if (StringUtils.isBlank(this.format) && propertyValue != null) { return StringUtils.escape(propertyValue.toString()); if (StringUtils.isNotBlank(this.defaultValue)) { return this.defaultValue.trim(); if (StringUtils.isNotBlank(defaultValue)) { return defaultValue.trim();
if (StringUtils.isBlank(activeProfile) || Arrays.asList(DEV_ALIASES).contains(activeProfile)) { return DEFAULT_DEV_PROFILE; else if (StringUtils.isNotBlank(activeProfile) && Arrays.asList(PROD_ALIASES).contains(activeProfile)) { return DEFAULT_PROD_PROFILE;
@Override protected Map<String, Object> getPageContext() { Map<Locale, Map<String, Map<Option<?>, Object>>> store = TableConfigurationFactory.getConfigurationStore(); Locale currentLocale = DatatableConfigurator.getLocaleResolver().resolveLocale(context.getRequest()); List<Map<String, Object>> groupsJson = new ArrayList<Map<String, Object>>(); int index = 0; for (Entry<String, Map<Option<?>, Object>> entry : store.get(currentLocale).entrySet()) { Map<String, Object> groupJson = new HashMap<String, Object>(); groupJson.put("groupName", StringUtils.capitalize(entry.getKey())); groupJson.put("options", getGroupOptions(entry.getValue())); groupJson.put("active", index == 0 ? "active" : ""); groupsJson.add(groupJson); index++; } Map<String, Object> pageContext = new HashMap<String, Object>(); pageContext.put("groups", groupsJson); pageContext.put("page-header", PAGE_NAME); return pageContext; }
/** * <p> * Escapes the characters in a {@code String} using XML entities only if the * passed boolean is {@code true}. * * @param str * the {@code String} to escape. * @return a new escaped {@code String} if {@code shouldEscape} is set to * {@code true}, an unchanged {@code String} otherwise. */ public static String escape(boolean shouldEscape, String src) { if (shouldEscape) { return escape(src); } return src; }
/** * {@inheritDoc} */ @Override public String getResource(String messageKey, String defaultValue, Object... objects) { Locale locale = RequestContextUtils.getLocale(request); String message = null; // Both title and titleKey attributes are not used if (messageKey == null || StringUtils.isBlank(messageKey) && StringUtils.isNotBlank(defaultValue)) { message = StringUtils.capitalize(defaultValue); } // the titleKey attribute is used else { try { message = messageSource.getMessage(messageKey, null, locale); } catch (NoSuchMessageException e) { logger.warn("No message found with the key {} and locale {}.", messageKey, locale); if (StringUtils.isBlank(message)) { message = UNDEFINED_KEY + messageKey + UNDEFINED_KEY; } } } return message; } }
/** * <p> * Retrieves the current and untouched active profile. * </p> * * @return the raw active profile, but at least trimmed if not null and * empty. */ public static String getActiveRawProfile() { String activeProfile = System.getProperty(DANDELION_PROFILE_ACTIVE); return StringUtils.isNotBlank(activeProfile) ? activeProfile.trim() : activeProfile; } }
public static void notBlank(String object, String message) { if (StringUtils.isBlank(object)) { throw new IllegalArgumentException(message); } }
if (StringUtils.isBlank(url)) { exportUrl = UrlUtils.getCurrentUri(request); UrlUtils.addParameter(exportUrl, ExportUtils.DDL_DT_REQUESTPARAM_EXPORT_TYPE, "f"); if (StringUtils.isNotBlank(fileName)) { conf.setFileName(fileName.trim()); UrlUtils.addParameter(exportUrl, ExportUtils.DDL_DT_REQUESTPARAM_EXPORT_NAME, this.fileName); if (StringUtils.isNotBlank(fileExtension)) { conf.setFileExtension(fileExtension); UrlUtils.addParameter(exportUrl, ExportUtils.DDL_DT_REQUESTPARAM_EXPORT_EXTENSION, this.fileExtension); if (StringUtils.isNotBlank(label)) { conf.setLabel(StringUtils.escape(this.escapeXml, this.label.trim())); if (StringUtils.isNotBlank(cssClass)) { conf.setCssClass(new StringBuilder(cssClass.trim())); if (StringUtils.isNotBlank(cssStyle)) { conf.setCssStyle(new StringBuilder(cssStyle.trim())); if (StringUtils.isNotBlank(method)) { HttpMethod httpMethod = null; try { if (StringUtils.isNotBlank(orientation)) { Orientation orientationEnum = null; try {
if (StringUtils.isBlank(this.fileName)) { this.fileName = "export-" + this.format + "-" + new SimpleDateFormat("yyyymmDD").format(new GregorianCalendar().getTime()); if (StringUtils.isBlank(this.label) && StringUtils.isNotBlank(this.format)) { this.label = this.format.toUpperCase(); this.method = HttpMethod.GET; if (StringUtils.isBlank(this.fileExtension)) { this.fileExtension = this.format;