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.duckling.probe.ui.permission.ProbePermissionChecker.java
public void setAdminUsers(String adminUserString) { adminUsers = new HashSet<String>(); if (adminUserString != null) { String[] users = adminUserString.split(":"); for (String user : users) { if (StringUtils.isNotEmpty(user)) { adminUsers.add(user);/*from w w w .java2s . c o m*/ } } } }
From source file:com.dp2345.interceptor.ListInterceptor.java
@Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { if (modelAndView != null && modelAndView.isReference()) { String viewName = modelAndView.getViewName(); if (StringUtils.startsWith(viewName, REDIRECT_VIEW_NAME_PREFIX)) { String listQuery = WebUtils.getCookie(request, LIST_QUERY_COOKIE_NAME); if (StringUtils.isNotEmpty(listQuery)) { if (StringUtils.startsWith(listQuery, "?")) { listQuery = listQuery.substring(1); }/*w w w. j a va 2s. co m*/ if (StringUtils.contains(viewName, "?")) { modelAndView.setViewName(viewName + "&" + listQuery); } else { modelAndView.setViewName(viewName + "?" + listQuery); } WebUtils.removeCookie(request, response, LIST_QUERY_COOKIE_NAME); } } } }
From source file:de.hybris.platform.acceleratorstorefrontcommons.forms.validation.GuestRegisterValidator.java
@Override public void validate(final Object object, final Errors errors) { final GuestRegisterForm guestRegisterForm = (GuestRegisterForm) object; final String newPasswd = guestRegisterForm.getPwd(); final String checkPasswd = guestRegisterForm.getCheckPwd(); if (StringUtils.isNotEmpty(newPasswd) && StringUtils.isNotEmpty(checkPasswd) && !StringUtils.equals(newPasswd, checkPasswd)) { errors.rejectValue(CHECK_PWD, "validation.checkPwd.equals"); } else {// w w w . j a v a2 s. c o m if (StringUtils.isEmpty(newPasswd)) { errors.rejectValue("pwd", "register.pwd.invalid"); } else if (StringUtils.length(newPasswd) < 6 || StringUtils.length(newPasswd) > 255) { errors.rejectValue("pwd", "register.pwd.invalid"); } if (StringUtils.isEmpty(checkPasswd)) { errors.rejectValue(CHECK_PWD, "register.checkPwd.invalid"); } else if (StringUtils.length(checkPasswd) < 6 || StringUtils.length(checkPasswd) > 255) { errors.rejectValue(CHECK_PWD, "register.checkPwd.invalid"); } } }
From source file:com.jaspersoft.jasperserver.war.cascade.handlers.converters.LongDataConverter.java
@Override public Long stringToValue(String rawData) throws JSValidationException { return StringUtils.isNotEmpty(rawData) ? Long.valueOf(rawData) : null; }
From source file:com.pinterest.clusterservice.aws.AwsManagerImpl.java
public AwsManagerImpl(AwsConfigManager configManager) { if (StringUtils.isNotEmpty(configManager.getId()) && StringUtils.isNotEmpty(configManager.getKey())) { AWSCredentials awsCredentials = new BasicAWSCredentials(configManager.getId(), configManager.getKey()); this.ec2Client = new AmazonEC2Client(awsCredentials); } else {//from ww w . jav a2s .c om LOG.debug( "AWS credential is missing for creating AWS client. Assuming to use role for authentication."); this.ec2Client = new AmazonEC2Client(); } }
From source file:net.shopxx.service.impl.ParameterValueServiceImpl.java
public void filter(List<ParameterValue> parameterValues) { CollectionUtils.filter(parameterValues, new Predicate() { public boolean evaluate(Object object) { ParameterValue parameterValue = (ParameterValue) object; if (parameterValue == null || StringUtils.isEmpty(parameterValue.getGroup())) { return false; }/*from ww w.jav a 2 s .c om*/ CollectionUtils.filter(parameterValue.getEntries(), new Predicate() { private Set<String> set = new HashSet<String>(); public boolean evaluate(Object object) { ParameterValue.Entry entry = (ParameterValue.Entry) object; return entry != null && StringUtils.isNotEmpty(entry.getName()) && StringUtils.isNotEmpty(entry.getValue()) && set.add(entry.getName()); } }); return CollectionUtils.isNotEmpty(parameterValue.getEntries()); } }); }
From source file:com.jaspersoft.jasperserver.war.cascade.handlers.converters.ShortDataConverter.java
@Override public Short stringToValue(String rawData) throws JSValidationException { return StringUtils.isNotEmpty(rawData) ? Short.parseShort(rawData) : null; }
From source file:ignitr.couchbase.discovery.ConfigDiscoveryStrategy.java
@Override public List<String> discoverClusterNodes() { String propertyValue = DynamicPropertyFactory.getInstance().getStringProperty(PROP_CONFIG_NODES, null) .get();/* w w w .ja v a2s.c om*/ if (StringUtils.isNotEmpty(propertyValue)) { return Lists.transform(Arrays.asList(propertyValue.split(",")), new Function<String, String>() { @Nullable @Override public String apply(String input) { return input.trim(); } }); } else { throw new IgnitrCouchbaseException(String.format( "Discovery strategy 'config' specified, but no nodes were " + "configured in '%s' property!", PROP_CONFIG_NODES)); } }
From source file:com.mmj.app.lucene.solr.utils.BaseSolrQueryConvert.java
public static SolrQuery createSuggestQuery(SuggestQuery query) { SolrQuery solrQuery = new SolrQuery(); StringBuilder sb = new StringBuilder(); sb.append("suggest:").append(query.getPrefix()).append("*"); solrQuery.setQuery(sb.toString());//from ww w. j ava 2 s .co m solrQuery.addField(query.getField()); if (StringUtils.isNotEmpty(query.getSortFiled())) { solrQuery.addSort(query.getSortFiled(), SolrQuery.ORDER.desc); } solrQuery.setStart(0); solrQuery.setRows(100); return solrQuery; }
From source file:kina.utils.CassandraUtils.java
/** * Returns the field name as known by the datastore. If the provided field object Field annotation * specifies the fieldName property, the value of this property will be returned, otherwise the java field name * will be returned./*w w w.ja v a2 s.c o m*/ * * @param field the Field object associated to the property for which we want to resolve the name. * @return the field name. */ public static String kinaFieldName(java.lang.reflect.Field field) { Field fieldAnnotation = field.getAnnotation(Field.class); Key genericKeyAnnotation = field.getAnnotation(Key.class); PartitionKey partitionKeyAnnotation = field.getAnnotation(PartitionKey.class); ClusterKey clusterKeyAnnotation = field.getAnnotation(ClusterKey.class); String fieldName = null; if (fieldAnnotation != null) { fieldName = fieldAnnotation.fieldName(); } else if (genericKeyAnnotation != null) { fieldName = genericKeyAnnotation.fieldName(); } else if (partitionKeyAnnotation != null) { fieldName = partitionKeyAnnotation.fieldName(); } else if (clusterKeyAnnotation != null) { fieldName = clusterKeyAnnotation.fieldName(); } if (StringUtils.isNotEmpty(fieldName)) { return fieldName; } else { return field.getName(); } }