List of usage examples for org.apache.commons.lang StringUtils contains
public static boolean contains(String str, String searchStr)
Checks if String contains a search String, handling null
.
From source file:com.nridge.ds.solr.SolrParentChild.java
private String extractOffset(String aValue) { String startingOffset = FIELD_FETCH_OFFSET_DEFAULT; if (StringUtils.isNotEmpty(aValue)) { int offset1 = aValue.lastIndexOf("("); int offset2 = aValue.lastIndexOf(")"); if ((offset1 != -1) && (offset2 != -1)) { String countString = aValue.substring(offset1 + 1, offset2); if (StringUtils.contains(countString, StrUtl.CHAR_COMMA)) { ArrayList<String> offsetLimitList = StrUtl.expandToList(countString, StrUtl.CHAR_COMMA); if (offsetLimitList.size() > 0) { String offsetValue = offsetLimitList.get(0); if (StringUtils.isNumeric(offsetValue)) startingOffset = offsetValue; }//w w w . ja v a 2 s . c o m } } } return startingOffset; }
From source file:com.zb.app.web.controller.tour.TourController.java
/** * ?//from ww w . j a v a 2 s .c o m * * @param travelMemberVO * @return */ @RequestMapping(value = "/updateMember.htm", produces = "application/json") @ResponseBody public JsonResult updateMember(TravelMemberVO travelMemberVO) { TravelMemberDO travelMemberDO = new TravelMemberDO(); BeanUtils.copyProperties(travelMemberDO, travelMemberVO); if (StringUtils.isNotEmpty(travelMemberDO.getmPassword())) { travelMemberDO.setmPassword(EncryptBuilder.getInstance().encrypt(travelMemberDO.getmPassword())); } if (StringUtils.isNotEmpty(travelMemberVO.getmRole()) && StringUtils.contains(travelMemberVO.getmRole(), ",")) { String role = travelMemberVO.getmRole(); role = AuthorityHelper.makeAuthority(role); travelMemberDO.setmRole(role); } Boolean bool = memberService.update(travelMemberDO); if (bool) { return JsonResultUtils.success(travelMemberDO, "?!"); } else { return JsonResultUtils.error(travelMemberDO, "!"); } }
From source file:com.hs.mail.imap.dao.MySqlSearchDao.java
private List<Long> query(UidToMsnMapper map, long mailboxID, String name, final String pattern) { if (StringUtils.isEmpty(pattern)) { String sql = SearchQuery.toQuery(mailboxID, name, true); return getJdbcTemplate().queryForList(sql, Long.class); } else {/*w w w . j av a2 s. c o m*/ String sql = SearchQuery.toQuery(mailboxID, name, false); final List<Long> results = new ArrayList<Long>(); getJdbcTemplate().query(sql, new RowCallbackHandler() { public void processRow(ResultSet rs) throws SQLException { // Stored header values are not decoded. String value = DecoderUtil.decodeEncodedWords(rs.getString(2)); if (StringUtils.contains(value, pattern)) { results.add(rs.getLong(1)); } } }); return results; } }
From source file:com.marvelution.bamboo.plugins.sonar.tasks.AbstractSonarMavenConfig.java
/** * Get the Maven executable path from the home path of the Maven installation * //from ww w .jav a 2 s . c o m * @param homePath the home path (M2_HOME) of the Maven installation * @return the path to the executable */ @NotNull protected String getMavenExecutablePath(@NotNull String homePath) { String pathToExecutable = StringUtils.join(new String[] { homePath, "bin", this.executableName }, File.separator); if (StringUtils.contains(pathToExecutable, " ")) { try { File f = new File(pathToExecutable); pathToExecutable = f.getCanonicalPath(); } catch (IOException e) { log.warn("IO Exception trying to get executable", e); } } return pathToExecutable; }
From source file:com.adobe.acs.commons.util.impl.QueryHelperImpl.java
@Override public boolean isTraversal(ResourceResolver resourceResolver, String language, String statement) throws RepositoryException { final QueryManager queryManager = resourceResolver.adaptTo(Session.class).getWorkspace().getQueryManager(); final Query query = queryManager.createQuery("explain " + statement, language); final QueryResult queryResult = query.execute(); final RowIterator rows = queryResult.getRows(); final Row firstRow = rows.nextRow(); final String plan = firstRow.getValue("plan").getString(); return StringUtils.contains(plan, " /* traverse "); }
From source file:com.morty.podcast.writer.PodCastUtils.java
public static String replaceParameters(String original, Map<String, String> values) { //Replace the strings... String returnValue = original; Iterator it = values.keySet().iterator(); while (it.hasNext()) { String key = (String) it.next(); if (StringUtils.contains(returnValue, key) && key.startsWith("$")) { Object val = values.get(key); if (!(val instanceof String)) val = "" + val; m_logger.debug("Replacing key [" + key + "] with [" + values.get(key) + "]"); returnValue = StringUtils.replace(returnValue, key, values.get(key)); }/*from w w w . j a v a 2 s . com*/ } m_logger.debug("After replacement, we have value of [" + returnValue + "]"); return returnValue; }
From source file:com.hangum.tadpole.rdb.core.editors.main.function.MainEditorBrowserFunctionService.java
/** * parse last object //from ww w. jav a 2s .co m */ private String parseLastObject(String obj) { String strObject = StringUtils.remove((String) obj, ","); if (StringUtils.contains(strObject, '(')) { strObject = StringUtils.substringBefore(strObject, "("); } if (StringUtils.contains(strObject, ')')) { strObject = StringUtils.substringAfter(strObject, ")"); } return strObject; }
From source file:com.prowidesoftware.swift.model.field.FieldTest.java
@SuppressWarnings("deprecation") @Test//w w w.j a v a 2s.c o m public void testLabel3_Legacy() { DeprecationUtils.setEnv(EnvironmentVariableKey.NODELAY); String text = (new Field20()).getLabel(); assertTrue(StringUtils.contains(text, "Referen")); //assertEquals("Sender's Reference", (new Field20()).getLabel()); DeprecationUtils.clearEnv(); }
From source file:edu.ku.brc.specify.conversion.TableDataChecker.java
/** * @param file/* ww w .j av a 2 s . c o m*/ * @param title */ public void createHTMLReport(final TableWriter tblWriter) { tblWriter.setHasLines(); HashSet<String> skipNames = new HashSet<String>(); String[] sknames = new String[] { "TimestampCreated", "TimestampModified", "LastEditedBy" }; for (String n : sknames) { skipNames.add(n.toLowerCase()); } try { tblWriter.print("<center>"); String titleStr = String.format("Nullable Table Columns with Data", connection.getCatalog()); tblWriter.print("<H3>"); tblWriter.print(titleStr); tblWriter.print("</H3>"); Vector<Object> tableNames = BasicSQLUtils.querySingleCol(connection, "SHOW TABLES"); tblWriter.startTable(); tblWriter.print("<caption style=\"text-align: center; font-weight: bold; font-size: 14pt;\">"); tblWriter.print(connection.getCatalog()); tblWriter.print("</caption>"); String[] headings = { "Table", "Field Name", "Sp5 Caption" }; tblWriter.print("<tr>"); for (String head : headings) { tblWriter.print("<th>");// style=\"text-align: center; font-weight: bold;\">"); tblWriter.print(head); tblWriter.println("</th>"); } tblWriter.println("</tr>"); for (Object tblObj : tableNames) { String tblName = tblObj.toString(); if (tblName.startsWith("usys") || tblName.startsWith("web") || tblName.startsWith("ft_") || tblName.startsWith("data") || tblName.startsWith("rave") || tblName.startsWith("reports") || StringUtils.contains(tblName, "_tmp") || StringUtils.contains(tblName, "_dup") || StringUtils.contains(tblName, "fulltext")) { continue; } System.out.println("Processing " + tblName); List<Pair<String, String>> cols = getColumnNamesWithData(tblName, skipNames); if (cols.size() > 0) { tblWriter.println("<tr>"); tblWriter.println("<td valign=\"top\" rowspan=\"" + cols.size() + "\"><span style=\"font-weight:bold;\">" + tblName + "</span></td>"); int cnt = 0; for (Pair<String, String> colName : cols) { if (cnt > 0) tblWriter.print("<tr>"); tblWriter.print("<td>"); tblWriter.print(colName.first); tblWriter.println("</td><td>"); tblWriter.println(colName.second != null ? colName.second : " "); tblWriter.println("</td></tr>"); cnt++; } } } tblWriter.endTable(); tblWriter.print("</center>"); } catch (Exception e) { e.printStackTrace(); } }
From source file:cec.easyshop.cockpits.cmscockpit.sitewizard.CMSSiteUtils.java
/** * @return first page templates that is of type 'landing page' *//*w ww . ja v a2s. c o m*/ protected static PageTemplateModel getLandingPageTemplate(final Collection<PageTemplateModel> pageTemplates) { for (final PageTemplateModel pageTemplateModel : pageTemplates) { if (StringUtils.contains(pageTemplateModel.getUid(), LANDING_PAGE)) { return pageTemplateModel; } } return null; }