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:de.hasait.genesis.base.model.JAssignmentStatement.java

JAssignmentStatement(final @Nonnull String pTargetName, final @Nonnull AbstractJExpression pSourceExpression) {
    super();// ww w. j  a  v  a  2 s . c  o  m
    GenesisUtils.assertTrue(StringUtils.isNotEmpty(pTargetName));
    GenesisUtils.assertNotNull(pSourceExpression);

    _targetName = pTargetName;
    _sourceExpression = pSourceExpression;
}

From source file:efx.util.converter.DoubleStringConverter.java

@Override
protected Object cast(Object obj) {
    if (obj == null) {
        return null;
    }/*from www . ja v a  2  s .c om*/
    if (obj instanceof Double) {
        return obj.toString();
    } else if (obj instanceof String) {
        String strValue = String.valueOf(obj);
        if (StringUtils.isNotEmpty(strValue)) {
            return Double.parseDouble(strValue);
        }
    }
    return super.cast(obj);
}

From source file:efx.util.converter.IntegerStringConverter.java

@Override
protected Object cast(Object obj) {
    if (obj == null) {
        return null;
    }/*from w  w  w  .j a va2  s .c  o  m*/
    if (obj instanceof Integer) {
        return obj.toString();
    } else if (obj instanceof String) {
        String strValue = String.valueOf(obj);
        if (StringUtils.isNotEmpty(strValue)) {
            return Integer.parseInt(strValue);
        }
    }

    return super.cast(obj);
}

From source file:com.thruzero.applications.faces.support.model.SimpleNotificationModel.java

public SimpleNotificationModel(String message) {
    this(StringUtils.isNotEmpty(message), message);
}

From source file:com.baidu.broadcast.userdemo.repository.TypeDaoTest.java

@Test
public void test() {
    List<Type> typeList = dao.find(" from Type where parent_id = ?", 0L);
    JsonMapper mapper = new JsonMapper();
    String json = mapper.toJson(typeList);
    Assert.assertTrue(StringUtils.isNotEmpty(json));
    System.out.println(json);/*w  ww. j a  v a 2  s.  com*/
}

From source file:de.drippinger.serviceExtractor.pojo.RunParameter.java

public boolean hasSufficientData() {
    return StringUtils.isNotEmpty(database) //
            && StringUtils.isNotEmpty(databaseUser) //
            && StringUtils.isNotEmpty(pathToFlows) //
            && StringUtils.isNotEmpty(databasePassword);
}

From source file:com.keybox.manage.db.ProfileDB.java

/**
 * method to do order by based on the sorted set object for profiles
 * @return list of profiles//from w  w w .jav  a 2  s  .  c om
 */
