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.tesora.dve.sql.util.StorageGroupDDL.java

@Override
public void destroy(ConnectionResource mr) throws Throwable {
    if (!isCreated())
        return;//ww w . j  a  v a 2  s.c  o m
    try {
        // drop the group
        mr.execute("drop persistent group " + name);
        // and also drop all the sites
        for (int i = 0; i < nsites; i++)
            mr.execute("drop persistent site " + siteKern + i);
        clearCreated();
    } catch (PEException e) {
        if (!throwDropGroupInUseException
                && (StringUtils.containsIgnoreCase(e.getMessage(), "Unable to drop persistent group")
                        && StringUtils.containsIgnoreCase(e.getMessage(), "because used by database"))) {
            // eat the exception
        } else {
            throw e;
        }
    }
}

From source file:com.alibaba.otter.common.push.datasource.media.MediaPushDataSourceHandler.java

public static boolean isMediaPushDataSource(String url) {
    return StringUtils.startsWithIgnoreCase(url, "jdbc:") && StringUtils.containsIgnoreCase(url, "groupKey");
}

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

private RowMapper<User> defineMapper(String username) {
    if (!username.contains("@") && (!StringUtils.containsIgnoreCase(username, ".org")
            || !StringUtils.containsIgnoreCase(username, ".net")
            || !StringUtils.containsIgnoreCase(username, ".gov")
            || !StringUtils.endsWithIgnoreCase(username, ".com"))) {
        return nameMapper;
    } else {//from   www  .  ja v  a 2s  .  c  o m
        return mailMapper;
    }
}

From source file:com.zb.app.web.controller.account.AccountController.java

/**
 * ??// w  ww .jav a  2  s  .  co  m
 * 
 * @param q
 * @param limit
 * @return
 */
@RequestMapping(value = "/autocompleteCompany.htm", produces = "application/json")
@ResponseBody
public JsonResult autocompleteCompany(String q, Integer limit) {
    List<TravelCompanyDO> list = companyService.list();
    final List<Long> cIdList = orderService
            .getTourCompany(new TravelOrderQuery(WebUserTools.getCid(), OrderStateEnum.CONFIRM));
    if (cIdList == null || cIdList.size() == 0) {
        return JsonResultUtils.success("?!");
    }
    CollectionUtils.remove(list, new Grep<TravelCompanyDO>() {

        @Override
        public boolean grep(TravelCompanyDO comapny) {
            return !cIdList.contains(comapny.getcId());
        }

    });

    List<Map<String, ?>> mapList = CollectionUtils.toMapList(list, "cId", "cName", "cSpell");

    // StringBuilder sb = new StringBuilder();
    String cond = q == null ? StringUtils.EMPTY : q;
    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);
}

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

/**
 * Define key.//from w  ww .  j ava2 s . co m
 * 
 * @param username
 *            the username
 * @return the string
 * @since 31/08/2014, 07:23:59 PM
 */
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.PROVIDER_NAME_QUERY.getConfigKey();
    } else {
        return AccessProperties.PROVIDER_MAIL_QUERY.getConfigKey();
    }
}

From source file:$.LogParserConfig.java

public boolean isMatchesFilter(String propertyValue, int propertyIndex) {
        String expectedValue = filter.get(getPropertyNames().get(propertyIndex));
        return expectedValue == null || StringUtils.containsIgnoreCase(propertyValue, expectedValue);
    }/*from   w  w w.  j av  a  2 s.  c o m*/

From source file:de.sub.goobi.forms.AdditionalField.java

/**
 * Get show depending on document type.//w w w.j a v  a  2  s .c  o  m
 *
 * @return show
 */
public boolean getShowDependingOnDoctype() {

    /* wenn nix angegeben wurde, dann anzeigen */
    if (this.isdoctype.equals("") && this.isnotdoctype.equals("")) {
        return true;
    }

    /* wenn pflicht angegeben wurde */
    if (!this.isdoctype.equals("") && !StringUtils.containsIgnoreCase(isdoctype, this.pkf.getDocType())) {
        return false;
    }

    /* wenn nur "darf nicht" angegeben wurde */
    return !(!this.isnotdoctype.equals("")
            && StringUtils.containsIgnoreCase(isnotdoctype, this.pkf.getDocType()));
}

