Example usage for org.apache.commons.lang StringUtils isNotBlank

List of usage examples for org.apache.commons.lang StringUtils isNotBlank

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils isNotBlank.

Prototype

public static boolean isNotBlank(String str) 

Source Link

Document

Checks if a String is not empty (""), not null and not whitespace only.

Usage

From source file:gov.nih.nci.calims2.ui.inventory.quantity.QuantityFormHelper.java

/**
 * Gets the quantities data as a collection of quantity objects.
 * //from   w  w w .  j  a va  2s. com
 * @return the quantities data as a collection of quantity objects.
 */
public Set<Quantity> getQuantities() {
    Set<Quantity> quantities = new HashSet<Quantity>();
    if (typeIds != null) {
        for (int i = 0; i < typeIds.size(); i++) {
            String value = values.get(i);
            if (StringUtils.isNotBlank(value)) {
                Quantity quantity = new Quantity();
                quantity.setType(EntityWithIdHelper.createEntity(Type.class, typeIds.get(i)));
                quantity.setValue(value);
                quantity.setStandardUnit(EntityWithIdHelper.createEntity(StandardUnit.class, unitIds.get(i)));
                quantities.add(quantity);
            }
        }
    }
    return quantities;
}

From source file:com.janrain.servlet.IPRangeFilter.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    String ipWhiteList = System.getProperty(BackplaneSystemProps.IP_WHITE_LIST);
    if (StringUtils.isNotBlank(ipWhiteList)) {
        List<String> items = Arrays.asList(ipWhiteList.split("\\s*,\\s*"));
        ArrayList<Pattern> patternArrayList = new ArrayList<Pattern>();
        for (String item : items) {
            patternArrayList.add(Pattern.compile(item));
        }/*from w w  w. j  ava  2s. c  o m*/
        whiteListProxies = (Pattern[]) patternArrayList.toArray(new Pattern[0]);
        logger.info("white listed ips: " + ipWhiteList);
    }
}

From source file:com.bstek.dorado.core.resource.GlobalResourceSearchPathRegister.java

public void afterPropertiesSet() throws Exception {
    if (StringUtils.isNotBlank(searchPath)) {
        globalResourceBundleManager.addSearchPath(searchPath);
    }/*from   ww w.  j  a  v  a  2 s.  com*/
    if (searchPaths != null && !searchPaths.isEmpty()) {
        globalResourceBundleManager.addSearchPaths(searchPaths);
    }
}

From source file:com.openshift.restclient.authorization.UnauthorizedException.java

@Override
public String getMessage() {
    String scheme = details.getScheme();
    if (StringUtils.isNotBlank(scheme)) {
        return String.format("%s You can access the server using %s authentication.", MSG_BASE, scheme);
    }//from  w w w. j a v  a2 s  . co m
    return StringUtils.defaultIfEmpty(details.getMessage(), super.getMessage());
}

From source file:ml.shifu.shifu.util.ExprAnalyzer.java

public String[] getVarsInExpr() {
    char[] processed = expr.toCharArray();
    removeQuota(processed, '\'');
    removeQuota(processed, '\"');
    removeNonValueChar(processed);//  ww w  . j ava2  s.  c  o  m
    removeObjMethod(processed);

    String formatStr = new String(processed);
    String[] vars = formatStr.split("[ ]");
    List<String> result = new ArrayList<String>();

    for (String var : vars) {
        String fvar = StringUtils.trimToEmpty(var);
        if (StringUtils.isNotBlank(fvar) && !"and".equals(fvar) && !"or".equals(fvar)
                && !StringUtils.isNumeric(fvar)) {
            result.add(fvar);
        }
    }
    return result.toArray(new String[0]);
}

From source file:fr.paris.lutece.plugins.directory.utils.UrlUtils.java

/**
 * Get the parameter map from a given url
 * @param strUrl the url/*from   ww  w . j av  a  2  s  .c  om*/
 * @return the parameter map
 */
