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:edu.umn.se.trap.rule.businessrule.NumBaggageClaimsRule.java

/**
 * @param expenses/*w  w w  .  j  ava 2  s.c  om*/
 * @throws TrapException
 */
protected void checkNumBaggageClaims(List<Expense> expenses) throws TrapException {

    int numClaims = 0;
    int numFlights = 0;

    for (Expense expense : expenses) {
        if (expense.getType().equals(ExpenseType.TRANSPORTATION)) {

            if (StringUtils.equalsIgnoreCase(((TransportationExpense) expense).getTranportationType(),
                    "BAGGAGE")
                    || StringUtils.equalsIgnoreCase(((TransportationExpense) expense).getTranportationType(),
                            "LUGGAGE")) {
                numClaims++;

            }
            if (StringUtils.equalsIgnoreCase(((TransportationExpense) expense).getTranportationType(), "AIR")) {
                numFlights++;

            }
        }
    }

    if (numFlights < numClaims) {
        throw new TrapException(TrapErrors.INVALID_NUM_BAGGAGE);
    }

}

From source file:io.wcm.devops.conga.tooling.maven.plugin.validation.TemplateValidator.java

@Override
public void validate(Resource resource, String pathForLog) throws MojoFailureException {
    if (StringUtils.equalsIgnoreCase(resource.getFileExtension(), FILE_EXTENSION)) {
        String templatePath = StringUtils.substringAfter(PathUtil.unifySlashes(resource.getCanonicalPath()),
                PathUtil.unifySlashes(templateDir.getCanonicalPath()) + "/");
        Handlebars handlebars = handlebarsManager.get(NoneEscapingStrategy.NAME, CharEncoding.UTF_8);
        try {/*from  w  w  w. j  a v  a 2 s  .  c om*/
            handlebars.compile(templatePath);
        } catch (Throwable ex) {
            throw new MojoFailureException("Template " + pathForLog + " is invalid:\n" + ex.getMessage());
        }
    }
}

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

public String getJabatanName() {
    if (StringUtils.equalsIgnoreCase(getKeyParam(), "jabatanName")) {
        jabatanName = getParameter();/*from www.  j a  v  a 2 s.  co m*/
    } else {
        jabatanName = null;
    }
    return jabatanName;
}

From source file:com.navercorp.lucy.security.xss.servletfilter.defender.XssFilterDefender.java

/**
 * @param value String/*from   ww  w.ja  v a 2 s  . c  o m*/
 * @return boolean
 */
private boolean isBoolean(String value) {
    return StringUtils.equalsIgnoreCase(value, "true") || StringUtils.equalsIgnoreCase(value, "false");
}

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

public String getOnBehalfApproverPosition() {
    if (StringUtils.equalsIgnoreCase(getKeyParam(), "onBehalfApproverPosition")) {
        onBehalfApproverPosition = getParameter();
    } else {/*from   w  ww .  j  av a  2 s. com*/
        onBehalfApproverPosition = null;
    }
    return onBehalfApproverPosition;
}

From source file:com.liveneo.plat.web.action.DownloadAction.java

public String getDownloadFileName() {
    String fileName = this.getRequest().getParameter("fileName");
    String filewav = this.getRequest().getParameter("filewav");
    String downFileName = "";
    if (StringUtils.equalsIgnoreCase(loadflag, "restore")) {
        downFileName = fileName + ".zip";
    }/*ww w . j av  a  2 s.c om*/
    if (StringUtils.equalsIgnoreCase(loadflag, "excel")) {
        downFileName = fileName;
    }
    if (StringUtils.equalsIgnoreCase(loadflag, "recording")) {
        if (StringUtils.isNotEmpty(fileName)) {
            downFileName = StringUtils.substringAfter(fileName, "/noneccrecord/ivrvoice/");
        } else {
            downFileName = "empty.wav";
        }
    }
    if (StringUtils.equalsIgnoreCase(loadflag, "license")) {
        downFileName = filewav;
    }
    if (StringUtils.equalsIgnoreCase(loadflag, "wo")) {
        downFileName = fileName;
    }
    if (StringUtils.equalsIgnoreCase(loadflag, "report")) {
        downFileName = fileName;
    }
    if (StringUtils.equalsIgnoreCase(loadflag, "commonexcel")) {
        downFileName = fileName;
    }
    try {
        downFileName = new String(downFileName.getBytes(), "ISO8859-1");
    } catch (Exception e) {
        e.printStackTrace();
    }
    return downFileName;
}

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

@Override
protected void formatChecking(final Sheet sheet) {
    // get the title row
    Row row = sheet.getRow(0);/*from w  w  w.  j av  a2  s .  c om*/
    Cell keyCell = row.getCell(0);
    Assert.isTrue(StringUtils.equalsIgnoreCase(keyCell.getStringCellValue(), "key"),
            "Column 'key' is required");

    Cell langCell = row.getCell(1);
    Assert.isTrue(StringUtils.isNotBlank(langCell.getStringCellValue()), "one language is required at least");
}

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

public String getCostCenterName() {
    if (StringUtils.equalsIgnoreCase(getKeyParam(), "costCenterName")) {
        costCenterName = getParameter();
    } else {// w  ww .  j a  v  a 2  s.c om
        costCenterName = null;
    }

    return costCenterName;
}

From source file:net.noday.cat.model.Tag.java

@Override
public boolean equals(Object obj) {
    if (obj instanceof Tag) {
        return StringUtils.equalsIgnoreCase(getName(), ((Tag) obj).getName());
    } else if (obj instanceof String) {
        return StringUtils.equalsIgnoreCase(getName(), (String) obj);
    } else {/*from  w w w  . j a v a 2  s  . c o  m*/
        return false;
    }
}

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

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

    if (ctxs != null) {
        for (IFIXConnection connection : ctxs) {
            if (StringUtils.equalsIgnoreCase(id, connection.getId())) {
                if (StringUtils.equalsIgnoreCase(action, "start")) {
                    connection.start();// www.j  a v  a  2s  .co m
                } else if (StringUtils.equalsIgnoreCase(action, "stop")) {
                    connection.stop();
                }
            }
        }
    }
}