List of usage examples for org.apache.commons.lang3 StringUtils containsIgnoreCase
public static boolean containsIgnoreCase(final CharSequence str, final CharSequence searchStr)
Checks if CharSequence contains a search CharSequence irrespective of case, handling null .
From source file:br.com.ararati.faces.cadastros.EmitenteFaces.java
public List<NFeTipoRegimeTributario> completeEnum(String query) { return NFeTipoRegimeTributario.valuesAsList().stream() .filter(v -> StringUtils.containsIgnoreCase(v.getDescricao(), query)).collect(Collectors.toList()); }
From source file:br.com.ararati.faces.cadastros.ProdutoFaces.java
public List<NFeTipoIndicadorVProd> completeIndicadorVProd(String query) { return NFeTipoIndicadorVProd.valuesAsList().stream() .filter(v -> StringUtils.containsIgnoreCase(v.getDescricao(), query)).collect(Collectors.toList()); }
From source file:city_planning.initialize_fields.Initialize_search_record_field_types.java
public static void init_cities(final JTextField tf) { Object[][] obj = null;//from w ww. j av a 2 s. c o m int i = 0; if (tf.getText().isEmpty()) { obj = new Object[cities.size()][1]; for (Cities.to_cities to : cities) { obj[i][0] = " " + to.city; i++; } } else { List<Cities.to_cities> in_search = new ArrayList(); for (Cities.to_cities to : cities) { boolean contains = StringUtils.containsIgnoreCase(to.city, tf.getText()); if (contains) { in_search.add(to); } } obj = new Object[in_search.size()][1]; for (Cities.to_cities to : in_search) { obj[i][0] = " " + to.city; i++; } } JLabel[] labels = {}; int[] tbl_widths_customers = { tf.getWidth() }; String[] col_names = { "Name" }; TableRenderer tr = new TableRenderer(); TableRenderer.setPopup(tf, obj, labels, tbl_widths_customers, col_names); tr.setCallback(new TableRenderer.Callback() { @Override public void ok(TableRenderer.OutputData data) { Cities.to_cities to = cities.get(data.selected_row); Field.Combo field = (Field.Combo) tf; field.setText(to.city); field.setId("" + to.id); } }); }
From source file:de.bmarwell.j9kwsolver.util.ResponseUtils.java
/** * Parses the content from the response, if any. * @param response the response sent by the server. * @return a CaptchaReturn object if captcha was offered, otherwise null. *//*from w w w. ja v a2s . com*/ public static CaptchaReturn captchaGetResponseToCaptchaReturn(final String response) { CaptchaReturn cr = null; if (StringUtils.isEmpty(response)) { RequestToURI.LOG.debug("Content ist leer!"); return cr; } /* converting answer to object */ if (StringUtils.containsIgnoreCase(response, "NO CAPTCHA")) { /* No captcha available */ cr = null; RequestToURI.LOG.debug("No captcha available atm: {}.", response); } else if (StringUtils.contains(response, "phrase")) { /* Extended Answer */ CaptchaReturnExtended cre = ResponseUtils.getExtendedFromResponse(response); RequestToURI.LOG.debug("CRE: {}.", cre); cr = cre; } else { /* * simple response contains only digits or few extra information * INT or INT|mouse or INT|confirm */ RequestToURI.LOG.debug("Simple response: {}.", response); String[] splitresponse = StringUtils.split(response, '|'); if (splitresponse.length < 1) { RequestToURI.LOG.warn("Simple response doesn't contain enough items"); return cr; } if (!NumberUtils.isDigits(splitresponse[0])) { RequestToURI.LOG.error("Response's first item isn't a captcha id." + " Found {} instead.", splitresponse[0]); return cr; } cr = new CaptchaReturn(); cr.setCaptchaID(splitresponse[0]); // TODO: add items } return cr; }
From source file:mfi.staticresources.ProcessResources.java
private String deleteBetween(String content, String start, String end, String exclusionContent) { try {//www. j a va2 s .co m String[] subs = StringUtils.substringsBetween(content, start, end); if (subs == null || subs.length == 0) { // noop } else { for (String sub : subs) { if (StringUtils.isNotBlank(exclusionContent) && StringUtils.containsIgnoreCase(sub, exclusionContent)) { // noop } else { sub = start + sub + end; content = StringUtils.replace(content, sub, ""); } } } } catch (Exception e) { throw new RuntimeException(e); } return content; }
From source file:fr.cph.chicago.core.fragment.BusFragment.java
private void addView() { busAdapter = new BusAdapter(listView); listView.setAdapter(busAdapter);//from w w w. ja v a 2 s .c o m textFilter.setVisibility(TextView.VISIBLE); textFilter.addTextChangedListener(new TextWatcher() { final BusData busData = DataHolder.getInstance().getBusData(); List<BusRoute> busRoutes = null; @Override public void beforeTextChanged(final CharSequence c, final int start, final int count, final int after) { busRoutes = new ArrayList<>(); } @Override public void onTextChanged(final CharSequence c, final int start, final int before, final int count) { final List<BusRoute> busRoutes = busData.getBusRoutes(); final CharSequence trimmed = c.toString().trim(); this.busRoutes.addAll(Stream.of(busRoutes) .filter(busRoute -> StringUtils.containsIgnoreCase(busRoute.getId(), trimmed) || StringUtils.containsIgnoreCase(busRoute.getName(), trimmed)) .collect(Collectors.toList())); } @Override public void afterTextChanged(final Editable s) { busAdapter.setRoutes(busRoutes); busAdapter.notifyDataSetChanged(); } }); }
From source file:com.pentaho.ctools.cdf.require.MetaLayerHomeDashboard.java
/** * ############################### Test Case 1 ############################### * * Test Case Name://from w w w . j a v a 2 s . c o m * MetaLayer Home Dashboard - clicking details * Description: * We pretend to validate when user click on 'Details...' a pop-up message * is displayed. * Steps: * 1. Open the MetaLayer Home Dashboard. * 2. Click in 'Details...'. * 3. Check if we have width = 500 and height = 600 */ @Test public void tc1_LinkDetails_PopupJPivot() { this.log.info("tc1_LinkDetails_PopupJPivot"); /* * ## Step 1 */ driver.get(baseUrl + "api/repos/%3Apublic%3Aplugin-samples%3Apentaho-cdf%3Apentaho-cdf-require%3A20-samples%3Ahome_dashboard_2%3Ahome_dashboard_metalayer.xcdf/generatedContent"); //NOTE - we have to wait for loading disappear this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay")); //Wait for title become visible and with value 'Community Dashboard Framework' wait.until(ExpectedConditions.titleContains("Community Dashboard Framework")); //Wait for visibility of 'Top Ten Customers' wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='titleObject']"))); // Validate the sample that we are testing is the one assertEquals("Community Dashboard Framework", driver.getTitle()); assertEquals("Top Ten Customers", this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//div[@id='titleObject']"))); /* * ## Step 2 */ //Wait for visibility of 'topTenCustomersDetailsObject' the text 'Details' WebElement linkDetails = this.elemHelper.FindElement(driver, By.linkText("Details...")); assertEquals("Details...", linkDetails.getText()); //click on the 'Details...' linkDetails.click(); /* * ## Step 3 */ //Wait for the frame this.elemHelper.WaitForElementPresenceAndVisible(driver, By.id("fancybox-content")); this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//iframe")); WebElement frame = this.elemHelper.FindElement(driver, By.xpath("//iframe")); String valueFrameAttrSrc = frame.getAttribute("src"); //Check if we have the sizes 500 and 600 assertTrue(StringUtils.containsIgnoreCase(valueFrameAttrSrc, "&width=500&height=600")); //NOTE - we have to wait for loading disappear this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay")); //Wait for the element be visible. WebDriver driverFrame = driver.switchTo().frame(frame); assertNotNull(this.elemHelper.FindElement(driverFrame, By.xpath("//div[@id='internal_content']"))); assertEquals("Measures", this.elemHelper.WaitForElementPresentGetText(driverFrame, By.xpath("//div[@id='internal_content']/table/tbody/tr[2]/td[2]/p/table/tbody/tr/th[2]"))); assertEquals("Australian Collectors, Co.", this.elemHelper.WaitForElementPresentGetText(driverFrame, By .xpath("//div[@id='internal_content']/table[1]/tbody/tr[2]/td[2]/p[1]/table/tbody/tr[5]/th/div"))); assertEquals("180,125", this.elemHelper.WaitForElementPresentGetText(driverFrame, By.xpath("//div[@id='internal_content']/table[1]/tbody/tr[2]/td[2]/p[1]/table/tbody/tr[7]/td"))); //Close pop-up driver.switchTo().defaultContent(); wait.until(ExpectedConditions.elementToBeClickable(By.id("fancybox-close"))); String background = this.elemHelper.FindElement(driver, By.cssSelector("#fancybox-close")) .getCssValue("background-image"); String background1 = background.substring(background.indexOf(34) + 1, background.lastIndexOf(34)); assertEquals(baseUrl + "plugin/pentaho-cdf/api/resources/js/compressed/lib/fancybox/fancybox.png", background1); this.elemHelper.ClickJS(driver, By.id("fancybox-close")); this.elemHelper.WaitForElementInvisibility(driver, By.id("fancybox-content")); assertEquals("200", Integer.toString(HttpUtils.GetResponseCode(background1, "admin", "password"))); }
From source file:fr.cph.chicago.fragment.BusFragment.java
private final void addView() { mAdapter = new BusAdapter(mActivity); mListView.setAdapter(mAdapter);/*from w w w .j a v a 2 s .c o m*/ mTextFilter.setVisibility(TextView.VISIBLE); mTextFilter.addTextChangedListener(new TextWatcher() { private BusData busData = DataHolder.getInstance().getBusData(); private List<BusRoute> busRoutes = null; @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { busRoutes = new ArrayList<BusRoute>(); } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { List<BusRoute> busRoutes = busData.getRoutes(); for (BusRoute busRoute : busRoutes) { if (StringUtils.containsIgnoreCase(busRoute.getId(), s.toString().trim()) || StringUtils.containsIgnoreCase(busRoute.getName(), s.toString().trim())) { this.busRoutes.add(busRoute); } } } @Override public void afterTextChanged(Editable s) { mAdapter.setRoutes(busRoutes); mAdapter.notifyDataSetChanged(); } }); }
From source file:com.glaf.oa.paymentplan.web.springmvc.PaymentplanController.java
@RequestMapping("/edit") public ModelAndView edit(HttpServletRequest request, ModelMap modelMap) { RequestUtils.setRequestParameterToAttribute(request); request.removeAttribute("canSubmit"); Paymentplan paymentplan = paymentplanService.getPaymentplan(RequestUtils.getLong(request, "planid")); if (paymentplan != null) { request.setAttribute("paymentplan", paymentplan); JSONObject rowJSON = paymentplan.toJsonObject(); request.setAttribute("x_json", rowJSON.toJSONString()); }/*from w ww . j a va 2 s . co m*/ boolean canUpdate = false; String x_method = request.getParameter("x_method"); if (StringUtils.equals(x_method, "submit")) { } if (StringUtils.containsIgnoreCase(x_method, "update")) { if (paymentplan != null) { } } request.setAttribute("canUpdate", canUpdate); String view = request.getParameter("view"); if (StringUtils.isNotEmpty(view)) { return new ModelAndView(view, modelMap); } String x_view = ViewProperties.getString("paymentplan.edit"); if (StringUtils.isNotEmpty(x_view)) { return new ModelAndView(x_view, modelMap); } return new ModelAndView("/oa/paymentplan/edit", modelMap); }
From source file:com.u2apple.tool.service.IdentifyAnalyticsService.java
private boolean matches(String model, String productId) { boolean matches = false; if (StringUtils.isNotBlank(model) && StringUtils.isNotBlank(productId)) { String pureModel = AndroidDeviceUtils.formatModel(model); if (!isWhilteListModel(pureModel, productId)) { String[] brandAndModel = productId.split("-"); if (brandAndModel.length >= 2) { String expectedModel = brandAndModel[1]; if (StringUtils.containsIgnoreCase(pureModel, expectedModel)) { String lowerPureModel = pureModel.toLowerCase(); String lowerExpectedModel = expectedModel.toLowerCase(); int index = lowerPureModel.indexOf(lowerExpectedModel); if (pureModel.length() > index + expectedModel.length()) { matches = true;/*from www. ja va2 s.com*/ } } } } } return matches; }