private List<T> findAll(@Nullable Query query) { if (query == null) { return Collections.emptyList(); } return mongoOperations.find(query, entityInformation.getJavaType(), entityInformation.getCollectionName()); } }
@Override public Optional<T> findById(ID id) { Assert.notNull(id, "The given id must not be null!"); return Optional.ofNullable( mongoOperations.findById(id, entityInformation.getJavaType(), entityInformation.getCollectionName())); }
@Override public Mono<T> findById(ID id) { Assert.notNull(id, "The given id must not be null!"); return mongoOperations.findById(id, entityInformation.getJavaType(), entityInformation.getCollectionName()); }
@Override public Mono<T> findById(Publisher<ID> publisher) { Assert.notNull(publisher, "The given id must not be null!"); return Mono.from(publisher).flatMap( id -> mongoOperations.findById(id, entityInformation.getJavaType(), entityInformation.getCollectionName())); }
@Override public void deleteById(ID id) { Assert.notNull(id, "The given id must not be null!"); mongoOperations.remove(getIdQuery(id), entityInformation.getJavaType(), entityInformation.getCollectionName()); }
private Flux<T> findAll(Query query) { return mongoOperations.find(query, entityInformation.getJavaType(), entityInformation.getCollectionName()); } }
@Override public Mono<Boolean> existsById(ID id) { Assert.notNull(id, "The given id must not be null!"); return mongoOperations.exists(getIdQuery(id), entityInformation.getJavaType(), entityInformation.getCollectionName()); }
@Override public boolean existsById(ID id) { Assert.notNull(id, "The given id must not be null!"); return mongoOperations.exists(getIdQuery(id), entityInformation.getJavaType(), entityInformation.getCollectionName()); }
@Override public Mono<Boolean> existsById(Publisher<ID> publisher) { Assert.notNull(publisher, "The given id must not be null!"); return Mono.from(publisher).flatMap(id -> mongoOperations.exists(getIdQuery(id), entityInformation.getJavaType(), entityInformation.getCollectionName())); }
@Override public Mono<Void> deleteById(ID id) { Assert.notNull(id, "The given id must not be null!"); return mongoOperations .remove(getIdQuery(id), entityInformation.getJavaType(), entityInformation.getCollectionName()).then(); }
@Override public Mono<Void> deleteById(Publisher<ID> publisher) { Assert.notNull(publisher, "Id must not be null!"); return Mono.from(publisher).flatMap(id -> mongoOperations.remove(getIdQuery(id), entityInformation.getJavaType(), entityInformation.getCollectionName())).then(); }
/** * Creates a new {@link ReactiveQuerydslMongoPredicateExecutor} for the given {@link MongoEntityInformation}, * {@link ReactiveMongoOperations} and {@link EntityPathResolver}. * * @param entityInformation must not be {@literal null}. * @param mongoOperations must not be {@literal null}. * @param resolver must not be {@literal null}. */ public ReactiveQuerydslMongoPredicateExecutor(MongoEntityInformation<T, ?> entityInformation, ReactiveMongoOperations mongoOperations, EntityPathResolver resolver) { super(mongoOperations.getConverter(), pathBuilderFor(resolver.createPath(entityInformation.getJavaType())), entityInformation); this.mongoOperations = mongoOperations; }
/** * Creates a new {@link QuerydslMongoPredicateExecutor} for the given {@link MongoEntityInformation}, * {@link MongoOperations} and {@link EntityPathResolver}. * * @param entityInformation must not be {@literal null}. * @param mongoOperations must not be {@literal null}. * @param resolver must not be {@literal null}. */ public QuerydslMongoPredicateExecutor(MongoEntityInformation<T, ?> entityInformation, MongoOperations mongoOperations, EntityPathResolver resolver) { super(mongoOperations.getConverter(), pathBuilderFor(resolver.createPath(entityInformation.getJavaType())), entityInformation); this.mongoOperations = mongoOperations; }
@Override public Optional<T> findById(ID id) { Assert.notNull(id, "The given id must not be null!"); return Optional.ofNullable( mongoOperations.findById(id, entityInformation.getJavaType(), entityInformation.getCollectionName())); }
private List<T> findAll(@Nullable Query query) { if (query == null) { return Collections.emptyList(); } return mongoOperations.find(query, entityInformation.getJavaType(), entityInformation.getCollectionName()); } }
@Override public Mono<T> findById(ID id) { Assert.notNull(id, "The given id must not be null!"); return mongoOperations.findById(id, entityInformation.getJavaType(), entityInformation.getCollectionName()); }
@Override public Mono<T> findById(Publisher<ID> publisher) { Assert.notNull(publisher, "The given id must not be null!"); return Mono.from(publisher).flatMap( id -> mongoOperations.findById(id, entityInformation.getJavaType(), entityInformation.getCollectionName())); }
@Override public boolean existsById(ID id) { Assert.notNull(id, "The given id must not be null!"); return mongoOperations.exists(getIdQuery(id), entityInformation.getJavaType(), entityInformation.getCollectionName()); }
@Override public Mono<Void> deleteById(Publisher<ID> publisher) { Assert.notNull(publisher, "Id must not be null!"); return Mono.from(publisher).flatMap(id -> mongoOperations.remove(getIdQuery(id), entityInformation.getJavaType(), entityInformation.getCollectionName())).then(); }
@Override public Mono<Void> deleteById(ID id) { Assert.notNull(id, "The given id must not be null!"); return mongoOperations .remove(getIdQuery(id), entityInformation.getJavaType(), entityInformation.getCollectionName()).then(); }