diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java index 14e956153..9d208993c 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java @@ -378,7 +378,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, @Override public CloseableIterator stream(final Query query, final Class entityType) { - return stream(query, entityType, operations.determineCollectionName(entityType)); + return stream(query, entityType, getCollectionName(entityType)); } /* @@ -528,7 +528,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, public T execute(Class entityClass, CollectionCallback callback) { Assert.notNull(entityClass, "EntityClass must not be null!"); - return execute(operations.determineCollectionName(entityClass), callback); + return execute(getCollectionName(entityClass), callback); } /* @@ -599,7 +599,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, @Nullable CollectionOptions collectionOptions) { Assert.notNull(entityClass, "EntityClass must not be null!"); - return doCreateCollection(operations.determineCollectionName(entityClass), + return doCreateCollection(getCollectionName(entityClass), convertToDocument(collectionOptions, entityClass)); } @@ -645,7 +645,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, * @see org.springframework.data.mongodb.core.ExecutableInsertOperation#getCollection(java.lang.Class) */ public boolean collectionExists(Class entityClass) { - return collectionExists(operations.determineCollectionName(entityClass)); + return collectionExists(getCollectionName(entityClass)); } /* @@ -674,7 +674,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, * @see org.springframework.data.mongodb.core.ExecutableInsertOperation#dropCollection(java.lang.Class) */ public void dropCollection(Class entityClass) { - dropCollection(operations.determineCollectionName(entityClass)); + dropCollection(getCollectionName(entityClass)); } /* @@ -710,7 +710,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, * @see org.springframework.data.mongodb.core.ExecutableInsertOperation#indexOps(java.lang.Class) */ public IndexOperations indexOps(Class entityClass) { - return new DefaultIndexOperations(this, operations.determineCollectionName(entityClass), entityClass); + return new DefaultIndexOperations(this, getCollectionName(entityClass), entityClass); } /* @@ -726,7 +726,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, * @see org.springframework.data.mongodb.core.ExecutableInsertOperation#bulkOps(org.springframework.data.mongodb.core.BulkMode, java.lang.Class) */ public BulkOperations bulkOps(BulkMode bulkMode, Class entityClass) { - return bulkOps(bulkMode, entityClass, operations.determineCollectionName(entityClass)); + return bulkOps(bulkMode, entityClass, getCollectionName(entityClass)); } /* @@ -761,7 +761,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, @Nullable @Override public T findOne(Query query, Class entityClass) { - return findOne(query, entityClass, operations.determineCollectionName(entityClass)); + return findOne(query, entityClass, getCollectionName(entityClass)); } @Nullable @@ -783,7 +783,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, @Override public boolean exists(Query query, Class entityClass) { - return exists(query, entityClass, operations.determineCollectionName(entityClass)); + return exists(query, entityClass, getCollectionName(entityClass)); } @Override @@ -813,7 +813,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, */ @Override public List find(Query query, Class entityClass) { - return find(query, entityClass, operations.determineCollectionName(entityClass)); + return find(query, entityClass, getCollectionName(entityClass)); } /* @@ -834,7 +834,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, @Nullable @Override public T findById(Object id, Class entityClass) { - return findById(id, entityClass, operations.determineCollectionName(entityClass)); + return findById(id, entityClass, getCollectionName(entityClass)); } @Nullable @@ -856,7 +856,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, */ @Override public List findDistinct(Query query, String field, Class entityClass, Class resultClass) { - return findDistinct(query, field, operations.determineCollectionName(entityClass), entityClass, resultClass); + return findDistinct(query, field, getCollectionName(entityClass), entityClass, resultClass); } /* @@ -939,7 +939,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, @Override public GeoResults geoNear(NearQuery near, Class entityClass) { - return geoNear(near, entityClass, operations.determineCollectionName(entityClass)); + return geoNear(near, entityClass, getCollectionName(entityClass)); } @Override @@ -962,7 +962,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, Assert.notNull(returnType, "ReturnType must not be null!"); String collection = StringUtils.hasText(collectionName) ? collectionName - : operations.determineCollectionName(domainType); + : getCollectionName(domainType); Document nearDocument = near.toDocument(); Document command = new Document("geoNear", collection); @@ -1016,7 +1016,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, @Override public T findAndModify(Query query, Update update, Class entityClass) { return findAndModify(query, update, new FindAndModifyOptions(), entityClass, - operations.determineCollectionName(entityClass)); + getCollectionName(entityClass)); } @Nullable @@ -1028,7 +1028,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, @Nullable @Override public T findAndModify(Query query, Update update, FindAndModifyOptions options, Class entityClass) { - return findAndModify(query, update, options, entityClass, operations.determineCollectionName(entityClass)); + return findAndModify(query, update, options, entityClass, getCollectionName(entityClass)); } @Nullable @@ -1092,7 +1092,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, @Nullable @Override public T findAndRemove(Query query, Class entityClass) { - return findAndRemove(query, entityClass, operations.determineCollectionName(entityClass)); + return findAndRemove(query, entityClass, getCollectionName(entityClass)); } @Nullable @@ -1111,7 +1111,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, public long count(Query query, Class entityClass) { Assert.notNull(entityClass, "Entity class must not be null!"); - return count(query, entityClass, operations.determineCollectionName(entityClass)); + return count(query, entityClass, getCollectionName(entityClass)); } @Override @@ -1255,7 +1255,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, Assert.notNull(batchToSave, "BatchToSave must not be null!"); - return (Collection) doInsertBatch(operations.determineCollectionName(entityClass), batchToSave, + return (Collection) doInsertBatch(getCollectionName(entityClass), batchToSave, this.mongoConverter); } @@ -1511,7 +1511,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, @Override public UpdateResult upsert(Query query, Update update, Class entityClass) { - return doUpdate(operations.determineCollectionName(entityClass), query, update, entityClass, true, false); + return doUpdate(getCollectionName(entityClass), query, update, entityClass, true, false); } @Override @@ -1529,7 +1529,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, @Override public UpdateResult updateFirst(Query query, Update update, Class entityClass) { - return doUpdate(operations.determineCollectionName(entityClass), query, update, entityClass, false, false); + return doUpdate(getCollectionName(entityClass), query, update, entityClass, false, false); } @Override @@ -1547,7 +1547,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, @Override public UpdateResult updateMulti(Query query, Update update, Class entityClass) { - return doUpdate(operations.determineCollectionName(entityClass), query, update, entityClass, false, true); + return doUpdate(getCollectionName(entityClass), query, update, entityClass, false, true); } @Override @@ -1667,7 +1667,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, @Override public DeleteResult remove(Query query, Class entityClass) { - return remove(query, entityClass, operations.determineCollectionName(entityClass)); + return remove(query, entityClass, getCollectionName(entityClass)); } @Override @@ -1738,7 +1738,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, @Override public List findAll(Class entityClass) { - return findAll(entityClass, operations.determineCollectionName(entityClass)); + return findAll(entityClass, getCollectionName(entityClass)); } @Override @@ -1935,7 +1935,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, */ @Override public AggregationResults aggregate(TypedAggregation aggregation, Class outputType) { - return aggregate(aggregation, operations.determineCollectionName(aggregation.getInputType()), outputType); + return aggregate(aggregation, getCollectionName(aggregation.getInputType()), outputType); } /* (non-Javadoc) @@ -1958,7 +1958,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, @Override public AggregationResults aggregate(Aggregation aggregation, Class inputType, Class outputType) { - return aggregate(aggregation, operations.determineCollectionName(inputType), outputType, + return aggregate(aggregation, getCollectionName(inputType), outputType, new TypeBasedAggregationOperationContext(inputType, mappingContext, queryMapper)); } @@ -1989,7 +1989,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, */ @Override public CloseableIterator aggregateStream(TypedAggregation aggregation, Class outputType) { - return aggregateStream(aggregation, operations.determineCollectionName(aggregation.getInputType()), outputType); + return aggregateStream(aggregation, getCollectionName(aggregation.getInputType()), outputType); } /* (non-Javadoc) @@ -1998,7 +1998,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, @Override public CloseableIterator aggregateStream(Aggregation aggregation, Class inputType, Class outputType) { - return aggregateStream(aggregation, operations.determineCollectionName(inputType), outputType, + return aggregateStream(aggregation, getCollectionName(inputType), outputType, new TypeBasedAggregationOperationContext(inputType, mappingContext, queryMapper)); } @@ -2024,7 +2024,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, */ @Override public List findAllAndRemove(Query query, Class entityClass) { - return findAllAndRemove(query, entityClass, operations.determineCollectionName(entityClass)); + return findAllAndRemove(query, entityClass, getCollectionName(entityClass)); } /* (non-Javadoc)