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

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

Introduction

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

Prototype

public static boolean isNotBlank(final CharSequence cs) 

Source Link

Document

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

 StringUtils.isNotBlank(null)      = false StringUtils.isNotBlank("")        = false StringUtils.isNotBlank(" ")       = false StringUtils.isNotBlank("bob")     = true StringUtils.isNotBlank("  bob  ") = true 

Usage

From source file:com.u2apple.tool.filter.ExcludeFilter.java

@Override
public List<AndroidDeviceRanking> filter(List<AndroidDeviceRanking> androidDevices) {
    List<AndroidDeviceRanking> filteredDevices = new ArrayList<>();
    if (androidDevices != null) {
        androidDevices.stream().filter((device) -> (StringUtils.isNotBlank(device.getRoProductModel())
                && !rulesmatches(device)
                && !StringUtils.equalsIgnoreCase(device.getRoProductBrand(), device.getRoProductModel())))
                .forEach((device) -> {
                    filteredDevices.add(device);
                });/* w w w.  j av a  2  s  . c  o  m*/
    }
    return new CheckedDeviceFilter().filter(filteredDevices);
}

From source file:com.easyshop.common.web.filter.SetCommonDataFilter.java

public void init(FilterConfig filterConfig) throws ServletException {
    webBase = filterConfig.getInitParameter(Constants.WEB_BASE);

    String currentPageParamName = filterConfig.getInitParameter(Constants.CURRENT_PAGE_KEY);
    if (StringUtils.isNotBlank(currentPageParamName)) {
        currentPageParamKey = currentPageParamName;
    }/*from   w  ww  .  j  a va  2  s .  c  om*/

    String pageSizeParamName = filterConfig.getInitParameter(Constants.PAGE_SIZE_KEY);
    if (StringUtils.isNotBlank(pageSizeParamName)) {
        pageSizeParamKey = pageSizeParamName;
    }
}

From source file:edu.usu.sdl.openstorefront.core.sort.AttributeCodeArchViewComparator.java

@Override
public int compare(T o1, T o2) {
    //Codes should be numbers (Note the description includes the code so they should be sort as well)
    BigDecimal codeKey1;/*ww  w . j a va 2 s.c  o m*/
    BigDecimal codeKey2;

    if (o1.getSortOrder() != null && o2.getSortOrder() != null) {
        return o1.getSortOrder().compareTo(o2.getSortOrder());
    } else {
        if (StringUtils.isNotBlank(o1.getArchitectureCode())) {
            codeKey1 = StringProcessor.archtecureCodeToDecimal(o1.getArchitectureCode());
        } else {
            codeKey1 = StringProcessor.archtecureCodeToDecimal(o1.getCode());
        }

        if (StringUtils.isNotBlank(o2.getArchitectureCode())) {
            codeKey2 = StringProcessor.archtecureCodeToDecimal(o2.getArchitectureCode());
        } else {
            codeKey2 = StringProcessor.archtecureCodeToDecimal(o2.getCode());
        }

        int results = codeKey1.compareTo(codeKey2);
        if (results != 0) {
            return results;
        } else {
            return o1.getCode().compareTo(o2.getCode());
        }
    }
}

From source file:ca.uhn.fhir.rest.gclient.TokenCriterion.java

private String toValue(String theSystem, String theCode) {
    String system = ParameterUtil.escape(theSystem);
    String code = ParameterUtil.escape(theCode);
    String value;//ww w  .  ja v a 2s . com
    if (StringUtils.isNotBlank(system)) {
        value = system + "|" + StringUtils.defaultString(code);
    } else if (system == null) {
        value = StringUtils.defaultString(code);
    } else {
        value = "|" + StringUtils.defaultString(code);
    }
    return value;
}

From source file:com.thoughtworks.go.server.materials.postcommit.mercurial.MercurialPostCommitHookImplementer.java

@Override
public Set<Material> prune(Set<Material> materials, Map params) {
    HashSet<Material> prunedCollection = new HashSet<>();
    if (params.containsKey(REPO_URL_PARAM_KEY)) {
        String paramRepoUrl = (String) params.get(REPO_URL_PARAM_KEY);
        if (StringUtils.isNotBlank(paramRepoUrl)) {
            for (Material material : materials) {
                if (material instanceof HgMaterial && isUrlEqual(paramRepoUrl, (HgMaterial) material)) {
                    prunedCollection.add(material);
                }/*from ww w .  java 2  s  .  co  m*/
            }
        }
        return prunedCollection;
    } else {
        return prunedCollection;
    }
}

From source file:cn.guoyukun.spring.web.filter.DebugRequestAndResponseFilter.java

