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:info.magnolia.voting.voters.RequestHasParametersVoter.java

@Override
protected boolean boolVote(Object value) {
    HttpServletRequest request;/*from   ww w.  j  ava2 s.  c o m*/
    if (value instanceof HttpServletRequest) {
        request = (HttpServletRequest) value;
    } else {
        if (MgnlContext.isWebContext()) {
            request = MgnlContext.getWebContext().getRequest();
        } else {
            return false;
        }
    }
    if (StringUtils.equalsIgnoreCase(request.getMethod(), "POST")) {
        return true;
    }

    if (!request.getParameterMap().isEmpty()) {
        return true;
    }

    return false;
}

From source file:com.tesora.dve.sql.statement.ddl.alter.AddColumnAction.java

@Override
public AlterTableAction alterTable(SchemaContext sc, PETable tab) {
    List<PEColumn> movedCols = null;
    if (firstOrAfterSpec != null) {
        // take a first pass and update the ordinal numbers
        int ordinal = -1;
        if (StringUtils.equalsIgnoreCase(firstOrAfterSpec.getFirst(), "AFTER")) {
            PEColumn afterColumn = tab.lookup(sc,
                    firstOrAfterSpec.getSecond().getUnqualified().getUnquotedName().get());
            ordinal = afterColumn.getPosition();
        }/*from   w  w  w  .  j  a v  a  2  s .c o m*/
        movedCols = new ArrayList<PEColumn>();
        List<PEColumn> origCols = tab.getColumns(sc);
        for (PEColumn col : origCols) {
            if (col.getPosition() > ordinal) {
                movedCols.add(col);
            }
        }

        for (PEColumn col : movedCols) {
            tab.removeColumn(sc, col);
        }
    }
    for (PEColumn nc : newColumns) {
        if (nc.getIn(sc, tab) == null) {
            PEColumn copy = (PEColumn) nc.copy(sc, null);
            tab.addColumn(sc, copy);
            // add back the columns if FIRST or AFTER was specified
            if (movedCols != null) {
                for (PEColumn c : movedCols) {
                    tab.addColumn(sc, c);
                }
            }
        }
    }
    return null;
}

From source file:com.evolveum.midpoint.prism.match.ExchangeEmailAddressesMatchingRule.java

@Override
public boolean match(String a, String b) {
    if (a == null && b == null) {
        return true;
    }//  w w  w.j  a v a  2s  . c  o m
    if (a == null || b == null) {
        return false;
    }
    a = a.trim();
    b = b.trim();
    if (a.equals(b)) {
        return true;
    }
    String aPrefix = getPrefix(a);
    String aSuffix = getSuffix(a);
    String bPrefix = getPrefix(b);
    String bSuffix = getSuffix(b);
    return StringUtils.equals(aPrefix, bPrefix) && StringUtils.equalsIgnoreCase(aSuffix, bSuffix);
}

From source file:hydrograph.ui.engine.converter.impl.FTPProtocolConverter.java

@Override
public void prepareForXML() {
    FTPProtocolDetails protocolDetails;/*from  w  ww.j  ava  2 s. c  o  m*/
    if (properties.get(Constants.PROTOCOL_SELECTION).equals("")) {
        this.baseComponent = new FTP();
        baseComponent.setBatch((String) properties.get(Constants.PARAM_BATCH));
        FTPConverterHelper converter = new FTPConverterHelper(component);
        converter.prepareForXML(baseComponent);
    } else {
        protocolDetails = (FTPProtocolDetails) properties.get(Constants.PROTOCOL_SELECTION);
        if (StringUtils.equalsIgnoreCase(protocolDetails.getProtocol(), Constants.FTP)) {
            this.baseComponent = new FTP();
            baseComponent.setBatch((String) properties.get(Constants.PARAM_BATCH));
            FTPConverterHelper converter = new FTPConverterHelper(component);
            converter.prepareForXML(baseComponent);
        } else if (StringUtils.equalsIgnoreCase(protocolDetails.getProtocol(), Constants.SFTP)) {
            this.baseComponent = new SFTP();
            baseComponent.setBatch((String) properties.get(Constants.PARAM_BATCH));
            SFTPConvertorHelper convertor = new SFTPConvertorHelper(component);
            convertor.prepareForXML(baseComponent);
        } else if (StringUtils.equalsIgnoreCase(protocolDetails.getProtocol(), Constants.AWS_S3)) {
            this.baseComponent = new S3FileTransfer();
            baseComponent.setBatch((String) properties.get(Constants.PARAM_BATCH));
            S3FileTransferConverterHelper fileTransferConverter = new S3FileTransferConverterHelper(component);
            fileTransferConverter.prepareForXML(baseComponent);
        }
    }
}

From source file:com.yahoo.flowetl.services.factory.ServiceFactory.java

