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:io.sidecar.query.Query.java

public Query(String stream, List<Arg> args) {

    Preconditions.checkArgument(StringUtils.isNotBlank(stream));
    Preconditions.checkArgument(CharMatcher.WHITESPACE.matchesNoneOf(stream));
    this.stream = stream;

    this.args = CollectionUtils.filterNulls(args);
}

From source file:net.di2e.ecdr.commons.query.cache.QueryRequestCache.java

public boolean isQueryIdUnique(String id) {
    boolean unique = true;
    if (StringUtils.isNotBlank(id)) {
        if (cache.containsKey(id)) {
            unique = false;//from  w  ww .  jav a 2 s  .  co m
        } else {
            cache.put(id, Boolean.TRUE);
        }
    }
    return unique;
}

From source file:com.adobe.acs.commons.quickly.results.impl.lists.AbstractAccessibleResults.java

public final List<Result> getResults(final ResourceResolver resourceResolver) {
    List<Result> results = new ArrayList<Result>();

    for (Result result : getResults()) {
        if (StringUtils.isNotBlank(result.getPath()) || resourceResolver.resolve(result.getPath()) != null) {
            results.add(result);//from w  w w. j av  a 2 s.  c om
        }
    }

    return results;
}

From source file:com.digitalpebble.storm.crawler.filtering.URLFilters.java

/**
 * Loads and configure the URLFilters based on the storm config if there is
 * one otherwise returns an empty URLFilter.
 **///w ww.j ava  2  s.co m
public static URLFilters fromConf(Map stormConf) {

    String urlconfigfile = ConfUtils.getString(stormConf, "urlfilters.config.file");
    if (StringUtils.isNotBlank(urlconfigfile)) {
        try {
            return new URLFilters(stormConf, urlconfigfile);
        } catch (IOException e) {
            String message = "Exception caught while loading the URLFilters from " + urlconfigfile;
            LOG.error(message);
            throw new RuntimeException(message, e);
        }
    }

    return URLFilters.emptyURLFilters;
}

From source file:net.bulletin.pdi.xero.step.support.Helpers.java

/**
 * <p>If the value is provided then this method will augment the supplied URL by adding on the
 * query to the URL.</p>/*from  w  w  w .  jav  a 2  s .  c  om*/
 */

public static StringBuilder appendUrlQuery(StringBuilder url, String key, String value) {
    if (null == url || 0 == url.length()) {
        throw new IllegalArgumentException("the supplied url may not be empty.");
    }

    if (StringUtils.isEmpty(key)) {
        throw new IllegalArgumentException("the supplied query key may not be empty.");
    }

    if (StringUtils.isNotBlank(value)) {

        url.append(-1 == url.indexOf("?") ? '?' : '&');
        url.append(key);
        url.append("=");

        try {
            url.append(URLEncoder.encode(value, CharEncoding.UTF_8));
        } catch (UnsupportedEncodingException uee) {
            throw new IllegalStateException("the encoding must be supported; " + CharEncoding.UTF_8);
        }
    }

    return url;
}

From source file:ar.com.zauber.commons.xmpp.message.XMPPNotificationAddress.java

/** @param jid  jabber user id */
public XMPPNotificationAddress(final String jid) {
    Validate.isTrue(StringUtils.isNotBlank(jid));

    this.jid = jid;
}

From source file:com.iadams.sonarqube.puppet.Puppet.java

private static String[] filterEmptyStrings(String[] stringArray) {
    List<String> nonEmptyStrings = Lists.newArrayList();
    for (String string : stringArray) {
        if (StringUtils.isNotBlank(string.trim())) {
            nonEmptyStrings.add(string.trim());
        }/*from   w  ww.  j  a  v  a 2 s  . c om*/
    }
    return nonEmptyStrings.toArray(new String[nonEmptyStrings.size()]);
}

From source file:bazaar4idea.ui.BzrCurrentBranchStatus.java

public void setCurrentBranch(String branch) {
    Object[] params1 = new Object[] { branch };
    String statusText = StringUtils.isNotBlank(branch)
            ? BzrBundle.message("bzr4intellij.status.currentBranch.text", params1)
            : "";

    Object[] params = new Object[] {};
    String toolTipText = StringUtils.isNotBlank(branch)
            ? BzrBundle.message("bzr4intellij.status.currentBranch.description", params)
            : "";

    setVisible(StringUtils.isNotBlank(branch));
    setText(statusText);//w  ww.j av a2 s.com
    setToolTipText(toolTipText);
}

From source file:net.di2e.ecdr.search.transform.atom.response.security.SecurityMarkingParser.java

public static Metacard addSecurityToMetacard(Metacard metacard, Entry entry) {
    HashMap<String, List<String>> securityProps = new HashMap<String, List<String>>();
    CDRMetacard metacardImpl = new CDRMetacard(metacard);
    List<QName> attributes = entry.getAttributes();
    if (attributes != null) {
        String metacardSecurityNamespace = null;
        for (QName qName : attributes) {
            String namespace = qName.getNamespaceURI();
            if (NAMESPACES.contains(namespace)) {
                String value = entry.getAttributeValue(qName);
                if (StringUtils.isNotBlank(value)) {
                    securityProps.put(qName.getLocalPart(), getValues(value));
                    if (metacardSecurityNamespace == null) {
                        metacardSecurityNamespace = namespace;
                    }/*w  ww.ja  v  a2s.  c  om*/
                }
            }
        }
        if (!securityProps.isEmpty()) {
            metacardImpl.setSecurity(securityProps);
            metacardImpl.setAttribute(SecurityConstants.SECURITY_NAMESPACE, metacardSecurityNamespace);
        }
    }
    return metacardImpl;
}

From source file:cn.com.gps169.bos.service.impl.VehicleServiceImpl.java

@Override
public JSONObject queryVehicle(int pageNum, int pageRows, int status, String licensePlate) {
    VehicleExample example = new VehicleExample();
    Criteria criteria = example.or();/*  ww  w. jav  a 2  s . c  om*/
    if (status != 0) {
        criteria.andFleeStatusEqualTo((byte) status);
    }
    if (StringUtils.isNotBlank(licensePlate)) {
        criteria.andPlateNoLike("%" + licensePlate + "%");
    }
    int total = vehicleMapper.countByExample(example);
    example.setLimitStart(pageNum);
    example.setLimitEnd(pageRows);
    List<Vehicle> list = vehicleMapper.selectByExample(example);
    JSONArray result = new JSONArray();
    for (Vehicle v : list) {
        result.add(JSONObject.fromObject(v));
    }
    JSONObject vehicles = new JSONObject();
    vehicles.put("total", total);
    vehicles.put("rows", result);

    return vehicles;
}