public static Map<String, List<String>> getMapParametersFromUrl(String strUrl) {
    Map<String, List<String>> mapParameters = new HashMap<String, List<String>>();

    if (StringUtils.isNotBlank(strUrl) && (strUrl.indexOf(INTERROGATION_MARK) > 0)) {
        String strUrlParameters = strUrl.substring(strUrl.indexOf(INTERROGATION_MARK) + 1);
        String[] listParameters = strUrlParameters.split(AMPERSAND);

        if ((listParameters != null) && (listParameters.length > 0)) {
            for (String strParameter : listParameters) {
                String[] parameter = strParameter.split(EQUAL);

                if ((parameter != null) && (parameter.length == 2)) {
                    List<String> listParameterValues = mapParameters.get(parameter[0]);

                    if ((listParameterValues != null) && !listParameterValues.isEmpty()) {
                        listParameterValues.add(parameter[1]);
                    } else {
                        listParameterValues = new ArrayList<String>();
                        listParameterValues.add(parameter[1]);
                        mapParameters.put(parameter[0], listParameterValues);
                    }
                }
            }
        }
    }

    return mapParameters;
}

From source file:com.marvelution.hudson.plugins.apiv2.cache.activity.ActivityCachePredicates.java

public static Predicate<ActivityCache> relatesToUsers(final String[] usernames) {
    List<Predicate<ActivityCache>> predicates = Lists.newArrayList();
    for (final String username : usernames) {
        if (StringUtils.isNotBlank(username)) {
            predicates.add(relatesToUser(username));
        }/*w w  w.j a v a 2 s  . c  o  m*/
    }
    return Predicates.or(predicates);
}

From source file:com.pinterest.secor.parser.TimestampedMessageParser.java

public TimestampedMessageParser(SecorConfig config) {
    super(config);

    String partitionDateFormat = config.getPartitionDateFormat();
    if (StringUtils.isNotBlank(partitionDateFormat)) {
        mPartitionFormat = new SimpleDateFormat(partitionDateFormat);
    } else {/*from   w w w.j a  v a  2  s .co m*/
        mPartitionFormat = new SimpleDateFormat("yyyy-MM-dd");
    }
    mPartitionFormat.setTimeZone(TimeZone.getTimeZone("UTC"));

    String partitionPrefix = config.getPartitionPrefix();
    if (partitionPrefix != null) {
        mPartitionPrefix = partitionPrefix;
    } else {
        mPartitionPrefix = "dt=";
    }
}

From source file:com.egt.core.jsf.component.AreaTexto.java

/**
 * {@inheritDoc}//w  ww. ja  v a2s .  c  o  m
 */
@Override
public String getToolTip() {
    String superstr = super.getToolTip();
    if (StringUtils.isNotBlank(superstr) && getValueExpression("toolTip") == null) {
        if (superstr.startsWith("BundleParametros.")) {
            int i = superstr.indexOf('.');
            String key = superstr.substring(i + 1);
            return BundleParametros.getToolTip(key);
        }
    }
    return superstr;
}

From source file:io.kodokojo.endpoint.BasicAuthenticator.java

@Override
public void handle(Request request, Response response) throws Exception {
    String authorization = request.headers("Authorization");
    if (StringUtils.isNotBlank(authorization) && authorization.startsWith("Basic ")) {
        String encoded = authorization.substring("Basic ".length());
        String decoded = new String(Base64.getDecoder().decode(encoded));
        String[] split = decoded.split(":");
        username = split[0];/*from   w w w .  java  2  s  . co  m*/
        password = split[1];
    } else if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Basic Authorization header not found.");
        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("List of Header of current request {}", StringUtils.join(request.headers(), ","));
            LOGGER.trace("List of attribute : {}", StringUtils.join(request.attributes(), ","));
            LOGGER.trace("List of params : {}", StringUtils.join(request.queryParams(), ","));
        }
    }
}