Commit Graph

1550 Commits

Author SHA1 Message Date
J. Brisbin
ad287efb4e DATADOC-143 - Made MongoMappingContext the default converter for the template, which also meant:
Several changes to how objects are initialized inside the template:

1. In one is not specified, a MappingMongoConverter is created and set as the default.
2. A special ApplicationEventPublisher implementation is installed by default to handle creating indexes when the template isn't used inside a Spring application context.
3. If a Spring application context is available, it will be set as the template's application context and eventPublisher, with the index creator being registered as an event listener if one isn't already present.

The tests had to be changed in a couple places to accurately reflect how mapping contexts and converters are now handled.
2011-05-20 11:38:20 -05:00
Thomas Risberg
98da8beb67 DATADOC-80 changed setCustomConverters to take a Set<Object> instead of a List similar to ConversionServiceFactory.registerConverters(…) 2011-05-20 08:04:13 -04:00
Oliver Gierke
9324ae2593 DATADOC-137 - Repositories now correctly replace multiple placeholders in JSON based queries.
When annotation a repository method with e.g. @Query("{ 'firstname' : ?0, 'lastname' : ?1 }") all placeholders get now replaced correctly. Added unit tests and fixed broken logging in StringBasedQueryCreator,
2011-05-20 08:27:08 +02:00
Mark Pollack
adc56ce79f DATADOC-83 - Review dependencies
Removed dependency on spring mvc in data-document-core to spring-data-document-examples\mongodb-myrestaurants-analytics
2011-05-19 14:04:34 -04:00
Thomas Risberg
2832b524d3 DATADOC-121 switched to use MappingMongoConverter as default; removed some renamed methods reintroduced from recent merge 2011-05-19 13:25:29 -04:00
Mark Pollack
1640db5d7c removed unused abstractions in data-document-core 2011-05-19 13:02:53 -04:00
Thomas Risberg
ac762b2289 changed Xlint options to avoid 'bad path element' error during build 2011-05-19 12:54:23 -04:00
Thomas Risberg
9429326ec2 removed collection from annotation since it is not used 2011-05-19 12:37:34 -04:00
Thomas Risberg
3e840e2380 DATADOC-121 deprecated the SimpleMongoConverter 2011-05-19 10:11:41 -04:00
J. Brisbin
5b57b40274 Added namespace parser for MongoDbFactory, made changes to getting mapping stuff to use MongoDbFactory 2011-05-19 08:47:50 -05:00
Thomas Risberg
63d9d35cba DATADOC-80 renamed setConverters to setCustomConverters and made signature consistent between Simple and mapping converters 2011-05-18 17:59:42 -04:00
Thomas Risberg
bf5fc0ff1f DATADOC-122 added a MongoCollectionsUtils to provide a method for preferred collection name 2011-05-18 17:24:50 -04:00
Oliver Gierke
6287fa425d DATADOC-108 - added findbyId(…) methods to MongoTemplate.
Removed Criteria.whereId(…). Updated SimpleMongoRepository to use the new method and use more core template methods to prevent objects from being marshalled to find out whether a particular object exists.
2011-05-18 23:16:45 +02:00
Oliver Gierke
345e6ebf8b DATADOC-136 - Fixed conversion of enums.
Introduced writeSimpleInternal(…) method that automatically stores the name of an enum instead of the enum itself. Changed quite a few places to rather use MongoPersistentProperty.getKey() over getName().
2011-05-18 23:16:44 +02:00
Thomas Risberg
4aaa32fe1d DATADOC-141 DATADOC-89 introduced a protected prepareCollection method and a boolean flag setSlaveOk on the MongoTemplate to have template instance level control over slave behavior 2011-05-18 15:46:22 -04:00
Thomas Risberg
60774dca26 DATADOC-88 switched test config files to use MongoDbFactory 2011-05-18 10:20:33 -04:00
Oliver Gierke
c9d5565aaa DATACMNS-38 - Added unit test for adding a self-referencing entity to the mapping context. 2011-05-17 20:19:08 +01:00
Thomas Risberg
30e96f9c97 DATADOC-88 added accessors for Mongo and database name to MongoDbFactory 2011-05-17 12:13:42 -04:00
Thomas Risberg
9641434090 DATADOC-88 removed unnessecary package protected constructor 2011-05-17 12:06:07 -04:00
Thomas Risberg
86960006cb DATADOC-88 introducing a MongoDbFactory interface and MongoTemplate constructors that take this as an argument 2011-05-16 18:07:56 -04:00
Thomas Risberg
21cd013cf1 DATADOC-88 re-introducing a MongoDbFactoryBean for configuring Mongo DB objects 2011-05-16 14:46:58 -04:00
Thomas Risberg
95750ffde1 cleaned up unused imports 2011-05-16 12:19:34 -04:00
Thomas Risberg
6ed1d2b226 DATADOC-110 removed 'substituteMappedIdIfNecessary' since this is now handled by QueryMapper 2011-05-16 12:11:55 -04:00
Thomas Risberg
4e04d0acd1 DATADOC-119 added test using 'afterMappingMongoConverterCreation' to register custom converters 2011-05-15 11:26:48 -04:00
Thomas Risberg
2212ca4b00 DATADOC-133 changed non-string attributes to xsd:string to support configuration using property placeholder; upgraded to Mongo Java driver 2.5.3 2011-05-13 17:26:47 -04:00
Oliver Gierke
025691a97a Change indentation from spaces to tabs. 2011-05-13 18:04:19 +02:00
Oliver Gierke
94e4d2b095 DATADOC-130 - Convert map key type to discovered generic key type.
Reding values into a map assumed map keys to be String values. We know leverage the conversion service to convert the key to the type we discover from the generics property information.
2011-05-13 12:45:38 +02:00
J. Brisbin
41e49ad3e2 DATADOC-96 - Had to tweak the way the QueryMapper works so that it more correctly searches for id properties to convert to _id as well as trying to turn them into ObjectIds if it can. If it can't, it puts the value in as-is. 2011-05-12 16:52:03 -05:00
Thomas Risberg
35629f5370 DATADOC-119 improved the converter parsing 2011-05-12 09:18:23 -04:00
Oliver Gierke
0b50e58020 DATACMNS-29 - Adapted changes in Spring Data Commons.
User repository interfaces are not required to implement MongoRepository anymore. Added missing override for save(Iterable<? extends T> entities) to return a List<T>.
2011-05-12 13:43:09 +02:00
Thomas Risberg
9b86637031 DATADOC-119 added support for registering custom converters with the mongo namespace support 2011-05-11 15:00:59 -04:00
Oliver Gierke
d7f33774e0 DATACMNS-35 - Added implementation and test for newly introduced Repository.delete(ID id) method. 2011-05-11 18:37:59 +02:00
Oliver Gierke
12ddfcc9f9 DATADOC-128 - Enable storing inheritance trees.
The document being persisted now gets a _class attribute to carry the actual type. That field key will be made configurable by a subsequent commit and its value should be interpreted as type hint to a client and  might be interpreted using a type mapper at a later stage as well (see DATADOC-63). For now it carries the fully-qualified Java class name.

