Example usage for org.apache.commons.lang StringUtils equalsIgnoreCase

List of usage examples for org.apache.commons.lang StringUtils equalsIgnoreCase

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils equalsIgnoreCase.

Prototype

public static boolean equalsIgnoreCase(String str1, String str2) 

Source Link

Document

Compares two Strings, returning true if they are equal ignoring the case.

Usage

From source file:com.ms.commons.cookie.parser.CookieParser.java

/**
 * CookieName???Cookievalue. ?CookieNameCookieKey
 * //w  w w.  j  a  v a  2  s  .  c  o m
 * @return ?null
 */
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 = CookieUtils.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.sfs.whichdoctor.export.writer.ExportWriterBase.java

/**
 * Checks if the field is an address.//from   w  w  w.j  av a  2s  .  c  o m
 *
 * @param fieldName the field name
 * @return true, if is address
 */
protected final boolean isAddress(final String fieldName) {

    boolean isAddress = false;

    if (StringUtils.equalsIgnoreCase(fieldName, "Address (mail merge)")
            || StringUtils.equalsIgnoreCase(fieldName, "Street Address (mail merge)")) {
        isAddress = true;
    }
    return isAddress;
}

From source file:de.hybris.platform.acceleratorservices.payment.cybersource.converters.populators.response.AuthReplyResultPopulator.java

@Override
public void populate(final Map<String, String> source, final CreateSubscriptionResult target)
        throws ConversionException {
    validateParameterNotNull(source, "Parameter [Map<String, String>] source cannot be null");
    validateParameterNotNull(target, "Parameter [CreateSubscriptionResult] target cannot be null");

    final AuthReplyData data = new AuthReplyData();
    data.setCcAuthReplyAmount(getBigDecimalForString(source.get("ccAuthReply_amount")));
    data.setCcAuthReplyAuthorizationCode(source.get("ccAuthReply_authorizationCode"));
    data.setCcAuthReplyAuthorizedDateTime(source.get("ccAuthReply_authorizedDateTime"));
    data.setCcAuthReplyAvsCode(source.get("ccAuthReply_avsCode"));
    data.setCcAuthReplyAvsCodeRaw(source.get("ccAuthReply_avsCodeRaw"));
    data.setCcAuthReplyCvCode(source.get("ccAuthReply_cvCode"));
    data.setCcAuthReplyProcessorResponse(source.get("ccAuthReply_processorResponse"));
    data.setCcAuthReplyReasonCode(getIntegerForString(source.get("ccAuthReply_reasonCode")));
    data.setCvnDecision(Boolean.valueOf(StringUtils.equalsIgnoreCase(source.get("ccAuthReply_cvCode"), "M")));

    target.setAuthReplyData(data);/*from w  ww  .  j  a v a2s . co  m*/
}

From source file:com.krawler.runtime.utils.URLClassLoaderUtil.java

public void addJarURL(URL u) throws Exception {
    try {//from w w w . java 2  s  . c  om

        URLClassLoader sysLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
        URL urls[] = sysLoader.getURLs();
        for (int i = 0; i < urls.length; i++) {
            if (StringUtils.equalsIgnoreCase(urls[i].toString(), u.toString())) {
                if (log.isDebugEnabled()) {
                    log.debug("URL " + u + " is already in the CLASSPATH");
                }
                return;
            }
        }
        Class sysclass = URLClassLoader.class;
        Method method = sysclass.getDeclaredMethod("addURL", parameters);
        method.setAccessible(true);
        method.invoke(sysLoader, new Object[] { u });
    } catch (Exception e) {
        e.printStackTrace();
        throw new Exception("Error, could not add URL to system classloader" + e.getMessage());
    }

}

From source file:edu.monash.merc.common.name.DbAcType.java

public static DbAcType fromType(String type) {
    if (StringUtils.equalsIgnoreCase(type, NextProt.type())) {
        return NextProt;
    }//from w  w  w  .jav a2 s . com
    if (StringUtils.equalsIgnoreCase(type, GPM.type())) {
        return GPM;
    }
    if (StringUtils.equalsIgnoreCase(type, GPMPSYT.type())) {
        return GPMPSYT;
    }
    if (StringUtils.equalsIgnoreCase(type, GPMLYS.type())) {
        return GPMLYS;
    }
    if (StringUtils.equalsIgnoreCase(type, GPMNTA.type())) {
        return GPMNTA;
    }
    if (StringUtils.equalsIgnoreCase(type, HPA.type())) {
        return HPA;
    }
    if (StringUtils.equalsIgnoreCase(type, PA.type())) {
        return PA;
    }
    if (StringUtils.equalsIgnoreCase(type, Ensembl.type())) {
        return Ensembl;
    }
    if (StringUtils.equalsIgnoreCase(type, Gene.type())) {
        return Gene;
    }
    if (StringUtils.equalsIgnoreCase(type, Protein.type())) {
        return Protein;
    }
    if (StringUtils.equalsIgnoreCase(type, Transcript.type())) {
        return Transcript;
    }
    if (StringUtils.equalsIgnoreCase(type, SwissProt.type())) {
        return SwissProt;
    }
    if (StringUtils.equalsIgnoreCase(type, BarCode.type())) {
        return BarCode;
    }
    if (StringUtils.equalsIgnoreCase(type, BarcodeHgu133a.type())) {
        return BarcodeHgu133a;
    }
    if (StringUtils.equalsIgnoreCase(type, BarcodeHgu133plus2.type())) {
        return BarcodeHgu133plus2;
    }
    if (StringUtils.equalsIgnoreCase(type, Affymetrix.type())) {
        return Affymetrix;
    }
    return Unknown;
}

