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

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

Introduction

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

Prototype

public static boolean containsIgnoreCase(String str, String searchStr) 

Source Link

Document

Checks if String contains a search String irrespective of case, handling null.

Usage

From source file:io.swagger.api.impl.ToolsApiServiceImpl.java

@Override
public Response toolsIdVersionsVersionIdTypeDescriptorRelativePathGet(String type, String id, String versionId,
        String relativePath, SecurityContext securityContext) throws NotFoundException {
    if (type == null) {
        return Response.status(Response.Status.BAD_REQUEST).build();
    }//  w w  w  . ja  va2  s  . co m
    SourceFile.FileType fileType = getFileType(type);
    if (fileType == null) {
        return Response.status(Response.Status.NOT_FOUND).build();
    }

    return getFileByToolVersionID(id, versionId, fileType, relativePath,
            StringUtils.containsIgnoreCase(type, "plain"));
}

From source file:com.egt.core.util.EA.java

private static void show(String name, String value) {
    String s = StringUtils.containsIgnoreCase(name, "password") ? EYE_CATCHER : value;
    Bitacora.trace(name + "=" + s);
}

From source file:ips1ap101.lib.core.util.EA.java

private static String jdbcDatabase() {
    for (int i = 0; i < DATABASES.length; i++) {
        String string = DATABASES[i];
        if (StringUtils.containsIgnoreCase(jdbc_driver, string)) {
            return string;
        }/*from w ww.ja  v  a 2s  .  c  o m*/
    }
    return DEFAULT_DATABASE;
}

From source file:com.alibaba.otter.shared.common.utils.meta.DdlUtils.java

private static Column readColumn(DatabaseMetaDataWrapper metaData, Map<String, Object> values)
        throws SQLException {
    Column column = new Column();

    column.setName((String) values.get("COLUMN_NAME"));
    column.setDefaultValue((String) values.get("COLUMN_DEF"));
    column.setTypeCode(((Integer) values.get("DATA_TYPE")).intValue());

    String typeName = (String) values.get("TYPE_NAME");
    // column.setType(typeName);

    if ((typeName != null) && typeName.startsWith("TIMESTAMP")) {
        column.setTypeCode(Types.TIMESTAMP);
    }/*  ww  w .  j  a va2  s  . co m*/
    // modify 2013-09-25?unsigned
    if ((typeName != null) && StringUtils.containsIgnoreCase(typeName, "UNSIGNED")) {
        // unsigned????
        switch (column.getTypeCode()) {
        case Types.TINYINT:
            column.setTypeCode(Types.SMALLINT);
            break;
        case Types.SMALLINT:
            column.setTypeCode(Types.INTEGER);
            break;
        case Types.INTEGER:
            column.setTypeCode(Types.BIGINT);
            break;
        case Types.BIGINT:
            column.setTypeCode(Types.DECIMAL);
            break;
        default:
            break;
        }
    }

    Integer precision = (Integer) values.get("NUM_PREC_RADIX");

    if (precision != null) {
        column.setPrecisionRadix(precision.intValue());
    }

    String size = (String) values.get("COLUMN_SIZE");

    if (size == null) {
        size = (String) _defaultSizes.get(new Integer(column.getTypeCode()));
    }

    // we're setting the size after the precision and radix in case
    // the database prefers to return them in the size value
    column.setSize(size);

    int scale = 0;
    Object dec_digits = values.get("DECIMAL_DIGITS");

    if (dec_digits instanceof String) {
        scale = (dec_digits == null) ? 0 : NumberUtils.toInt(dec_digits.toString());
    } else if (dec_digits instanceof Integer) {
        scale = (dec_digits == null) ? 0 : (Integer) dec_digits;
    }

    if (scale != 0) {
        column.setScale(scale);
    }

    column.setRequired("NO".equalsIgnoreCase(((String) values.get("IS_NULLABLE")).trim()));
    column.setDescription((String) values.get("REMARKS"));
    return column;
}

From source file:com.evolveum.midpoint.model.impl.lens.TestPasswordPolicy.java

private void assertNotContains(String psswd, String val) {
    assertFalse("Generated password " + psswd + " contains value " + val,
            StringUtils.containsIgnoreCase(psswd, val));
}

From source file:io.swagger.api.impl.ToolsApiServiceImpl.java

private SourceFile.FileType getFileType(String format) {
    SourceFile.FileType type;//from w  w w. ja  v a  2s . c  o  m
    if (StringUtils.containsIgnoreCase(format, "CWL")) {
        type = DOCKSTORE_CWL;
    } else if (StringUtils.containsIgnoreCase(format, "WDL")) {
        type = DOCKSTORE_WDL;
    } else if (Objects.equals("JSON", format)) {
        // if JSON is specified
        type = DOCKSTORE_CWL;
    } else {
        // TODO: no other descriptor formats implemented for now
        type = null;
    }
    return type;
}

From source file:com.haulmont.cuba.gui.components.filter.edit.CustomConditionFrame.java

