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:com.etrip.service.Impl.SupplierServiceImpl.java

@Override
public ResultMap search(String name, Integer page, Integer rows) {
    Assert.notNull(page, "page is null");
    Assert.notNull(rows, "rows is null");
    ResultMap resultMap = new ResultMap();
    FilterMap filterMap = FilterMap.init();
    filterMap.eq("deleted", 0);
    if (StringUtils.isNotBlank(name)) {
        filterMap.like("supplierName", "%" + name + "%");
    }/* www.  j a v a2 s  .  c  o m*/
    Page queryPage = bSuppilierRepository.queryPage(filterMap, null, page, rows);
    int count = Integer.parseInt(queryPage.getPageInfo().get("pageCount").toString());
    int totalCount = Integer.parseInt(queryPage.getPageInfo().get("totalCount").toString());
    if (totalCount % count != 0) {
        queryPage.getPageInfo().put("totalPage", totalCount / count + 1);
    }
    resultMap.success();
    resultMap.put(queryPage);
    return resultMap;
}

From source file:com.digitalpebble.storm.crawler.parse.ParseFilters.java

/**
 * Loads and configure the ParseFilters based on the storm config if there
 * is one otherwise returns an emptyParseFilter.
 **///w  w w .j  a v a  2  s . c  o m
@SuppressWarnings("rawtypes")
public static ParseFilters fromConf(Map stormConf) {
    String parseconfigfile = ConfUtils.getString(stormConf, "parsefilters.config.file");
    if (StringUtils.isNotBlank(parseconfigfile)) {
        try {
            return new ParseFilters(stormConf, parseconfigfile);
        } catch (IOException e) {
            String message = "Exception caught while loading the URLFilters from " + parseconfigfile;
            LOG.error(message);
            throw new RuntimeException(message, e);
        }
    }

    return ParseFilters.emptyParseFilter;
}

From source file:gov.nih.nci.cabig.caaers.web.listener.InvestigatorModificationEventListener.java

@Override
public void preProcess(ApplicationEvent event) {
    super.preProcess(event);
    Investigator inv = (Investigator) event.getSource();
    String userName = inv.getLoginId();
    if (StringUtils.isNotBlank(userName)) {
        caaersSecurityFacade.clearUserCache(userName);
    }//from ww w  . j a v a2 s  .  c o  m

}

From source file:com.googlecode.jtiger.modules.ecside.table.cell.DateCell.java

protected String getCellValue(TableModel model, Column column) {
    String value = column.getPropertyValueAsString();
    if (StringUtils.isNotBlank(value)) {
        Locale locale = model.getLocale();
        value = ExtremeUtils.formatDate(column.getParse(), column.getFormat(), column.getPropertyValue(),
                locale);// w  w w . j a v  a  2 s. co  m
    }

    return value;
}

From source file:gov.nih.nci.cabig.caaers.web.listener.ResearchStaffModificationEventListener.java

@Override
public void preProcess(ApplicationEvent event) {
    super.preProcess(event);
    ResearchStaff rs = (ResearchStaff) event.getSource();
    String userName = rs.getLoginId();
    if (StringUtils.isNotBlank(userName)) {
        caaersSecurityFacade.clearUserCache(userName);
    }//from   w  w w. j a  v  a 2s . c o m

}

From source file:com.alibaba.doris.cli.CommandLine.java

public String getValue(String key) {
    String value = valueMap.get(key);

    if (StringUtils.isNotBlank(value)) {
        return value;
    }/*from  w w  w.j  a  v  a2s .c om*/

    Option option = getOption(key);
    if (null != option) {
        return option.getDefaultValue();
    }

    return null;
}

From source file:net.handle.servlet.AcceptsHeader.java

/**
 * <p>//  ww w.j a  va  2s.  c o  m
 * Initialize with the raw header string.
 * </p>
 *
 * @param header the raw header string
 */
