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.apexxs.neonblack.setup.Setup.java

public static void main(String[] args) {
    Configuration config = Configuration.getInstance();
    SolrLoader solrLoader = null;// w w w  . j  a  v a 2 s  . com
    int count = 0;

    SolrUtilities solrUtilities = new SolrUtilities();
    if (!solrUtilities.checkCoreStatus("geonames")) {
        logger.error("Unable to establish connection to geonames core - Application terminated");
        System.exit(-1);
    }

    if (!solrUtilities.checkCoreStatus("geodata")) {
        logger.error("Unable to establish connection to geodata core - Application terminated");
        System.exit(-1);
    }

    logger.warn("Solr geonames and geodata indices will be cleared...");
    SolrUtilities sutil = new SolrUtilities();
    //        sutil.clearSolrIndices();

    long startTime = System.currentTimeMillis();

    try {
        SolrServerFactory solrServerFactory = new SolrServerFactory();
        SolrServer server = solrServerFactory.getConcurrentSolrServer("geonames");

        //            GeoNamesLoader geoNamesLoader = new GeoNamesLoader();
        //            System.out.println("***Loading Geonames gazetteer***");
        //            count = geoNamesLoader.load(server);
        //            System.out.println("Committing and optimizing Geonames index....");
        //            server.commit();
        //            server.optimize();
        //
        //            System.out.println("Geonames index complete - inserted " + count + " documents.");

        server = solrServerFactory.getHTTPServer("geodata");
        if (StringUtils.equalsIgnoreCase(config.getPolygonType(), "gadm")) {
            System.out.println("***Loading GADM Border polygons***");
            solrLoader = new GADMBorderLoader();
            count = solrLoader.load(server);
        } else if (StringUtils.equalsIgnoreCase(config.getPolygonType(), "ne")) {
            System.out.println("***Loading Natural Earth Border polygons***");
            solrLoader = new NaturalEarthLoader();
            count = solrLoader.load(server);
        } else {
            System.out.println("***Loading Thematicmapping polygons***");
            solrLoader = new TMBorderLoader();
            count = solrLoader.load(server);
            solrLoader = new StateBorderLoader();
            count += solrLoader.load(server);
        }
        System.out.println("Committing and optimizing Geodata index....");
        server.commit();
        server.optimize();
        server.shutdown();
        System.out.println("***Loaded " + count + " polygons***");
    } catch (Exception ex) {
        logger.error("Error loading SOLR indices - " + ex.getMessage());
    }

    long endTime = System.currentTimeMillis();
    System.out.println("***Solr Index load complete***");
    System.out.println("Elapsed time: " + (endTime - startTime) / 60000 + " minutes");
}

From source file:com.kamike.misc.CookieUtils.java

/**
 *
 * ?COOKIE//from  w w  w .  ja v a  2 s  .com
 *
 *
 *
 * @param name
 *
 */
public static Cookie getCookie(HttpServletRequest request, String name) {

    Cookie[] cookies = request.getCookies();

    if (cookies == null) {
        return null;
    }

    for (Cookie ck : cookies) {

        if (StringUtils.equalsIgnoreCase(name, ck.getName())) {
            return ck;
        }
    }

    return null;

}

From source file:com.sfs.whichdoctor.formatter.UrlGenerator.java

public static String modify(final PreferencesBean preferences, final String type, final int objectId) {

    String url = "";

    if (StringUtils.equalsIgnoreCase(type, "person")) {
        url = preferences.buildUrl("save", "people_edit", "modifyitem", objectId);
    }//  w w w.  j  a  va  2  s  .  c  om
    if (StringUtils.equalsIgnoreCase(type, "organisation")) {
        url = preferences.buildUrl("save", "organisations_edit", "modifyitem", objectId);
    }
    if (StringUtils.equalsIgnoreCase(type, "debit")) {
        url = preferences.buildUrl("save", "debits_edit", "modifyitem", objectId);
    }
    if (StringUtils.equalsIgnoreCase(type, "credit")) {
        url = preferences.buildUrl("save", "credits_edit", "modifyitem", objectId);
    }
    if (StringUtils.equalsIgnoreCase(type, "receipt")) {
        url = preferences.buildUrl("save", "receipts_edit", "modifyitem", objectId);
    }
    if (StringUtils.equalsIgnoreCase(type, "reimbursement")) {
        url = preferences.buildUrl("save", "reimbursements_edit", "modifyitem", objectId);
    }
    if (StringUtils.equalsIgnoreCase(type, "rotation")) {
        url = preferences.buildUrl("save", "rotations_modify", "modify", objectId);
    }
    if (StringUtils.equalsIgnoreCase(type, "group")) {
        url = preferences.buildUrl("save", "groups_edit", "modifyitem", objectId);
    }
    return url;
}

