List of usage examples for org.apache.commons.lang3 StringUtils trim
public static String trim(final String str)
Removes control characters (char <= 32) from both ends of this String, handling null by returning null .
The String is trimmed using String#trim() .
From source file:com.dominion.salud.pedicom.negocio.repositories.impl.PedidosRepositoryImpl.java
public List<Pedidos> findTransN() { String initDate = "01/01/2016"; Date date = null;/* w w w . jav a2 s .com*/ List<LinParInt> list = linParIntRepository.getModulos(); for (LinParInt lin : list) { if (lin.getLinParIntPK().getTipo().equals("MIN_FECHA_ENVIO")) { initDate = StringUtils.trim(lin.getParametro()); } } try { date = DateUtils.parseDate(initDate, "dd/MM/yyyy"); } catch (ParseException ex) { } return entityManager.createQuery( "from Pedidos where (transferido = 'N' or transferido = null or transferido ='T') and (estado = 'S') and fechaPedido > :fecha order by centros.linea, proveedor.codigo", Pedidos.class).setParameter("fecha", date).getResultList(); }
From source file:com.xpn.xwiki.internal.XWikiConfigDelegate.java
@Override public String getProperty(String key, String defaultValue) { return StringUtils.trim(this.source.getProperty(key, defaultValue)); }
From source file:com.hengyi.japp.execution.domain.Operator.java
public void setName(String name) { this.name = StringUtils.trim(name); }
From source file:io.wcm.caravan.io.http.impl.CaravanHttpHelper.java
/** * Constructs a Map from a multi-value header (i.e. one that can have multiple values that either split up into * multiple lines with the same name, or given as a comma-separated list of values in a single header line) * For example, see the following header: * * <pre>/* w w w . jav a2 s. c o m*/ * Cache-Control: public, max-age=120 * </pre> * * That will return a map with two entries: ("public" -> "true", "max-age" -> "120") * The following header will result in the same map. * * <pre> * Cache-Control: public * Cache-Control: max-age=120 * </pre> * @param header the collection of header values (one entry for each line) * @return Header map */ public static Map<String, String> convertMultiValueHeaderToMap(final Collection<String> header) { // we use linked hash map, because the order of entries is important Map<String, String> headerMap = new LinkedHashMap<>(); for (String line : header) { String[] tokens = StringUtils.split(line, ','); for (String token : tokens) { String[] keyValue = StringUtils.split(token, '='); headerMap.put(StringUtils.trim(keyValue[0]), keyValue.length == 1 ? "true" : StringUtils.trim(keyValue[1])); } } return headerMap; }
From source file:com.mirth.connect.donkey.server.data.jdbc.XmlQuerySource.java
public void load(String xmlFile) throws XmlQuerySourceException { Document document = null;//from w w w .j ava 2s . com try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = dbf.newDocumentBuilder(); InputStream is = ResourceUtil.getResourceStream(XmlQuerySource.class, xmlFile); document = documentBuilder.parse(is); IOUtils.closeQuietly(is); } catch (Exception e) { throw new XmlQuerySourceException("Failed to read query file: " + xmlFile, e); } NodeList queryNodes = document.getElementsByTagName("query"); int queryNodeCount = queryNodes.getLength(); for (int i = 0; i < queryNodeCount; i++) { Node node = queryNodes.item(i); if (node.hasAttributes()) { Attr attr = (Attr) node.getAttributes().getNamedItem("id"); if (attr != null) { String query = StringUtils.trim(node.getTextContent()); if (query.length() > 0) { queries.put(attr.getValue(), query); } } } } }
From source file:br.com.binarti.simplesearchexpr.builders.jpql.SimpleSearchJPQLBuilder.java
@Override public JPQLWhereClause build(SimpleSearchExpression searchExpression) { JPQLWhereClause jpqlCondition = new JPQLWhereClause(); for (SimpleSearchRelationalOperation op : searchExpression.getOperations()) { final String name = op.getField().getName(); final String field = op.getField().getFieldExpr(); final Object value = op.getValue(); switch (op.getOperator()) { case EQUALS: jpqlCondition.add(field + " = :" + name, name, value); break; case LIKE: jpqlCondition.add(field + " like :" + name, name, getLike(StringUtils.trim((String) value))); break; case INTERVAL: Iterator<Object> it = op.getValueAsCollection().iterator(); Object value1 = it.next(); Object value2;//from w ww . j av a2 s .co m if (it.hasNext()) { value2 = it.next(); } else { value2 = value1; } String paramBegin = name + "_begin"; String paramEnd = name + "_end"; jpqlCondition.add(field + " >= :" + paramBegin, paramBegin, value1); jpqlCondition.add(field + " <= :" + paramEnd, paramEnd, value2); break; case LIST: jpqlCondition.add(field + " in :" + name, name, op.getValueAsCollection()); break; default: throw new SimpleSearchExpressionException("Operator " + op.getOperator() + " not supported"); } } return jpqlCondition; }
From source file:com.jk.util.JKStringUtil.java
/** * Trim. * * @param str * the str * @return the string */ public static String trim(String str) { return StringUtils.trim(str); }
From source file:de.micromata.tpsb.doc.renderer.RendererClassUtils.java
private static void addRencerCps(List<String> cps) { String tpsbcp = LocalSettings.get().get("genome.tpsb.rendercp"); if (StringUtils.isBlank(tpsbcp) == true) { return;/*from w w w.j av a 2 s . com*/ } String[] pathes = StringUtils.split(tpsbcp, ','); for (String path : pathes) { cps.add(StringUtils.trim(path)); } }
From source file:com.book.identification.dao.CategoryDAOHibernate.java
public Category retrieveCategory(String categoryName, String... parentCategoryName) { Query query;/*ww w .j av a 2s. c o m*/ if (parentCategoryName == null) { query = getSession() .createQuery("Select c From Category c Where c.category = :categoryName AND c.parent is null") .setParameter("categoryName", categoryName); } else { StringBuilder stringQuery = new StringBuilder(); stringQuery.append("Select c From Category c Where c.category = :categoryName"); for (int i = 0; i < parentCategoryName.length; i++) { stringQuery.append( " AND c." + StringUtils.repeat("parent.", i + 1) + "category = :parentCategoryName" + i); } stringQuery.append( " AND c.parent" + StringUtils.repeat(".parent", parentCategoryName.length) + " is null"); query = getSession().createQuery(stringQuery.toString()).setParameter("categoryName", categoryName); for (int i = parentCategoryName.length; i > 0; i--) { query = query.setParameter("parentCategoryName" + (parentCategoryName.length - i), StringUtils.trim(parentCategoryName[i - 1])); } } return (Category) query.uniqueResult(); }
From source file:com.adeptj.modules.jaxrs.core.jwt.JwtExtractor.java
private static String cleanseJwt(String jwt) { return StringUtils.startsWith(jwt, AUTH_SCHEME_BEARER) ? StringUtils.substring(jwt, JWT_START_POS) : StringUtils.trim(jwt); }