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

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

Introduction

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

Prototype

public static boolean isNotEmpty(String str) 

Source Link

Document

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

Usage

From source file:com.bstek.dorado.view.widget.HtmlContainerOutputter.java

@Override
public void output(Object object, OutputContext context) throws Exception {
    HtmlContainer htmlContainer = (HtmlContainer) object;
    if (StringUtils.isNotEmpty(htmlContainer.getContentFile())) {
        String calloutId = "html_" + context.getCalloutId();
        context.addCalloutHtml(htmlContainer, calloutId);

        StringBuffer script = new StringBuffer();
        script.append("self.assignDom(document.getElementById(\"").append(calloutId).append("\"));");

        htmlContainer.addClientEventListener("onCreate", new DefaultClientEvent(script.toString()));
    }// w  ww .  j  ava2s. co m
    super.output(object, context);
}

From source file:com.bosscs.spark.commons.utils.AnnotationUtils.java

/**
 * Returns the field name as known by the datastore. If the provided field object DeepField annotation
 * specifies the fieldName property, the value of this property will be returned, otherwise the java field name
 * will be returned./*from  www .  j  a  v a2 s.  c  o m*/
 *
 * @param field the Field object associated to the property for which we want to resolve the name.
 * @return the field name.
 */
public static String deepFieldName(Field field) {

    HadoopField annotation = field.getAnnotation(HadoopField.class);
    if (StringUtils.isNotEmpty(annotation.fieldName())) {
        return annotation.fieldName();
    } else {
        return field.getName();
    }
}

From source file:com.liferay.faces.maven.CopyTask.java

public static void copyDirectory(File source, File destination, String includes, String excludes,
        boolean overwrite, boolean preserveLastModified) {

    Copy copy = new Copy();

    FileSet fileSet = new FileSet();

    fileSet.setDir(source);// ww w.  java  2s.  co  m

    if (StringUtils.isNotEmpty(excludes)) {
        fileSet.setExcludes(excludes);
    }

    if (StringUtils.isNotEmpty(includes)) {
        fileSet.setIncludes(includes);
    }

    copy.addFileset(fileSet);

    copy.setOverwrite(overwrite);
    copy.setPreserveLastModified(preserveLastModified);
    copy.setProject(AntUtil.getProject());
    copy.setTodir(destination);

    copy.execute();
}

From source file:me.smoe.adar.zookeeper.zookeeper.Zookeeper.java

public static ZooKeeper getClient(String scheme, byte[] auth) throws Exception {
    CountDownLatch latch = new CountDownLatch(1);

    ZooKeeper zooKeeper = new ZooKeeper(CONNECT, 5000, (e) -> {
        latch.countDown();//  w  ww.ja va2  s.  c  om
    });

    latch.await();

    if (StringUtils.isNotEmpty(scheme) && auth != null) {
        zooKeeper.addAuthInfo(scheme, auth);
    }

    return zooKeeper;
}

From source file:com.intel.databackend.datasources.hbase.DataFormatterTest.java

@Test
public void Invoke_DataFormatter_zeroPrefixedTimestamp() {
    String timestamp = DataFormatter.zeroPrefixedTimestamp(new Date().getTime());
    assert StringUtils.isNotEmpty(timestamp);
    assert timestamp.length() == 13;
}

From source file:com.dp2345.template.method.CurrencyMethod.java

@SuppressWarnings("rawtypes")
public Object exec(List arguments) throws TemplateModelException {
    if (arguments != null && !arguments.isEmpty() && arguments.get(0) != null
            && StringUtils.isNotEmpty(arguments.get(0).toString())) {
        boolean showSign = false;
        boolean showUnit = false;
        if (arguments.size() == 2) {
            if (arguments.get(1) != null) {
                showSign = Boolean.valueOf(arguments.get(1).toString());
            }// www .j  ava 2 s  . co m
        } else if (arguments.size() > 2) {
            if (arguments.get(1) != null) {
                showSign = Boolean.valueOf(arguments.get(1).toString());
            }
            if (arguments.get(2) != null) {
                showUnit = Boolean.valueOf(arguments.get(2).toString());
            }
        }
        Setting setting = SettingUtils.get();
        BigDecimal amount = new BigDecimal(arguments.get(0).toString());
        String price = setting.setScale(amount).toString();
        if (showSign) {
            price = setting.getCurrencySign() + price;
        }
        if (showUnit) {
            price += setting.getCurrencyUnit();
        }
        return new SimpleScalar(price);
    }
    return null;
}