public static SortedSet getProfileSet(SortedSet sortedSet) {

    ArrayList<Profile> profileList = new ArrayList<>();

    String orderBy = "";
    if (sortedSet.getOrderByField() != null && !sortedSet.getOrderByField().trim().equals("")) {
        orderBy = " order by " + sortedSet.getOrderByField() + " " + sortedSet.getOrderByDirection();
    }
    String sql = "select distinct p.* from  profiles p ";
    if (StringUtils.isNotEmpty(sortedSet.getFilterMap().get(FILTER_BY_SYSTEM))) {
        sql = sql + ", system_map m, system s where m.profile_id = p.id and m.system_id = s.id"
                + " and (lower(s.display_nm) like ? or lower(s.host) like ?)";
    } else if (StringUtils.isNotEmpty(sortedSet.getFilterMap().get(FILTER_BY_USER))) {
        sql = sql + ", user_map m, users u where m.profile_id = p.id and m.user_id = u.id"
                + " and (lower(u.first_nm) like ? or lower(u.last_nm) like ?"
                + " or lower(u.email) like ? or lower(u.username) like ?)";
    }
    sql = sql + orderBy;

    Connection con = null;
    try {
        con = DBUtils.getConn();
        PreparedStatement stmt = con.prepareStatement(sql);
        if (StringUtils.isNotEmpty(sortedSet.getFilterMap().get(FILTER_BY_SYSTEM))) {
            stmt.setString(1, "%" + sortedSet.getFilterMap().get(FILTER_BY_SYSTEM).toLowerCase() + "%");
            stmt.setString(2, "%" + sortedSet.getFilterMap().get(FILTER_BY_SYSTEM).toLowerCase() + "%");
        } else if (StringUtils.isNotEmpty(sortedSet.getFilterMap().get(FILTER_BY_USER))) {
            stmt.setString(1, "%" + sortedSet.getFilterMap().get(FILTER_BY_USER).toLowerCase() + "%");
            stmt.setString(2, "%" + sortedSet.getFilterMap().get(FILTER_BY_USER).toLowerCase() + "%");
            stmt.setString(3, "%" + sortedSet.getFilterMap().get(FILTER_BY_USER).toLowerCase() + "%");
            stmt.setString(4, "%" + sortedSet.getFilterMap().get(FILTER_BY_USER).toLowerCase() + "%");
        }
        ResultSet rs = stmt.executeQuery();

        while (rs.next()) {
            Profile profile = new Profile();
            profile.setId(rs.getLong("id"));
            profile.setNm(rs.getString("nm"));
            profile.setDesc(rs.getString("desc"));
            profileList.add(profile);

        }
        DBUtils.closeRs(rs);
        DBUtils.closeStmt(stmt);

    } catch (Exception e) {
        log.error(e.toString(), e);
    } finally {
        DBUtils.closeConn(con);
    }

    sortedSet.setItemList(profileList);
    return sortedSet;
}

From source file:com.glaf.core.el.ExpressionTools.java

public static String evaluate(String expression, Map<String, Object> params) {
    if (expression == null || params == null) {
        return expression;
    }//w  ww. ja v a2 s  . c o  m
    expression = StringTools.replaceIgnoreCase(expression, "${", "#{");
    StringBuffer sb = new StringBuffer(expression.length() + 1000);
    int begin = 0;
    int end = 0;
    boolean flag = false;
    for (int i = 0; i < expression.length(); i++) {
        if (expression.charAt(i) == '#' && expression.charAt(i + 1) == '{') {
            sb.append(expression.substring(end, i));
            begin = i + 2;
            flag = true;
        }
        if (flag && expression.charAt(i) == '}') {
            String temp = expression.substring(begin, i);
            String value = null;
            try {
                Object object = Mvel2ExpressionEvaluator.evaluate(temp, params);
                if (object != null) {
                    value = object.toString();
                }
            } catch (Exception ex) {
                // ex.printStackTrace();
            }
            if (StringUtils.isNotEmpty(value)) {
                sb.append(value);
                end = i + 1;
                flag = false;
            } else {
                sb.append("");
                end = i + 1;
                flag = false;
            }
        }
        if (i == expression.length() - 1) {
            sb.append(expression.substring(end, i + 1));
        }
    }
    return sb.toString();
}

From source file:de.micromata.genome.gwiki.controls.GWikiPageNotFound.java

public Object onInit() {
    if (StringUtils.isEmpty(getPageId()) == true) {
        setPageId((String) wikiContext.getRequestAttribute("NotFoundPageId"));
    }/*from w  w  w .j  av  a 2  s . c om*/
    if (StringUtils.isNotEmpty(getPageId()) == true) {
        if (wikiContext.getWikiWeb().getAuthorization().isAllowTo(wikiContext,
                GWikiAuthorizationRights.GWIKI_CREATEPAGES.name()) == true) {
            allowCreatePage = true;
        }
    }

    return null;
}

From source file:com.streamsets.pipeline.stage.origin.jdbc.cdc.SchemaAndTable.java

public boolean isNotEmpty() {
    return StringUtils.isNotEmpty(this.schema) && StringUtils.isNotEmpty(this.table);
}