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

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

Introduction

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

Prototype

public static boolean equalsIgnoreCase(final CharSequence str1, final CharSequence str2) 

Source Link

Document

Compares two CharSequences, returning true if they represent equal sequences of characters, ignoring case.

null s are handled without exceptions.

Usage

From source file:com.github.lburgazzoli.quickfixj.karaf.cmd.ConnectionListCommand.java

@Override
protected void execute() throws Exception {
    CommandShellTable table = new CommandShellTable(COLUMNS);
    List<IFIXConnection> ctxs = getAllServices(IFIXConnection.class, null);

    if (ctxs != null) {
        for (IFIXConnection connection : ctxs) {
            FIXSessionHelper helper = connection.getHelper();
            boolean add = true;

            if (StringUtils.isNotEmpty(ctx)) {
                add = StringUtils.equalsIgnoreCase(ctx, helper.getContext().getId());
            }/*from  w  w w.  j a  va  2 s. c  o m*/

            if (add) {
                table.row(helper.getContext().getId(), helper.getSession().getSessionID().getBeginString(),
                        helper.getSession().getSessionID().getSenderCompID(),
                        helper.getSession().getSessionID().getTargetCompID(), helper.getSession().isLoggedOn(),
                        connection.getRemoteIpAddress());
            }
        }
    }

    table.print();
}

From source file:com.yqboots.initializer.core.builder.excel.DomainSheetBuilder.java

@Override
protected void formatChecking(final Sheet sheet) {
    // get the title row
    Row mergedRow = sheet.getRow(0);/*from   w w  w  .j a v a  2  s  . co m*/
    Cell mergedCell = mergedRow.getCell(0);
    Assert.isTrue(StringUtils.equalsIgnoreCase(mergedCell.getStringCellValue(), "Module"),
            "Column 'Module' is required");

    mergedCell = mergedRow.getCell(1);
    Assert.isTrue(StringUtils.equalsIgnoreCase(mergedCell.getStringCellValue(), "Domain Name"),
            "Column 'Domain Name' is required");

    mergedCell = mergedRow.getCell(2);
    Assert.isTrue(StringUtils.equalsIgnoreCase(mergedCell.getStringCellValue(), "Generated"),
            "Column 'Generated' is required");

    Row row = sheet.getRow(1);
    Assert.isTrue(StringUtils.equalsIgnoreCase(row.getCell(3).getStringCellValue(), "DB Column"),
            "Column 'DB Column' is required");
    Assert.isTrue(StringUtils.equalsIgnoreCase(row.getCell(4).getStringCellValue(), "Class Field"),
            "Column 'Class Field' is required");
    Assert.isTrue(StringUtils.equalsIgnoreCase(row.getCell(5).getStringCellValue(), "Field Type"),
            "Column 'Field Type' is required");
}

From source file:edu.umn.se.trap.rule.businessrule.VisaStatusRule.java

/**
 * @param grants//w  ww .  j  a v a2  s  .  co  m
 * @param formUser
 * @throws TrapException
 */
protected void checkVisaStatus(Set<FormGrant> grants, FormUser formUser) throws TrapException {

    if (!(StringUtils.equalsIgnoreCase(formUser.getCitizenship(), "United States"))
            && !(StringUtils.equalsIgnoreCase(formUser.getCitizenship(), "USA"))) {

        /*
         * Iterate over the set and throw an error if any of the grants are
         * non-export.
         */

        if (!(StringUtils.equalsIgnoreCase(formUser.getVisaStatus(), "valid"))) {

            throw new TrapException(TrapErrors.INVALID_VISA);

        }

    }

}

From source file:io.ehdev.json.validation.pojo.validation.JsonValidationFloat.java

@Override
public boolean isEntryValid(String inputValue) {

    if (nullAcceptable && null == inputValue || StringUtils.equalsIgnoreCase("null", inputValue))
        return true;

    try {/*from www. j  av a  2s  .c om*/
        Float value = Float.parseFloat(inputValue);
        return isEntryValid(value);
    } catch (Exception e) {
        return false;
    }

}

From source file:com.opentable.logging.jetty.JsonRequestLog.java

