List of usage examples for java.lang String compareToIgnoreCase
public int compareToIgnoreCase(String str)
From source file:es.alrocar.poiproxy.configuration.DescribeService.java
/** * Check if the category is in the {@link #categories} supported by the * service//from w w w. ja v a 2s. co m * * @param category * @return */ public boolean containsCategory(String category) { if (this.categories == null || this.categories.isEmpty()) { return false; } for (String cat : categories) { if (category.compareToIgnoreCase(cat) == 0) { return true; } } return false; }
From source file:io.hops.hopsworks.common.util.WebCommunication.java
public Object anaconda(String hostAddress, String agentPassword, String op, String project, String arg) throws Exception { String path = "anaconda/" + settings.getAnacondaUser() + '/' + op.toLowerCase() + "/" + project; String template = "%s://%s:%s/%s"; String url = String.format(template, PROTOCOL, hostAddress, PORT, path); Map<String, String> args = null; if (op.compareToIgnoreCase(PythonDepsFacade.CondaOp.CLONE.toString()) == 0) { args = new HashMap<>(); if (arg == null || arg.isEmpty()) { throw new RuntimeException("You forgot the 'srcProject' argument for the conda " + "clone environment command for project " + project); }/*from w ww . jav a2 s . com*/ args.put("srcproj", arg); } Response response = getWebResource(url, agentPassword, args); int code = response.getStatus(); Family res = Response.Status.Family.familyOf(code); if (res == Response.Status.Family.SUCCESSFUL) { return response.getEntity(); } throw new RuntimeException( "Error. Failed to execute anaconda command " + op + " on " + project + ". Result was: " + res); }
From source file:org.sipfoundry.openfire.vcard.provider.SipXVCardProvider.java
@Override public Element createVCard(String username, Element element) { Element vcard = null;/*from w ww.j a v a 2s.c o m*/ try { defaultProvider.deleteVCard(username); vcard = defaultProvider.createVCard(username, element); } catch (AlreadyExistsException e) { e.printStackTrace(); logger.error("AlreadyExistsException even afer delete is called!"); if (username.compareToIgnoreCase(PA_USER) == 0) { return defaultProvider.loadVCard(username); } } if (username.compareToIgnoreCase(PA_USER) == 0) { return vcard; } return updateVCard(username, element); }
From source file:org.apache.synapse.transport.passthru.ServerWorker.java
/** * Create an Axis2 message context for the given http request. The request may be in the * process of being streamed//from ww w. j a v a 2s . c om * * @param request the http request to be used to create the corresponding Axis2 message context * @return the Axis2 message context created */ public MessageContext createMessageContext(MessageContext msgContext, SourceRequest request) { Map excessHeaders = request.getExcessHeaders(); ConfigurationContext cfgCtx = sourceConfiguration.getConfigurationContext(); if (msgContext == null) { msgContext = new MessageContext(); } msgContext.setMessageID(UIDGenerator.generateURNString()); // Axis2 spawns a new threads to send a message if this is TRUE - and it has to // be the other way msgContext.setProperty(MessageContext.CLIENT_API_NON_BLOCKING, Boolean.FALSE); msgContext.setConfigurationContext(cfgCtx); // msgContext.setTransportOut(cfgCtx.getAxisConfiguration() // .getTransportOut(Constants.TRANSPORT_HTTP)); // msgContext.setTransportIn(cfgCtx.getAxisConfiguration() // .getTransportIn(Constants.TRANSPORT_HTTP)); // msgContext.setIncomingTransportName(Constants.TRANSPORT_HTTP); // msgContext.setProperty(Constants.OUT_TRANSPORT_INFO, this); NHttpServerConnection conn = request.getConnection(); if (sourceConfiguration.getScheme().isSSL()) { msgContext.setTransportOut(cfgCtx.getAxisConfiguration().getTransportOut(Constants.TRANSPORT_HTTPS)); msgContext.setTransportIn(cfgCtx.getAxisConfiguration().getTransportIn(Constants.TRANSPORT_HTTPS)); msgContext.setIncomingTransportName(sourceConfiguration.getInDescription() != null ? sourceConfiguration.getInDescription().getName() : Constants.TRANSPORT_HTTPS); SSLIOSession ssliosession = (SSLIOSession) (conn.getContext()).getAttribute(SSLIOSession.SESSION_KEY); //set SSL certificates to message context if SSLVerifyClient parameter is set if (ssliosession != null && msgContext.getTransportIn() != null && msgContext.getTransportIn().getParameter(NhttpConstants.SSL_VERIFY_CLIENT) != null) { try { msgContext.setProperty(NhttpConstants.SSL_CLIENT_AUTH_CERT_X509, ssliosession.getSSLSession().getPeerCertificateChain()); } catch (SSLPeerUnverifiedException e) { //Peer Certificate Chain may not be available always.(in case of Mutual SSL is not enabled) if (log.isTraceEnabled()) { log.trace("Peer certificate chain is not available for MsgContext " + msgContext.getMessageID()); } } } } else { msgContext.setTransportOut(cfgCtx.getAxisConfiguration().getTransportOut(Constants.TRANSPORT_HTTP)); msgContext.setTransportIn(cfgCtx.getAxisConfiguration().getTransportIn(Constants.TRANSPORT_HTTP)); msgContext.setIncomingTransportName(sourceConfiguration.getInDescription() != null ? sourceConfiguration.getInDescription().getName() : Constants.TRANSPORT_HTTP); } msgContext.setProperty(Constants.OUT_TRANSPORT_INFO, this); msgContext.setServerSide(true); msgContext.setProperty(Constants.Configuration.TRANSPORT_IN_URL, request.getUri()); // http transport header names are case insensitive Map<String, String> headers = new TreeMap<String, String>(new Comparator<String>() { public int compare(String o1, String o2) { return o1.compareToIgnoreCase(o2); } }); Set<Map.Entry<String, String>> entries = request.getHeaders().entrySet(); for (Map.Entry<String, String> entry : entries) { headers.put(entry.getKey(), entry.getValue()); } msgContext.setProperty(MessageContext.TRANSPORT_HEADERS, headers); msgContext.setProperty(NhttpConstants.EXCESS_TRANSPORT_HEADERS, excessHeaders); // Following section is required for throttling to work if (conn instanceof HttpInetConnection) { HttpInetConnection netConn = (HttpInetConnection) conn; InetAddress remoteAddress = netConn.getRemoteAddress(); if (remoteAddress != null) { msgContext.setProperty(MessageContext.REMOTE_ADDR, remoteAddress.getHostAddress()); msgContext.setProperty(NhttpConstants.REMOTE_HOST, NhttpUtil.getHostName(remoteAddress)); } } msgContext.setProperty(RequestResponseTransport.TRANSPORT_CONTROL, new HttpCoreRequestResponseTransport(msgContext)); return msgContext; }
From source file:org.martin.ftp.util.RemoteComparator.java
@Override public int compare(FTPFile o1, FTPFile o2) { if (null != option) switch (option) { case DATE: if (order == SortOption.UPWARD) return (int) (o1.getTimestamp().getTimeInMillis() - o2.getTimestamp().getTimeInMillis()); else// w ww . j av a 2 s .c o m return (int) (o2.getTimestamp().getTimeInMillis() - o1.getTimestamp().getTimeInMillis()); case FORMAT: String file1Format = Utilities.getFormat(o1.getName()); String file2Format = Utilities.getFormat(o2.getName()); if (order == SortOption.UPWARD) if (o1.isDirectory() || o2.isDirectory()) { if (o1.isDirectory() && o2.isDirectory()) return idDirectory - idDirectory; else if (o1.isDirectory() && !o2.isDirectory()) return idDirectory - idFile; else return idFile - idDirectory; } else return file1Format.compareToIgnoreCase(file2Format); else if (o1.isDirectory() || o2.isDirectory()) { if (o1.isDirectory() && o2.isDirectory()) return idDirectory - idDirectory; else if (o1.isDirectory() && !o2.isDirectory()) return idFile - idDirectory; else return idDirectory - idFile; } else return file2Format.compareToIgnoreCase(file1Format); case NAME: if (order == SortOption.UPWARD) return o1.getName().compareToIgnoreCase(o2.getName()); else return o2.getName().compareToIgnoreCase(o1.getName()); case SIZE: if (order == SortOption.UPWARD) return (int) (o1.getSize() - o2.getSize()); else return (int) (o2.getSize() - o1.getSize()); case TYPE: if ((o1.isDirectory() && o2.isDirectory()) || (!o1.isDirectory() && !o2.isDirectory())) return idDirectory - idDirectory; if (order == SortOption.UPWARD) if (o1.isDirectory() && !o2.isDirectory()) return idDirectory - idFile; else return idFile - idDirectory; else if (o1.isDirectory() && !o2.isDirectory()) return idFile - idDirectory; else return idDirectory - idFile; default: return 0; } return 0; }
From source file:com.sfs.beans.GadgetBean.java
/** * Sets the scroll.//from w w w. ja v a 2 s . co m * * @param scrollOption the new scroll */ public final void setScroll(final String scrollOption) { this.scroll = "no"; if (scrollOption != null) { if (scrollOption.compareToIgnoreCase("true") == 0) { this.scroll = "auto"; } } }
From source file:com.krawler.spring.crm.common.ImportRecordAdvisor.java
private void AfterGetCustomComboID(MethodInvocation mi, Object result) throws DataInvalidateException { if (result != null) { List masterList = (List) result; if (masterList.size() == 0) { Object arguments[] = mi.getArguments(); try { HashMap<String, Object> requestParams = (HashMap<String, Object>) arguments[0]; if (requestParams.containsKey("doAction") && requestParams.containsKey("masterPreference")) { // String module = (String) arguments[1]; // String companyid = requestParams.get("companyid").toString(); String doAction = requestParams.get("doAction").toString(); String pref = (String) requestParams.get("masterPreference"); //0:Skip Record, 1:Skip Column, 2:Add new String addMissingMaster = (String) requestParams.get("addMissingMaster"); if (doAction.compareToIgnoreCase("import") == 0 && pref != null && pref.compareToIgnoreCase("2") == 0) { ArrayList<Object> filterValues = (ArrayList<Object>) arguments[3]; String fieldid = filterValues.get(1).toString(); String combovalue = (String) filterValues.get(0); HashMap<String, Object> comborequestParams = new HashMap<String, Object>(); comborequestParams.put("Fieldid", fieldid); comborequestParams.put("Value", combovalue); KwlReturnObject kmsg = fieldManagerDAOobj.insertfieldcombodata(comborequestParams); // JSONObject jobj = new JSONObject(fieldManager.addCustomComboData(fieldid, combovalue)); if (kmsg.getEntityList().size() > 0) { Iterator ite = kmsg.getEntityList().iterator(); FieldComboData fieldData = (FieldComboData) ite.next(); masterList.add(fieldData.getId()); }// ww w . j a va2 s . c o m } } } catch (Exception e) { logger.warn(e.getMessage(), e); } } } }
From source file:org.extensiblecatalog.ncip.v2.service.SchemeValuePair.java
/** * Note: If value is null and this.value is null, this will return true. * * @param scheme/*from w ww . j a v a2s . c o m*/ * @param value * @return */ public boolean matches(String scheme, String value) { // Note: We test for null value even though it should never be null. This is because this is called by // {@link #equals} and we can't violate the equals contract just because we've violated that design contract // for SchemeValuePair; and this is a public method and we don't want to impose any unnecessary requirements // on callers. boolean thisClassAllowsNullScheme = areNullSchemesAllowed(); if (this.getScheme() != null) { String thisSchemeCanonical = canonicalizeSchemeURI(this.getScheme()); // TODO: Consider storing canonical form of Scheme to speed this comparison, per Bloch p. 33-4. if (scheme != null) { String svpOSchemeCanonical = canonicalizeSchemeURI(scheme); if (thisSchemeCanonical.compareToIgnoreCase(svpOSchemeCanonical) == 0) { return this.compareValue(value); } else { return false; // this.scheme != o.scheme } } else if (thisClassAllowsNullScheme) { return this.compareValue(value); } else { return false; // this.scheme != null && o.scheme == null } } else { // this.scheme == null if (scheme != null) { if (thisClassAllowsNullScheme) { return this.compareValue(value); } else { return false; // this.scheme == null && o.scheme != null } } else { // this.scheme == null && o.scheme == null return this.compareValue(value); } } }
From source file:com.sfs.beans.GadgetBean.java
/** * Get the value.//www . j a v a 2 s .c om * * @param keyVal the key * @param gadgetPreferences the gadget preferences * * @return the string */ private String getValue(final String keyVal, final GadgetPreferencesBean gadgetPreferences) { String value = ""; if (gadgetPreferences.getUserPref(keyVal) != null) { value = gadgetPreferences.getUserPref(keyVal); } HashMap<String, HashMap<String, Object>> userPrefs = this.getUserPreferences(); if (userPrefs != null) { if (userPrefs.containsKey(keyVal)) { HashMap<String, Object> userPref = userPrefs.get(keyVal); String dataType = (String) userPref.get("datatype"); if (dataType != null) { if (dataType.compareToIgnoreCase("bool") == 0) { if (value.compareToIgnoreCase("true") == 0) { value = "1"; } else { value = "0"; } } } } } return value; }