List of usage examples for org.apache.commons.lang StringUtils stripToNull
public static String stripToNull(String str)
Strips whitespace from the start and end of a String returning null
if the String is empty ("") after the strip.
From source file:gov.nih.nci.calims2.taglib.form.FormTag.java
/** * @param enctype the enctype to set */ public void setEnctype(String enctype) { this.enctype = StringUtils.stripToNull(enctype); }
From source file:gov.nih.nci.calims2.taglib.form.ValidationTextBoxTag.java
/** * @param format the format to set */ public void setFormat(String format) { this.format = StringUtils.stripToNull(format); }
From source file:gov.nih.nci.calims2.taglib.form.FormTag.java
/** * @param method the method to set */ public void setMethod(String method) { this.method = StringUtils.stripToNull(method); }
From source file:gov.nih.nci.calims2.taglib.form.FormWidgetTag.java
/** * @param style the style to set */ public void setStyle(String style) { this.style = StringUtils.stripToNull(style); }
From source file:com.adobe.acs.commons.forms.impl.FormsPostFilterImpl.java
private String getParameter(SlingHttpServletRequest slingRequest, String param) { final RequestParameter requestParameter = slingRequest.getRequestParameter(param); if (requestParameter == null) { return null; }//from www .j a v a2s . c o m return StringUtils.stripToNull(requestParameter.getString()); }
From source file:com.adobe.acs.commons.wcm.impl.PropertyMergePostProcessor.java
/** * Gets the corresponding list of PropertyMerge directives from the * RequestParams./*from ww w. j a v a 2 s. co m*/ * * @param requestParameters the Request Param Map * @return a list of the PropertyMerge directives by Destination */ @SuppressWarnings("squid:S3776") private List<PropertyMerge> getPropertyMerges(final SlingHttpServletRequest request) { final RequestParameterMap requestParameters = request.getRequestParameterMap(); final HashMap<String, Set<String>> mapping = new HashMap<>(); boolean isBulkUpdate = Boolean.valueOf(getParamValue(requestParameters, "dam:bulkUpdate")); // Collect the Destination / Source mappings requestParameters.forEach((key, values) -> { if (!StringUtils.endsWith(key, AT_SUFFIX)) { // Not a @PropertyMerge request param return; } Function<String, String> stripPrefix = (s -> StringUtils.removeStart(StringUtils.stripToNull(s), IGNORE_PREFIX)); final String source = stripPrefix.apply(StringUtils.substringBefore(key, AT_SUFFIX)); Stream.of(values).map(RequestParameter::getString).map(stripPrefix).filter(Objects::nonNull) .forEach(destination -> { if (source.equalsIgnoreCase(OPERATION_ALL_TAGS)) { // if this is a request for merging all tags, look at everyting that might be a tag trackAllTagsMergeParameters(request, destination, mapping); } else if (isBulkUpdate) { // if this is a DAM bulk update, search all request params ending with this value trackAssetMergeParameters(requestParameters, source, destination, mapping); } else { trackMergeParameters(mapping, source, destination); } }); }); // Convert the Mappings into PropertyMerge objects return mapping.entrySet().stream() .map(entry -> new PropertyMerge(entry.getKey(), entry.getValue(), areDuplicatesAllowed(requestParameters, entry.getKey()), getFieldTypeHint(requestParameters, entry.getKey()))) .collect(Collectors.toList()); }
From source file:gov.nih.nci.calims2.taglib.form.ButtonTag.java
/** * @param iconClass the iconClass to set */ public void setIconClass(String iconClass) { this.iconClass = StringUtils.stripToNull(iconClass); }
From source file:gov.nih.nci.calims2.taglib.form.FormWidgetTag.java
/** * @param styleClass the styleClass to set */ public void setStyleClass(String styleClass) { this.styleClass = StringUtils.stripToNull(styleClass); }
From source file:gov.nih.nci.calims2.taglib.form.ButtonTag.java
/** * @param labelKey the labelKey to set */ public void setLabelKey(String labelKey) { this.labelKey = StringUtils.stripToNull(labelKey); }
From source file:gov.nih.nci.calims2.taglib.form.ButtonTag.java
/** * @param label the label to set */ public void setLabel(String label) { this.label = StringUtils.stripToNull(label); }