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

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

Introduction

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

Prototype

public static boolean containsIgnoreCase(final CharSequence str, final CharSequence searchStr) 

Source Link

Document

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

Usage

From source file:org.kuali.kra.institutionalproposal.proposallog.ProposalLogLookupableHelperServiceImpl.java

@Override
public List<? extends BusinessObject> getSearchResults(Map<String, String> fieldValues) {

    checkIsLookupForProposalCreation();/*from w w  w. j a  v  a  2s  .  c om*/
    List<ProposalLog> results = (List<ProposalLog>) super.getSearchResults(fieldValues);
    String returnLocation = fieldValues.get(BACK_LOCATION);
    List<ProposalLog> searchList = filterForPermissions(results);
    if (StringUtils.containsIgnoreCase(returnLocation, NEGOTIATION_NEGOTIATION)) {
        return cleanSearchResultsForNegotiationLookup(searchList);
    } else {
        return searchList;
    }
}

From source file:org.kuali.kra.timeandmoney.service.impl.TimeAndMoneyVersionServiceImpl.java

String getLimitSql(Connection connection, Integer num) throws SQLException {
    if (StringUtils.containsIgnoreCase(connection.getMetaData().getDatabaseProductName(), "oracle")) {
        return "where rownum <= " + num;
    } else if (StringUtils.containsIgnoreCase(connection.getMetaData().getDatabaseProductName(), "mysql")) {
        return "limit 0, " + num;
    } else {//www . j  a va  2s.  c  o m
        throw new UnsupportedOperationException("Unsupported database detected");
    }
}

From source file:org.libreplan.web.orders.OrderElementPredicate.java

private boolean acceptFilterName(OrderElement orderElement) {
    if (name == null) {
        return true;
    }/* ww  w .j  a v a  2s.c o m*/
    if ((orderElement.getName() != null) && (StringUtils.containsIgnoreCase(orderElement.getName(), name))) {
        return true;
    }
    return false;
}

From source file:org.libreplan.web.orders.OrderPredicate.java

private boolean acceptFilterName(Order order) {
    if (name == null) {
        return true;
    }//  w w  w  .jav  a  2s  .c  o m
    if ((order.getName() != null) && (StringUtils.containsIgnoreCase(order.getName(), name))) {
        return true;
    }
    return false;
}

From source file:org.libreplan.web.planner.TaskElementPredicate.java

private boolean acceptFilterName(TaskElement taskElement) {
    if (name == null) {
        return true;
    }/* w  w  w  .ja v  a 2 s  . c  om*/
    if ((taskElement.getName() != null) && (StringUtils.containsIgnoreCase(taskElement.getName(), name))) {
        return true;
    }
    return false;
}

From source file:org.libreplan.web.planner.TaskGroupPredicate.java

protected boolean acceptFilterName(TaskGroup taskGroup) {
    if (name == null) {
        return true;
    }//from w ww  . j  ava 2 s  .c om
    if ((taskGroup.getName() != null) && (StringUtils.containsIgnoreCase(taskGroup.getName(), name))) {
        return true;
    }
    return false;
}

From source file:org.ligoj.app.plugin.id.ldap.dao.AbstractContainerLdapRepository.java

/**
 * Indicates the given group matches to the given pattern.
 *//* w w  w.  j a  v a  2s  .  c  om*/
private boolean matchPattern(final T group, final String criteria) {
    return StringUtils.containsIgnoreCase(group.getName(), criteria);
}

From source file:org.ligoj.app.plugin.id.ldap.dao.UserLdapRepository.java

/**
 * Indicates the given user match to the given pattern.
 */// w w  w  . ja v  a  2 s.c o  m
private boolean matchPattern(final UserOrg userLdap, final String criteria) {
    return StringUtils.containsIgnoreCase(userLdap.getFirstName(), criteria)
            || StringUtils.containsIgnoreCase(userLdap.getLastName(), criteria)
            || StringUtils.containsIgnoreCase(userLdap.getId(), criteria) || !userLdap.getMails().isEmpty()
                    && StringUtils.containsIgnoreCase(userLdap.getMails().get(0), criteria);
}

From source file:org.ligoj.app.plugin.vm.aws.VmAwsPluginResource.java

/**
 * Find the virtual machines matching to the given criteria. Look into virtual machine name and identifier.
 *
 * @param node// w  w w.j av  a 2s  .  c  o m
 *            the node to be tested with given parameters.
 * @param criteria
 *            the search criteria. Case is insensitive.
 * @param uriInfo
 *            Additional subscription parameters.
 * @return virtual machines.
 * @throws Exception
 *             When AWS content cannot be read.
 */
@GET
@Path("{node:service:.+}/{criteria}")
@Consumes(MediaType.APPLICATION_JSON)
public List<AwsVm> findAllByNameOrId(@PathParam("node") final String node,
        @PathParam("criteria") final String criteria, @Context final UriInfo uriInfo) throws Exception {
    // Check the node exists
    if (nodeRepository.findOneVisible(node, securityHelper.getLogin()) == null) {
        return Collections.emptyList();
    }

    // Merge the node parameters to the node ones
    final Map<String, String> parameters = new HashMap<>(pvResource.getNodeParameters(node));
    uriInfo.getQueryParameters().forEach((p, v) -> parameters.putIfAbsent(p, v.get(0)));

    // Get all VMs and then filter by its name or id
    // Note : AWS does not support RegExp on tag
    return this.getDescribeInstances(parameters, "", this::toVm).stream()
            .filter(vm -> StringUtils.containsIgnoreCase(vm.getName(), criteria)
                    || StringUtils.containsIgnoreCase(vm.getId(), criteria))
            .sorted().collect(Collectors.toList());
}

From source file:org.ligoj.app.plugin.vm.aws.VmAwsSnapshotResource.java

/**
 * Check the given snapshot matches to the criteria : name, id, or one of its volume id.
 *//*from   w w  w.ja  va 2 s  .c o m*/
private boolean matches(final Snapshot snapshot, final String criteria) {
    return StringUtils.containsIgnoreCase(StringUtils.defaultIfEmpty(snapshot.getName(), ""), criteria)
            || StringUtils.containsIgnoreCase(snapshot.getId(), criteria) || snapshot.getVolumes().stream()
                    .anyMatch(v -> StringUtils.containsIgnoreCase(v.getId(), criteria));
}