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:cn.vlabs.duckling.vwb.service.dml.html2dml.ParseHtmlEmbed.java
@Override public void printAttribute(Element e, Html2DmlEngine html2dmlengine) { PrintWriter writer = html2dmlengine.getM_out(); for (String attr : ATTRIBUTE_NAMES) { String attrValue = e.getAttributeValue(attr); if (StringUtils.isNotBlank(attrValue)) { writer.printf(" %s=\"%s\"", attr, e.getAttributeValue(attr)); }//from w w w. j av a2 s. c o m } String srcValue = e.getAttributeValue(ATTRIBUTE_SRC); if (srcValue != null) { String dmlSrc = html2dmlengine.findAttachment(srcValue, html2dmlengine); if (dmlSrc != null) { writer.printf(" %s=\"%s\"", "dmlsrc", dmlSrc); } else { writer.printf(" %s=\"%s\"", "src", srcValue); } } }
From source file:com.adanac.module.blog.dynamic.UserCenter.java
@Override public void putCustomData(Map<String, Object> data, HttpServletRequest request, HttpServletResponse response) { Map<String, String> user = AbstractServlet.getUser(request); if (user == null) { throw new RuntimeException(); }/*w w w . j a va 2 s.c o m*/ if (StringUtils.isNotBlank(user.get("province"))) { Integer provinceId = DaoFactory.getDao(ProvinceDao.class).getId(user.get("province")); data.put("cities", DaoFactory.getDao(CityDao.class).getCities(provinceId)); } data.put("provinces", DaoFactory.getDao(ProvinceDao.class).getProvinces()); data.put("languages", DaoFactory.getDao(DictionaryDao.class).getDictionariesByType("LANG")); }
From source file:com.exxonmobile.ace.hybris.storefront.servlets.util.FilterSpringUtil.java
/** * The same as {@link #getSpringBean(HttpServletRequest, String, Class)} but uses ServletContext as the first * parameter. It might be used in places, where HttpServletRequest is not available, but ServletContext is. *//* ww w . j av a 2s. c o m*/ public static <T> T getSpringBean(final ServletContext servletContext, final String beanName, final Class<T> beanClass) { T ret = null; final WebApplicationContext appContext = WebApplicationContextUtils .getRequiredWebApplicationContext(servletContext); if (StringUtils.isNotBlank(beanName)) { try { ret = (T) appContext.getBean(beanName); } catch (final NoSuchBeanDefinitionException ex) { LOG.warn("No bean found with the specified name. Trying to resolve bean using type..."); } } if (ret == null) { if (beanClass == null) { LOG.warn("No bean could be resolved. Reason: No type specified."); } else { final Map<String, T> beansOfType = appContext.getBeansOfType(beanClass); if (beansOfType != null && !beansOfType.isEmpty()) { if (beansOfType.size() > 1) { LOG.warn("More than one matching bean found of type " + beanClass.getSimpleName() + ". Returning the first one found."); } ret = beansOfType.values().iterator().next(); } } } return ret; }
From source file:eu.eidas.auth.engine.metadata.MetadataUtil.java
/** * @since 1.1/*from w w w .ja v a 2s. c om*/ */ @Nullable public static String getAssertionConsumerUrlFromMetadata(@Nonnull MetadataFetcherI metadataFetcher, @Nonnull MetadataSignerI metadataSigner, @Nonnull ILightRequest authnRequest) throws EIDASSAMLEngineException { String issuer = authnRequest.getIssuer(); if (StringUtils.isNotBlank(issuer)) { // This would fetch the metadata only once! EntityDescriptor entityDescriptor = metadataFetcher.getEntityDescriptor(issuer, metadataSigner); SPSSODescriptor spSsoDescriptor = getSPSSODescriptor(entityDescriptor); return getAssertionConsumerUrl(spSsoDescriptor); } return null; }
From source file:adalid.core.wrappers.EntityWrapper.java
public String getValidDefaultCollectionLabel(EntityReference reference) { String string = reference == null ? null : _entity.getDefaultCollectionLabel(reference); return StringUtils.isNotBlank(string) ? string : getValidDefaultCollectionLabel(); }
From source file:ips1ap101.lib.core.db.util.Exporter.java
private static int getLimiteFilasFuncionSelect(String archivo, UsuarioActual usuario) { Integer limiteFilas = Utils.getReportRowsLimit(archivo, FORMATO_GUARDAR, usuario); if (limiteFilas != null) { return limiteFilas; }/*from w ww . j a v a 2s. co m*/ String string = BaseBundle.getLimiteFilasFuncionExport(archivo); int limite = StringUtils.isNotBlank(string) && StringUtils.isNumeric(string) ? Integer.valueOf(string) : -1; return limite < 0 ? LIMITE_FILAS_FUNCION_SELECT : limite; }
From source file:com.wwinsoft.modules.utils.reflection.ConvertUtils.java
public static Set convertSeparatorStringToSet(final String separatorString, final String separator, Class<?> toType) {/* w w w . j ava 2 s . c o m*/ Set set = new HashSet(); String[] split = separatorString.split(separator); for (String s : split) { if (StringUtils.isNotBlank(s)) { set.add(convertStringToObject(s, toType)); } } return set; }
From source file:de.hybris.platform.commercewebservicescommons.errors.converters.WebserviceExceptionConverter.java
@Override public void populate(final Object o, final List<ErrorWsDTO> webserviceErrorList) { final WebserviceException ex = (WebserviceException) o; final ErrorWsDTO error = createTargetElement(); if (StringUtils.isNotEmpty(ex.getSubject())) { error.setSubject(ex.getSubject()); if (StringUtils.isNotEmpty(ex.getSubjectType())) { error.setSubjectType(ex.getSubjectType()); }/*from ww w . j a v a 2s . c om*/ } if (StringUtils.isNotEmpty(ex.getReason())) { error.setReason(ex.getReason()); } if (StringUtils.isNotBlank(ex.getType())) { error.setType(ex.getType()); } error.setMessage(ex.getMessage()); webserviceErrorList.add(error); }
From source file:com.jsmartframework.web.config.FileVersion.java
public void setVersion(String version) { if (StringUtils.isNotBlank(version)) { this.version = version; } }
From source file:com.selfsoft.business.dao.impl.TbBusinessBalanceDaoImpl.java
public List<Object> getTotalCostPriceBusinessBalance(BusinessBalanceCostPriceVo businessBalanceCostPriceVo) { StringBuilder sql = new StringBuilder(); sql.append("select sum(sod.quantity*pi.cost_price) cost_price from tb_business_balance bb,"); sql.append(/*from w w w . jav a 2 s. c om*/ " tm_stock_out so, tm_stockout_detail sod , tb_part_info pi ,tb_fix_entrust fe,tm_user u , tb_car_info ci"); sql.append( " where so.id = sod.stockout_id and sod.balance_id = bb.id and fe.entrust_code = so.trust_bill and ci.id = fe.car_info_id"); sql.append( " and pi.id = sod.partinfo_id and u.id = fe.user_id and sod.balance_id is not null and so.is_confirm not in (8000)"); if (businessBalanceCostPriceVo != null) { if (StringUtils.isNotBlank(businessBalanceCostPriceVo.getBalanceCode())) { sql.append(" and bb.balance_code like '%").append(businessBalanceCostPriceVo.getBalanceCode()) .append("%'"); } if (StringUtils.isNotBlank(businessBalanceCostPriceVo.getEntrustCode())) { sql.append(" and fe.entrust_code like '%").append(businessBalanceCostPriceVo.getEntrustCode()) .append("%'"); } if (StringUtils.isNotBlank(businessBalanceCostPriceVo.getBeginBalanceDeadTime())) { sql.append(" and convert(varchar(10),bb.banance_date,120) >= '") .append(businessBalanceCostPriceVo.getBeginBalanceDeadTime()).append("'"); } if (StringUtils.isNotBlank(businessBalanceCostPriceVo.getEndBalanceDeadTime())) { sql.append(" and convert(varchar(10),bb.banance_date,120) <= '") .append(businessBalanceCostPriceVo.getEndBalanceDeadTime()).append("'"); } if (businessBalanceCostPriceVo.getUserId() != null) { sql.append(" and bb.user_id = ").append(businessBalanceCostPriceVo.getUserId()); } if (StringUtils.isNotBlank(businessBalanceCostPriceVo.getLicenseCode())) { sql.append(" and ci.license_code like '%").append(businessBalanceCostPriceVo.getLicenseCode()) .append("%'"); } if (businessBalanceCostPriceVo.getServiceUserId() != null) { sql.append(" and fe.user_id=" + businessBalanceCostPriceVo.getServiceUserId()); } } sql.append(" union all "); sql.append( " select sum(m.part_quantity*pi.cost_price) wx_cp from tb_business_balance bb,tb_maintain_part_content m , "); sql.append(" tb_part_info pi ,tb_fix_entrust fe,tm_user u , tb_car_info ci "); sql.append( " where m.balance_id = bb.id and m.entrust_id = fe.id and pi.id = m.part_id and ci.id = fe.car_info_id and "); sql.append(" u.id = fe.user_id and m.balance_id is not null and m.is_confirm not in (8000) "); if (businessBalanceCostPriceVo != null) { if (StringUtils.isNotBlank(businessBalanceCostPriceVo.getBalanceCode())) { sql.append(" and bb.balance_code like '%").append(businessBalanceCostPriceVo.getBalanceCode()) .append("%'"); } if (StringUtils.isNotBlank(businessBalanceCostPriceVo.getEntrustCode())) { sql.append(" and fe.entrust_code like '%").append(businessBalanceCostPriceVo.getEntrustCode()) .append("%'"); } if (StringUtils.isNotBlank(businessBalanceCostPriceVo.getBeginBalanceDeadTime())) { sql.append(" and convert(varchar(10),bb.banance_date,120) >= '") .append(businessBalanceCostPriceVo.getBeginBalanceDeadTime()).append("'"); } if (StringUtils.isNotBlank(businessBalanceCostPriceVo.getEndBalanceDeadTime())) { sql.append(" and convert(varchar(10),bb.banance_date,120) <= '") .append(businessBalanceCostPriceVo.getEndBalanceDeadTime()).append("'"); } if (businessBalanceCostPriceVo.getUserId() != null) { sql.append(" and bb.user_id = ").append(businessBalanceCostPriceVo.getUserId()); } if (StringUtils.isNotBlank(businessBalanceCostPriceVo.getLicenseCode())) { sql.append(" and ci.license_code like '%").append(businessBalanceCostPriceVo.getLicenseCode()) .append("%'"); } if (businessBalanceCostPriceVo.getServiceUserId() != null) { sql.append(" and fe.user_id=" + businessBalanceCostPriceVo.getServiceUserId()); } } sql.append(" union all "); sql.append(" select sum(sod.quantity*pi.cost_price) cost_price"); sql.append(" from tm_stock_out so, tm_stockout_detail sod , tb_part_info pi"); sql.append( " where so.id = sod.stockout_id and pi.id = sod.partinfo_id and sod.balance_id is not null and so.is_confirm not in (8000) and so.trust_bill = ''"); List result = this.findByOriginSql(sql.toString(), null); return result; }