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:com.glaf.oa.assessinfo.web.springmvc.AssessinfoController.java
@RequestMapping("/edit") public ModelAndView edit(HttpServletRequest request, ModelMap modelMap) { RequestUtils.setRequestParameterToAttribute(request); request.removeAttribute("canSubmit"); Assessinfo assessinfo = assessinfoService.getAssessinfo(RequestUtils.getLong(request, "indexid")); if (assessinfo != null) { request.setAttribute("assessinfo", assessinfo); JSONObject rowJSON = assessinfo.toJsonObject(); request.setAttribute("x_json", rowJSON.toJSONString()); }//w ww.j a va2 s. c o m boolean canUpdate = false; String x_method = request.getParameter("x_method"); if (StringUtils.equals(x_method, "submit")) { } if (StringUtils.containsIgnoreCase(x_method, "update")) { if (assessinfo != null) { canUpdate = true; } } request.setAttribute("canUpdate", canUpdate); String view = request.getParameter("view"); if (StringUtils.isNotEmpty(view)) { return new ModelAndView(view, modelMap); } String x_view = ViewProperties.getString("assessinfo.edit"); if (StringUtils.isNotEmpty(x_view)) { return new ModelAndView(x_view, modelMap); } return new ModelAndView("/oa/assessinfo/assessinfoEdit", modelMap); }
From source file:com.intuit.wasabi.email.impl.EmailTextProcessorImplTest.java
@Test(expected = IllegalArgumentException.class) public void testSubjectExtraction() { EventLogEvent mockedEventLog = mock(EventLogEvent.class); assertThat(textProcessor.getSubject(appName), is("A User requests access to your Application")); when(mockedEventLog.getType()).thenReturn(BUCKET_CHANGED); String subject = textProcessor.getSubject(mockedEventLog); assertTrue(StringUtils.containsIgnoreCase(subject, "bucket")); when(mockedEventLog.getType()).thenReturn(EXPERIMENT_CHANGED); subject = textProcessor.getSubject(mockedEventLog); assertTrue(StringUtils.containsIgnoreCase(subject, "experiment")); when(mockedEventLog.getType()).thenReturn(EventLogEventType.EXPERIMENT_CREATED); subject = textProcessor.getSubject(mockedEventLog); assertThat(subject, is("Experiment Created")); when(mockedEventLog.getType()).thenReturn(EventLogEventType.UNKNOWN); subject = textProcessor.getSubject(mockedEventLog); fail();/* w w w.j ava 2 s . c o m*/ assertThat(subject, is("NOT_POSSIBLE")); }
From source file:forge.properties.ForgeProfileProperties.java
private static Pair<String, String> getDefaultDirs() { if (!GuiBase.getInterface().isRunningOnDesktop()) { //special case for mobile devices final String assetsDir = ForgeConstants.ASSETS_DIR; return Pair.of(assetsDir + "data" + File.separator, assetsDir + "cache" + File.separator); }/*from w w w. jav a2s . c om*/ final String osName = System.getProperty("os.name"); final String homeDir = System.getProperty("user.home"); if (StringUtils.isEmpty(osName) || StringUtils.isEmpty(homeDir)) { throw new RuntimeException("cannot determine OS and user home directory"); } final String fallbackDataDir = String.format("%s/.forge", homeDir); if (StringUtils.containsIgnoreCase(osName, "windows")) { // the split between appdata and localappdata on windows is relatively recent. If // localappdata is not defined, use appdata for both. and if appdata is not defined, // fall back to a linux-style dot dir in the home directory String appRoot = System.getenv().get("APPDATA"); if (StringUtils.isEmpty(appRoot)) { appRoot = fallbackDataDir; } String cacheRoot = System.getenv().get("LOCALAPPDATA"); if (StringUtils.isEmpty(cacheRoot)) { cacheRoot = appRoot; } // the cache dir is Forge/Cache instead of just Forge since appRoot and cacheRoot might be the // same directory on windows and we need to distinguish them. return Pair.of(appRoot + File.separator + "Forge", cacheRoot + File.separator + "Forge" + File.separator + "Cache"); } else if (StringUtils.containsIgnoreCase(osName, "mac os x")) { return Pair.of(String.format("%s/Library/Application Support/Forge", homeDir), String.format("%s/Library/Caches/Forge", homeDir)); } // Linux and everything else return Pair.of(fallbackDataDir, String.format("%s/.cache/forge", homeDir)); }
From source file:io.selendroid.standalone.android.impl.DefaultAndroidEmulator.java
private void extractAPITargetType(String avdOutput) { String target = extractValue("Target: (.*?)$", avdOutput); // chose to compare against both of these strings because currently some targets say google_api [Google APIs] so // perhaps the actual name which looks to be google_api will be the only string in the target in the future if (StringUtils.containsIgnoreCase(target, "Google APIs") || StringUtils.containsIgnoreCase(target, "google_apis")) { this.apiTargetType = "google"; }/* ww w . java 2 s .c o m*/ }
From source file:br.com.ararati.faces.cadastros.DestinatarioFaces.java
public List<NFeTipoIndicadorIEDestinatario> completeindIeDest(String query) { return NFeTipoIndicadorIEDestinatario.valuesAsList().stream() .filter(v -> StringUtils.containsIgnoreCase(v.getDescricao(), query)).collect(Collectors.toList()); }
From source file:com.glaf.oa.assessscore.web.springmvc.AssessscoreController.java
@RequestMapping("/edit") public ModelAndView edit(HttpServletRequest request, ModelMap modelMap) { RequestUtils.setRequestParameterToAttribute(request); request.removeAttribute("canSubmit"); Assessscore assessscore = assessscoreService.getAssessscore(RequestUtils.getLong(request, "scoreid")); if (assessscore != null) { request.setAttribute("assessscore", assessscore); JSONObject rowJSON = assessscore.toJsonObject(); request.setAttribute("x_json", rowJSON.toJSONString()); }//from w w w.j a va 2 s . c om boolean canUpdate = false; String x_method = request.getParameter("x_method"); if (StringUtils.equals(x_method, "submit")) { } if (StringUtils.containsIgnoreCase(x_method, "update")) { if (assessscore != null) { canUpdate = true; } } request.setAttribute("canUpdate", canUpdate); String view = request.getParameter("view"); if (StringUtils.isNotEmpty(view)) { return new ModelAndView(view, modelMap); } String x_view = ViewProperties.getString("assessscore.edit"); if (StringUtils.isNotEmpty(x_view)) { return new ModelAndView(x_view, modelMap); } return new ModelAndView("/oa/assessscore/edit", modelMap); }
From source file:ec.edu.chyc.manejopersonal.managebean.GestorTesis.java
public boolean filtrarPorAutor(Object value, Object filter, Locale locale) { String filterText = (filter == null) ? null : filter.toString().trim(); if (filterText == null || filterText.equals("")) { return true; }/* ww w .ja v a 2 s . com*/ if (value == null) { return false; } Set<Persona> autores = (Set<Persona>) value; for (Persona per : autores) { if (StringUtils.containsIgnoreCase(per.getNombres(), filterText) || StringUtils.containsIgnoreCase(per.getApellidos(), filterText)) { return true; } } return false; }
From source file:fr.cph.chicago.activity.SearchActivity.java
/** * Reload adapter with correct data// w w w . j a va 2 s . c o m * * @param intent * the intent */ private void handleIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); DataHolder dataHolder = DataHolder.getInstance(); BusData busData = dataHolder.getBusData(); TrainData trainData = dataHolder.getTrainData(); List<Station> foundStations = new ArrayList<Station>(); for (Entry<TrainLine, List<Station>> e : trainData.getAllStations().entrySet()) { for (Station station : e.getValue()) { boolean res = StringUtils.containsIgnoreCase(station.getName(), query.trim()); if (res) { if (!foundStations.contains(station)) { foundStations.add(station); } } } } List<BusRoute> foundBusRoutes = new ArrayList<BusRoute>(); for (BusRoute busRoute : busData.getRoutes()) { boolean res = StringUtils.containsIgnoreCase(busRoute.getId(), query.trim()) || StringUtils.containsIgnoreCase(busRoute.getName(), query.trim()); if (res) { if (!foundBusRoutes.contains(busRoute)) { foundBusRoutes.add(busRoute); } } } List<BikeStation> foundBikeStations = new ArrayList<BikeStation>(); if (mBikeStations != null) { for (BikeStation bikeStation : mBikeStations) { boolean res = StringUtils.containsIgnoreCase(bikeStation.getName(), query.trim()) || StringUtils.containsIgnoreCase(bikeStation.getStAddress1(), query.trim()); if (res) { if (!foundBikeStations.contains(bikeStation)) { foundBikeStations.add(bikeStation); } } } } mAdapter.updateData(foundStations, foundBusRoutes, foundBikeStations); mAdapter.notifyDataSetChanged(); } }
From source file:com.glaf.oa.borrow.web.springmvc.BorrowmoneyController.java
@RequestMapping("/edit") public ModelAndView edit(HttpServletRequest request, ModelMap modelMap) { RequestUtils.setRequestParameterToAttribute(request); request.removeAttribute("canSubmit"); Borrowmoney borrowmoney = borrowmoneyService.getBorrowmoney(RequestUtils.getLong(request, "borrowmoneyid")); if (borrowmoney != null) { request.setAttribute("borrowmoney", borrowmoney); JSONObject rowJSON = borrowmoney.toJsonObject(); request.setAttribute("x_json", rowJSON.toJSONString()); }// ww w . j ava 2 s.c om boolean canUpdate = false; String x_method = request.getParameter("x_method"); if (StringUtils.equals(x_method, "submit")) { } if (StringUtils.containsIgnoreCase(x_method, "update")) { if (borrowmoney != null) { } } request.setAttribute("canUpdate", canUpdate); String view = request.getParameter("view"); if (StringUtils.isNotEmpty(view)) { return new ModelAndView(view, modelMap); } String x_view = ViewProperties.getString("borrowmoney.edit"); if (StringUtils.isNotEmpty(x_view)) { return new ModelAndView(x_view, modelMap); } return new ModelAndView("/oa/borrowmoney/edit", modelMap); }
From source file:com.glaf.oa.borrow.web.springmvc.BorrowadderssController.java
@RequestMapping("/edit") public ModelAndView edit(HttpServletRequest request, ModelMap modelMap) { RequestUtils.setRequestParameterToAttribute(request); request.removeAttribute("canSubmit"); Borrowadderss borrowadderss = borrowadderssService .getBorrowadderss(RequestUtils.getLong(request, "addressid")); if (borrowadderss != null) { request.setAttribute("borrowadderss", borrowadderss); JSONObject rowJSON = borrowadderss.toJsonObject(); request.setAttribute("x_json", rowJSON.toJSONString()); }/*from w w w. j a va2s. c o m*/ boolean canUpdate = false; String x_method = request.getParameter("x_method"); if (StringUtils.equals(x_method, "submit")) { } if (StringUtils.containsIgnoreCase(x_method, "update")) { if (borrowadderss != null) { } } request.setAttribute("canUpdate", canUpdate); String view = request.getParameter("view"); if (StringUtils.isNotEmpty(view)) { return new ModelAndView(view, modelMap); } String x_view = ViewProperties.getString("borrowadderss.edit"); if (StringUtils.isNotEmpty(x_view)) { return new ModelAndView(x_view, modelMap); } return new ModelAndView("/oa/borrowadderss/edit", modelMap); }