From source file:com.sammyun.template.method.CurrencyMethod.java

@SuppressWarnings("rawtypes")
public Object exec(List arguments) throws TemplateModelException {
    if (arguments != null && !arguments.isEmpty() && arguments.get(0) != null
            && StringUtils.isNotEmpty(arguments.get(0).toString())) {
        boolean showSign = false;
        boolean showUnit = false;
        if (arguments.size() == 2) {
            if (arguments.get(1) != null) {
                showSign = Boolean.valueOf(arguments.get(1).toString());
            }// w  w  w .j  a v  a2  s.c om
        } else if (arguments.size() > 2) {
            if (arguments.get(1) != null) {
                showSign = Boolean.valueOf(arguments.get(1).toString());
            }
            if (arguments.get(2) != null) {
                showUnit = Boolean.valueOf(arguments.get(2).toString());
            }
        }
        // Setting setting = SettingUtils.get();
        // BigDecimal amount = new BigDecimal(arguments.get(0).toString());
        /**
         String price = setting.setScale(amount).toString();
         if (showSign)
         {
        price = setting.getCurrencySign() + price;
         }
         if (showUnit)
         {
        price += setting.getCurrencyUnit();
         }**/
        return new SimpleScalar("0");
    }
    return null;
}

From source file:com.griddynamics.genesis.notification.utils.ConfigReaderUtils.java

public static Integer getIntParameter(java.util.Map<String, String> config, String paramName, int maxValue) {
    String paramValue = config.get(paramName);
    if (StringUtils.isNotEmpty(paramValue) && StringUtils.isNumeric(paramValue)) {
        try {/*  w  ww.  java2s  . c om*/
            int i = Integer.parseInt(paramValue);
            if (i > maxValue) {
                throw new IllegalArgumentException(String.format("%s is too big: %s", paramName, paramValue));
            }
            return i;
        } catch (NumberFormatException e) {
            throw new IllegalArgumentException(String.format("%s is is too big: %s", paramName, paramValue));
        }
    } else {
        throw new IllegalArgumentException(
                paramName + String.format("%s is not a number: '%s'", paramName, paramValue));
    }
}

From source file:com.testritegroup.ec.core.category.strategies.impl.ECPHotSellProductFindStrategyMock.java

public List<ProductModel> getBrandProductsByBrandCode(String brandCode) {

    if (StringUtils.isNotEmpty(brandCode)) {

        final FlexibleSearchQuery fQuery = new FlexibleSearchQuery(SQL);
        fQuery.addQueryParameter("code", brandCode);
        return getEcpBrandDao().getECPBrandProductsByQuery(fQuery);

    }//from w  w w. j a va 2  s  .  c  om

    return new ArrayList<ProductModel>(0);
}

From source file:com.pureinfo.srm.product.action.Product3indexDuplicateAction.java

public ActionForward beforeExecution() throws PureException {
    m_sProduct0Ids = request.getParameter("product0Ids");

    if (StringUtils.isNotEmpty(m_sProduct0Ids)) {
        logger.debug("************************" + m_sProduct0Ids);
        productIds = m_sProduct0Ids.split(",");
        //            for(int i = 0; i<productIds.length;i++){
        //                logger.debug("productids["+i+"]"+productIds[i]+"\n");
        //            }
    }/*from   ww w  .  j av  a 2  s  .c o  m*/
    return super.beforeExecution();
}