private Predicate allOf(Collection<Predicate> predicates) { return predicates != null ? ExpressionUtils.allOf(predicates) : null; }
public GraphBlock(Expression<UID> context, List<Block> blocks, Predicate... filters) { this.blocks = Assert.notEmpty(blocks, "blocks"); this.context = context; this.filters = ExpressionUtils.allOf(filters); }
/** * Get a union of this and the intersection of the given predicates * * @param predicates * @return */ public BooleanExpression orAllOf(Predicate... predicates) { return or(ExpressionUtils.allOf(predicates)); }
/** * Create the union of this and the intersection of the given args * {@code (this || (arg1 && arg2 ... && argN))} * * @param args * @return */ public BooleanBuilder orAllOf(Predicate... args) { if (args.length > 0) { or(ExpressionUtils.allOf(args)); } return this; }
public GroupBlock(List<Block> blocks, Predicate... filters) { this.blocks = Assert.notEmpty(blocks, "blocks"); this.filters = ExpressionUtils.allOf(filters); }
public OptionalBlock(List<Block> blocks, Predicate... filters) { this.blocks = Assert.notEmpty(blocks, "blocks"); this.filters = ExpressionUtils.allOf(filters); }
public MongodbQuery<K> on(Predicate... conditions) { return queryMixin.where(PredicateOperation.create( MongodbOps.ELEM_MATCH, collection, ExpressionUtils.allOf(conditions))); }
@Nullable protected Predicate createFilter(QueryMetadata metadata) { Predicate filter; if (!metadata.getJoins().isEmpty()) { filter = ExpressionUtils.allOf(metadata.getWhere(), createJoinFilter(metadata)); } else { filter = metadata.getWhere(); } return filter; }
@Nullable protected Predicate createJoinFilter(QueryMetadata metadata) { Multimap<Expression<?>, Predicate> predicates = HashMultimap.<Expression<?>, Predicate>create(); List<JoinExpression> joins = metadata.getJoins(); for (int i = joins.size() - 1; i >= 0; i--) { JoinExpression join = joins.get(i); Path source = (Path)((Operation<?>)join.getTarget()).getArg(0); Path target = (Path)((Operation<?>)join.getTarget()).getArg(1); Collection<Predicate> extraFilters = predicates.get(target.getRoot()); Predicate filter = ExpressionUtils.allOf(join.getCondition(), allOf(extraFilters)); List<Object> ids = getIds(target.getType(), filter); if (ids.isEmpty()) { throw new NoResults(); } Path path = new PathImpl<String>(String.class, source, "$id"); predicates.put(source.getRoot(), ExpressionUtils.in(path, ids)); } Path source = (Path)((Operation)joins.get(0).getTarget()).getArg(0); return allOf(predicates.get(source.getRoot())); }
/** * Add code matches in XDS form using XDSCode entity * * @param builder BooleanBuilder to add matches for given code parameter * @param codeParam Stored Query Parameter with code values * @param codeType The classification of the codes (Classification.classificationScheme) * @param xdsCodes The CollectionPath for XDSCodes of parent select (to bind subselect) * @throws XDSException */ protected void addXdsCodeMatch(BooleanBuilder builder, StoredQueryParam codeParam, String codeClassification, CollectionPath<XDSCode, QXDSCode> xdsCodes) throws XDSException { if (codeParam != null) { List<String> codeValues; String[] codeAndScheme; for (int i = 0, len=codeParam.getNumberOfANDElements() ; i < len ; i++) { codeValues = codeParam.getMultiValues(i); BooleanBuilder codesBuilder = new BooleanBuilder(); for (int j = 0, jLen = codeValues.size() ; j < jLen ; j++) { codeAndScheme = toCodeValueAndScheme(codeValues.get(j)); codesBuilder.or(ExpressionUtils.allOf(QXDSCode.xDSCode.codeClassification.eq(codeClassification), QXDSCode.xDSCode.codeValue.eq(codeAndScheme[0]), QXDSCode.xDSCode.codingSchemeDesignator.eq(codeAndScheme[1]))); } builder.and(new JPASubQuery().from(QXDSCode.xDSCode) .where(QXDSCode.xDSCode.in(xdsCodes), codesBuilder).exists()); } } }
for (int j = 0, jLen = codeValues.size() ; j < jLen ; j++) { codeAndScheme = toCodeValueAndScheme(codeValues.get(j)); codesBuilder.or(ExpressionUtils.allOf(QClassificationScheme.classificationScheme.id.eq(codeType), QClassification.classification.nodeRepresentation.eq(codeAndScheme[0]), QSlot.slot.value.eq(codeAndScheme[1])));
protected void addFromToMatch(BooleanBuilder builder, StoredQueryParam from, StoredQueryParam to, NumberPath<Long> subselectJoinPk, String slotName) { if (from != null || to != null) { Predicate fromTo = from == null ? QSlot.slot.value.lt(to.getStringValue()) : to != null ? ExpressionUtils.allOf(QSlot.slot.value.goe(from.getStringValue()), QSlot.slot.value.lt(to.getStringValue())) : QSlot.slot.value.goe(from.getStringValue()); builder.and(new JPASubQuery().from(QSlot.slot) .where(QSlot.slot.parent.pk.eq(subselectJoinPk), QSlot.slot.name.eq(slotName), fromTo).exists()); } }