/** * Creates a Mongo Bson object for field-based search criteria on the *unwound* __internal array documents. * * @param expression the expression for the resource whose existence is under scrutiny. * @return the complete Bson for the field-based search criteria */ public static Bson apply(final ExistsFieldExpression expression) { return expression.acceptExistsVisitor(new GetUnwoundExistsFilterBsonVisitor()); }
@Override public Function<Boolean, Optional<Bson>> visitExists(final ExistsFieldExpression fieldExpression) { return isPositive -> fieldExpression.accept(new CreateUnwoundBsonFieldVisitor(null)); }
/** * Creates a Mongo Bson object for field-based search criteria on the *unwound* __internal array documents. * * @param expression the expression for the resource whose existence is under scrutiny. * @return the complete Bson for the field-based search criteria */ public static Bson apply(final ExistsFieldExpression expression) { return expression.acceptExistsVisitor(new GetUnwoundExistsFilterBsonVisitor()); }
@Override public Function<Boolean, Optional<Bson>> visitExists(final ExistsFieldExpression fieldExpression) { return isPositive -> fieldExpression.accept(new CreateUnwoundBsonFieldVisitor(null)); }
public static Predicate<Thing> apply(final ExistsFieldExpression expression) { return expression.acceptExistsVisitor(new ExistsThingPredicateVisitor()); }
@Override public Predicate<Document> visitExists(final ExistsFieldExpression fieldExpression) { return thingResult -> { final Predicate<Document> predicate = fieldExpression.accept(new IsInternalViewVisitor()); final List<?> internalList = thingResult.get(PersistenceConstants.FIELD_INTERNAL, List.class); return internalList.stream() .anyMatch(element -> element instanceof Document && predicate.test((Document) element)); }; }
/** * Creates a Mongo Bson object for field-based exists criteria. * * @param expression the expression of the resource whose existence is under scrutiny. * @return the complete Bson for the field-based exists criteria */ public static Bson apply(final ExistsFieldExpression expression) { return expression.acceptExistsVisitor(new GetExistsBsonVisitor()); }
@Override public Predicate<Document> visitExists(final ExistsFieldExpression fieldExpression) { return thingResult -> { final Predicate<Document> predicate = fieldExpression.accept(new IsInternalViewVisitor()); final List<?> internalList = thingResult.get(PersistenceConstants.FIELD_INTERNAL, List.class); return internalList.stream() .anyMatch(element -> element instanceof Document && predicate.test((Document) element)); }; }
/** * Creates a Mongo Bson object for field-based exists criteria. * * @param expression the expression of the resource whose existence is under scrutiny. * @return the complete Bson for the field-based exists criteria */ public static Bson apply(final ExistsFieldExpression expression) { return expression.acceptExistsVisitor(new GetExistsBsonVisitor()); }