List of usage examples for org.apache.commons.lang3 StringUtils contains
public static boolean contains(final CharSequence seq, final CharSequence searchSeq)
Checks if CharSequence contains a search CharSequence, handling null .
From source file:com.u2apple.tool.service.DeviceServiceImpl.java
private boolean requireAdvanceProps(String productId, List<VID> vids) { for (VID vid : vids) { for (Modal model : vid.getModals()) { for (ProductId aProductId : model.getProductId()) { if (aProductId.getValue().equals(productId) && StringUtils.contains(aProductId.getCondition(), "type")) { return true; }//ww w . ja va 2 s. c om } } } return false; }
From source file:com.drisoftie.cwdroid.frag.FragBoard.java
/** * Most actions are created here.//from www. ja va2 s .c o m */ @SuppressWarnings("unchecked") private void initActions() { actionInit = new ActionBuilder().with().reg(IGenericAction.class, RegActionMethod.NONE) .pack(new AndroidAction<View, Void, Void, Void, Void>(null, null) { @Override public Object onActionPrepare(String methodName, Object[] methodArgs, Void tag1, Void tag2, Object[] additionalTags) { webBoard.loadUrl(getArguments().getString(FragBoard.class.getName())); webBoard.getSettings().setUseWideViewPort(false); webBoard.getSettings().setJavaScriptEnabled(true); CookieManager cm = CookieManager.getInstance(); if (!CwApp.domain().isUserLoggedIn()) { cm.removeAllCookie(); } else { CwUser user = CwApp.domain().getLoggedInUser(); String cookie = cm.getCookie(getString(R.string.api_domain)); if (StringUtils.contains(cookie, getString(R.string.cw_cookie_userid)) && StringUtils.contains(cookie, getString(R.string.cw_cookie_userid) + "=" + user.getId()) && cookie.contains(getString(R.string.cw_cookie_pw) + "=" + CredentialUtils .deobfuscateFromBase64(user.getKeyData(), user.getPwHash()))) { } else { cm.removeAllCookie(); cm.setCookie(getString(R.string.api_domain), getString(R.string.cw_cookie_userid) + "=" + user.getId()); cm.setCookie(getString(R.string.api_domain), getString(R.string.cw_cookie_pw) + "=" + CredentialUtils .deobfuscateFromBase64(user.getKeyData(), user.getPwHash())); } } skipWorkThreadOnce(); return null; } @Override public Void onActionDoWork(String methodName, Object[] methodArgs, Void tag1, Void tag2, Object[] additionalTags) { return null; } @Override public void onActionAfterWork(String methodName, Object[] methodArgs, Void result, Void tag1, Void tag2, Object[] additionalTags) { } }); actionRefresh = new ActionBuilder().with(swipeBoard) .reg(SwipeRefreshLayout.OnRefreshListener.class, "setOnRefreshListener") .reg(IGenericAction.class, RegActionMethod.NONE) .pack(new AndroidAction<View, Void, Void, Void, Void>(null, null) { @Override public Object onActionPrepare(String methodName, Object[] methodArgs, Void tag1, Void tag2, Object[] additionalTags) { webBoard.loadUrl(getArguments().getString(FragShoutbox.class.getName())); skipWorkThreadOnce(); return null; } @Override public Void onActionDoWork(String methodName, Object[] methodArgs, Void tag1, Void tag2, Object[] additionalTags) { return null; } @Override public void onActionAfterWork(String methodName, Object[] methodArgs, Void result, Void tag1, Void tag2, Object[] additionalTags) { } }); }
From source file:fr.scc.elo.service.impl.EloServiceImpl.java
@Override public List<Player> removeTest() { playerService.getAllPlayers().stream() .filter(p -> !StringUtils.contains(p.getName(), ".") || !StringUtils.equals(p.getName(), StringUtils.lowerCase(p.getName()))) .forEach(player -> playerService.deletePlayer(player)); return playerService.getAllPlayers(); }
From source file:com.thoughtworks.go.matchers.ConsoleOutMatcher.java
public static TypeSafeMatcher<String> printedJobCanceledInfo(final Object jobIdentifer) { return new TypeSafeMatcher<String>() { private String consoleOut; public String stdout; public boolean matchesSafely(String consoleOut) { this.consoleOut = consoleOut; stdout = format("Job is canceled %s", jobIdentifer.toString()); return StringUtils.contains(consoleOut, stdout); }//from w w w.jav a 2 s. co m public void describeTo(Description description) { description.appendText("expected console to contain [" + stdout + "]" + " but was " + consoleOut); } }; }
From source file:com.cognifide.qa.bb.aem.touch.pageobjects.pages.AuthorPage.java
/** * Looks for parsys by data path. If parsys is not found then throws runtime exception * {@link IllegalStateException}./*from w ww .jav a2s. c o m*/ * * @param dataPath data path of parsys. * @return Parsys object. */ public Parsys getParsys(String dataPath) { String componentDataPath = DataPathUtil.normalize(dataPath); return parsyses.stream() // .filter(parsys -> StringUtils.contains(parsys.getDataPath(), componentDataPath)) // .findFirst() // .orElseThrow(() -> new IllegalStateException("Parsys not found")); }
From source file:com.thinkbiganalytics.schema.QueryRunner.java
/** * Initializes the query result with the specified metadata. * * @param queryResult the query result to initialize * @param rsMetaData the result set metadata for the query * @throws SQLException if the metadata is not available *//*w w w. j a v a2 s . c o m*/ private void initQueryResult(@Nonnull final DefaultQueryResult queryResult, @Nonnull final ResultSetMetaData rsMetaData) throws SQLException { final List<QueryResultColumn> columns = new ArrayList<>(); final Map<String, Integer> displayNameMap = new HashMap<>(); for (int i = 1; i <= rsMetaData.getColumnCount(); i++) { final DefaultQueryResultColumn column = new DefaultQueryResultColumn(); column.setField(rsMetaData.getColumnName(i)); String displayName = rsMetaData.getColumnLabel(i); column.setHiveColumnLabel(displayName); //remove the table name if it exists displayName = StringUtils.contains(displayName, ".") ? StringUtils.substringAfterLast(displayName, ".") : displayName; Integer count = 0; if (displayNameMap.containsKey(displayName)) { count = displayNameMap.get(displayName); count++; } displayNameMap.put(displayName, count); column.setDisplayName(displayName + "" + (count > 0 ? count : "")); column.setTableName(StringUtils.substringAfterLast(rsMetaData.getColumnName(i), ".")); column.setDataType(ParserHelper.sqlTypeToHiveType(rsMetaData.getColumnType(i))); column.setNativeDataType(rsMetaData.getColumnTypeName(i)); columns.add(column); } queryResult.setColumns(columns); }
From source file:net.sf.dynamicreports.googlecharts.test.AbstractJasperTest.java
protected void containsHtml(String message, String text) { Assert.assertTrue(message, StringUtils.contains(html, text)); }
From source file:cz.muni.fi.editor.services.api.notifications.NotificationFactoryImpl.java
private String requestToParameter(Request request) { if (StringUtils.contains(request.getClazz(), "Organization")) { return MessageFormat.format(REQUEST_PATTERN, request.getAction(), "organization"); } else {// w w w. j a v a 2s . c o m //todo in the future return StringUtils.EMPTY; } }
From source file:com.haulmont.cuba.web.widgets.CubaFileUpload.java
protected void setUploadingErrorHandler() { setErrorHandler(event -> {//ww w . ja va 2 s. c om //noinspection ThrowableResultOfMethodCallIgnored Throwable ex = event.getThrowable(); String rootCauseMessage = ExceptionUtils.getRootCauseMessage(ex); Logger log = LoggerFactory.getLogger(CubaFileUpload.class); if (StringUtils.contains(rootCauseMessage, "The multipart stream ended unexpectedly") || StringUtils.contains(rootCauseMessage, "Unexpected EOF read on the socket")) { log.warn("Unable to upload file, it seems upload canceled or network error occurred"); } else { log.error("Unexpected error in CubaFileUpload", ex); } if (isUploading) { endUpload(); } }); }
From source file:com.gargoylesoftware.htmlunit.WebResponseDataTest.java
/** * Tests that broken gzipped content is handled correctly. * @throws Exception if the test fails//ww w .j a v a 2s. c o m */ @Test public void brokenGZippedContent() throws Exception { final List<NameValuePair> headers = new ArrayList<>(); headers.add(new NameValuePair("Content-Encoding", "gzip")); final WebResponseData data = new WebResponseData("Plain Content".getBytes(), HttpStatus.SC_OK, "OK", headers); try { data.getBody(); } catch (final RuntimeException e) { assertTrue(StringUtils.contains(e.getMessage(), "Not in GZIP format")); } }