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:hydrograph.ui.expression.editor.composites.FunctionsUpperComposite.java

private void addListnersToSearchTextBox() {
    functionSearchTextBox.addModifyListener(new ModifyListener() {
        @Override//w  ww. j av a  2s .c  om
        public void modifyText(ModifyEvent e) {
            if (!StringUtils.equals(Constants.DEFAULT_SEARCH_TEXT, functionSearchTextBox.getText())
                    && (classNameList.getSelectionCount() != 0 && !StringUtils
                            .startsWith(classNameList.getItem(0), Messages.CANNOT_SEARCH_INPUT_STRING))) {
                methodList.removeAll();
                ClassDetails classDetails = (ClassDetails) methodList
                        .getData(CategoriesComposite.KEY_FOR_ACCESSING_CLASS_FROM_METHOD_LIST);
                if (classDetails != null) {
                    for (MethodDetails methodDetails : classDetails.getMethodList()) {
                        if (StringUtils.containsIgnoreCase(methodDetails.getMethodName(),
                                functionSearchTextBox.getText())) {
                            methodList.add(methodDetails.getSignature());
                            methodList.setData(String.valueOf(methodList.getItemCount() - 1), methodDetails);
                        }
                    }
                }
                if (methodList.getItemCount() == 0 && StringUtils.isNotBlank(functionSearchTextBox.getText())) {
                    methodList.add(Messages.CANNOT_SEARCH_INPUT_STRING + functionSearchTextBox.getText());
                }
                descriptionStyledText.setText(Constants.EMPTY_STRING);
            }
        }
    });
}

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