From source file:com.microsoft.alm.plugin.external.models.ServerStatusType.java

/**
 * Figure out server status type from string
 *
 * @param statusString//from ww w .  j av a  2  s .c o  m
 * @return
 */
public static List<ServerStatusType> getServerStatusTypes(final String statusString) {
    final String[] args = StringUtils.split(statusString, ",");
    final List<ServerStatusType> types = new ArrayList<ServerStatusType>(args.length);

    for (int i = 0; i < args.length; i++) {
        if (StringUtils.equalsIgnoreCase(args[i].trim(), ADD.name())) {
            types.add(ADD);
        } else if (StringUtils.equalsIgnoreCase(args[i].trim(), DELETE.name())) {
            types.add(DELETE);
        } else if (StringUtils.equalsIgnoreCase(args[i].trim(), EDIT.name())) {
            types.add(EDIT);
        } else if (StringUtils.equalsIgnoreCase(args[i].trim(), RENAME.name())
                || StringUtils.equalsIgnoreCase(args[i].trim(), SOURCE_RENAME)) {
            types.add(RENAME);
        } else if (StringUtils.equalsIgnoreCase(args[i].trim(), UNDELETE.name())) {
            types.add(UNDELETE);
        } else if (StringUtils.containsIgnoreCase(args[i].trim(), LOCK.name())) {
            types.add(LOCK);
        } else if (StringUtils.containsIgnoreCase(args[i].trim(), BRANCH.name())) {
            types.add(BRANCH);
        } else {
            logger.error("Undocumented status from server: " + args[i]);
            types.add(UNKNOWN);
        }
    }
    return types;
}

From source file:com.sfs.whichdoctor.formatter.ExpenseClaimFormatter.java

public static String getField(final ExpenseClaimBean expenseClaim, final String field) {

    String value = "";

    if (StringUtils.equalsIgnoreCase(field, "Quantity")) {
        value = getQuantity(expenseClaim);
    }// w w  w . j  a  v a 2 s .c  o m
    return value;
}

From source file:com.adobe.acs.commons.analysis.jcrchecksum.impl.options.ChecksumGeneratorOptionsFactory.java

public static ChecksumGeneratorOptions getOptions(SlingHttpServletRequest request, String name)
        throws IOException {
    if (StringUtils.equalsIgnoreCase("REQUEST", name)) {
        return new RequestChecksumGeneratorOptions(request);
    } else {//from  ww  w .j  a  v a  2 s .  c o  m
        return new DefaultChecksumGeneratorOptions(request);
    }
}

From source file:com.tesora.dve.common.SiteInstanceStatus.java

public static SiteInstanceStatus fromString(String s) {
    for (SiteInstanceStatus sis : values()) {
        if (StringUtils.equalsIgnoreCase(sis.name(), s)) {
            return sis;
        }//from  w  w w.  j  a  va  2  s. c o m
    }
    return null;
}

From source file:com.zb.app.websocket.cons.ActionStatusEnum.java

public static ActionStatusEnum getAction(String name) {
    for (ActionStatusEnum action : values()) {
        if (StringUtils.equalsIgnoreCase(name, action.getName()))
            return action;
    }//from  www.ja  v  a 2 s.  com
    return null;
}

From source file:com.kamike.misc.CookieUtils.java

/**
 *
 * ?COOKIE/* w  w w .ja va 2 s  .c o m*/
 *
 *
 *
 * @param name
 *
 */
public static String getCookieValue(HttpServletRequest request, String name) {

    Cookie[] cookies = request.getCookies();

    if (cookies == null) {
        return null;
    }

    for (Cookie ck : cookies) {

        if (StringUtils.equalsIgnoreCase(name, ck.getName())) {

        }
    }

    return null;

}

From source file:com.mmj.app.biz.cons.SexEnum.java

/**
 * ?value?// ww w. ja v  a 2s  .c  o  m
 */
public static SexEnum getEnum(String name) {
    if (StringUtils.isEmpty(name)) {
        return null;
    }
    if (StringUtils.equalsIgnoreCase("true", name) || StringUtils.equalsIgnoreCase("man", name)
            || StringUtils.equalsIgnoreCase("male", name)) {
        return MAN;
    }
    if (StringUtils.equalsIgnoreCase("false", name) || StringUtils.equalsIgnoreCase("man", name)
            || StringUtils.equalsIgnoreCase("female", name)) {
        return WOMAN;
    }
    return null;
}