From source file:io.cloudslang.score.facade.execution.ExecutionSummary.java

public void setBranchId(String branchId) {
    // In the DB and ExecutionSummaryEntity we use "EMPTY" (EMPTY_BRANCH) for empty branchId.
    // But all the usages still use null. So, here we convert it from "EMPTY" to null, for the outside world.
    if (StringUtils.equalsIgnoreCase(branchId, EMPTY_BRANCH)) {
        this.branchId = null;
    } else {//from  www . j a  va 2s . c o  m
        this.branchId = branchId;
    }
}

From source file:com.igrow.mall.common.util.Struts2Utils.java

/**
 * ./*from w  w w .  jav  a 2s .  c o  m*/
        
 * eg.
 * render("text/plain", "hello", "encoding:GBK");
 * render("text/plain", "hello", "no-cache:false");
 * render("text/plain", "hello", "encoding:GBK", "no-cache:false");
 * 
 * @param headers ??header??"encoding:""no-cache:",UTF-8true.
 */
public static void render(final String contentType, final String content, final String... headers) {
    try {
        //?headers?
        String encoding = ENCODING_DEFAULT;
        boolean noCache = NOCACHE_DEFAULT;
        for (String header : headers) {
            String headerName = StringUtils.substringBefore(header, ":");
            String headerValue = StringUtils.substringAfter(header, ":");

            if (StringUtils.equalsIgnoreCase(headerName, ENCODING_PREFIX)) {
                encoding = headerValue;
            } else if (StringUtils.equalsIgnoreCase(headerName, NOCACHE_PREFIX)) {
                noCache = Boolean.parseBoolean(headerValue);
            } else
                throw new IllegalArgumentException(headerName + "??header");
        }

        HttpServletResponse response = ServletActionContext.getResponse();

        //headers?
        String fullContentType = contentType + ";charset=" + encoding;
        response.setContentType(fullContentType);
        if (noCache) {
            response.setHeader("Pragma", "No-cache");
            response.setHeader("Cache-Control", "no-cache");
            response.setDateHeader("Expires", 0);
        }

        response.getWriter().write(content);
        response.getWriter().flush();

    } catch (IOException e) {
        logger.error(e.getMessage(), e);
    }
}

From source file:hydrograph.ui.validators.impl.FTPProtocolSelectionValidator.java

@Override
public boolean validate(Object object, String propertyName, Map<String, List<FixedWidthGridRow>> inputSchemaMap,
        boolean isJobFileImported) {
    FTPProtocolDetails protocolDetails = null;
    if (object instanceof FTPProtocolDetails) {
        if (object != null && !object.equals("")) {
            protocolDetails = (FTPProtocolDetails) object;
            if (!StringUtils.equalsIgnoreCase(protocolDetails.getProtocol(), "AWS S3 HTTPS")) {
                if (protocolDetails.getHost() != null && protocolDetails.getPort() != null) {
                    if (StringUtils.isBlank(protocolDetails.getHost())) {
                        return false;
                    }//from w  w w . j ava2 s  .c o  m
                    if (!validatePort(protocolDetails.getPort(), "Port")) {
                        return false;
                    }
                }
            }
        }
    }
    return true;
}

From source file:de.dev.eth0.retweeter.Distributor.java

/**
 * Distributes the tweets to all target accounts.
 *
 * @return/*  ww w  .  j  a va2  s.  co m*/
 * @throws TwitterException
 */
public int distribute() throws TwitterException {
    if (!getConfig().isDistributorConfigValid()) {
        return Integer.MIN_VALUE;
    }
    Twitter twitter = getTwitter();
    String search = buildSearchString();
    Query query = new Query(search);
    QueryResult result = twitter.search(query);
    int count = 0;
    // Iterate through results
    for (Tweet tweet : result.getTweets()) {
        // Check if already distributed
        if (!distributedTweets.contains(tweet.getId())
                && StringUtils.contains(tweet.getText(), getConfig().getDistributorConfig().getHashtag())) {
            // Retweet each result to all targetaccounts
            for (String targetaccount : getConfig().getDistributorConfig().getTargetaccounts()) {
                // Dont distribute to yourself
                if (!StringUtils.equalsIgnoreCase(tweet.getFromUser(), targetaccount)) {
                    StringBuilder sb = new StringBuilder();
                    sb.append("@");
                    sb.append(targetaccount);
                    sb.append(": RT @");
                    sb.append(tweet.getFromUser());
                    sb.append(" ");
                    sb.append(tweet.getText());
                    String text = sb.toString();
                    // try to tweet, might cause an exception (status duplicate) if already tweeted
                    logger.debug("Distributing tweet {} to {}", tweet.toString(), targetaccount);
                    try {
                        twitter.updateStatus(text.length() < 140 ? text : text.substring(0, 140));
                        count++;
                    } catch (TwitterException te) {
                        logger.warn("distribute of tweet " + tweet.toString() + "failed " + text, te);
                    }
                    distributedTweets.add(tweet.getId());
                }
            }
        }
    }
    return count;
}

From source file:com.sfs.beans.UserPreferencesBean.java

/**
 * Gets the user preference option as a boolean.
 *
 * @param index the index/*w  ww  . j  a  v  a 2s .c  om*/
 * @return the bl option
 */
public final boolean getBlOption(final String index) {
    boolean option = false;

    if (StringUtils.equalsIgnoreCase(this.getOption(index), "true")) {
        option = true;
    }
    return option;
}