private void initializeDependencyCache() throws SQLException, DatabaseInitializationException {
    DependencyCacheDao dao = new DependencyCacheDao(databaseManager);

    try {/*  w  ww. j a va2s.c om*/
        dao.getCount();
    } catch (SQLException e) {
        String err = e.getMessage();

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

From source file:br.com.utfpr.pb.view.CaixasView.java

private void pesquisa() {
    String query = pesquisa.getText();
    model = (DefaultTableModel) jTable.getModel();
    model.getDataVector().removeAllElements();
    model.fireTableDataChanged();//from w  ww . j  av a  2 s .c  o m
    data.stream().filter(e -> StringUtils.containsIgnoreCase(e.getId().toString(), query)
            || StringUtils.containsIgnoreCase(e.getDescricao(), query)).forEach(item -> add(item));

    model.fireTableDataChanged();
}

From source file:net.navasoft.madcoin.backend.services.security.UserDataAccess.java

private String defineKey(String username) {
    if (!username.contains("@") && (!StringUtils.containsIgnoreCase(username, ".org")
            || !StringUtils.containsIgnoreCase(username, ".net")
            || !StringUtils.containsIgnoreCase(username, ".gov")
            || !StringUtils.endsWithIgnoreCase(username, ".com"))) {
        return AccessProperties.USERNAME_QUERY.getConfigKey();
    } else {/*from  w w w .  j  av a 2s.c  o m*/
        return AccessProperties.USERMAIL_QUERY.getConfigKey();
    }
}

From source file:com.mirth.connect.plugins.imageviewer.ImageViewer.java

@Override
public boolean isContentTypeViewable(String contentType) {
    return StringUtils.containsIgnoreCase(contentType, "image");
}

From source file:com.byraphaelmedeiros.autosubdown.domain.Rule.java

public boolean inRule(String content) {
    setContentUsed(content);/*from  w  w  w . j a v a 2  s.  c  o m*/

    if (StringUtils.containsIgnoreCase(content, notInclude))
        return false;

    if (!StringUtils.containsIgnoreCase(content, searchFor))
        return false;

    if (isTVShow()) {
        String[] search = episode.split(",");

        if (search.length == 2) {
            String seasonSearch = search[0];
            String episodeSearch = search[1];

            int seasonStart = 0;
            int seasonEnd = 0;
            int episodeStart = 0;
            int episodeEnd = 0;

            boolean isSeasonRange = false;
            boolean isEpisodeRange = false;

            // verifica se a temporada esta em intervalo
            if (seasonSearch.contains("-")) {
                String[] seasonRange = seasonSearch.split("-");

                if (seasonRange.length == 2) {
                    seasonStart = Integer.parseInt(seasonRange[0]);
                    seasonEnd = Integer.parseInt(seasonRange[1]);

                    isSeasonRange = true;
                }
            }

            // verifica se o episodio esta em intervalo
            if (episodeSearch.contains("-")) {
                String[] episodeRange = episodeSearch.split("-");

                if (episodeRange.length == 2) {
                    episodeStart = Integer.parseInt(episodeRange[0]);
                    episodeEnd = Integer.parseInt(episodeRange[1]);

                    isEpisodeRange = true;
                }
            }

            String rangeSearch = "";

            if (isSeasonRange && isEpisodeRange) {
                for (int s = seasonStart; s <= seasonEnd; s++) {
                    for (int e = episodeStart; e <= episodeEnd; e++) {
                        rangeSearch = "S" + String.format("%02d", s) + "E" + String.format("%02d", e);

                        if (StringUtils.containsIgnoreCase(content, rangeSearch)
                                && !isEpisodeDownloaded(rangeSearch))
                            return true;
                    }
                }

                return false;
            } else if (!isSeasonRange && isEpisodeRange) {
                for (int e = episodeStart; e <= episodeEnd; e++) {
                    rangeSearch = "S" + String.format("%02d", Integer.parseInt(seasonSearch)) + "E"
                            + String.format("%02d", e);

                    if (StringUtils.containsIgnoreCase(content, rangeSearch)
                            && !isEpisodeDownloaded(rangeSearch))
                        return true;
                }

                return false;
            } else if (isSeasonRange && !isEpisodeRange) {
                for (int s = seasonStart; s <= seasonEnd; s++) {
                    rangeSearch = "S" + String.format("%02d", s) + "E" + String.format("%02d", episodeSearch);

                    if (StringUtils.containsIgnoreCase(content, rangeSearch)
                            && !isEpisodeDownloaded(rangeSearch))
                        return true;
                }

                return false;
            }
        }
    }

    return true;
}

From source file:com.evolveum.midpoint.repo.sql.testing.TestSqlRepositoryBeanPostProcessor.java

/**
 * This method decides whether function or procedure (oracle, ms sql server)
 * will be used to cleanup testing database.
 *
 * @param config/*  ww  w  .  j  a  v  a  2 s . co m*/
 * @return
 */
private boolean useProcedure(SqlRepositoryConfiguration config) {
    return StringUtils.containsIgnoreCase(config.getHibernateDialect(), "oracle")
            || StringUtils.containsIgnoreCase(config.getHibernateDialect(), "SQLServer");
}

From source file:br.com.utfpr.pb.view.ContaPagarView.java

private void pesquisa() {
    String query = pesquisa.getText();
    model = (DefaultTableModel) jTable.getModel();
    model.getDataVector().removeAllElements();
    model.fireTableDataChanged();//  ww w. ja  va2  s.c  o m
    data.stream().filter(e -> naoQuitadas.isSelected() ? e.getSaldo() > 0 : true)
            .filter(e -> StringUtils.containsIgnoreCase(e.getId().toString(), query)
                    || StringUtils.containsIgnoreCase(e.getPessoa().getNome(), query)
                    || StringUtils.containsIgnoreCase(e.getDescricao(), query))
            .forEach(item -> add(item));

    model.fireTableDataChanged();
}

From source file:com.tesora.dve.sql.util.PEDDL.java

@Override
public void destroy(ConnectionResource mr) throws Throwable {
    if (mr == null)
        return;//from   w  w  w  .java 2  s. co  m

    TaggedLineInfo tli = new TaggedLineInfo(-1, null, -1, LineTag.DDL);
    // drop all the dbs
    for (DatabaseDDL dbddl : getDatabases())
        mr.execute(tli, dbddl.getDropStatement());
    HashSet<String> pgnames = new HashSet<String>();
    for (StorageGroupDDL sgddl : persGroups)
        pgnames.add(sgddl.getName());
    ResourceResponse rr = mr.fetch("show containers");
    List<ResultRow> results = rr.getResults();
    for (ResultRow row : results) {
        ResultColumn rc = row.getResultColumn(1);
        String contName = (String) rc.getColumnValue();
        mr.execute(tli, "drop container " + contName);
    }
    // now we have to find ranges that use our persistent group
    rr = mr.fetch("show ranges");
    results = rr.getResults();
    for (ResultRow row : results) {
        ResultColumn rangeNameColumn = row.getResultColumn(1);
        ResultColumn storageGroupColumn = row.getResultColumn(2);
        String rangeName = rangeNameColumn.getColumnValue().getClass().isArray()
                ? new String((byte[]) rangeNameColumn.getColumnValue())
                : (String) rangeNameColumn.getColumnValue();
        String groupName = storageGroupColumn.getColumnValue().getClass().isArray()
                ? new String((byte[]) storageGroupColumn.getColumnValue())
                : (String) storageGroupColumn.getColumnValue();
        if (pgnames.contains(groupName.trim())) {
            try {
                mr.execute(tli, "drop range " + rangeName + " persistent group " + groupName.trim());
            } catch (PEException e) {
                if (!throwDropRangeInUseException
                        && (StringUtils.containsIgnoreCase(e.getMessage(), "Unable to drop range")
                                && StringUtils.containsIgnoreCase(e.getMessage(), "because used by table"))) {
                    // eat the exception
                } else {
                    throw e;
                }
            }
        }
    }
    // now we can drop the persistent group, which apparently also drops the persistent sites
    for (StorageGroupDDL sgddl : persGroups) {
        sgddl.destroy(mr);
    }
}

From source file:com.microsoft.alm.plugin.idea.git.ui.pullrequest.PullRequestsTreeModel.java

private boolean nodeContainsFilter(final GitPullRequest pr) {
    if (pr == null) {
        return false;
    }//  w  ww .  j a  v a2  s  .  co m

    // filter on the data shown in the node view
    if (StringUtils.containsIgnoreCase(pr.getTitle(), filter)
            || StringUtils.containsIgnoreCase(pr.getCreatedBy().getDisplayName(), filter)
            || StringUtils.containsIgnoreCase(String.valueOf(pr.getPullRequestId()), filter)
            || StringUtils.containsIgnoreCase(
                    pr.getSourceRefName().replace(PRTreeCellRenderer.GIT_REFS_HEADS, ""), filter)
            || StringUtils.containsIgnoreCase(
                    pr.getTargetRefName().replace(PRTreeCellRenderer.GIT_REFS_HEADS, ""), filter)
            || StringUtils.containsIgnoreCase(pr.getMergeStatus().toString(), filter) || StringUtils
                    .containsIgnoreCase(DateHelper.getFriendlyDateTimeString(pr.getCreationDate()), filter)) {
        return true;
    } else {
        return false;
    }
}