List of usage examples for org.apache.commons.lang3 StringUtils isNotBlank
public static boolean isNotBlank(final CharSequence cs)
Checks if a CharSequence is not empty (""), not null and not whitespace only.
StringUtils.isNotBlank(null) = false StringUtils.isNotBlank("") = false StringUtils.isNotBlank(" ") = false StringUtils.isNotBlank("bob") = true StringUtils.isNotBlank(" bob ") = true
From source file:com.cnten.platform.util.FileUtil.java
public static String getUUIDFileName(String fileName) { StringBuffer newName = new StringBuffer(); if (StringUtils.isNotBlank(fileName)) { newName.append(UUIDUtil.getUUID()); newName.append('.'); newName.append(getExtensionName(fileName)); }/* w ww .j a v a 2 s . c o m*/ return newName.toString(); }
From source file:com.alibaba.dubbo.qos.command.decoder.TelnetCommandDecoder.java
public static final CommandContext decode(String str) { CommandContext commandContext = null; if (StringUtils.isNotBlank(str)) { String[] array = str.split("(?<![\\\\]) "); if (array.length > 0) { String name = array[0]; String[] targetArgs = new String[array.length - 1]; System.arraycopy(array, 1, targetArgs, 0, array.length - 1); commandContext = CommandContextFactory.newInstance(name, targetArgs, false); commandContext.setOrginRequest(str); }//from ww w . ja v a 2s .c o m } return commandContext; }
From source file:com.netflix.dyno.contrib.consul.ConsulHelper.java
public static String findHost(HealthService healthService) { HealthService.Service service = healthService.getService(); HealthService.Node node = healthService.getNode(); if (StringUtils.isNotBlank(service.getAddress())) { return service.getAddress(); } else if (StringUtils.isNotBlank(node.getAddress())) { return node.getAddress(); }//from www . java 2 s. c o m return node.getNode(); }
From source file:com.yqboots.core.util.DBUtils.java
/** * Wildcard the string for DB query.// w w w .j a v a2s. c o m * * @param source source * @return the wildcard string */ public static String wildcard(final String source) { String result = WILDCARD_ALL; if (StringUtils.isNotBlank(source)) { result = WILDCARD_ALL + source + WILDCARD_ALL; } return result; }
From source file:controllers.api.v1.Tracking.java
public static Result addTrackingEvent() { ObjectNode result = Json.newObject(); String username = session("user"); ObjectNode json = Json.newObject();/*from w w w . jav a 2s . c o m*/ ArrayNode res = json.arrayNode(); JsonNode requestNode = request().body().asJson(); if (StringUtils.isNotBlank(username)) { String message = TrackingDAO.addTrackingEvent(requestNode, username); if (StringUtils.isBlank(message)) { result.put("status", "success"); return ok(result); } else { result.put("status", "failed"); result.put("message", message); return badRequest(result); } } else { result.put("status", "failed"); result.put("message", "User is not authenticated"); return unauthorized(result); } }
From source file:com.omnigon.aem.common.utils.url.SlingUrlBuilder.java
public static SlingUrlBuilder create(final String uri) { if (StringUtils.isNotBlank(uri)) { try {/*from ww w. j a v a 2 s .c o m*/ URI u = URLUtils.createURI(uri); String path = u.getPath(); if (u.isAbsolute() || StringUtils.isBlank(path)) { return new AbsoluteUrlBuilder(u.toASCIIString()); } else { if (!StringUtils.startsWith(path, "/")) { path = "/" + path; } return create(new PathInfo(path)); } } catch (Exception e) { LOG.error(e.getMessage(), e); } } return new NullUrlBuilder(); }
From source file:com.orange.ocara.ui.view.SiteItemView.java
private static String buildAddress(Site site) { StringBuilder result = new StringBuilder(); if (StringUtils.isNotBlank(site.getStreet())) { result.append(site.getStreet()); }//w w w . j a v a 2 s . co m if (site.getCode() != null) { result.append(' ').append(site.getCode()); } if (StringUtils.isNotBlank(site.getCity())) { result.append(' ').append(site.getCity()); } return result.toString(); }
From source file:com.dx.ss.plugins.ptree.utils.ClassloaderUtility.java
public static ClassLoader getCustomClassloader(String classpathEntry) { File file = null;/*from w ww . jav a 2 s.c o m*/ try { if (StringUtils.isNotBlank(classpathEntry)) { file = new File(classpathEntry); if (file.exists()) { ClassLoader parent = Thread.currentThread().getContextClassLoader(); URLClassLoader ucl = new URLClassLoader(new URL[] { file.toURI().toURL() }, parent); return ucl; } } } catch (MalformedURLException e) { e.printStackTrace(); } return null; }
From source file:com.haulmont.cuba.web.gui.FileUploadTypesHelper.java
public static String convertToMIME(String types, String originSeparator, String separator) { return StringUtils.isNotBlank(types) ? convertToMIME(types.split(originSeparator), separator) : null; }
From source file:edu.usu.sdl.openstorefront.util.TranslateUtil.java
public static <T extends LookupEntity> String translate(Class<T> lookupClass, String code) { String translated = code;/* w w w. ja v a 2 s . c o m*/ if (StringUtils.isNotBlank(code)) { ServiceProxy serviceProxy = new ServiceProxy(); LookupEntity lookupEntity = serviceProxy.getLookupService().getLookupEnity(lookupClass, code); if (lookupEntity != null) { translated = lookupEntity.getDescription(); } else { log.warning("Unable to find: " + code + " in lookup: " + lookupClass.getName()); } } return translated; }