List of usage examples for org.apache.commons.lang StringUtils isEmpty
public static boolean isEmpty(String str)
Checks if a String is empty ("") or null.
From source file:com.mmj.app.biz.cons.TabTypeEnum.java
/** * ?name?/* w w w . j a v a 2s.c om*/ */ public static TabTypeEnum getEnum(String name) { if (StringUtils.isEmpty(name)) { return null; } for (TabTypeEnum current : values()) { if (StringUtils.equalsIgnoreCase(current.name, name)) { return current; } } return null; }
From source file:com.infullmobile.jenkins.plugin.restrictedregister.mail.data.Footer.java
public boolean isEmpty() { return StringUtils.isEmpty(content); }
From source file:com.jsqlboxdemo.dispatcher.Dispatcher.java
public static void dispach(PageContext pageContext) throws Exception { HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); String uri = StringUtils.substringBefore(request.getRequestURI(), "."); String contextPath = request.getContextPath(); if (!StringUtils.isEmpty(contextPath)) uri = StringUtils.substringAfter(uri, contextPath); if (StringUtils.isEmpty(uri) || "/".equals(uri)) uri = "/home"; String[] paths = StringUtils.split(uri, "/"); String[] pathParams;/*from w ww . j av a 2 s. c o m*/ String resource = null; String operation = null; if (paths.length >= 2) {// /team/add/100... resource = paths[0]; operation = paths[1]; pathParams = new String[paths.length - 2]; for (int i = 2; i < paths.length; i++) pathParams[i - 2] = paths[i]; } else { // /home_default resource = paths[0]; pathParams = new String[0]; } if (operation == null) operation = "default"; StringBuilder controller = new StringBuilder("com.jsqlboxdemo.controller.").append(resource).append("$") .append(resource).append("_").append(operation); if ("POST".equals(request.getMethod())) controller.append("_post"); WebBox box; try { Class boxClass = Class.forName(controller.toString()); box = BeanBox.getPrototypeBean(boxClass); } catch (Exception e) { throw new ClassNotFoundException("There is no WebBox classs '" + controller + "' found."); } request.setAttribute("pathParams", pathParams); box.show(pageContext); }
From source file:com.github.trask.sandbox.saucelabs.SauceLabsCredentials.java
public static SauceLabsCredentials fromSystemEnv() { String username = System.getenv("SAUCE_LABS_USERNAME"); String apiKey = System.getenv("SAUCE_LABS_API_KEY"); if (StringUtils.isEmpty(username)) { throw new IllegalStateException("Missing environment variable SAUCE_LABS_USERNAME"); }/* ww w .j a v a 2s. c o m*/ if (StringUtils.isEmpty(apiKey)) { throw new IllegalStateException("Missing environment variable SAUCE_LABS_API_KEY"); } return new SauceLabsCredentials(username, apiKey); }
From source file:com.hangum.tadpole.engine.initialize.ApplicationLicenseInitialize.java
public static void load() { if (ApplicationArgumentUtils.isInitialize) return;/* ww w.j a v a 2s. co m*/ try { String strLicenseInfo = ApplicationArgumentUtils.initDBServer(); if (!StringUtils.isEmpty(strLicenseInfo)) { logger.info("******** [0] Start enterprise version "); LicenseExtensionHandler linceseHandler = new LicenseExtensionHandler(); linceseHandler.license(strLicenseInfo); } else { File fileExist = new File(TDB_License_FILE); if (fileExist.isFile()) { logger.info("******** [1] Start enterprise version "); LicenseExtensionHandler linceseHandler = new LicenseExtensionHandler(); linceseHandler.license(fileExist); } } ApplicationArgumentUtils.isInitialize = true; } catch (Exception e) { logger.error("System initialize exception", e); MessageDialog.openError(null, "Error", "License validation exception\n" + e.getMessage()); System.exit(0); } }
From source file:com.github.dbourdette.glass.job.util.JobDataMapUtils.java
public static JobDataMap fromProperties(String dataMap) { if (StringUtils.isEmpty(dataMap)) { return new JobDataMap(); }//from w ww .j a v a2s . c o m Properties props = new Properties(); try { props.load(new StringReader(dataMap)); } catch (IOException e) { throw new RuntimeException(e); } JobDataMap map = new JobDataMap(); for (Object key : props.keySet()) { map.put(key, props.getProperty((String) key)); } return map; }
From source file:com.nec.harvest.util.StringUtil.java
/** * Check a string is empty or null// w w w. j av a 2 s . c o m * * @param text * @return */ public static String value(String text) { return StringUtils.isEmpty(text) ? StringUtils.EMPTY : text; }
From source file:com.zb.app.biz.cons.ColumnCatEnum.java
public static ColumnCatEnum getAction(String name) { if (StringUtils.isEmpty(name)) { return null; }/*from w w w . j a v a 2 s . c o m*/ for (ColumnCatEnum type : values()) { if (StringUtils.equals(name, type.name)) return type; } return null; }
From source file:com.envision.envservice.common.util.UserUtil.java
public static void sortByName(List<UserBo> users) { Collections.sort(users, new Comparator<UserBo>() { @Override/* www . j a va2 s . c om*/ public int compare(UserBo u1, UserBo u2) { if (StringUtils.isEmpty(u1.getName())) { return 1; } if (StringUtils.isEmpty(u2.getName())) { return -1; } String u1Name = u1.getName(); if (u1Name.contains(".")) { String[] names = u1Name.split("\\."); u1Name = names[1] + names[0]; } String u2Name = u2.getName(); if (u2Name.contains(".")) { String[] names = u2Name.split("\\."); u2Name = names[1] + names[0]; } return u1Name.compareTo(u2Name); } }); }
From source file:com.cloudera.nav.plugin.model.HiveIdGenerator.java
public static String generateColumnId(String sourceId, String databaseName, String tableName, String columnName) {/*w ww . ja v a2s. com*/ Preconditions.checkArgument( !StringUtils.isEmpty(sourceId) && !StringUtils.isEmpty(databaseName) && !StringUtils.isEmpty(tableName) && !StringUtils.isEmpty(columnName), "SourceId, database name, table name, and column name must be " + "supplied to generate Hive column identity"); return MD5IdGenerator.generateIdentity(sourceId, databaseName, tableName, columnName); }