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:com.microsoft.alm.common.utils.UrlHelper.java

public static boolean isTeamServicesUrl(final String url) {
    if (StringUtils.containsIgnoreCase(url, HOST_VSO) || StringUtils.containsIgnoreCase(url, HOST_TFS_ALL_IN)) {
        return true;
    }/* w  ww  .  jav a 2  s.  c om*/
    return false;
}

From source file:com.nokia.helium.diamonds.DiamondsClient.java

private String checkForProtocol(String url) throws DiamondsException {
    String retURL = url;//from   w  ww .  j a  va 2  s  .c  o m
    try {
        if (!StringUtils.containsIgnoreCase(url, "http://")) {
            retURL = "http://" + url;
        }
    } catch (Exception ex) {
        // ex.printStackTrace();
        isRecordOnly = true;
        throw new DiamondsException("Failed to check url, defaulting to input. " + ex.getMessage());
    }
    return retURL;
}

From source file:com.enonic.cms.core.content.index.queryexpression.QueryParserTest.java

@Test
public void testFulltextOperator() {
    QueryExpr test = parseQuery("a FT 'abc'");
    assertTrue(StringUtils.containsIgnoreCase(test.getExpr().toString(), "FT"));
}

From source file:hudson.search.FixedSet.java

public void suggest(String token, List<SearchItem> result) {
    boolean caseInsensitive = UserSearchProperty.isCaseInsensitive();
    for (SearchItem i : items) {
        String name = i.getSearchName();
        if (name != null
                && (name.contains(token) || (caseInsensitive && StringUtils.containsIgnoreCase(name, token)))) {
            result.add(i);// ww  w .  j  ava 2 s .  c om
        }
    }
}

From source file:net.ageto.gyrex.persistence.jdbc.pool.internal.commands.ListPools.java

@Override
protected void doExecute() throws Exception {

    // check for exact filter match
    if ((null != poolIdFilter) && IdHelper.isValidId(poolIdFilter)) {
        final PoolDefinition pool = new PoolDefinition(poolIdFilter);
        if (pool.exists()) {
            printPool(pool);//from   ww w.  jav a  2s  . c o m
            return;
        }
    }

    // list all known ids
    printf("Known Pools:");
    final String[] knownPoolIds = PoolDefinition.getKnownPoolIds();
    Arrays.sort(knownPoolIds);
    for (final String poolId : knownPoolIds) {
        if ((null == poolIdFilter) || StringUtils.containsIgnoreCase(poolId, poolIdFilter)) {
            if (PoolActivator.getInstance().getRegistry().isActive(poolId)) {
                printf("  %s (open)", poolId);
            } else {
                printf("  %s", poolId);
            }
        }
    }

    // list all known drivers
    printf("Known drivers:");
    final Collection<ServiceReference<DataSourceFactory>> services = PoolActivator.getInstance()
            .findDriverDataSourceFactoryServices(null);
    if (!services.isEmpty()) {
        for (final ServiceReference<DataSourceFactory> serviceReference : services) {
            printf("  %s", serviceReference.toString());
        }
    } else {
        printf("  None");
    }

}

From source file:com.haulmont.cuba.web.app.ui.serverlogviewer.ControlLoggerWindow.java

protected void fillLoggerGrid(String keyword) {
    loggersGrid.removeAll();//w ww  .j  a  va 2s  .c  o m

    for (Map.Entry<String, Level> levelEntry : loggersMap.entrySet()) {
        String loggerName = levelEntry.getKey();
        if (StringUtils.isEmpty(keyword) || StringUtils.containsIgnoreCase(loggerName, keyword)) {
            Level level = levels.containsKey(loggerName) ? levels.get(loggerName) : levelEntry.getValue();

            Pair<TextField, HBoxLayout> editComponents = createEditComponents(loggerName, level);
            fieldMap.put(loggerName, editComponents.getSecond());

            loggersGrid.add(editComponents.getFirst());
            loggersGrid.add(editComponents.getSecond());
        }
    }
}

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

public static List<ScriptAssignment> getAssignments(ScriptStep step) {
    List<ScriptAssignment> ret = new ArrayList<ScriptAssignment>();
    if (step.getType().equals("request")) {
        for (RequestData rd : step.getResponseData()) {
            if (StringUtils.isNotBlank(rd.getKey())) {
                if (StringUtils.containsIgnoreCase(rd.getType(), "assignment")) {
                    ret.add(new ScriptAssignment(rd.getKey().trim(),
                            StringUtils.removeStart(StringUtils.trim(rd.getValue()), "="),
                            step.getStepIndex()));
                }/*from  w w  w.  j a v a  2 s  . c  o  m*/
            }
        }
    }
    return ret;
}

