private static Predicate getPredicate(final SetJoin<JpaDistributionSet, JpaDistributionSetTag> tags, final Collection<String> tagNames, final Boolean selectDSWithNoTag, final CriteriaBuilder cb) { tags.get(JpaDistributionSetTag_.name); final Path<String> exp = tags.get(JpaDistributionSetTag_.name); if (selectDSWithNoTag != null && selectDSWithNoTag) { if (!CollectionUtils.isEmpty(tagNames)) { return cb.or(exp.isNull(), exp.in(tagNames)); } else { return exp.isNull(); } } else { return exp.in(tagNames); } }
private static Predicate getPredicate(final SetJoin<JpaDistributionSet, JpaDistributionSetTag> tags, final Collection<String> tagNames, final Boolean selectDSWithNoTag, final CriteriaBuilder cb) { tags.get(JpaDistributionSetTag_.name); final Path<String> exp = tags.get(JpaDistributionSetTag_.name); if (selectDSWithNoTag != null && selectDSWithNoTag) { if (!CollectionUtils.isEmpty(tagNames)) { return cb.or(exp.isNull(), exp.in(tagNames)); } else { return exp.isNull(); } } else { return exp.in(tagNames); } }
private static Predicate getPredicate(final Root<JpaTarget> targetRoot, final CriteriaBuilder cb, final Boolean selectTargetWithNoTag, final String[] tagNames) { final SetJoin<JpaTarget, JpaTargetTag> tags = targetRoot.join(JpaTarget_.tags, JoinType.LEFT); final Path<String> exp = tags.get(JpaTargetTag_.name); if (selectTargetWithNoTag) { if (tagNames != null) { return cb.or(exp.isNull(), exp.in(tagNames)); } else { return exp.isNull(); } } else { return exp.in(tagNames); } }
private static Predicate getPredicate(final Root<JpaTarget> targetRoot, final CriteriaBuilder cb, final Boolean selectTargetWithNoTag, final String[] tagNames) { final SetJoin<JpaTarget, JpaTargetTag> tags = targetRoot.join(JpaTarget_.tags, JoinType.LEFT); final Path<String> exp = tags.get(JpaTargetTag_.name); if (selectTargetWithNoTag) { if (tagNames != null) { return cb.or(exp.isNull(), exp.in(tagNames)); } else { return exp.isNull(); } } else { return exp.in(tagNames); } }
predicates.add(root.get("serviceAccountClientLink").isNull());
if (value == null) { if (!getConfig().isExcludeZeroes()) { predicates.add(path.get(attribute).isNull());
/** * * @param path * @param property * @param value * @return */ private Predicate preparePredicate(Path<?> path, String property, Object value) { path = getPath(path, property); if (value == null) { return path.isNull(); } // openjpa and datanucleus do not support embeddables as restriction // directly // TODO: verify whether this is working now if (JpaHelper.isJpaProviderOpenJpa(getEntityManager()) || JpaHelper.isJpaProviderDataNucleus(getEntityManager())) { for (ManagedType<?> embeddableType : metaModel.getEmbeddables()) { if (embeddableType.getJavaType().equals(value.getClass())) { return andPredicates(preparePredicates(path, embeddableType, value)); } } } return preparePredicate(path, value); }
@Override public Specification<SalesAchievement> specification() { return (root, query, cb) -> { Predicate predicate = cb.isTrue(root.get(SalesAchievement_.picked)); if (date != null) { predicate = cb.and(predicate, JpaFunctionUtils.dateEqual(cb , root.get(SalesAchievement_.targetTime), date)); } if (remark != null) { final Path<String> remarkPath = root.get(SalesAchievement_.remark); predicate = cb.and(predicate, !remark ? remarkPath.isNull() : remarkPath.isNotNull()); } if (deal != null) { Join<?, MainOrder> orderPath = root.join(SalesAchievement_.mainOrder, JoinType.LEFT); Predicate next; if (deal) next = cb.and(orderPath.isNotNull(), MainOrder.getOrderPaySuccess(orderPath, cb)); else next = cb.or(orderPath.isNull(), MainOrder.getOrderPaySuccess(orderPath, cb).not()); predicate = cb.and(predicate, next); } return predicate; }; } };
p = from.get(attr).isNull(); this.add(p); continue;
p = from.get(attr).isNull(); this.add(p); continue;
p = from.get(attr).isNull(); this.add(p); continue;
p = from.get(attr).isNull(); this.add(p); continue;