Example usage for javax.persistence.criteria CriteriaBuilder like

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

Introduction

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

Prototype

Predicate like(Expression<String> x, String pattern);

Source Link

Document

Create a predicate for testing whether the expression satisfies the given pattern.

Usage

From source file:th.co.geniustree.dental.spec.AppointmentSpec.java

public static Specification<Appointment> namePatientLike(final String keyword) {
    return new Specification<Appointment>() {

        @Override/*from w  w w.j  av a 2 s . co  m*/
        public Predicate toPredicate(Root<Appointment> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
            return cb.like(root.get(Appointment_.patient).get(Patient_.name), keyword);
        }
    };
}

From source file:th.co.geniustree.dental.spec.AppointmentSpec.java

public static Specification<Appointment> mobileLike(final String keyword) {
    return new Specification<Appointment>() {

        @Override/*from w ww. j a  va 2  s.c o  m*/
        public Predicate toPredicate(Root<Appointment> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
            return cb.like(root.get(Appointment_.mobile), keyword);
        }
    };
}

From source file:th.co.geniustree.dental.spec.AppointmentSpec.java

public static Specification<Appointment> appointmentStatus(final String keyword) {
    return new Specification<Appointment>() {

        @Override//from  ww w.j  a  va  2  s.co m
        public Predicate toPredicate(Root<Appointment> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.like(root.get(Appointment_.status), keyword);
        }
    };
}

From source file:th.co.geniustree.dental.spec.StaffSpec.java

public static Specification<Staff> nameLike(final String keyword) {
    return new Specification<Staff>() {

        @Override/*from   w  ww . jav a 2  s  .  c  o  m*/
        public Predicate toPredicate(Root<Staff> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.or(cb.like(root.get(Staff_.nameTh), keyword),
                    cb.like(cb.upper(root.get(Staff_.nameEng)), keyword.toUpperCase()));
        }
    };
}

From source file:th.co.geniustree.dental.spec.DetailHealSpec.java

public static Specification<DetailHeal> patientLike(final String keyword) {
    return new Specification<DetailHeal>() {

        @Override//  www  .  j av  a  2  s  . co m
        public Predicate toPredicate(Root<DetailHeal> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.like(cb.upper(root.get(DetailHeal_.patient).get(Patient_.name)), keyword);
        }
    };
}

From source file:th.co.geniustree.dental.spec.DetailHealSpec.java

public static Specification<DetailHeal> doctorLike(final String keyword) {
    return new Specification<DetailHeal>() {

        @Override/* ww w. jav a  2  s.  c  o  m*/
        public Predicate toPredicate(Root<DetailHeal> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.like(cb.upper(root.get(DetailHeal_.doctor).get(Doctor_.nameTh)), keyword);
        }
    };
}

From source file:th.co.geniustree.dental.spec.PriceAndExpireProductSpec.java

public static Specification<PriceAndExpireProduct> productLike(final String keyword) {
    return new Specification<PriceAndExpireProduct>() {

        @Override/*from www . j a  v  a2s.  com*/
        public Predicate toPredicate(Root<PriceAndExpireProduct> root, CriteriaQuery<?> cq,
                CriteriaBuilder cb) {
            return cb.and(cb.like(cb.upper(root.get(PriceAndExpireProduct_.product).get(Product_.name)),
                    keyword.toUpperCase()), cb.isNull(root.get(PriceAndExpireProduct_.status)));
        }
    };
}

From source file:th.co.geniustree.dental.spec.DetailHealSpec.java

public static Specification<DetailHeal> patientLikeForBill(final String keyword) {
    return new Specification<DetailHeal>() {

        @Override/*from  w w w  .  j  a v a 2 s.  co  m*/
        public Predicate toPredicate(Root<DetailHeal> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.and(cb.like(cb.upper(root.get(DetailHeal_.patient).get(Patient_.name)), keyword),
                    cb.isNull(root.get(DetailHeal_.status)));
        }
    };
}

From source file:th.co.geniustree.dental.spec.DetailHealSpec.java

public static Specification<DetailHeal> doctorLikeForBill(final String keyword) {
    return new Specification<DetailHeal>() {

        @Override/*from  www . j ava 2 s.c  om*/
        public Predicate toPredicate(Root<DetailHeal> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.and(cb.like(cb.upper(root.get(DetailHeal_.doctor).get(Doctor_.nameTh)), keyword),
                    cb.isNull(root.get(DetailHeal_.status)));
        }
    };
}

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);
}