/**
 * Parses the config file and returns a configuration object for it. It
 * attempts to look at the extension of the file and then create the
 * corresponding apache commons configuration reader for that file type.
 * Currently this is supporting a .xml file and a .properties file.
 * /*from w w  w .jav a2  s . c  o  m*/
 * @param configFileName
 * 
 * @return the configuration
 * 
 * @throws ConfigurationException
 */
protected Configuration parseConfigFile(String configFileName) throws ConfigurationException {
    if (configFileName == null) {
        return null;
    }
    Configuration out = null;
    String ext = FilenameUtils.getExtension(configFileName);
    if (StringUtils.equalsIgnoreCase("xml", ext)) {
        out = new XMLConfiguration(configFileName);
    } else if (StringUtils.equalsIgnoreCase("properties", ext)) {
        out = new PropertiesConfiguration(configFileName);
    }
    return out;
}

From source file:com.daveayan.rjson.transformer.toobject.JsonObjectAsMapTransformer.java

public Object transform(Object from, Class<?> to, String fieldName, Context context) {
    JSONObject jo = (JSONObject) from;/*from   w w w.j av  a  2s.c  o  m*/
    Map<Object, Object> newMap = null;
    if (StringUtils.equalsIgnoreCase(to.getName(), "java.util.Map")) {
        newMap = new HashMap<Object, Object>();
    } else {
        newMap = (Map<Object, Object>) ReflectionUtils.objectFor(to.getName());
    }
    Iterator<?> iter = jo.getMap().keySet().iterator();
    while (iter.hasNext()) {
        Object key = iter.next();
        Object value = jo.getMap().get(key);
        Class convertTo = to;
        if (StringUtils.equalsIgnoreCase(value.getClass().getName(), "com.daveayan.json.JSONArray")) {
            convertTo = ArrayList.class;
        }
        newMap.put(key, context.transformer().delegateTransformation(value, convertTo, fieldName, context));
    }
    return newMap;
}

From source file:com.adobe.acs.tools.csv_asset_importer.impl.Column.java

public Column(final String raw, final int index) {
    this.index = index;
    this.raw = StringUtils.trim(raw);

    String paramsStr = StringUtils.substringBetween(raw, "{{", "}}");
    String[] params = StringUtils.split(paramsStr, ":");

    if (StringUtils.isBlank(paramsStr)) {
        this.relPropertyPath = this.getRaw();
    } else {//from ww  w. java  2s  .c  o  m
        this.relPropertyPath = StringUtils.trim(StringUtils.substringBefore(this.getRaw(), "{{"));

        if (params.length == 2) {
            this.dataType = nameToClass(StringUtils.stripToEmpty(params[0]));
            this.multi = StringUtils.equalsIgnoreCase(StringUtils.stripToEmpty(params[1]), MULTI);
        }

        if (params.length == 1) {
            if (StringUtils.equalsIgnoreCase(MULTI, StringUtils.stripToEmpty(params[0]))) {
                this.multi = true;
            } else {
                this.dataType = nameToClass(StringUtils.stripToEmpty(params[0]));
            }
        }
    }

    if (StringUtils.contains(this.relPropertyPath, "/")) {
        this.propertyName = StringUtils.trim(StringUtils.substringAfterLast(this.relPropertyPath, "/"));
    } else {
        this.propertyName = StringUtils.trim(this.relPropertyPath);
    }

}

From source file:hydrograph.ui.expression.editor.util.FieldDataTypeMap.java

private Class<?> getFieldDataType(String field, List<FixedWidthGridRow> outputSchema) {
    Class<?> clazz = String.class;
    if (outputSchema != null) {
        for (GridRow gridRow : outputSchema) {
            if (StringUtils.equalsIgnoreCase(gridRow.getFieldName(), field)) {
                clazz = DataTypes.getDataTypeClassfromString(
                        ExpressionEditorUtil.INSTANCE.lastString(gridRow.getDataTypeValue(), Constants.DOT));
            }//from   w  ww .j  a v  a  2 s. c  o  m
        }
    }
    return clazz;
}

From source file:com.adobe.acs.commons.quickly.operations.impl.GoOperationImpl.java

@Override
public boolean accepts(final SlingHttpServletRequest request, final Command cmd) {

    return StringUtils.equalsIgnoreCase(CMD, cmd.getOp());
}

From source file:info.magnolia.jaas.principal.GroupListImpl.java

/**
 * Checks if the name exist in this list
 * @param name//from  w w  w  .  j  a va 2  s.  co  m
 */
public boolean has(String name) {
    Iterator listIterator = this.list.iterator();
    while (listIterator.hasNext()) {
        String roleName = (String) listIterator.next();
        if (StringUtils.equalsIgnoreCase(name, roleName)) {
            return true;
        }
    }
    return false;
}