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.cloudera.nav.sdk.model.custom.MetaClassPackage.java

public static MetaClassPackage newPackage(String name) {
    Preconditions.checkArgument(StringUtils.isNotEmpty(name));
    MetaClassPackage pkg = new MetaClassPackage();
    pkg.setName(name);//  w  ww .ja v a 2 s . c o m
    return pkg;
}

From source file:com.cloudera.nav.sdk.model.custom.Namespace.java

public static Namespace newNamespace(String name) {
    Preconditions.checkArgument(StringUtils.isNotEmpty(name));
    Namespace ns = new Namespace();
    ns.setName(name);//from w ww . j a  v a 2  s.  c  o m
    return ns;
}

From source file:jp.primecloud.auto.ui.util.ViewMessages.java

/**
 * TODO: //w  w w  .  jav a 2 s .  co m
 *
 * @param code
 * @param additions
 * @return
 */
public static String getMessage(String code, Object... additions) {
    String pattern = ViewProperties.get(code);
    if (StringUtils.isNotEmpty(pattern)) {
        return MessageUtils.format(pattern, additions);
    }

    return MessageUtils.getMessage(code, additions);
}

From source file:com.cyclopsgroup.tornado.utils.ConfigurationUtils.java

/**
 * Get properties from given configuration node
 *
 * @param root Configuration node root/*ww w  .  jav  a 2  s  .  c  o m*/
 * @return Properties object
 * @throws ConfigurationException Illegal format of configuration
 */
public static Properties getProperties(Configuration root) throws ConfigurationException {
    Properties p = new Properties();
    Configuration[] confs = root.getChildren("property");
    for (int i = 0; i < confs.length; i++) {
        Configuration conf = confs[i];
        String name = conf.getAttribute("name");
        String value = conf.getValue(StringUtils.EMPTY);
        if (StringUtils.isNotEmpty(name)) {
            p.setProperty(name, value);
        }
    }
    return p;
}

From source file:com.brouwersystems.testing.SqlBatchManager.java

public static List<String> loadSqlCommands(String commandFileName) {
    if (commandFileName == null) {
        LOG.error("Missing filename");
        throw new IllegalArgumentException("Missing filename");
    }//from  ww w. ja va 2 s  .  c  om

    List<String> sqlCommands = new ArrayList<>();
    try (BufferedReader br = new BufferedReader(new FileReader(commandFileName))) {
        sqlCommands = new ArrayList<>();
        String sql = br.readLine();
        while (sql != null) {
            if (StringUtils.isNotEmpty(sql)) {
                sqlCommands.add(sql);
            }
            sql = br.readLine();
        }
    } catch (FileNotFoundException ex) {
        LOG.error("File " + commandFileName + " not found", ex);
    } catch (IOException ex) {
        LOG.error("IO error accessing file " + commandFileName, ex);
    }

    for (String sql : sqlCommands) {
        System.out.println("SQL: " + sql);
    }
    return sqlCommands;
}

From source file:com.bstek.dorado.core.io.ResourceUtils.java

/**
 * ???? '/'// w w  w  .j  a v a  2  s.c  o m
 */
public static String concatPath(String path1, String path2) {
    String result;
    if (StringUtils.isEmpty(path1)) {
        result = path2;
    } else {
        result = path1;
        if (StringUtils.isNotEmpty(path2)) {
            char c1 = path1.charAt(path1.length() - 1), c2 = path2.charAt(0);
            boolean b1 = (c1 == '\\' || c1 == '/'), b2 = (c2 == '\\' || c2 == '/');
            if (!b1 && !b2) {
                result += '/';
            } else if (b1 && b2) {
                path2 = path2.substring(1);
            }
            result += path2;
        }
    }
    return result;
}

From source file:com.photon.phresco.plugins.util.MojoUtil.java

public static final Map<String, String> getAllValues(Configuration config) {
    List<Parameter> parameters = config.getParameters().getParameter();
    Map<String, String> configValues = new HashMap<String, String>(parameters.size() * 2);
    for (Parameter parameter : parameters) {
        String value = parameter.getValue();
        if (StringUtils.isNotEmpty(value)) {
            String key = parameter.getKey();
            configValues.put(key, value);
        }//w  ww .j a  v  a 2s . c o  m
    }

    return configValues;
}

From source file:com.cloudera.nav.sdk.model.custom.MetaClass.java

public static MetaClass newClass(String packageName, String name) {
    Preconditions.checkArgument(StringUtils.isNotEmpty(packageName));
    Preconditions.checkArgument(StringUtils.isNotEmpty(name));
    MetaClass metaClass = new MetaClass();
    metaClass.setPackageName(packageName);
    metaClass.setName(name);/*from  w ww  . j av  a 2 s  .  c o  m*/
    return metaClass;
}

From source file:energy.usef.core.adapter.YodaTimeAdapter.java

/**
 * Transforms a String (xsd:dateTime) to a {@link LocalDateTime}.
 * /*from w w  w  . j a va2s  .c o  m*/
 * @param dateTimeString A String (xsd:dateTime)
 * @return {@link LocalDateTime}
 */
public static LocalDateTime parseDateTime(String dateTimeString) {
    if (StringUtils.isNotEmpty(dateTimeString)) {
        return new DateTime(dateTimeString).withZone(DateTimeZone.getDefault()).toLocalDateTime();
    }
    return null;
}

From source file:com.usefullc.platform.common.utils.CookieUtils.java

/**
 * cookie //from  ww  w.  j  a v  a 2  s  . co m
 * 
 * @param request
 * @param name
 * @param domain
 * @return
 */
public static Cookie getCookie(HttpServletRequest request, String name, String domain) {
    Cookie cookies[] = request.getCookies();
    if (cookies == null) {
        return null;
    }
    for (Cookie cookie : cookies) {
        String cookieName = cookie.getName();
        String cookieDomain = cookie.getDomain();
        if (!cookieName.equals(name)) {
            continue;
        }
        if (StringUtils.isNotEmpty(domain) && !cookieDomain.equals(domain)) {
            continue;
        }
        return cookie;
    }
    return null;
}