Example usage for javax.persistence.criteria CriteriaBuilder lower

List of usage examples for javax.persistence.criteria CriteriaBuilder lower

Introduction

In this page you can find the example usage for javax.persistence.criteria CriteriaBuilder lower.

Prototype

Expression<String> lower(Expression<String> x);

Source Link

Document

Create expression for converting a string to lowercase.

Usage

From source file:edu.pitt.dbmi.ccd.db.specification.GroupSpecification.java

private static Predicate nameContains(Root<Group> root, CriteriaBuilder cb, String term) {
    return cb.like(cb.lower(root.get(NAME)), term);
}

From source file:edu.pitt.dbmi.ccd.db.specification.GroupSpecification.java

private static Predicate descriptionContains(Root<Group> root, CriteriaBuilder cb, String term) {
    return cb.like(cb.lower(root.get(DESC)), term);
}

From source file:edu.pitt.dbmi.ccd.db.specification.VocabularySpecification.java

private static Predicate nameContains(Root<Vocabulary> root, CriteriaBuilder cb, String term) {
    return cb.like(cb.lower(root.get(NAME)), term);
}

From source file:edu.pitt.dbmi.ccd.db.specification.VocabularySpecification.java

private static Predicate descriptionContains(Root<Vocabulary> root, CriteriaBuilder cb, String term) {
    return cb.like(cb.lower(root.get(DESC)), term);
}

From source file:com.mtt.myapp.user.repository.UserSpecification.java

/**
 * Create "Email like" query spec./*from  w  w  w. jav  a  2 s . c om*/
 * @param query query
 * @return created spec
 */
public static Specification<User> emailLike(final String query) {
    return new Specification<User>() {
        @Override
        public Predicate toPredicate(Root<User> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
            String pattern = ("%" + query + "%").toLowerCase();
            return cb.like(cb.lower(root.get("email").as(String.class)), pattern);
        }
    };
}

From source file:com.mtt.myapp.user.repository.UserSpecification.java

/**
 * Create "Name Like" query spec./*from w  w  w .j  av a 2 s . com*/
 * @param query query
 * @return created spec
 */
public static Specification<User> nameLike(final String query) {
    return new Specification<User>() {
        @Override
        public Predicate toPredicate(Root<User> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder cb) {
            String pattern = ("%" + query + "%").toLowerCase();
            return cb.or(cb.like(cb.lower(root.get("userName").as(String.class)), pattern),
                    cb.like(cb.lower(root.get("userId").as(String.class)), pattern));
        }
    };
}

From source file:edu.pitt.dbmi.ccd.db.specification.AnnotationTargetSpecification.java

private static Predicate titleContains(Root<AnnotationTarget> root, CriteriaBuilder cb, String term) {
    return cb.like(cb.lower(root.get(TITLE)), term);
}

From source file:edu.pitt.dbmi.ccd.db.specification.AnnotationTargetSpecification.java

private static Predicate addressContains(Root<AnnotationTarget> root, CriteriaBuilder cb, String term) {
    return cb.like(cb.lower(root.get(ADDRESS)), term);
}

From source file:edu.pitt.dbmi.ccd.db.specification.AnnotationTargetSpecification.java

private static Predicate fileNameContains(Root<AnnotationTarget> root, CriteriaBuilder cb, String term) {
    return cb.like(cb.lower(root.get(FILE).get(NAME)), term);
}

From source file:edu.pitt.dbmi.ccd.db.specification.AnnotationTargetSpecification.java

private static Predicate belongsToUser(Root<AnnotationTarget> root, CriteriaBuilder cb, String username) {
    return cb.like(cb.lower(root.get(USER).get(USERNAME)), username.toLowerCase());
}