List of usage examples for org.apache.commons.lang StringUtils containsIgnoreCase
public static boolean containsIgnoreCase(String str, String searchStr)
Checks if String contains a search String irrespective of case, handling null
.
From source file:crawler.AScraper.java
@Splitter(inputChannel = "channel1", outputChannel = "channel2") public List<Element> scrape(ResponseEntity<String> payload) { String html = payload.getBody(); final Document htmlDoc; try {// w ww. j a va 2 s .c o m htmlDoc = Jsoup.parse(new String(html.getBytes("ISO-8859-1"), "GBK")); } catch (UnsupportedEncodingException e) { LOG.error("Unsupported page encoding."); return null; } final Elements anchorNodes = htmlDoc.select("body").select("div[id^=read]").select("a"); final List<Element> anchorList = new ArrayList<>(); anchorNodes.traverse(new NodeVisitor() { @Override public void head(org.jsoup.nodes.Node node, int depth) { if (node instanceof org.jsoup.nodes.Element) { Element e = (Element) node; if (StringUtils.containsIgnoreCase(e.text(), ANCHOR_TEXT_PATTERN)) { anchorList.add(e); } } } @Override public void tail(Node node, int depth) { } }); return anchorList; }
From source file:com.microsoft.alm.plugin.idea.ui.common.tabs.TabLookupListenerImpl.java
@Override public void notifyLookupResults(final Operation.Results results) { if (results.isCancelled()) { operationDone();// w w w .j av a 2 s. c o m IdeaHelper.runOnUIThread(new Runnable() { @Override public void run() { model.setTabStatus(VcsTabStatus.LOADING_COMPLETED); } }); } else if (results.hasError()) { final ServerContext newContext; if (AuthHelper.isNotAuthorizedError(results.getError())) { newContext = ServerContextManager.getInstance().updateAuthenticationInfo(gitRemoteUrl); //call this on a background thread, will hang UI thread if not } else if (results.getError() instanceof java.lang.AssertionError && StringUtils.containsIgnoreCase(results.getError().getMessage(), "Microsoft.TeamFoundation.Git.Server.GitRepositoryNotFoundException")) { //repo was probably deleted on the server ServerContextManager.getInstance().remove(gitRemoteUrl); newContext = null; } else { newContext = null; } IdeaHelper.runOnUIThread(new Runnable() { @Override public void run() { if (AuthHelper.isNotAuthorizedError(results.getError())) { if (newContext != null) { //try reloading the data with new context and authentication info model.loadData(); } else { //user cancelled login, don't retry model.setTabStatus(VcsTabStatus.NO_AUTH_INFO); } } else { model.setTabStatus(VcsTabStatus.LOADING_COMPLETED_ERRORS); } } }); } else { IdeaHelper.runOnUIThread(new Runnable() { @Override public void run() { model.appendData(results); } }); } }
From source file:eu.esdihumboldt.hale.io.haleconnect.ui.projects.ProjectFilter.java
private boolean containsSearchText(HaleConnectProjectInfo projectInfo, String searchText) { String ownerName = ""; if (projectInfo.getUser() != null) { ownerName = StringUtils.isNotEmpty(projectInfo.getUser().getFullName()) ? projectInfo.getUser().getFullName() : projectInfo.getUser().getScreenName(); } else if (projectInfo.getOrganisation() != null) { ownerName = projectInfo.getOrganisation().getName(); }// w w w. jav a2 s . c o m return Arrays.asList(projectInfo.getAuthor(), projectInfo.getName(), ownerName).stream() .anyMatch(str -> StringUtils.containsIgnoreCase(str, searchText)); }
From source file:com.alibaba.otter.manager.biz.monitor.impl.ExceptionRuleMonitor.java
private void check(AlarmRule rule, NodeAlarmEvent alarmEvent) { if (!inPeriod(rule)) { return;//from w w w .j a va 2s . c o m } String matchValue = rule.getMatchValue(); matchValue = StringUtils.substringBeforeLast(matchValue, "@"); String[] matchValues = StringUtils.split(matchValue, ","); for (String match : matchValues) { if (StringUtils.containsIgnoreCase(alarmEvent.getMessage(), match)) { String message = String.format(MESAGE_FORMAT, alarmEvent.getPipelineId(), alarmEvent.getNid(), alarmEvent.getMessage()); sendAlarm(rule, message); break; } } }
From source file:com.microsoft.alm.plugin.idea.common.ui.common.LoginPageModelImpl.java
@Override public void setServerName(final String serverName) { if (!StringUtils.equals(this.serverName, serverName)) { final String newServerName; // Allow just the server name as a short hand if (StringUtils.isNotEmpty(serverName) && !StringUtils.contains(serverName, UrlHelper.URL_SEPARATOR) && !StringUtils.equals(serverName, TfPluginBundle.message(TfPluginBundle.KEY_USER_ACCOUNT_PANEL_VSO_SERVER_NAME)) && !StringUtils.containsIgnoreCase(serverName, UrlHelper.HOST_VSO) && !StringUtils.containsIgnoreCase(serverName, UrlHelper.HOST_TFS_ALL_IN)) { // no slash, not "Microsoft Account" and does not contain visualstudio.com or tfsallin.net // means it must just be a on-premise TFS server name, so add all the normal stuff newServerName = String.format(DEFAULT_SERVER_FORMAT, serverName); } else if (!StringUtils.contains(serverName, UrlHelper.URL_SEPARATOR) && (StringUtils.containsIgnoreCase(serverName, UrlHelper.HOST_VSO) || StringUtils.containsIgnoreCase(serverName, UrlHelper.HOST_TFS_ALL_IN))) { //no slash and contains visualstudio.com or tfsallin.net // means it must be a VSTS account newServerName = String.format(DEFAULT_VSTS_ACCOUNT_FORMAT, serverName); } else {//from w w w. j av a2s . co m newServerName = serverName; } setServerNameInternal(newServerName); } }
From source file:com.microsoft.alm.plugin.idea.common.ui.common.tabs.TabLookupListenerImpl.java
@Override public void notifyLookupResults(final Operation.Results results) { if (results.isCancelled()) { operationDone();/*from www. ja v a 2 s . com*/ IdeaHelper.runOnUIThread(new Runnable() { @Override public void run() { model.setTabStatus(VcsTabStatus.LOADING_COMPLETED); } }); } else if (results.hasError()) { final ServerContext newContext; if (AuthHelper.isNotAuthorizedError(results.getError())) { newContext = ServerContextManager.getInstance() .updateAuthenticationInfo(repositoryContext.getUrl()); //call this on a background thread, will hang UI thread if not } else if (results.getError() instanceof java.lang.AssertionError && StringUtils.containsIgnoreCase(results.getError().getMessage(), "Microsoft.TeamFoundation.Git.Server.GitRepositoryNotFoundException")) { //repo was probably deleted on the server ServerContextManager.getInstance().remove(repositoryContext.getUrl()); newContext = null; } else { newContext = null; } IdeaHelper.runOnUIThread(new Runnable() { @Override public void run() { if (AuthHelper.isNotAuthorizedError(results.getError())) { if (newContext != null) { //try reloading the data with new context and authentication info model.loadData(); } else { //user cancelled login, don't retry model.setTabStatus(VcsTabStatus.NO_AUTH_INFO); isContextFound = false; } } else { model.setTabStatus(VcsTabStatus.LOADING_COMPLETED_ERRORS); } } }); } else { isContextFound = true; IdeaHelper.runOnUIThread(new Runnable() { @Override public void run() { model.appendData(results); } }); } }
From source file:com.bluexml.xforms.controller.alfresco.AlfrescoWebscriptException.java
private void analyzeError(Element exceptionElement) { Set<Entry<String, Element>> elements = getElements(exceptionElement).entrySet(); for (Entry<String, Element> entry : elements) { if (StringUtils.equals(entry.getKey(), "message")) { String message = entry.getValue().getTextContent(); ////from ww w . ja va2s . c o m if (StringUtils.containsIgnoreCase(message, "integrity violation")) { String assoName = getAssociationName(message, 0); // assoName should never trim to null ! if it is, algorithm problem! if (StringUtils.trimToNull(assoName) == null) { if (logger.isErrorEnabled()) { logger.error("Caught an unknown integrity violation: " + message); } sb = new StringBuilder(MsgPool.getMsg(MsgId.MSG_ERROR_DEFAULT_MSG)); } else { sb = new StringBuilder(MsgPool.getMsg(MsgId.MSG_ERROR_INTEGRITY_VIOLATION, assoName)); } gotCauseMessage = true; return; } // // if (message.contains("Unicity Checking Error")) { // sb = new StringBuilder(MsgPool.getMsg(MsgId.MSG_UNICITY_VIOLATION)); // gotCauseMessage = true; // return; // } // if (StringUtils.containsIgnoreCase(message, "access denied")) { sb = new StringBuilder(MsgPool.getMsg(MsgId.MSG_ERROR_ACCESS_DENIED)); gotCauseMessage = true; return; } errorMessage = message; sb.append(message); sb.append("\n\r"); } if (StringUtils.equals(entry.getKey(), "cause")) { Element exception = getElements(entry.getValue()).get("exception"); analyzeError(exception); } } }
From source file:br.com.utfpr.pb.view.UsuariosView.java
private void pesquisa() { String query = pesquisa.getText(); model = (DefaultTableModel) jTable.getModel(); model.getDataVector().removeAllElements(); model.fireTableDataChanged();/* www.j a v a 2 s .c o m*/ data.stream() .filter(e -> StringUtils.containsIgnoreCase(e.getId().toString(), query) || StringUtils.containsIgnoreCase(e.getNome(), query) || StringUtils.containsIgnoreCase(e.getLogin(), query)) .forEach(item -> add(item)); model.fireTableDataChanged(); }
From source file:net.orpiske.ssps.sdm.main.DbInitializationHelper.java
private void initializePackageCache() throws SQLException, DatabaseInitializationException { PackageCacheDao dao = new PackageCacheDao(databaseManager); try {//from w ww . j ava2 s . c o m dao.getCount(); } catch (SQLException e) { String err = e.getMessage(); if (StringUtils.containsIgnoreCase(err, "does not exist")) { dao.createTable(); logger.debug("Package cache table created successfully"); } else { throw e; } } }
From source file:io.github.jeddict.jcode.DatabaseType.java
public boolean isMatchingDatabase(DatabaseConnection databaseConnection) { if (databaseConnection != null) { if (StringUtils.containsIgnoreCase(databaseConnection.getDriverClass(), this.name())) { return true; }// w ww .j a v a2 s . com if (StringUtils.containsIgnoreCase(databaseConnection.getDatabaseURL(), this.name())) { return true; } } return false; }