Browse Source

DATAMONGO-1647 - Polishing.

pull/371/head
Oliver Gierke 9 years ago
parent
commit
f59bbd351d
  1. 17
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java

17
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java

@ -20,8 +20,19 @@ import static org.springframework.data.mongodb.core.query.SerializationUtils.*;
import static org.springframework.data.util.Optionals.*; import static org.springframework.data.util.Optionals.*;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Optional;
import java.util.Scanner;
import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.bson.Document; import org.bson.Document;
@ -2010,7 +2021,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
PersistentPropertyAccessor accessor = entity.getPropertyAccessor(savedObject); PersistentPropertyAccessor accessor = entity.getPropertyAccessor(savedObject);
Optional<Object> value = accessor.getProperty(idProp); Optional<Object> value = accessor.getProperty(idProp);
if(!value.isPresent()) { if (!value.isPresent()) {
new ConvertingPropertyAccessor(accessor, conversionService).setProperty(idProp, Optional.of(id)); new ConvertingPropertyAccessor(accessor, conversionService).setProperty(idProp, Optional.of(id));
} }
}); });
@ -2522,7 +2533,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
try { try {
if (query.getSkip() > 0) { if (query.getSkip() > 0) {
cursorToUse = cursorToUse.skip((int)query.getSkip()); cursorToUse = cursorToUse.skip((int) query.getSkip());
} }
if (query.getLimit() > 0) { if (query.getLimit() > 0) {
cursorToUse = cursorToUse.limit(query.getLimit()); cursorToUse = cursorToUse.limit(query.getLimit());

Loading…
Cancel
Save