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:mediathekplugin.MediathekProgramItem.java

public void show() {
    if (StringUtils.isBlank(mUrl)) {
        return;//  ww w.  java 2 s.c o  m
    }
    if (StringUtils.containsIgnoreCase(mUrl, "--host")) {
        openStream();
    } else {
        Launch.openURL(mUrl);
    }
}

From source file:com.iyonger.apm.web.util.HttpContainerContext.java

/**
 * Check the user has unix user agent./*from   ww w .  j a  v  a  2 s. co  m*/
 *
 * @return true if unix.
 */
public boolean isUnixUser() {
    SecurityContextHolderAwareRequestWrapper request = cast(
            RequestContextHolder.currentRequestAttributes().resolveReference("request"));
    return !StringUtils.containsIgnoreCase(request.getHeader("User-Agent"), "Win");
}

From source file:com.intuit.tank.common.ScriptUtil.java

private static void addKeys(Map<String, String> ret, Set<RequestData> rds, String type) {
    for (RequestData rd : rds) {
        if (StringUtils.isNotBlank(rd.getKey())) {
            if (type == null || StringUtils.containsIgnoreCase(rd.getType(), type)) {
                ret.put(rd.getKey().trim(), StringUtils.trim(rd.getValue()));
            }//  www . j a  va2s  .c  o m
        }
    }

}

From source file:de.codecentric.robot.pdf.PDFKeywords.java

private void collectionShouldContain(String expectedValue, Collection<String> values, boolean ignoreCase) {
    for (String content : values) {
        if (ignoreCase ? StringUtils.containsIgnoreCase(content, expectedValue)
                : StringUtils.contains(content, expectedValue)) {
            return;
        }/*from ww w .j ava2s.  c  om*/
    }
    throw new RuntimeException("could not find " + expectedValue + " in " + pdfData);
}

From source file:edu.cornell.mannlib.vitro.webapp.controller.api.SparqlUpdateApiController.java

private UpdateRequest parseUpdateString(HttpServletRequest req) throws ParseException {
    String update = req.getParameter("update");
    if (StringUtils.isBlank(update)) {
        log.debug("No update parameter.");
        throw new ParseException("No 'update' parameter.");
    }/* w  w w  .  j a  va2  s.c  o  m*/

    if (!StringUtils.containsIgnoreCase(update, "GRAPH")) {
        if (log.isDebugEnabled()) {
            log.debug("No GRAPH uri in '" + update + "'");
        }
        throw new ParseException("SPARQL update must specify a GRAPH URI.");
    }

    try {
        return UpdateFactory.create(update);
    } catch (Exception e) {
        log.debug("Problem parsing", e);
        throw new ParseException("Failed to parse SPARQL update", e);
    }
}

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

@Override
protected List<Result> withParams(final SlingHttpServletRequest request,
        final SlingHttpServletResponse response, final Command cmd) {

    /* Look for shortcuts first. Add directly to results to maintain their initial order */

    final List<Result> results = new ArrayList<Result>();

    for (final Result shortcut : this.buildShortcuts(request.getResourceResolver())) {
        if (StringUtils.containsIgnoreCase(shortcut.getTitle(), cmd.getParam())) {
            results.add(shortcut);//from w  ww . j a  va 2s .c o  m
        }
    }

    return results;
}

From source file:net.orpiske.ssps.sdm.main.DbInitializationHelper.java

private void initializeDbVersion() throws SQLException, DatabaseInitializationException {
    DbVersionDao dao = new DbVersionDao(databaseManager);

    try {/*from  w ww.  ja  va  2 s  .c o m*/
        DbVersionDto dto = dao.get();

        if (dto == null) {
            logger.debug("Creating database version record");
            dto = new DbVersionDto();

            dto.setCreationDate(new Date());
            dto.setConversionDate(new Date());
            dto.setVersion("0.3.x");

            dao.insert(dto);
        }
    } catch (SQLException e) {
        String err = e.getMessage();

        if (StringUtils.containsIgnoreCase(err, "does not exist")) {
            dao.createTable();
            logger.debug("Database version table created successfully");
        } else {
            throw e;
        }
    }
}

From source file:com.liferay.alloy.util.DefaultValueUtil.java

public static boolean isValidStringValue(String value) {
    value = StringUtil.trim(GetterUtil.getString(value));

    if (Validator.isNull(value)) {
        return false;
    }/*  w  w w. j a v  a2 s.com*/

    if (StringUtils.isAlpha(value) || (!StringUtils.containsIgnoreCase(value, _GENERATED)
            && !StringUtils.isAlpha(value.substring(0, 1))
            && !StringUtils.endsWith(value, StringPool.PERIOD))) {

        return true;
    }

    return false;
}

From source file:com.baasbox.controllers.ScriptInvoker.java

public static JsonNode serializeRequest(String path, Http.Request request) {
    Http.RequestBody body = request.body();

    Map<String, String[]> headers = request.headers();
    String method = request.method();
    Map<String, String[]> query = request.queryString();
    path = path == null ? "/" : path;
    ObjectNode reqJson = Json.mapper().createObjectNode();
    reqJson.put("method", method);
    reqJson.put("path", path);
    reqJson.put("remote", request.remoteAddress());

    if (!StringUtils.containsIgnoreCase(request.getHeader(CONTENT_TYPE), "application/json")) {
        String textBody = body == null ? null : body.asText();
        if (textBody == null) {
            //fixes issue 627
            Map<String, String> params = BodyHelper.requestData(request);
            JsonNode jsonBody = Json.mapper().valueToTree(params);
            reqJson.put("body", jsonBody);
        } else {/*from  w  w w. j  a  va2s .c o m*/
            reqJson.put("body", textBody);
        }
    } else {
        reqJson.put("body", body.asJson());
    }

    JsonNode queryJson = Json.mapper().valueToTree(query);
    reqJson.put("queryString", queryJson);
    JsonNode headersJson = Json.mapper().valueToTree(headers);
    reqJson.put("headers", headersJson);
    BaasBoxLogger.debug("Serialized request to pass to the script: ");
    BaasBoxLogger.debug(reqJson.toString());
    return reqJson;
}

From source file:io.kamax.mxisd.backend.memory.MemoryIdentityStore.java

@Override
public UserDirectorySearchResult searchByDisplayName(String query) {
    return search(entry -> StringUtils.containsIgnoreCase(entry.getUsername(), query), entry -> {
        UserDirectorySearchResult.Result result = new UserDirectorySearchResult.Result();
        result.setUserId(MatrixID.from(entry.getUsername(), mxCfg.getDomain()).acceptable().getId());
        result.setDisplayName(entry.getUsername());
        return result;
    });/*from   ww w. j a v a2s  .c  o m*/
}