@Override
public void log(final Request request, final Response response) {
    final String requestUri = request.getRequestURI();

    for (String blackListEntry : startsWithBlackList) {
        if (StringUtils.startsWithIgnoreCase(requestUri, blackListEntry)) {
            return;
        }/*  ww w. ja v a  2 s  . c  om*/
    }

    for (String blackListEntry : equalityBlackList) {
        if (StringUtils.equalsIgnoreCase(requestUri, blackListEntry)) {
            return;
        }
    }

    final RequestLogEvent event = eventFactory.createFor(clock, request, response);

    // TODO: this is a bit of a hack.  The RequestId filter happens inside of the
    // servlet dispatcher which is a Jetty handler.  Since the request log is generated
    // as a separate handler, the scope has already exited and thus the MDC lost its token.
    // But we want it there when we log, so let's put it back temporarily...
    MDC.put(CommonLogFields.REQUEST_ID_KEY, event.getRequestId());
    try {
        event.prepareForDeferredProcessing();
        LogbackLogging.log(LOG, event);
    } finally {
        MDC.remove(CommonLogFields.REQUEST_ID_KEY);
    }
}

From source file:io.ehdev.json.validation.pojo.validation.JsonValidationInteger.java

@Override
public boolean isEntryValid(String inputValue) {

    if (nullAcceptable && null == inputValue || StringUtils.equalsIgnoreCase("null", inputValue))
        return true;

    try {//from w  ww .jav  a2s  .  c  o  m
        Integer value = Integer.parseInt(inputValue);
        return isEntryValid(value);
    } catch (Exception e) {
        return false;
    }

}

From source file:edu.umn.se.trap.rule.grantrule.DodNoBreakfastRule.java

/**
 * @param expenses//from  w  w w . ja va2  s. c o  m
 * @throws TrapException
 */
private void checkExpenseGrants(Expense expense) throws TrapException {

    if (expense.getType().equals(ExpenseType.BREAKFAST)) {
        GrantSet grantSet = expense.getEligibleGrants();

        if (grantSet == null) {
            throw new TrapException("Invalid TrapForm object: grantSet was null.");
        }

        Set<FormGrant> grants = grantSet.getGrants();

        if (grants == null) {
            throw new TrapException("Invalid TrapForm object: grants was null.");
        }

        Iterator<FormGrant> grantIter = grants.iterator();

        while (grantIter.hasNext()) {
            FormGrant grant = grantIter.next();

            if (StringUtils.equalsIgnoreCase(grant.getFundingOrganization(), "DOD")) {
                // Remove the grant if it is a DOD grant trying to cover a
                // breakfast expense.
                grantSet.removeGrant(grant.getAccountName());
            }
        }

    }

}

From source file:com.inkubator.hrm.web.search.JabatanSearchParameter.java

public String getGolJab() {
    if (StringUtils.equalsIgnoreCase(getKeyParam(), "golJab")) {
        golJab = getParameter();//ww  w  .  ja v a 2 s .  c om
    } else {
        golJab = null;
    }
    return golJab;
}

From source file:com.glaf.core.db.mybatis2.SqlMapContainer.java

public void execute(String statementId, String operation, Map<String, Object> params) throws Exception {
    if (LogUtils.isDebug()) {
        logger.debug("execute sqlmap:" + statementId);
        logger.debug("params:" + params);
    }/*ww w  .  j  a  va 2  s .  c o m*/
    Connection connection = null;
    try {
        connection = DBConnectionFactory.getConnection();
        getEntityDAO().setConnection(connection);
        if (StringUtils.equalsIgnoreCase("insert", operation)) {
            getEntityDAO().insert(statementId, params);
        } else if (StringUtils.equalsIgnoreCase("update", operation)) {
            getEntityDAO().update(statementId, params);
        } else if (StringUtils.equalsIgnoreCase("delete", operation)) {
            getEntityDAO().delete(statementId, params);
        }
    } catch (Exception ex) {
        throw new RuntimeException(ex);
    } finally {
        JdbcUtils.close(connection);
    }
}

From source file:com.adobe.acs.commons.http.headers.impl.MonthlyExpiresHeaderFilter.java

@Override
protected void adjustExpires(Calendar next) {

    if (StringUtils.equalsIgnoreCase(LAST, dayOfMonth)) {
        next.set(Calendar.DAY_OF_MONTH, next.getActualMaximum(Calendar.DAY_OF_MONTH));
    } else {/*  w w  w.j a v  a2s . c  o m*/
        next.set(Calendar.DAY_OF_MONTH, Integer.parseInt(dayOfMonth));
    }
    if (next.before(Calendar.getInstance())) {
        next.add(Calendar.MONTH, 1);
    }
}