List of usage examples for org.apache.commons.lang StringUtils isNotBlank
public static boolean isNotBlank(String str)
Checks if a String is not empty (""), not null and not whitespace only.
From source file:adalid.core.wrappers.EntityWrapper.java
public String getValidDefaultLabel(EntityReference reference) { String string = reference == null ? null : _entity.getDefaultLabel(reference); return StringUtils.isNotBlank(string) ? string : getValidDefaultLabel(); }
From source file:com.lhhy.framework.utils.SecurityCodeUtils.java
public static String encode(String str) { StringBuilder builder = new StringBuilder(); if (StringUtils.isNotBlank(str)) { for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); int charindex = charIndex(_srcArray, c); if (charindex != -1) { builder.append(_tmpArray[charindex]); } else { int doIndex = charIndex(_doArray, c); if (doIndex != -1) builder.append(_endoArray[doIndex]); else builder.append(c);//from w ww . j ava 2 s . c o m } } } return builder.toString(); }
From source file:com.shopzilla.api.client.helper.CredentialFactory.java
public CredentialFactory() { String id = StringUtils.isNotBlank(System.getenv("PUBLISHER_ID")) ? System.getenv("PUBLISHER_ID") : System.getProperty("PUBLISHER_ID"); String key = StringUtils.isNotBlank(System.getenv("PUBLISHER_API_KEY")) ? System.getenv("PUBLISHER_API_KEY") : System.getProperty("PUBLISHER_API_KEY"); if (key != null && id != null) { this.publisherId = id; this.publisherApiKey = key; } else {//from w w w . ja v a 2 s.c om throw new IllegalArgumentException( "No API credentials were provided! " + "Please set PUBLISHER_ID and PUBLISHER_API_KEY "); } }
From source file:com.spotify.docker.CompositeImageName.java
/** * An image name can be a plain image name or in the composite format <name>:<tag> and * this factory method makes sure that we get the plain image name as well as all the desired tags * for an image, including any composite tag. *//*from ww w . ja v a 2s . com*/ static CompositeImageName create(final String imageName, final List<String> imageTags) throws MojoExecutionException { final String name = StringUtils.substringBeforeLast(imageName, ":"); if (StringUtils.isBlank(name)) { throw new MojoExecutionException("imageName not set!"); } final List<String> tags = new ArrayList<>(); final String tag = StringUtils.substringAfterLast(imageName, ":"); if (StringUtils.isNotBlank(tag)) { tags.add(tag); } if (imageTags != null) { tags.addAll(imageTags); } if (tags.size() == 0) { throw new MojoExecutionException("No tag included in imageName and no imageTags set!"); } return new CompositeImageName(name, tags); }
From source file:com.thalesgroup.hudson.plugins.klocwork.util.KloMetricUtil.java
public static int convert(String threshold) { if (isValid(threshold)) { if (StringUtils.isNotBlank(threshold)) { try { return Integer.valueOf(threshold); } catch (NumberFormatException exception) { // not valid }/*from w ww . j a v a 2s .c o m*/ } } throw new IllegalArgumentException("Not a parsable integer value >= 0: " + threshold); }
From source file:com.enonic.cms.core.content.contentdata.custom.KeywordsDataEntry.java
public KeywordsDataEntry addKeyword(final String value) { if (StringUtils.isNotBlank(value)) { keywords.add(value);//from w w w. j a v a 2 s . c om } return this; }
From source file:com.siberhus.web.ckeditor.utils.PathUtils.java
public static String getBaseUrl(HttpServletRequest request, String space, String type) { CkeditorConfig config = CkeditorConfigurationHolder.config(); String baseUrl = null;/* w ww.j ava 2 s.c o m*/ baseUrl = StringUtils.isNotBlank(config.upload().basedir(request)) ? config.upload().basedir(request) : CkeditorTagConfig.DEFAULT_BASEDIR; baseUrl = PathUtils.checkSlashes(baseUrl, "L- R-", true); String spaceDir = PathUtils.sanitizePath(space); if (StringUtils.isNotBlank(spaceDir)) { baseUrl += "/" + spaceDir; } String typeName = PathUtils.sanitizePath(StringUtils.lowerCase(type)); if (StringUtils.isNotBlank(typeName)) { typeName = WordUtils.capitalize(typeName); baseUrl += "/" + typeName; } return baseUrl; }
From source file:com.surfs.storage.web.controller.storage.LoginController.java
@RequestMapping(method = RequestMethod.POST, value = "/login.do") public ModelAndView login(HttpServletRequest request, User user) { String pwd = WebUtils.getPropertiesMessage(request, user.getUserName(), null); if (StringUtils.isNotBlank(pwd) && pwd.equals(user.getPassWord())) { //request.getSession().setAttribute("user", user); //request.getSession().setAttribute("dataCenter", user.getDataCenter()); return new ModelAndView("redirect:/storage/showGlobleProperties.do"); }/*from w ww.j a v a2 s . c o m*/ return new ModelAndView("redirect:/home.jsp?status=login_error"); }
From source file:io.sidecar.org.Developer.java
private Developer(Builder b) { checkArgument(StringUtils.isNotBlank(b.username)); this.username = b.username; checkArgument(StringUtils.isNotBlank(b.password)); this.password = b.password; this.developerId = checkNotNull(b.developerId); this.active = b.active; }
From source file:com.googlecode.markuputils.MarkupUtils.java
public static String openElement(String name) { StringBuilder buffer = new StringBuilder(); if (StringUtils.isNotBlank(name)) { buffer.append("<").append(name).append(">"); }//from ww w . j ava 2 s . c om return buffer.toString(); }