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

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

Introduction

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

Prototype

public static boolean isNotEmpty(final CharSequence cs) 

Source Link

Document

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

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

Usage

From source file:com.aistor.modules.sys.service.DictService.java

public Page<Dict> find(Page<Dict> page, Dict dict) {
    DetachedCriteria dc = dictDao.createDetachedCriteria();
    if (StringUtils.isNotEmpty(dict.getType())) {
        dc.add(Restrictions.eq("type", dict.getType()));
    }/*from  w  w  w. ja v a2 s .c  om*/
    if (StringUtils.isNotEmpty(dict.getDesciption())) {
        dc.add(Restrictions.like("desciption", "%" + dict.getDesciption() + "%"));
    }
    dc.add(Restrictions.eq("delFlag", Dict.DEL_FLAG_NORMAL));
    dc.addOrder(Order.asc("type")).addOrder(Order.asc("sort"));
    return dictDao.find(page, dc);
}

From source file:com.hybris.mobile.app.commerce.barcode.CommerceBarcodeCheckerFactory.java

@Override
public BarcodeChecker getBarcodeChecker(BarcodeData barcodeData) {

    BarcodeChecker barcodeChecker = null;

    // Identifying a product code
    String productCode = getProductCode(barcodeData.getData(), barcodeData.getFormat());

    if (StringUtils.isNotEmpty(productCode)) {
        barcodeChecker = new ProductDetailsBarcodeChecker(productCode);
    } else {/*from   w w w  .  j  a va  2  s  .  c  o m*/

        List<String> addToCart = RegexUtils.getAddToCart(barcodeData.getData());

        if (addToCart != null && !addToCart.isEmpty()) {

            int quantity = 1;

            if (addToCart.size() == 2 && StringUtils.isNotBlank(addToCart.get(1))) {
                quantity = Integer.parseInt(addToCart.get(1));
            }

            barcodeChecker = new AddToCartBarcodeChecker(addToCart.get(0), quantity);
        } else {
            // Identifying a order id
            String orderCode = RegexUtils.getOrderCode(barcodeData.getData());

            if (StringUtils.isNotEmpty(orderCode)) {
                barcodeChecker = new OrderDetailsBarcodeChecker(orderCode);
            }

        }

    }

    return barcodeChecker;
}

From source file:com.ec2box.manage.util.DSPool.java

/**
 * register the data source for H2 DB/*from   w w w  .j a  v  a  2s .  co m*/
 *
 * @return pooling database object
 */

private static PoolingDataSource registerDataSource() {

    // create a database connection
    String user = "ec2box";
    String password = "filepwd 0WJLnwhpA47EepT1A4drVnDn3vYRvJhpZi0sVdvN9SmlbKw";
    String connectionURI = "jdbc:h2:" + getDBPath() + "/ec2box;CIPHER=AES;";

    if (StringUtils.isNotEmpty(DB_OPTIONS)) {
        connectionURI = connectionURI + DB_OPTIONS;
    }

    String validationQuery = "select 1";

    try {
        Class.forName("org.h2.Driver");
    } catch (ClassNotFoundException ex) {
        log.error(ex.toString(), ex);
    }

    GenericObjectPool connectionPool = new GenericObjectPool(null);

    connectionPool.setMaxActive(MAX_ACTIVE);
    connectionPool.setTestOnBorrow(TEST_ON_BORROW);
    connectionPool.setMinIdle(MIN_IDLE);
    connectionPool.setMaxWait(MAX_WAIT);
    connectionPool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);

    ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(connectionURI, user, password);

    new PoolableConnectionFactory(connectionFactory, connectionPool, null, validationQuery, false, true);

    return new PoolingDataSource(connectionPool);

}

From source file:com.nridge.core.base.std.FilUtl.java

/**
 * Convenience method that determines if a path/file name exists in the
 * file system./*  w ww .j  ava2  s.  com*/
 * @param aPathFileName Path file name.
 * @return true if it exists and false otherwise
 */
static public boolean exists(String aPathFileName) {
    if (StringUtils.isNotEmpty(aPathFileName)) {
        File osFile = new File(aPathFileName);
        return osFile.exists();
    } else
        return false;
}

From source file:io.wcm.handler.link.markup.SimpleLinkMarkupBuilder.java

@Override
public boolean accepts(Link link) {
    return link.isValid() && StringUtils.isNotEmpty(link.getUrl());
}

From source file:com.glaf.report.job.ReportMailJob.java

public void execute(JobExecutionContext context) throws JobExecutionException {
    String taskId = (String) context.getJobDetail().getJobDataMap().get("taskId");
    if (StringUtils.isNotEmpty(taskId)) {
        boolean success = false;
        int retry = 0;
        while (retry < 2 && !success) {
            try {
                retry++;/*  w  w w  . j  a  va 2 s . co m*/
                ReportFactory.createReportFile(taskId);
                ReportMailSender sender = new ReportMailSender();
                sender.sendMail(taskId);
                success = true;
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    }
}

From source file:iqq.app.bean.UIDiscuz.java

@Override
public String getName() {
    return StringUtils.isNotEmpty(discuz.getName()) ? discuz.getName() : "No Title";
}

From source file:com.baifendian.swordfish.common.job.struct.resource.ResourceInfo.java

/**
 * ??/*from  www  . j  ava2 s . co m*/
 *
 * @return
 */
@JsonIgnore
public String getSymbolicRes() {
    if (StringUtils.isNotEmpty(alias)) {
        return String.format("%s#%s", res, alias);
    }

    return res;
}

From source file:com.glaf.base.utils.ParamUtil.java

public static double getDouble(Map<String, Object> dataMap, String key) {
    double result = 0.0;
    Object value = dataMap.get(key);
    if (value != null && StringUtils.isNotEmpty(value.toString())) {
        if (value instanceof String) {
            String tmp = (String) value;
            result = Double.valueOf(tmp);
        } else if (value instanceof Integer) {
            Integer x = (Integer) value;
            result = x.doubleValue();//from   w ww  .  j a v  a2s. c o  m
        } else if (value instanceof Long) {
            Long x = (Long) value;
            result = x.doubleValue();
        } else if (value instanceof Double) {
            Double x = (Double) value;
            result = x.doubleValue();
        }
    }
    return result;
}

From source file:de.micromata.genome.gwiki.plugin.forum_1_0.GWikiForumTrackReadContainer.java

public GWikiForumTrackReadContainer(String data) {
    if (StringUtils.isNotEmpty(data) == true) {
        int idx = data.indexOf(';');
        if (idx != -1) {
            String ts = data.substring(0, idx);
            data = data.substring(idx + 1);
            try {
                lastRead = GWikiProps.parseTimeStamp(ts).getTime();
            } catch (Exception ex) {
                ; // nothing
                lastRead = new Date().getTime();
            }//  w  w  w  .  j a  v a2 s.  co m
            List<String> pl = Converter.parseStringTokens(data, ",", false);
            readedPages.addAll(pl);
        }
    }
}