From source file:com.intuit.tank.tools.debugger.SelectDialog.java

public void filter(final long timeValue) {
    new Thread(new Runnable() {

        @Override/*  www. j a v  a2s. c o m*/
        public void run() {
            try {
                Thread.sleep(200);
                if (timeValue == timeClicked) {
                    SwingUtilities.invokeLater(new Runnable() {

                        @Override
                        public void run() {
                            List<SELECTION_TYPE> filtered = new ArrayList<SELECTION_TYPE>();
                            for (SELECTION_TYPE obj : items) {
                                if (StringUtils.isBlank(filterField.getText()) || StringUtils
                                        .containsIgnoreCase(obj.toString(), filterField.getText().trim())) {
                                    filtered.add(obj);
                                }
                            }
                            list.setListData(filtered.toArray());
                            list.repaint();
                        }
                    });
                } else {
                    System.out.println("skipping...");
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }).start();

}

From source file:edu.harvard.iq.dataverse.RolePermissionFragment.java

public List<RoleAssignee> completeRoleAssignee(String query) {
    if (roleAssigneeList.isEmpty()) {
        for (AuthenticatedUser au : authenticationService.findAllAuthenticatedUsers()) {
            roleAssigneeList.add(au);//  w  w w  .j  a  v a  2 s  .co  m
        }
    }
    List<RoleAssignee> returnList = new ArrayList<>();
    for (RoleAssignee ra : roleAssigneeList) {
        // @todo unsure if containsIgnore case will work for all locales
        if (StringUtils.containsIgnoreCase(ra.getDisplayInfo().getTitle(), query)) {
            returnList.add(ra);
        }
    }
    return returnList;
}

From source file:fr.dutra.confluence2wordpress.core.metadata.DefaultMetadataManager.java

public Metadata createMetadata(ContentEntityObject page, Set<WordpressUser> users,
        Set<WordpressCategory> categories) {
    Metadata metadata = new Metadata();
    String pageTitle = page.getTitle();
    Matcher matcher = DRAFT_PREFIX_PATTERN.matcher(pageTitle);
    if (matcher.matches()) {
        String prefix = matcher.group(1);
        metadata.setPageTitle(StringUtils.substringAfter(pageTitle, prefix));
    } else {/*  w w w . j  av  a2s  .  c  o m*/
        metadata.setPageTitle(pageTitle);
    }
    if (StringUtils.containsIgnoreCase(metadata.getPageTitle(), RDP_CATEGORY_NAME)) {
        metadata.setPageTitle(RDP_PAGE_TITLE); // to normalize the title
        if (categories != null) {
            for (WordpressCategory category : categories) {
                if (StringUtils.containsIgnoreCase(category.getCategoryName(), RDP_CATEGORY_NAME)) {
                    metadata.setCategoryNames(Collections.singletonList(category.getCategoryName()));
                    break;
                }
            }
        }
        Calendar now = Calendar.getInstance();
        metadata.setPostSlug(
                String.format(RDP_POST_SLUG_FORMAT, now.getTime(), now.get(Calendar.WEEK_OF_YEAR)));
        if (users != null) {
            for (WordpressUser user : users) {
                if (XEBIA_FRANCE_LOGIN.equals(user.getLogin())) {
                    metadata.setAuthorId(user.getId());
                    break;
                }
            }
        }
    } else {
        String creatorName = page.getCreatorName();
        if (creatorName != null && users != null) {
            for (WordpressUser wordpressUser : users) {
                if (creatorName.equals(wordpressUser.getLogin())) {
                    metadata.setAuthorId(wordpressUser.getId());
                    break;
                }
            }
        }
    }
    return metadata;
}