On reads MappingMongoConverter will consider this field when choosing a type to bind the data to if - and only if - the type stored in there is a subtype of the actually requested one. So if we have a document carrying Person type information and you query for Contact you would get back a Person object. If you query for any other type not extending Contact you would get this custom type instead.

Added unit tests and an integration tests covering the Contact/Person scenario.
2011-05-10 18:21:47 +02:00
Oliver Gierke
47f184dbf0 Fixed generic warning by using more concrete meta-model type. 2011-05-10 18:16:05 +02:00
Oliver Gierke
2ca10c13c5 Extracted custom mongo repository namespace attributes to make them usable in <repositories /> and <repository />. 2011-05-10 18:14:06 +02:00
Oliver Gierke
965f9fd260 DATACMNS-34 - Adapted refactorings in Spring Data Commons regarding PersistenceConstructor discovery. 2011-05-10 10:20:06 +02:00
Thomas Risberg
d5c625dc2a DATADOC-107 added an overloaded method taking a Collection; added test to only allow a single parameter of type Collection 2011-05-09 08:54:39 -04:00
Oliver Gierke
55ce0b8272 DATADOC-130 - Conversion of Maps with simple key types works again.
Don't use ConversionService for simple type keys as we unregistered ObjectToStringConverter. This in turn causes Number, Boolean, Locale and the like not being convertible to String anymore as for those types only the Type -> String converter is registered but no corresponding converter back. Opened a ticket for this against Core Spring (SPR-8306).
2011-05-07 19:27:48 +02:00
Oliver Gierke
1c8a55a081 DATADOC-113 - NotNull and IsNull are now working for repositories.
Fixed Criteria being able to create correct query for ….is(null). MongoQueryCreator now uses ….ne(…) instead of ….not().is(…) as this doesn't generate a correct query (see DATADOC-129).
2011-05-07 15:53:45 +02:00
Oliver Gierke
35259f4e12 Reapplied old formatting to avoid merge conflicts (yet again). 2011-05-07 15:50:15 +02:00
Thomas Risberg
c9facf5338 DATADOC-129 changed Criteria to disallow 'not' before 'is' - should use 'ne' instead 2011-05-06 12:00:35 -04:00
Thomas Risberg
283e5cb76b DATADOC-118 refactoring some of the protected methods; some other minor refactorings 2011-05-05 18:12:56 -04:00
J. Brisbin
f05d200cd3 Fix the build since a new change for DATADOC-114 caused some tests to not compile cleanly. 2011-05-05 15:14:43 -05:00
J. Brisbin
62ecfc8416 DATADOC-114 - Fixes for updateFirst/updateMulti not converting POJOs correctly 2011-05-05 15:09:28 -05:00
Thomas Risberg
dfbc89c3b6 DATADOC-118 removed methods that take a MongoWriter 2011-05-05 13:59:29 -04:00
Thomas Risberg
b6c6016b1e DATADOC-120 removed MongoReaderWriter interface 2011-05-05 13:46:07 -04:00
Thomas Risberg
c9fe785c32 DATADOC-118 removed methods that take a MongoReader 2011-05-05 13:45:43 -04:00
Oliver Gierke
7b3d030794 DATADOC-43 - Implemented Near and Within for repository queries.
Refactored spatial domain classes to use each other a bit more. Added assertions to fail fast on invalid usage. Improved Geospatial index creation in MongoPersistentEntityIndexCreator by using the index abstraction instead of manually building the DBObject.

Fixed implementation of SimpleMongoRepository.deleteAll() to not drop the collection as this causes indexes to be dropped as well.

Skip index creation from query methods for now if we encounter a Near or Within part as we can't build combined queries right now.
2011-05-05 14:30:07 +02:00
Oliver Gierke
02448bc0ee Reverted formatting change in Criteria for now. 2011-05-05 14:21:08 +02:00
Thomas Risberg
e4fdabba1d DATADOC-117 removed defaultCollection on MongoTemplate/Operations; changed getDefaultCollectionName to getCollectionName(Class clazz) to determine collection name used for specific class; added a class parameter where necessary 2011-05-04 18:34:15 -04:00