List of usage examples for org.apache.commons.lang StringUtils equalsIgnoreCase
public static boolean equalsIgnoreCase(String str1, String str2)
Compares two Strings, returning true
if they are equal ignoring the case.
From source file:io.wcm.tooling.netbeans.sightly.completion.classLookup.MemberLookupResult.java
/** * * @param candidate// w w w. jav a 2 s. co m * @return if the methodname mathces the candidate. This is the case if either the methodname is (get|is)candidate or candidate; */ public boolean matches(String candidate) { return StringUtils.equalsIgnoreCase("get" + candidate, methodName) || StringUtils.equalsIgnoreCase("is" + candidate, methodName) || StringUtils.equalsIgnoreCase(candidate, this.variableName); }
From source file:fr.paris.lutece.util.file.FileUtil.java
/** * Check if a file name match extensions in a given list * @param strFileName The file name to check * @param strAllowedExtensions The comma separated list of allowed * extensions/* w w w. ja va 2s . co m*/ * @return True of the extension of the file exists in the extension list */ private static boolean hasExtension(String strFileName, String strAllowedExtensions) { int nIndex = strFileName.lastIndexOf(CONSTANT_POINT); if ((nIndex >= 0) && (strFileName.length() > (nIndex + 2))) { String strExtension = strFileName.substring(nIndex + 1); if (StringUtils.isNotEmpty(strExtension)) { for (String strAllowedExtention : strAllowedExtensions.split(CONSTANT_COMMA)) { if (StringUtils.equalsIgnoreCase(strExtension, strAllowedExtention)) { return true; } } } } return false; }
From source file:edu.ku.brc.specify.tasks.subpane.qb.TableTreePathPoint.java
@Override public boolean equals(Object obj) { if (obj instanceof TableTreePathPoint) { TableTreePathPoint ttpp = (TableTreePathPoint) obj; if (tableId != ttpp.tableId) { return false; }/* w w w . j av a2 s .co m*/ return StringUtils.equalsIgnoreCase(name, ttpp.name); } return false; }
From source file:io.udvi.amqp.mq.transport.protocol.data.CAMQPDefinitionSourceCodecTest.java
@Test public void testCAMQPDefinitionSource() throws Exception { CAMQPDefinitionSource data = new CAMQPDefinitionSource(); data.setAddress("address"); CAMQPDefinitionAccepted outcome = new CAMQPDefinitionAccepted(); data.setDefaultOutcome(outcome);//from w w w. ja va 2 s .c o m CAMQPDefinitionDeleteOnClose dynamicVal = new CAMQPDefinitionDeleteOnClose(); dynamicVal.setRequiredOptions(true); dynamicVal.getOptions().put("dynoptkey", "dynoptval"); data.setDynamic(true); data.setDistributionMode(CAMQPConstants.STD_DIST_MODE_COPY); data.getFilter().put("opt1", "val1"); data.getFilter().put("opt2", "val2"); data.getFilter().put("opt3", "val3"); data.addCapabilities("capab1"); data.addCapabilities("capab2"); data.addCapabilities("capab3"); data.addOutcomes("outcomes1"); data.addOutcomes("outcomes2"); data.addOutcomes("outcomes3"); data.addOutcomes("outcomes4"); CAMQPEncoder outstream = CAMQPEncoder.createCAMQPEncoder(); CAMQPDefinitionSource.encode(outstream, data); ChannelBuffer buffer = outstream.getEncodedBuffer(); CAMQPSyncDecoder inputPipe = CAMQPSyncDecoder.createCAMQPSyncDecoder(); inputPipe.take(buffer); String controlName = inputPipe.readSymbol(); assertTrue(controlName.equalsIgnoreCase(CAMQPDefinitionSource.descriptor)); CAMQPDefinitionSource outputData = CAMQPDefinitionSource.decode(inputPipe); assertTrue(outputData.isSetDistributionMode()); assertTrue( StringUtils.equalsIgnoreCase(outputData.getDistributionMode(), CAMQPConstants.STD_DIST_MODE_COPY)); assertTrue(((String) data.getAddress()).equalsIgnoreCase((String) outputData.getAddress())); assertTrue(data.getDefaultOutcome() instanceof CAMQPDefinitionAccepted); CAMQPDefinitionAccepted outcomeVal = (CAMQPDefinitionAccepted) data.getDefaultOutcome(); assertTrue(!outcomeVal.isSetOptions()); assertTrue(data.getDistributionMode().equalsIgnoreCase(outputData.getDistributionMode())); assertTrue(data.getDynamic()); assertTrue(outputData.getCapabilities().containsAll(data.getCapabilities())); assertTrue(outputData.getOutcomes().containsAll(data.getOutcomes())); { Map<String, String> map = outputData.getFilter(); Set<String> keys = map.keySet(); for (String s : keys) { assertTrue(outputData.getFilter().get(s).equalsIgnoreCase(data.getFilter().get(s))); } } }
From source file:com.fengduo.bee.commons.core.lang.BeanUtils.java
/** * ???//from ww w. j a v a 2 s.co m * * @param f * @return */ public static Map<String, String> fieldEditable(Object oldObj, Object newObj) { Map<String, String> oldMap = getFieldValueMap(oldObj); Map<String, String> newMap = getFieldValueMap(newObj); Map<String, String> oldChangeMap = new HashMap<String, String>(); Map<String, String> newChangeMap = new HashMap<String, String>(); for (Entry<String, String> entry : oldMap.entrySet()) { String fieldKey = entry.getKey(); if (StringUtils.equalsIgnoreCase(fieldKey, "gmtModified") || StringUtils.equalsIgnoreCase(fieldKey, "gmtCreate")) { continue; } String oldValue = entry.getValue(); String newValue = newMap.get(fieldKey); if (!StringUtils.equalsIgnoreCase(oldValue, newValue)) { oldChangeMap.put(fieldKey, oldValue); newChangeMap.put(fieldKey, newValue); } } newMap.clear(); newMap.put("oldString", new Gson().toJson(oldChangeMap)); newMap.put("newString", new Gson().toJson(newChangeMap)); return newMap; }
From source file:com.alibaba.otter.common.push.media.MediaSubscribeManager.java
public MediaSubscribeManager() { // ?//from ww w . java2 s . c om ComputeFunction function = new ComputeFunction<String, String>() { public String apply(final String key, String oldValue) { FindMediaEvent event = new FindMediaEvent(); event.setDataId(key); try { Object obj = arbitrateCommmunicationClient.callManager(event); if (obj != null && obj instanceof String) { final String value = (String) obj; if (!StringUtils.equalsIgnoreCase(oldValue, value)) { // ?? executor.submit(new Runnable() { public void run() { Set<SubscribeCallback> callbacks = getCallbacks(key, null); for (SubscribeCallback callback : callbacks) { callback.callback(value); } } }); } return value; } else { throw new ConfigException("No Such dataId[" + key + "]"); } } catch (Exception e) { logger.error("call_manager_error", event.toString(), e); } // return oldValue; } }; matrixCache = new RefreshMemoryMirror<String, String>(timeout, function); }
From source file:com.sfs.whichdoctor.search.http.AddressVerificationInputHandler.java
/** * Process the incoming HttpRequest for search parameters. * * @param request the request// www.j av a2s .co m * @param user the user * * @return the search bean */ public final SearchBean process(final HttpServletRequest request, final UserBean user) { SearchBean search = addressVerificationSqlHandler.initiate(user); AddressVerificationBean searchCriteria = (AddressVerificationBean) search.getSearchCriteria(); AddressVerificationBean searchConstraints = (AddressVerificationBean) search.getSearchConstraints(); /* Process search form */ String strIdentifier = DataFilter.getHtml(request.getParameter("identifier")); String strReturnCode = DataFilter.getHtml(request.getParameter("returnCode")); String strProcessStatus = DataFilter.getHtml(request.getParameter("processStatus")); String strCreatedA = DataFilter.getHtml(request.getParameter("createdA")); String strCreatedB = DataFilter.getHtml(request.getParameter("createdB")); /* Set identity (identifier/name) requirements */ if (StringUtils.isNotBlank(strIdentifier)) { int identifier = 0; try { identifier = Integer.parseInt(strIdentifier.trim()); } catch (NumberFormatException nfe) { dataLogger.debug("Error parsing identifier: " + nfe.getMessage()); } if (identifier > 0) { searchCriteria.setPersonIdentifier(identifier); } else { searchCriteria.setPersonName(strIdentifier); } } if (StringUtils.isNotBlank(strReturnCode) && !StringUtils.equalsIgnoreCase(strReturnCode, "Null")) { searchCriteria.setReturnCode(strReturnCode); } if (StringUtils.isNotBlank(strProcessStatus) && !StringUtils.equalsIgnoreCase(strProcessStatus, "Null")) { searchCriteria.setProcessStatus(strProcessStatus); } if (StringUtils.isNotBlank(strCreatedA)) { searchCriteria.setCreatedDate(DataFilter.parseDate(strCreatedA, false)); } if (StringUtils.isNotBlank(strCreatedB)) { searchConstraints.setCreatedDate(DataFilter.parseDate(strCreatedB, false)); if (StringUtils.equals(strCreatedB, "+")) { /* All dates above Date A requested */ searchConstraints.setCreatedDate(getMaximumDate()); } if (StringUtils.equals(strCreatedB, "-")) { /* Add dates below Date A requested */ searchConstraints.setCreatedDate(getMinimumDate()); } } search.setSearchCriteria(searchCriteria); search.setSearchConstraints(searchConstraints); return search; }
From source file:au.edu.anu.portal.portlets.tweetal.TweetalPortlet.java
/** * Delegate to appropriate PortletMode.// w w w. j av a 2s. com */ protected void doDispatch(RenderRequest request, RenderResponse response) throws PortletException, IOException { if (StringUtils.equalsIgnoreCase(request.getPortletMode().toString(), "config")) { doConfig(request, response); } else { super.doDispatch(request, response); } }
From source file:com.alibaba.otter.node.etl.common.io.download.impl.aria2c.Aria2cDownload.java
protected void analyzeResult(Exec.Result result) { String[] results = StringUtils.split(result.getStdout(), SystemUtils.LINE_SEPARATOR); List<Aria2cStat> segmentStat = new ArrayList<Aria2cStat>(); int pos = 0;//from w ww. ja v a 2 s . com for (; pos < results.length; pos++) { if (true == results[pos].toLowerCase().startsWith("gid|stat")) { break; } } for (pos++; pos < results.length; pos++) { // ? // Download Results: // gid|stat|avg speed |path/URI // ===+====+===========+=========================================================== // 1| OK| 103.7KiB/s|./index.html // // Status Legend: // (OK):download completed. if (true == StringUtils.isNumeric(results[pos].substring(0, 1))) { // ????? String[] status = StringUtils.split(results[pos], " \t|"); if (status.length > 2) { if (StringUtils.equalsIgnoreCase(Aria2cStat.OK.name(), status[1])) { segmentStat.add(Aria2cStat.OK); } else if (StringUtils.equalsIgnoreCase(Aria2cStat.ERR.name(), status[1])) { segmentStat.add(Aria2cStat.ERR); } else if (StringUtils.equalsIgnoreCase(Aria2cStat.INPR.name(), status[1])) { segmentStat.add(Aria2cStat.INPR); } logger.warn(results[pos]); } else { logger.error("it seems aria2 changed it's status format: " + results[pos]); } } } int size = segmentStat.size(); int errCount = 0; int inprCount = 0; for (int i = 0; i < size; i++) { final Aria2cStat stat = segmentStat.get(i); if (Aria2cStat.ERR == stat) { errCount++; } else if (Aria2cStat.INPR == stat) { inprCount++; } } // ??? if (errCount == 0) { if (inprCount == 0) { // ? completed.set(true); } else { // ? paused.set(true); } } else { if (errCount == size) { // ? aborted.set(true); } else { // ?? paused.set(true); } } }
From source file:com.aqnote.shared.cryptology.digetst.SHATest.java
public void test02_innerMethod() throws UnsupportedEncodingException { // SHA1//w ww .j av a 2s . c o m Assert.assertTrue( StringUtils.equalsIgnoreCase(SHA.sha1("13675815985"), SHA._sha1("13675815985".getBytes("UTF-8")))); // SHA2 Assert.assertTrue(StringUtils.equalsIgnoreCase(SHA.sha224("13675815985"), SHA._sha224("13675815985".getBytes("UTF-8")))); Assert.assertTrue(StringUtils.equalsIgnoreCase(SHA.sha256("13675815985"), SHA._sha256("13675815985".getBytes("UTF-8")))); Assert.assertTrue(StringUtils.equalsIgnoreCase(SHA.sha384("13675815985"), SHA._sha384("13675815985".getBytes("UTF-8")))); Assert.assertTrue(StringUtils.equalsIgnoreCase(SHA.sha512("13675815985"), SHA._sha512("13675815985".getBytes("UTF-8")))); Assert.assertTrue(StringUtils.equalsIgnoreCase(SHA.sha512_224("13675815985"), SHA._sha512_224("13675815985".getBytes("UTF-8")))); Assert.assertTrue(StringUtils.equalsIgnoreCase(SHA.sha512_256("13675815985"), SHA._sha512_256("13675815985".getBytes("UTF-8")))); // SHA3 Assert.assertTrue(StringUtils.equalsIgnoreCase(SHA.sha3_224("13675815985"), SHA._sha3_224("13675815985".getBytes("UTF-8")))); Assert.assertTrue(StringUtils.equalsIgnoreCase(SHA.sha3_256("13675815985"), SHA._sha3_256("13675815985".getBytes("UTF-8")))); Assert.assertTrue(StringUtils.equalsIgnoreCase(SHA.sha3_384("13675815985"), SHA._sha3_384("13675815985".getBytes("UTF-8")))); Assert.assertTrue(StringUtils.equalsIgnoreCase(SHA.sha3_512("13675815985"), SHA._sha3_512("13675815985".getBytes("UTF-8")))); }