List of usage examples for org.apache.commons.lang StringUtils isNotEmpty
public static boolean isNotEmpty(String str)
Checks if a String is not empty ("") and not null.
From source file:net.bible.service.download.FakeSwordBookFactory.java
/** create dummy Book object for file available for download from repo *//*from w w w .j a v a 2s. c o m*/ public static SwordBook createFakeRepoBook(String module, String conf, String repo) throws IOException, BookException { SwordBookMetaData sbmd = createRepoSBMD(module, conf); if (StringUtils.isNotEmpty(repo)) { sbmd.setProperty(DownloadManager.REPOSITORY_KEY, repo); } SwordBook extraBook = new SwordBook(sbmd, new NullBackend()); return extraBook; }
From source file:com.photon.phresco.eshop.utils.Utility.java
public static String getJSONP(String callback, String json) { if (StringUtils.isNotEmpty(callback)) { String jsonp = callback + "(" + json + ")"; return jsonp; } else {/*from ww w.j av a2 s. co m*/ return json; } }
From source file:net.duckling.ddl.util.ResourceQueryKeywordUtil.java
public static String getKeyWordString(String keyword, Map<String, Object> param, String ableAlies) { if (StringUtils.isNotEmpty(keyword)) { if (keyword.endsWith("ddoc")) { if (keyword.length() == "ddoc".length() || ".ddoc".equalsIgnoreCase(keyword)) { String s = " and " + ableAlies + "item_type='" + LynxConstants.TYPE_PAGE + "' "; return s; } else { String s = " and " + ableAlies + "item_type='" + LynxConstants.TYPE_PAGE + "' and lcase(" + ableAlies + "title) like :keyWord "; String u = keyword.substring(0, keyword.lastIndexOf(".ddoc")); setMap("keyWord", u, param); return s; }//from w w w . j av a 2 s. c om } else { String s = " and (lcase(" + ableAlies + "title) like :keyWord or lcase(" + ableAlies + "last_editor_name) like :keyWord or lcase(" + ableAlies + "tags) like :keyWord) "; setMap("keyWord", keyword, param); return s; } } else { return ""; } }
From source file:com.microsoft.alm.plugin.idea.settings.ServerContextSecrets.java
public static AuthenticationInfo load(final ServerContextStore.Key key) throws IOException { final String authInfoSerialized = readPassword(key); AuthenticationInfo info = null;// www.j a v a 2 s . co m if (StringUtils.isNotEmpty(authInfoSerialized)) { info = JsonHelper.read(authInfoSerialized, AuthenticationInfo.class); } if (info == null) { forget(key); logger.warn("getServerContextSecrets: info was null for key: ", key); return null; } return info; }
From source file:com.netflix.spinnaker.clouddriver.kubernetes.provider.KubernetesModelUtil.java
public static long translateTime(String time) { try {//w w w .ja v a 2 s .co m return StringUtils.isNotEmpty(time) ? (new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX").parse(time)).getTime() : 0; } catch (ParseException e) { log.error("Failed to parse kubernetes timestamp", e); return 0; } }
From source file:com.alifi.jgenerator.utils.StringFormatUtils.java
/** * /*from w w w . j av a 2s . c o m*/ * * @param str * @return */ @SuppressWarnings("deprecation") public static String hump(String str) { if (StringUtils.isNotEmpty(str)) { String s = str.replaceAll("_", " "); s = StringUtils.capitaliseAllWords(str); return s.replaceAll(" ", ""); } return null; }
From source file:com.github.dbourdette.otto.web.util.SizeInBytes.java
public static SizeInBytes fromValueNullSafe(String value) { if (StringUtils.isNotEmpty(value)) { return SizeInBytes.fromValue(value); } else {/*from w w w . j a va2 s. c o m*/ return null; } }
From source file:com.baifendian.swordfish.execserver.job.mr.HadoopJarArgsUtil.java
/** * ? <p>//ww w . jav a 2 s . c om * * @return ? */ public static List<String> buildArgs(MrParam param) { List<String> args = new ArrayList<>(); // jar if (StringUtils.isNotEmpty(param.getMainJar().getRes())) { args.add(param.getMainJar().getRes()); } // class if (StringUtils.isNotEmpty(param.getMainClass())) { args.add(param.getMainClass()); } // -D if (param.getDArgs() != null && !param.getDArgs().isEmpty()) { for (String darg : param.getDArgs()) { args.add(String.format("%s%s", HadoopJarArgsConst.D, darg)); } } // -libjars if (param.getLibJars() != null && !param.getLibJars().isEmpty()) { args.add(HadoopJarArgsConst.JARS); args.add(StringUtils.join(param.getLibJars().stream().map(p -> p.getSymbolicRes()).toArray(), ",")); } // -files if (param.getFiles() != null && !param.getFiles().isEmpty()) { args.add(HadoopJarArgsConst.FILES); args.add(StringUtils.join(param.getFiles().stream().map(p -> p.getSymbolicRes()).toArray(), ",")); } // -archives if (param.getArchives() != null && !param.getArchives().isEmpty()) { args.add(HadoopJarArgsConst.ARCHIVES); args.add(StringUtils.join(param.getArchives().stream().map(p -> p.getSymbolicRes()).toArray(), ",")); } // if (StringUtils.isNotEmpty(param.getQueue())) { args.add(String.format("%s%s=%s", HadoopJarArgsConst.D, HadoopJarArgsConst.QUEUE, param.getQueue())); } // ? if (StringUtils.isNotEmpty(param.getArgs())) { args.add(param.getArgs()); } return args; }
From source file:net.duckling.ddl.web.sync.ContextUtil.java
public static Context retrieveContext(HttpServletRequest req) { String device = req.getParameter("device"); String token = req.getParameter("access_token"); String tidStr = req.getParameter("tid"); int tid = 0;//from ww w . j a v a 2 s . c om if (StringUtils.isNotEmpty(tidStr)) { tid = Integer.parseInt(tidStr); } Context ctx = new Context(); ctx.setDevice(device); ctx.setTid(tid); ctx.setToken(token); ctx.setUid(VWBSession.getCurrentUid(req)); return ctx; }
From source file:com.ms.commons.message.utils.MessageUtil.java
/** * /*from www. j a va 2s .c om*/ * * @param array * @return */ public static String[] removeEmptyElement(String[] array) { if (array == null) { return new String[0]; } int removeCount = 0; for (int i = 0; i < array.length; i++) { if (StringUtils.isEmpty(array[i])) { removeCount += 1; } } if (removeCount > 0) { String[] newArray = new String[array.length - removeCount]; int index = 0; for (int i = 0; i < array.length; i++) { if (StringUtils.isNotEmpty(array[i])) { newArray[index] = array[i]; index += 1; } } return newArray; } return array; }