protected List<Suggestion> requestHint(SourceCodeEditor sender, String text, int senderCursorPosition) {
    String joinStr = joinField.getValue();
    String whereStr = whereField.getValue();
    CollectionDatasource ds = (CollectionDatasource) condition.getDatasource();

    // CAUTION: the magic entity name!  The length is three character to match "{E}" length in query
    String entityAlias = "a39";

    int queryPosition = -1;
    String queryStart = "select " + entityAlias + " from " + ds.getMetaClass().getName() + " " + entityAlias
            + " ";

    StringBuilder queryBuilder = new StringBuilder(queryStart);
    if (StringUtils.isNotEmpty(joinStr)) {
        if (sender == joinField) {
            queryPosition = queryBuilder.length() + senderCursorPosition - 1;
        }//from w  w  w  . j av a  2s  .c om
        if (!StringUtils.containsIgnoreCase(joinStr, "join") && !StringUtils.contains(joinStr, ",")) {
            queryBuilder.append("join ").append(joinStr);
            queryPosition += "join ".length();
        } else {
            queryBuilder.append(joinStr);
        }
    }
    if (StringUtils.isNotEmpty(whereStr)) {
        if (sender == whereField) {
            queryPosition = queryBuilder.length() + WHERE.length() + senderCursorPosition - 1;
        }
        queryBuilder.append(WHERE).append(whereStr);
    }
    String query = queryBuilder.toString();
    query = query.replace("{E}", entityAlias);

    return JpqlSuggestionFactory.requestHint(query, queryPosition, sender.getAutoCompleteSupport(),
            senderCursorPosition);
}

From source file:com.jwmsolutions.timeCheck.gui.TodoForm.java

private void jcbTodosItemStateChanged(ItemEvent evt) {
    String todoName = (String) jcbTodos.getSelectedItem();
    boolean isCompletedTodo = StringUtils.containsIgnoreCase(todoName,
            CoreObject.getConfig().getString(Constants.CONFIG_COMPLETED_ITEM_TAG));
    jchkCompleted.setSelected(isCompletedTodo);
}

From source file:ddf.security.assertion.impl.SecurityAssertionImpl.java

/**
 * Checks if the NameIDFormat is of the following formats below, if not, the name is changed
 * to the value of the first matching usernameAttribute.
 *//*from   w  ww  .  j a  va 2  s  .com*/
private void identifyNameIDFormat() {
    if (!((StringUtils.containsIgnoreCase(nameIDFormat, SAML2Constants.NAMEID_FORMAT_PERSISTENT)
            || StringUtils.containsIgnoreCase(nameIDFormat, SAML2Constants.NAMEID_FORMAT_X509_SUBJECT_NAME)
            || StringUtils.containsIgnoreCase(nameIDFormat, SAML2Constants.NAMEID_FORMAT_KERBEROS)
            || StringUtils.containsIgnoreCase(nameIDFormat, SAML2Constants.NAMEID_FORMAT_UNSPECIFIED))
            && !name.equals(""))) {
        for (AttributeStatement attributeStatementList : getAttributeStatements()) {
            List<Attribute> attributeList = attributeStatementList.getAttributes();
            for (Attribute attribute : attributeList) {
                if (listContainsIgnoreCase(usernameAttributeList, attribute.getName())) {
                    name = ((XMLString) attribute.getAttributeValues().get(0)).getValue();
                    return;
                }
            }
        }
    }
}

From source file:com.zb.app.web.controller.cms.CMSController.java

/**
 * ???//from w  ww .j av  a 2  s . c o m
 * 
 * @return
 */
@RequestMapping(value = "/queryCompanyByConditions.htm", produces = "application/json")
@ResponseBody
public JsonResult queryCompanyByConditions(TravelCompanyQuery query, Integer limit) {
    List<TravelCompanyDO> list = companyService.listQuery(query);

    List<Map<String, ?>> mapList = CollectionUtils.toMapList(list, "cId", "cName", "cSpell");
    // StringBuilder sb = new StringBuilder();
    String cond = query.getQ() == null ? StringUtils.EMPTY : query.getQ();
    cond = cond.toLowerCase();
    // String temp;
    int maxSize = getLimit(limit);
    int size = 0;
    List<Map<String, ?>> result = new LinkedList<Map<String, ?>>();
    String property = cond.matches("[a-zA-Z]+") ? "cSpell" : "cName";
    for (Map<String, ?> map : mapList) {
        Object cName = null;
        for (Entry<String, ?> entry : map.entrySet()) {
            if (StringUtils.equals(entry.getKey(), property)) {
                cName = entry.getValue();
            }
        }
        if (cond.matches("[a-zA-Z]+") ? StringUtils.startsWith((String) cName, cond)
                : StringUtils.containsIgnoreCase((String) cName, cond)) {
            result.add(map);
            size++;
            if (size > maxSize) {
                break;
            }
        }
    }
    return JsonResultUtils.success(result);
}