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:edu.monash.merc.common.name.PTMPhsType.java
public static PTMPhsType fromType(String type) { if (StringUtils.isBlank(type)) { return PHS_UKNOWN; }/*from w ww . j a v a2s . c o m*/ if (StringUtils.equalsIgnoreCase(type, PHS_S.type())) { return PHS_S; } if (StringUtils.equalsIgnoreCase(type, PHS_T.type())) { return PHS_T; } if (StringUtils.equalsIgnoreCase(type, PHS_Y.type())) { return PHS_Y; } if (StringUtils.equalsIgnoreCase(type, PHS_NON_S.type())) { return PHS_NON_S; } if (StringUtils.equalsIgnoreCase(type, PHS_NON_T.type())) { return PHS_NON_T; } if (StringUtils.equalsIgnoreCase(type, PHS_NON_Y.type())) { return PHS_NON_Y; } return PHS_UKNOWN; }
From source file:gov.nih.nci.cabig.caaers.web.search.AdvancedSearchUiUtil.java
/** * @param attr//from w ww .ja v a2 s . co m * @param predicate * @return */ public static Operator getOperator(UiAttribute attr, String predicate) { for (Operator op : attr.getOperator()) { if (StringUtils.equalsIgnoreCase(predicate, op.getName())) { return op; } } return null; }
From source file:com.mmj.app.common.cookie.parser.CookieParser.java
/** * CookieName???Cookievalue. ?CookieNameCookieKey * /*from w w w.j a v a2 s. c om*/ * @return ?null */ public static CookieNameHelper paserCookieValue(CookieNameConfig cookieNameConfig, String cookieValue) { String value = StringUtils.trimToNull(cookieValue); if (value == null || StringUtils.equalsIgnoreCase("null", value)) return null; // ? if (cookieNameConfig.isEncrypt()) { value = EncryptBuilder.getInstance().decrypt(value); } CookieNameHelper cookieNameHelper = new CookieNameHelper(cookieNameConfig.getCookieName(), cookieNameConfig); // ??Key??,? if (cookieNameConfig.isSimpleValue()) { cookieNameHelper.parserValue(value); } else { // ??Value?? Map<CookieKeyEnum, String> kv = CookieUtils.strToKVMap(value, cookieNameConfig); // CookieNameHelper cookieNameHelper = null; if (kv != null && !kv.isEmpty()) cookieNameHelper.parserAllValues(kv); } return cookieNameHelper; }
From source file:com.btobits.automator.fix.comparator.MailComparator.java
public static void compare(final FixMessageType inMsg, final SMTPMessage inSmtpMessage) throws Exception { final List<String> errors = new ArrayList<String>(); try {// ww w . j a va2 s .c o m // compare header field for (final FixMessageType.Field field : inMsg.getFields()) { if (!field.isGroup()) { final String value = getHeaderField(field.getName(), inSmtpMessage); if (StringUtils.isBlank(value) && StringUtils.isBlank(field.getValue())) { continue; } else if (StringUtils.isBlank(value)) { errors.add("Field [" + field.getName() + "] is absend in receive email."); } else if (!StringUtils.equals(field.getValue(), value) && StringUtils.startsWith(value, "<") && StringUtils.endsWith(value, ">")) { final String subValue = StringUtils.substringBetween(value, "<", ">"); if (StringUtils.isBlank(subValue)) { errors.add("Field [" + field.getName() + "] is not eq receive email field ['" + field.getValue() + " != " + value + "']."); } else if (!StringUtils.equalsIgnoreCase(subValue, field.getValue())) { errors.add("Field [" + field.getName() + "] is not eq receive email field ['" + field.getValue() + " != " + value + "']."); } } else if (!StringUtils.equals(field.getValue(), value)) { errors.add("Field [" + field.getName() + "] is not eq receive email field ['" + field.getValue() + " != " + value + "']."); } } else { // compare group final List<String> body = getDataFields(inSmtpMessage); final LinkedList<FixMessageType.Field> fields = field.getFields(); int count = 0; for (FixMessageType.Field grFld : fields) { final String value = getValueOnPosition(body, count); if (StringUtils.equals(grFld.getName(), FIX_MESSAGE_FLD)) { String fixMessage = getFixField("Original FIX message:", inSmtpMessage); if (!StringUtils.equals(fixMessage, grFld.getValue())) { errors.add( "Data fix field [" + grFld.getName() + "] is not eq receive email field ['" + grFld.getValue() + " != " + fixMessage + "']."); } } else { if (StringUtils.isBlank(value) && StringUtils.isBlank(grFld.getValue())) { } else { if (!StringUtils.equals(value, grFld.getValue())) { errors.add( "Data field [" + grFld.getName() + "] is not eq receive email field ['" + grFld.getValue() + " != " + value + "']."); } } } count++; } } } } catch (Exception ex) { throw new BuildException("Error compare message", ex); } if (!errors.isEmpty()) { throw new MessageDifferenceException(FixUtils.toString(errors)); } }
From source file:com.adobe.acs.commons.quickly.operations.impl.HelpOperationImpl.java
@Override public boolean accepts(final SlingHttpServletRequest request, final Command cmd) { return StringUtils.equalsIgnoreCase(CMD, cmd.getOp()) || StringUtils.equalsIgnoreCase(CMD_ALIAS, cmd.getOp()); }
From source file:com.tesora.dve.distribution.compare.ComparatorCache.java
public static void add(String comparatorClassName) { // For now hard code our implementation of UUID to this comparator class name if (!comparators.containsKey(comparatorClassName)) { if (StringUtils.equalsIgnoreCase(comparatorClassName, DEFAULT_UUID_COMPARATOR)) { comparators.put(comparatorClassName, UUID_COMPARATOR); }/*from ww w.ja va2 s .co m*/ } // try to dynamically load the jar file... // try { // if (!managers.containsKey(comparator)) { // Class<?> theClass = null; // try { // theClass = Class.forName(comparator); // } catch (Exception e) { // // new jar? look for new ones // Collection<File> files = FileUtils.listFiles(new File("D:\\Eclipse\\workspace\\general\\UUIDComparator\\target"), // new String[] {"jar"}, // false); // List<URL> urls = new ArrayList<URL>(); // for(File file : files) { // URL u = file.toURI().toURL(); // urls.add(u); // } //// URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader(); //// theClass = sysloader.loadClass(comparator); // URLClassLoader child = new URLClassLoader(urls.toArray(new URL[urls.size()]), ComparisonManager.class.getClassLoader()); // Class classToLoad = Class.forName (comparator, true, child); // Comparator c = (Comparator)theClass.newInstance(); // managers.put(comparator, c); // } // // } // } catch (Exception e) { // e.printStackTrace(); // } }
From source file:hydrograph.ui.propertywindow.widgets.listeners.VerifyTeraDataFastLoadOption.java
@Override public Listener getListener(PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helpers, Widget... widgets) {// w ww . j ava 2 s. co m final Widget[] widgetList = widgets; Listener listener = new Listener() { @Override public void handleEvent(Event event) { if (StringUtils.equalsIgnoreCase(((Button) widgetList[0]).getText(), String.valueOf(FAST_LOAD)) && ((Button) widgetList[0]).getSelection()) { MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_INFORMATION | SWT.OK); messageBox.setText(INFORMATION); messageBox.setMessage(Messages.FAST_LOAD_ERROR_MESSAGE); messageBox.open(); } } }; return listener; }
From source file:edu.monash.merc.common.name.GPMPTMSubType.java
public static GPMPTMSubType fromType(String type) { if (StringUtils.isBlank(type)) { return UKNOWN; }/*from w ww . j av a 2 s. c o m*/ if (StringUtils.equalsIgnoreCase(type, PHS_S.type())) { return PHS_S; } if (StringUtils.equalsIgnoreCase(type, PHS_T.type())) { return PHS_T; } if (StringUtils.equalsIgnoreCase(type, PHS_Y.type())) { return PHS_Y; } if (StringUtils.equalsIgnoreCase(type, NON_PHS_S.type())) { return NON_PHS_S; } if (StringUtils.equalsIgnoreCase(type, NON_PHS_T.type())) { return NON_PHS_T; } if (StringUtils.equalsIgnoreCase(type, NON_PHS_Y.type())) { return NON_PHS_Y; } if (StringUtils.equalsIgnoreCase(type, LYS.type())) { return LYS; } if (StringUtils.equalsIgnoreCase(type, NON_LYS.type())) { return NON_LYS; } if (StringUtils.equalsIgnoreCase(type, NTA.type())) { return NTA; } if (StringUtils.equalsIgnoreCase(type, NON_NTA.type())) { return NON_NTA; } return UKNOWN; }
From source file:com.smartitengineering.cms.ws.common.jackson.FieldValueTypeIdResolver.java
@Override public JavaType typeFromId(String id) { if (StringUtils.equalsIgnoreCase(id, "collection")) { return SimpleType.construct(CollectionFieldValue.class); } else if (StringUtils.equalsIgnoreCase(id, "composite")) { return SimpleType.construct(CompositeFieldValue.class); } else if (StringUtils.equalsIgnoreCase(id, "string") || StringUtils.equalsIgnoreCase(id, "other")) { return SimpleType.construct(OtherFieldValue.class); } else {/* w w w . j a v a2 s. c om*/ return SimpleType.construct(FieldValue.class); } }
From source file:com.dianping.phoenix.router.ResponseFilter.java
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (response instanceof HttpServletResponse && request instanceof HttpServletRequest) { HttpServletRequest hRequest = (HttpServletRequest) request; if (StringUtils.equalsIgnoreCase(SCRIPT_NAME, hRequest.getRequestURI())) { IOUtils.copy(this.getClass().getResourceAsStream(SCRIPT_NAME), response.getOutputStream()); return; }//www .ja v a 2 s . com StatusAwareServletResponse statusAwareServletResponse = new StatusAwareServletResponse( (HttpServletResponse) response); chain.doFilter(request, statusAwareServletResponse); if (ACCEPTED_STATUS_CODE.contains(statusAwareServletResponse.getStatus()) && (StringUtils.isBlank(statusAwareServletResponse.getContentType()) || ACCEPTED_CONTENT_TYPE .contains(statusAwareServletResponse.getContentType().toLowerCase())) && hRequest.getHeader("x-requested-with") == null) { statusAwareServletResponse.getOutputStream().write(RESPONSE_APPEND_TEXT); } } else { chain.doFilter(request, response); } }