DATADOC-118 removed methods that take a MongoWriter
This commit is contained in:
@@ -378,37 +378,6 @@ public interface MongoOperations {
|
||||
*/
|
||||
void insert(String collectionName, Object objectToSave);
|
||||
|
||||
/**
|
||||
* Insert the object into the default collection.
|
||||
* <p/>
|
||||
* The object is converted to the MongoDB native representation using an instance of
|
||||
* {@see MongoWriter}
|
||||
* <p/>
|
||||
* Insert is used to initially store the object into the
|
||||
* database. To update an existing object use the save method.
|
||||
*
|
||||
* @param <T> the type of the object to insert
|
||||
* @param objectToSave the object to store in the collection
|
||||
* @param writer the writer to convert the object to save into a DBObject
|
||||
*/
|
||||
<T> void insert(T objectToSave, MongoWriter<T> writer);
|
||||
|
||||
/**
|
||||
* Insert the object into the specified collection.
|
||||
* <p/>
|
||||
* The object is converted to the MongoDB native representation using an instance of
|
||||
* {@see MongoWriter}
|
||||
* <p/>
|
||||
* Insert is used to initially store the object into the
|
||||
* database. To update an existing object use the save method.
|
||||
*
|
||||
* @param <T> the type of the object to insert
|
||||
* @param collectionName name of the collection to store the object in
|
||||
* @param objectToSave the object to store in the collection
|
||||
* @param writer the writer to convert the object to save into a DBObject
|
||||
*/
|
||||
<T> void insert(String collectionName, T objectToSave, MongoWriter<T> writer);
|
||||
|
||||
/**
|
||||
* Insert a list of objects into the default collection in a single batch write to the database.
|
||||
*
|
||||
@@ -424,25 +393,6 @@ public interface MongoOperations {
|
||||
*/
|
||||
void insertList(String collectionName, List<? extends Object> listToSave);
|
||||
|
||||
/**
|
||||
* Insert a list of objects into the default collection using the provided MongoWriter instance
|
||||
*
|
||||
* @param <T> the type of object being saved
|
||||
* @param listToSave the list of objects to save.
|
||||
* @param writer the writer to convert the object to save into a DBObject
|
||||
*/
|
||||
<T> void insertList(List<? extends T> listToSave, MongoWriter<T> writer);
|
||||
|
||||
/**
|
||||
* Insert a list of objects into the specified collection using the provided MongoWriter instance
|
||||
*
|
||||
* @param <T> the type of object being saved
|
||||
* @param collectionName name of the collection to store the object in
|
||||
* @param listToSave the list of objects to save.
|
||||
* @param writer the writer to convert the object to save into a DBObject
|
||||
*/
|
||||
<T> void insertList(String collectionName, List<? extends T> listToSave, MongoWriter<T> writer);
|
||||
|
||||
/**
|
||||
* Save the object to the default collection. This will perform an insert if the object is not already
|
||||
* present, that is an 'upsert'.
|
||||
@@ -482,35 +432,6 @@ public interface MongoOperations {
|
||||
*/
|
||||
void save(String collectionName, Object objectToSave);
|
||||
|
||||
/**
|
||||
* Save the object into the default collection using the provided writer.
|
||||
* This will perform an insert if the object is not already
|
||||
* present, that is an 'upsert'.
|
||||
* <p/>
|
||||
* The object is converted to the MongoDB native representation using an instance of
|
||||
* {@see MongoWriter}
|
||||
*
|
||||
* @param <T> the type of the object to insert
|
||||
* @param objectToSave the object to store in the collection
|
||||
* @param writer the writer to convert the object to save into a DBObject
|
||||
*/
|
||||
<T> void save(T objectToSave, MongoWriter<T> writer);
|
||||
|
||||
/**
|
||||
* Save the object into the specified collection using the provided writer.
|
||||
* This will perform an insert if the object is not already
|
||||
* present, that is an 'upsert'.
|
||||
* <p/>
|
||||
* The object is converted to the MongoDB native representation using an instance of
|
||||
* {@see MongoWriter}
|
||||
*
|
||||
* @param <T> the type of the object to insert
|
||||
* @param collectionName name of the collection to store the object in
|
||||
* @param objectToSave the object to store in the collection
|
||||
* @param writer the writer to convert the object to save into a DBObject
|
||||
*/
|
||||
<T> void save(String collectionName, T objectToSave, MongoWriter<T> writer);
|
||||
|
||||
/**
|
||||
* Updates the first object that is found in the default collection that matches the query document
|
||||
* with the provided updated document.
|
||||
|
||||
@@ -504,20 +504,10 @@ public class MongoTemplate implements MongoOperations, ApplicationEventPublisher
|
||||
* @see org.springframework.data.document.mongodb.MongoOperations#insert(java.lang.String, java.lang.Object)
|
||||
*/
|
||||
public void insert(String collectionName, Object objectToSave) {
|
||||
insert(collectionName, objectToSave, this.mongoConverter);
|
||||
doInsert(collectionName, objectToSave, this.mongoConverter);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.data.document.mongodb.MongoOperations#insert(T, org.springframework.data.document.mongodb.MongoWriter)
|
||||
*/
|
||||
public <T> void insert(T objectToSave, MongoWriter<T> writer) {
|
||||
insert(determineEntityCollectionName(objectToSave), objectToSave, writer);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.data.document.mongodb.MongoOperations#insert(java.lang.String, T, org.springframework.data.document.mongodb.MongoWriter)
|
||||
*/
|
||||
public <T> void insert(String collectionName, T objectToSave, MongoWriter<T> writer) {
|
||||
protected <T> void doInsert(String collectionName, T objectToSave, MongoWriter<T> writer) {
|
||||
BasicDBObject dbDoc = new BasicDBObject();
|
||||
|
||||
maybeEmitEvent(new BeforeConvertEvent<T>(objectToSave));
|
||||
@@ -534,20 +524,17 @@ public class MongoTemplate implements MongoOperations, ApplicationEventPublisher
|
||||
* @see org.springframework.data.document.mongodb.MongoOperations#insertList(java.util.List)
|
||||
*/
|
||||
public void insertList(List<? extends Object> listToSave) {
|
||||
insertList(listToSave, mongoConverter);
|
||||
doInsertList(listToSave, mongoConverter);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.data.document.mongodb.MongoOperations#insertList(java.lang.String, java.util.List)
|
||||
*/
|
||||
public void insertList(String collectionName, List<? extends Object> listToSave) {
|
||||
insertList(collectionName, listToSave, this.mongoConverter);
|
||||
doInsertList(collectionName, listToSave, this.mongoConverter);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.data.document.mongodb.MongoOperations#insertList(java.util.List, org.springframework.data.document.mongodb.MongoWriter)
|
||||
*/
|
||||
public <T> void insertList(List<? extends T> listToSave, MongoWriter<T> writer) {
|
||||
protected <T> void doInsertList(List<? extends T> listToSave, MongoWriter<T> writer) {
|
||||
Map<String, List<Object>> objs = new HashMap<String, List<Object>>();
|
||||
|
||||
for (Object o : listToSave) {
|
||||
@@ -573,10 +560,7 @@ public class MongoTemplate implements MongoOperations, ApplicationEventPublisher
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.data.document.mongodb.MongoOperations#insertList(java.lang.String, java.util.List, org.springframework.data.document.mongodb.MongoWriter)
|
||||
*/
|
||||
public <T> void insertList(String collectionName, List<? extends T> listToSave, MongoWriter<T> writer) {
|
||||
protected <T> void doInsertList(String collectionName, List<? extends T> listToSave, MongoWriter<T> writer) {
|
||||
|
||||
Assert.notNull(writer);
|
||||
|
||||
@@ -611,20 +595,10 @@ public class MongoTemplate implements MongoOperations, ApplicationEventPublisher
|
||||
* @see org.springframework.data.document.mongodb.MongoOperations#save(java.lang.String, java.lang.Object)
|
||||
*/
|
||||
public void save(String collectionName, Object objectToSave) {
|
||||
save(collectionName, objectToSave, this.mongoConverter);
|
||||
doSave(collectionName, objectToSave, this.mongoConverter);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.data.document.mongodb.MongoOperations#save(T, org.springframework.data.document.mongodb.MongoWriter)
|
||||
*/
|
||||
public <T> void save(T objectToSave, MongoWriter<T> writer) {
|
||||
save(determineEntityCollectionName(objectToSave), objectToSave, writer);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.data.document.mongodb.MongoOperations#save(java.lang.String, T, org.springframework.data.document.mongodb.MongoWriter)
|
||||
*/
|
||||
public <T> void save(String collectionName, T objectToSave, MongoWriter<T> writer) {
|
||||
protected <T> void doSave(String collectionName, T objectToSave, MongoWriter<T> writer) {
|
||||
BasicDBObject dbDoc = new BasicDBObject();
|
||||
|
||||
maybeEmitEvent(new BeforeConvertEvent<T>(objectToSave));
|
||||
|
||||
@@ -273,16 +273,6 @@ public abstract class MongoOperationsUnitTests {
|
||||
}.assertDataAccessException();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void convertsExceptionForInsert3() {
|
||||
new Execution() {
|
||||
@Override
|
||||
public void doWith(MongoOperations operations) {
|
||||
operations.insert("collection", person, converter);
|
||||
}
|
||||
}.assertDataAccessException();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void convertsExceptionForInsertList() throws Exception {
|
||||
new Execution() {
|
||||
@@ -303,16 +293,6 @@ public abstract class MongoOperationsUnitTests {
|
||||
}.assertDataAccessException();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void convertsExceptionForGetInsertList3() throws Exception {
|
||||
new Execution() {
|
||||
@Override
|
||||
public void doWith(MongoOperations operations) {
|
||||
operations.insertList("collection", persons, converter);
|
||||
}
|
||||
}.assertDataAccessException();
|
||||
}
|
||||
|
||||
private abstract class Execution {
|
||||
|
||||
public void assertDataAccessException() {
|
||||
|
||||
Reference in New Issue
Block a user