From source file:net.bible.service.format.osistohtml.TitleHandler.java

public void start(Attributes attrs) {
    //JSword adds the chapter no at the top but hide this because the chapter is in the And Bible header
    boolean addedByJSword = attrs.getLength() == 1
            && OSISUtil.GENERATED_CONTENT.equals(attrs.getValue(OSISUtil.OSIS_ATTR_TYPE));
    // otherwise show if user wants Titles or the title is canonical
    isShowTitle = !addedByJSword && (parameters.isShowTitles()
            || "true".equalsIgnoreCase(attrs.getValue(OSISUtil.OSIS_ATTR_CANONICAL)));

    if (isShowTitle) {
        // ESV has subType butNETtext has lower case subtype so concatenate both and search with contains() 
        String subtype = attrs.getValue(OSISUtil.OSIS_ATTR_SUBTYPE)
                + attrs.getValue(OSISUtil.OSIS_ATTR_SUBTYPE.toLowerCase());
        isMoveBeforeVerse = StringUtils.containsIgnoreCase(subtype, PREVERSE)
                || (!verseInfo.isTextSinceVerse && verseInfo.currentVerseNo > 0);
        if (isMoveBeforeVerse) {
            // section Titles normally come before a verse, so overwrite the, already written verse, which is rewritten on writer.finishedInserting
            writer.beginInsertAt(verseInfo.positionToInsertBeforeVerse);
        }/*from w ww  . j a  va  2  s  . c om*/

        // get title type from level
        String titleClass = "heading" + TagHandlerHelper.getAttribute(OSISUtil.OSIS_ATTR_LEVEL, attrs, "1");

        writer.write("<h1 class='" + titleClass + "'>");
    } else {
        writer.setDontWrite(true);
    }
}

From source file:com.haulmont.cuba.gui.app.security.role.edit.tabs.EntityNameFilter.java

@Override
public boolean test(@Nullable T target) {
    if (target != null) {
        if (Boolean.TRUE.equals(assignedOnlyCheckBox.getValue()) && !target.isAssigned()) {
            return false;
        }/*from w  ww .ja  v a  2  s.  co  m*/

        if (Boolean.FALSE.equals(systemLevelCheckBox.getValue()) && (target instanceof EntityPermissionTarget)
                && !target.isAssigned()) {
            Class entityClass = ((EntityPermissionTarget) target).getEntityClass();
            MetaClass metaClass = metadata.getSession().getClassNN(entityClass);
            if (metadata.getTools().isSystemLevel(metaClass)) {
                return false;
            }
        }

        String filterValue = StringUtils.trimToEmpty(entityFilter.<String>getValue());
        return StringUtils.isBlank(filterValue)
                || StringUtils.containsIgnoreCase(target.getCaption(), filterValue);
    }
    return false;
}

From source file:hydrograph.ui.graph.canvas.search.HydrographComponentProposalProvider.java

@Override
public IContentProposal[] getProposals(String contents, int position) {

    proposalList.clear();//from  w  w w  . jav  a2 s . com
    List<PaletteContainer> paletteEntry = paletteRoot.getChildren();
    for (PaletteContainer paletteContainer : paletteEntry) {
        List<PaletteEntry> paletteDrawersList = paletteContainer.getChildren();
        for (PaletteEntry paletteDrawer : paletteDrawersList) {

            if (StringUtils.containsIgnoreCase(
                    paletteDrawer.getParent().getLabel() + " : " + paletteDrawer.getLabel(), contents)) {
                String componentName = ((Class) ((CombinedTemplateCreationEntry) paletteDrawer).getTemplate())
                        .getSimpleName();
                componentDetails = new ComponentDetails();
                Component component = XMLConfigUtil.INSTANCE.getComponent(componentName);
                componentDetails.setName(componentName);
                componentDetails.setCategoryAndPalletteName(
                        paletteDrawer.getParent().getLabel() + " : " + paletteDrawer.getLabel());
                componentDetails.setDescription(component.getDescription());
                componentDetails.setDescriptor(paletteDrawer.getSmallIcon());
                proposalList.add(new ComponentContentProposal(componentDetails));
            }
        }
    }

    componentDetails = new ComponentDetails();
    componentDetails.setName(COMMENT_BOX);
    componentDetails.setCategoryAndPalletteName(COMMENT_BOX);
    componentDetails.setDescription(COMMENT_BOX);
    componentDetails.setDescriptor(getCommentBoxImageDisDescriptor());
    proposalList.add(new ComponentContentProposal(componentDetails));
    return proposalList.toArray(new IContentProposal[0]);
}