public AcceptsHeader(String header) {
    if (StringUtils.isNotBlank(header)) {
        // split entries, which are comma-separated
        String[] rawEntries = header.split(",");
        for (String rawEntry : rawEntries) {
            rawEntry = rawEntry.trim();
            AcceptsHeaderEntry entry = new AcceptsHeaderEntry();
            // split entry into type & params, which are semi-colon
            // separated
            String[] parts = rawEntry.split(";");
            for (String part : parts) {
                part = part.trim();
                if (part.split("=").length > 1) {
                    // it's a param
                    String[] rawParam = part.split("=");
                    if (rawParam.length == 2) {
                        String key = rawParam[0].trim();
                        String value = rawParam[1].trim();
                        if (key.equals("q")) {
                            entry.setQ(new Float(value));
                        } else if (key.equals("mxb")) {
                            entry.setMxb(new Float(value));
                        } else if (key.equals("mxs")) {
                            entry.setMxs(new Float(value));
                        }
                    }
                } else {
                    // it's the type
                    Mimetype mimetype = Mimetype.forName(part);

                    if (mimetype != null) {
                        entry.setType(mimetype);
                    }
                }
            }

            if (entry.getType() != null) {
                entries.add(entry);
            }
        }
    }
}

From source file:com.wwinsoft.modules.utils.reflection.ConvertUtils.java

public static List convertSeparatorStringToList(final String separatorString, final String separator,
        Class<?> toType) {/*from  w w  w.j a va  2 s  .  co  m*/
    List list = new ArrayList();
    String[] split = separatorString.split(separator);
    for (String s : split) {
        if (StringUtils.isNotBlank(s)) {
            list.add(convertStringToObject(s, toType));
        }
    }
    return list;
}

From source file:com.mmj.app.lucene.search.utils.CustomSolrQueryConvert.java

public static SolrQuery to(TopicSearchQuery query) {
    // ?/*from www  .ja va 2  s . c o m*/
    List<String> params = new ArrayList<String>();
    // ?
    if (Argument.isNotEmpty(query.getWordList())) {
        String q = StringUtils.join(query.getWordList().toArray(new String[0]), " ");
        if (StringUtils.isNotBlank(q)) {
            if (q.length() == 1 || StringFormatter.matchsRegex(q, "^[a-zA-Z]+$")
                    || StringFormatter.matchsRegex(q, "^\\d+$")) {
                params.add("topicSearch:*" + q + "*");
            } else {
                params.add(filterQuery(q));
            }
        }
    }
    // 
    List<String> fiter = new ArrayList<String>();
    TimeSearchEnum timeSearch = query.getTime();
    if (timeSearch != null && timeSearch.getStartTimeLong() != null) {
        fiter.add(String.format("topicGmtCreate:[%s TO *]", timeSearch.getStartTimeLong()));
    }
    // ?
    SortSearchEnum sortSearch = query.getSort();
    if (sortSearch != null && StringUtils.isNotEmpty(sortSearch.getSort())) {
        query.setSortFiled(sortSearch.getSort());
    }
    return createSearchQuery(params, fiter, query, "/browse");
}

From source file:io.github.jeddict.collaborate.issues.ExceptionUtils.java

public static void printStackTrace(String errorMessage, final Throwable t, final ModelerFile file) {
    t.printStackTrace();//from www.j  a  va2s . c o  m
    if (StringUtils.isBlank(errorMessage)) {
        errorMessage = t.getMessage();

        if (StringUtils.isBlank(errorMessage)) {
            if (t.getCause() != null && StringUtils.isNotBlank(t.getCause().getMessage())) {
                errorMessage = t.getCause().getMessage();
            } else if (t.getStackTrace().length > 0) {
                errorMessage = t.getStackTrace()[0].toString();
            }
        }
    }
    final String message = errorMessage;
    LOG.log(Level.ALL, errorMessage, t);
    String content = file != null ? file.getContent() : "";
    SwingUtilities.invokeLater(() -> {
        ExceptionReporterPanel exceptionReporterPanel = new ExceptionReporterPanel(message, t, content);
        exceptionReporterPanel.setVisible(true);
    });
}