private void debugRequest(HttpServletRequest request) {
    log.debug("=====================request begin==========================");
    String uri = request.getRequestURI();
    String queryString = request.getQueryString();
    if (StringUtils.isNotBlank(queryString)) {
        uri = uri + "?" + queryString;
    }/*w  w  w.j  a  v a2 s . c o m*/
    log.debug("{}:{}", request.getMethod(), uri);
    log.debug("remote ip:{}  sessionId:{}  ", IpUtils.getIpAddr(request), request.getRequestedSessionId());
    log.debug("===header begin============================================");
    Enumeration<String> headerNames = request.getHeaderNames();
    while (headerNames.hasMoreElements()) {
        String name = headerNames.nextElement();
        String value = headersToString(request.getHeaders(name));
        log.debug("{}={}", name, value);
    }
    log.debug("===header   end============================================");
    log.debug("===parameter begin==========================================");
    Enumeration<String> parameterNames = request.getParameterNames();
    while (parameterNames.hasMoreElements()) {
        String name = parameterNames.nextElement();
        String value = StringUtils.join(request.getParameterValues(name), "||");
        log.debug("{}={}", name, value);
    }
    log.debug("===parameter   end==========================================");
    log.debug("=====================request   end==========================");
}

From source file:fr.mycellar.interfaces.web.security.CurrentUserService.java

/**
 * @return/*  w  ww.j  a  v a 2s .  c o m*/
 */
public User getCurrentUser() {
    User user = null;
    String email = getCurrentUserEmail();
    if (StringUtils.isNotBlank(email)) {
        user = userServiceFacade.getUserByEmail(email);
    }
    return user;
}

From source file:net.eledge.android.europeana.search.RecordController.java

public void readRecord(Activity activity, String id) {
    if (StringUtils.isNotBlank(id)) {
        if ((record != null) && StringUtils.equals(id, record.about)) {
            // don't load the same record twice but do notify listeners!;
            activity.runOnUiThread(new ListenerNotifier<>(listeners.values(), record));
            return;
        }//from   w  ww. ja va  2s  . co m
        record = null;
        currentRecordId = id;
        currentRecordSelected = false;
        if (mRecordTask != null) {
            mRecordTask.cancel(true);
        }
        mRecordTask = new RecordTask(activity);
        mRecordTask.execute(id);
    }
}

From source file:com.netflix.genie.web.data.repositories.jpa.specifications.JpaApplicationSpecs.java

/**
 * Get a specification using the specified parameters.
 *
 * @param name     The name of the application
 * @param user     The name of the user who created the application
 * @param statuses The status of the application
 * @param tags     The set of tags to search with
 * @param type     The type of applications to fine
 * @return A specification object used for querying
 *//*from   ww  w  .java2s . c  om*/
public static Specification<ApplicationEntity> find(@Nullable final String name, @Nullable final String user,
        @Nullable final Set<ApplicationStatus> statuses, @Nullable final Set<TagEntity> tags,
        @Nullable final String type) {
    return (final Root<ApplicationEntity> root, final CriteriaQuery<?> cq, final CriteriaBuilder cb) -> {
        final List<Predicate> predicates = new ArrayList<>();
        if (StringUtils.isNotBlank(name)) {
            predicates.add(JpaSpecificationUtils.getStringLikeOrEqualPredicate(cb,
                    root.get(ApplicationEntity_.name), name));
        }
        if (StringUtils.isNotBlank(user)) {
            predicates.add(JpaSpecificationUtils.getStringLikeOrEqualPredicate(cb,
                    root.get(ApplicationEntity_.user), user));
        }
        if (statuses != null && !statuses.isEmpty()) {
            predicates.add(
                    cb.or(statuses.stream().map(status -> cb.equal(root.get(ApplicationEntity_.status), status))
                            .toArray(Predicate[]::new)));
        }
        if (tags != null && !tags.isEmpty()) {
            final Join<ApplicationEntity, TagEntity> tagEntityJoin = root.join(ApplicationEntity_.tags);
            predicates.add(tagEntityJoin.in(tags));
            cq.groupBy(root.get(ApplicationEntity_.id));
            cq.having(cb.equal(cb.count(root.get(ApplicationEntity_.id)), tags.size()));
        }
        if (StringUtils.isNotBlank(type)) {
            predicates.add(JpaSpecificationUtils.getStringLikeOrEqualPredicate(cb,
                    root.get(ApplicationEntity_.type), type));
        }
        return cb.and(predicates.toArray(new Predicate[predicates.size()]));
    };
}

From source file:com.dtstack.jlogstash.assembly.CmdLineParams.java

public static int getFilterWork() {
    String number = line.getOptionValue("w");
    int works = StringUtils.isNotBlank(number) ? Integer.parseInt(number) : getInputBase();
    logger.warn("filter works:{}", String.valueOf(works));
    return works;
}