Example usage for javax.persistence.criteria CriteriaBuilder isNull

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

Introduction

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

Prototype

Predicate isNull(Expression<?> x);

Source Link

Document

Create a predicate to test whether the expression is null.

Usage

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

private static Predicate isFile(Root<AnnotationTarget> root, CriteriaBuilder cb) {
    return cb.isNull(root.get(ADDRESS));
}

From source file:com.invariantproperties.project.student.specification.CourseSpecifications.java

/**
 * Creates a specification used to find courses with the specified testUuid.
 * /*from   w ww .  j  av a 2  s  .  com*/
 * @param testRun
 * @return
 */
public static Specification<Course> testRunIs(final TestRun testRun) {

    return new Specification<Course>() {
        @Override
        public Predicate toPredicate(Root<Course> courseRoot, CriteriaQuery<?> query, CriteriaBuilder cb) {
            Predicate p = null;
            if (testRun == null || testRun.getUuid() == null) {
                p = cb.isNull(courseRoot.<Course_>get("testRun"));
            } else {
                p = cb.equal(courseRoot.<Course_>get("testRun").<TestRun_>get("uuid"), testRun.getUuid());
            }
            return p;
        }
    };
}

From source file:com.invariantproperties.project.student.specification.TermSpecifications.java

/**
 * Creates a specification used to find terms with the specified testUuid.
 * //  www .  ja  v  a2 s .c  o  m
 * @param testRun
 * @return
 */
public static Specification<Term> testRunIs(final TestRun testRun) {

    return new Specification<Term>() {
        @Override
        public Predicate toPredicate(Root<Term> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
            Predicate p = null;
            if (testRun == null || testRun.getUuid() == null) {
                p = cb.isNull(root.<Term_>get("testRun"));
            } else {
                p = cb.equal(root.<Term_>get("testRun").<TestRun_>get("uuid"), testRun.getUuid());
            }
            return p;
        }
    };
}

From source file:com.invariantproperties.project.student.specification.ClassroomSpecifications.java

/**
 * Creates a specification used to find classrooms with the specified
 * testUuid.//  w  w w  .  ja  v a 2  s.  c  o  m
 * 
 * @param testRun
 * @return
 */
public static Specification<Classroom> testRunIs(final TestRun testRun) {

    return new Specification<Classroom>() {
        @Override
        public Predicate toPredicate(Root<Classroom> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
            Predicate p = null;
            if (testRun == null || testRun.getUuid() == null) {
                p = cb.isNull(root.<Classroom_>get("testRun"));
            } else {
                p = cb.equal(root.<Classroom_>get("testRun").<TestRun_>get("uuid"), testRun.getUuid());
            }
            return p;
        }
    };
}

From source file:com.invariantproperties.project.student.specification.InstructorSpecifications.java

/**
 * Creates a specification used to find instructors with the specified
 * testUuid./*from  w  w w.ja  v a  2s.c o m*/
 * 
 * @param testRun
 * @return
 */
public static Specification<Instructor> testRunIs(final TestRun testRun) {

    return new Specification<Instructor>() {
        @Override
        public Predicate toPredicate(Root<Instructor> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
            Predicate p = null;
            if (testRun == null || testRun.getUuid() == null) {
                p = cb.isNull(root.<Instructor_>get("testRun"));
            } else {
                p = cb.equal(root.<Instructor_>get("testRun").<TestRun_>get("uuid"), testRun.getUuid());
            }
            return p;
        }
    };
}

From source file:com.invariantproperties.project.student.specification.SectionSpecifications.java

/**
 * Creates a specification used to find sections with the specified
 * testUuid.// w  w w.  ja  v  a 2  s  . c o  m
 * 
 * @param testRun
 * @return
 */
public static Specification<Section> testRunIs(final TestRun testRun) {

    return new Specification<Section>() {
        @Override
        public Predicate toPredicate(Root<Section> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
            Predicate p = null;
            if (testRun == null || testRun.getUuid() == null) {
                p = cb.isNull(root.<Section_>get("testRun"));
            } else {
                p = cb.equal(root.<Section_>get("testRun").<TestRun_>get("uuid"), testRun.getUuid());
            }
            return p;
        }
    };
}

From source file:com.invariantproperties.project.student.specification.StudentSpecifications.java

/**
 * Creates a specification used to find students with the specified
 * testUuid.//from  w  w  w.j  av a2  s . c  om
 * 
 * @param testRun
 * @return
 */
public static Specification<Student> testRunIs(final TestRun testRun) {

    return new Specification<Student>() {
        @Override
        public Predicate toPredicate(Root<Student> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
            Predicate p = null;
            if (testRun == null || testRun.getUuid() == null) {
                p = cb.isNull(root.<Student_>get("testRun"));
            } else {
                p = cb.equal(root.<Student_>get("testRun").<TestRun_>get("uuid"), testRun.getUuid());
            }
            return p;
        }
    };
}

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

public static Specification<DetailHeal> dateHealLikeForBill(final Date keyword) {
    return new Specification<DetailHeal>() {

        @Override/*  w  w w. j  ava  2  s. c  om*/
        public Predicate toPredicate(Root<DetailHeal> root, CriteriaQuery<?> cq, CriteriaBuilder cb) {
            return cb.and(cb.between(root.get(DetailHeal_.dateHeal), keyword, keyword),
                    cb.isNull(root.get(DetailHeal_.status)));
        }
    };
}

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

public static Specification<PriceAndExpireProduct> expireBetween(final Date keyword) {
    return new Specification<PriceAndExpireProduct>() {

        @Override//from  w ww .j  a  v  a2  s.c  o  m
        public Predicate toPredicate(Root<PriceAndExpireProduct> root, CriteriaQuery<?> cq,
                CriteriaBuilder cb) {
            return cb.and(cb.between(root.get(PriceAndExpireProduct_.expire), keyword, keyword),
                    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//  w  w w.  j av a  2 s.c  o  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)));
        }
    };
}