Skip to content

Commit 16052bf

Browse files
committed
Remove deprecated methods
1 parent 32a8a4b commit 16052bf

File tree

8 files changed

+1
-96
lines changed

8 files changed

+1
-96
lines changed

grace-datastore-gorm-mongodb/src/main/groovy/grails/mongodb/MongoEntity.groovy

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@ import org.grails.datastore.gorm.GormEntity
3434
import org.grails.datastore.gorm.mongo.MongoCriteriaBuilder
3535
import org.grails.datastore.gorm.mongo.api.MongoStaticApi
3636
import org.grails.datastore.gorm.schemaless.DynamicAttributes
37-
import org.grails.datastore.mapping.core.AbstractDatastore
38-
import org.grails.datastore.mapping.core.SessionImplementor
39-
import org.grails.datastore.mapping.engine.EntityPersister
40-
import org.grails.datastore.mapping.mongo.AbstractMongoSession
41-
import org.grails.datastore.mapping.mongo.MongoDatastore
42-
import org.grails.datastore.mapping.mongo.engine.MongoEntityPersister
4337

4438
/**
4539
* Enhances the default {@link GormEntity} class with MongoDB specific methods
@@ -72,43 +66,6 @@ trait MongoEntity<D> implements GormEntity<D>, DynamicAttributes {
7266
DynamicAttributes.super.putAt(name, val)
7367
}
7468

75-
/**
76-
* Return the DBObject instance for the entity
77-
*
78-
* @deprecated use dynamic properties instead
79-
* @param instance The instance
80-
* @return The DBObject instance
81-
*/
82-
@Deprecated
83-
Document getDbo() {
84-
AbstractMongoSession session = (AbstractMongoSession) AbstractDatastore.retrieveSession(MongoDatastore)
85-
// check first for embedded cached entries
86-
SessionImplementor<Document> si = (SessionImplementor<Document>) session
87-
def persistentEntity = session.mappingContext.getPersistentEntity(getClass().name)
88-
Document dbo = (Document) si.getCachedEntry(persistentEntity,
89-
MongoEntityPersister.createEmbeddedCacheEntryKey(this))
90-
if (dbo != null) {
91-
return dbo
92-
}
93-
// otherwise check if instance is contained within session
94-
if (!session.contains(this)) {
95-
dbo = new Document()
96-
si.cacheEntry(persistentEntity, MongoEntityPersister.createInstanceCacheEntryKey(this), dbo)
97-
return dbo
98-
}
99-
100-
EntityPersister persister = (EntityPersister) session.getPersister(this)
101-
def id = persister.getObjectIdentifier(this)
102-
dbo = (Document) ((SessionImplementor) session).getCachedEntry(persister.getPersistentEntity(), id)
103-
if (dbo == null) {
104-
MongoCollection<Document> coll = session.getCollection(persistentEntity)
105-
dbo = coll.find((Bson) new Document(MongoEntityPersister.MONGO_ID_FIELD, id))
106-
.limit(1)
107-
.first()
108-
}
109-
return dbo
110-
}
111-
11269
/**
11370
* Finds all of the entities in the collection.
11471
*

grace-datastore-gorm-mongodb/src/main/groovy/grails/mongodb/api/MongoInstanceOperations.groovy

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
*/
1616
package grails.mongodb.api
1717

18-
import org.bson.Document
19-
2018
import grails.gorm.api.GormInstanceOperations
2119

2220
/**
@@ -26,14 +24,4 @@ import grails.gorm.api.GormInstanceOperations
2624
*/
2725
interface MongoInstanceOperations<D> extends GormInstanceOperations<D> {
2826

29-
/**
30-
* Return the DBObject instance for the entity
31-
*
32-
* @deprecated use dynamic properties instead
33-
* @param instance The instance
34-
* @return The DBObject instance
35-
*/
36-
@Deprecated
37-
Document getDbo(D instance)
38-
3927
}

grace-datastore-gorm-mongodb/src/main/groovy/grails/mongodb/bootstrap/MongoDbDataStoreSpringInitializer.groovy

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ class MongoDbDataStoreSpringInitializer extends AbstractDatastoreInitializer {
5151

5252
public static final String DATASTORE_TYPE = 'mongo'
5353
protected String mongoBeanName = 'mongo'
54-
protected String mongoOptionsBeanName = 'mongoOptions'
5554
protected String databaseName = DEFAULT_DATABASE_NAME
56-
protected Closure defaultMapping
5755
protected MongoClientSettings mongoOptions
5856
protected MongoClient mongo
5957

@@ -149,24 +147,6 @@ class MongoDbDataStoreSpringInitializer extends AbstractDatastoreInitializer {
149147
}
150148
}
151149

152-
/**
153-
* Sets the name of the Mongo bean to use
154-
*/
155-
@Deprecated
156-
void setMongoBeanName(String mongoBeanName) {
157-
this.mongoBeanName = mongoBeanName
158-
}
159-
160-
/**
161-
* The name of the MongoOptions bean
162-
*
163-
* @param mongoOptionsBeanName The mongo options bean name
164-
*/
165-
@Deprecated
166-
void setMongoOptionsBeanName(String mongoOptionsBeanName) {
167-
this.mongoOptionsBeanName = mongoOptionsBeanName
168-
}
169-
170150
/**
171151
* Sets the MongoOptions instance to use when constructing the Mongo instance
172152
*/
@@ -189,12 +169,4 @@ class MongoDbDataStoreSpringInitializer extends AbstractDatastoreInitializer {
189169
this.databaseName = databaseName
190170
}
191171

192-
/**
193-
* Sets the default MongoDB GORM mapping configuration
194-
*/
195-
@Deprecated
196-
void setDefaultMapping(Closure defaultMapping) {
197-
this.defaultMapping = defaultMapping
198-
}
199-
200172
}

grace-datastore-gorm-mongodb/src/main/groovy/org/grails/datastore/gorm/mongo/api/MongoStaticApi.groovy

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import org.bson.conversions.Bson
3434
import org.springframework.transaction.PlatformTransactionManager
3535

3636
import grails.gorm.multitenancy.Tenants
37-
import grails.mongodb.MongoEntity
3837
import grails.mongodb.api.MongoAllOperations
3938

4039
import org.grails.datastore.gorm.GormStaticApi
@@ -293,12 +292,6 @@ class MongoStaticApi<D> extends GormStaticApi<D> implements MongoAllOperations<D
293292
})
294293
}
295294

296-
@Override
297-
@Deprecated
298-
Document getDbo(D instance) {
299-
return ((MongoEntity) instance).dbo
300-
}
301-
302295
protected Bson wrapFilterWithMultiTenancy(Bson filter) {
303296
if (multiTenancyMode == MultiTenancySettings.MultiTenancyMode.DISCRIMINATOR &&
304297
persistentEntity.isMultiTenant()) {

grace-datastore-gorm-mongodb/src/main/groovy/org/grails/datastore/mapping/mongo/MongoDatastore.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@ public void setMessageSource(MessageSource messageSource) {
634634
/**
635635
* @return The transaction manager
636636
*/
637+
@Override
637638
public PlatformTransactionManager getTransactionManager() {
638639
return this.transactionManager;
639640
}

grace-datastore-gorm-mongodb/src/test/groovy/org/grails/datastore/gorm/mongo/BasicArraySpec.groovy

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,10 @@ class BasicArraySpec extends GormDatastoreSpec {
5656
Data data = new Data(str: 'baz', byteArray: 'hello'.bytes).save(flush: true, validate: false)
5757
session.clear()
5858
data = Data.findByStr('baz')
59-
Document dbo = data.dbo
6059

6160
then: 'The array is saved correct'
6261
data.str == 'baz'
6362
data.byteArray == 'hello'.bytes
64-
dbo.byteArray.data == 'hello'.bytes
6563
}
6664

6765
@Override

grace-datastore-gorm-mongodb/src/test/groovy/org/grails/datastore/gorm/mongo/DisableVersionSpec.groovy

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ class DisableVersionSpec extends GormDatastoreSpec {
2929
then: 'The version field is not persisted'
3030
nv.name == 'Bob'
3131
nv.version == null
32-
nv.dbo.version == null
33-
!nv.dbo.containsKey('version')
3432
}
3533

3634
@Override

grace-datastore-gorm-mongodb/src/test/groovy/org/grails/datastore/gorm/mongo/SchemalessSpec.groovy

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class SchemalessSpec extends GormDatastoreSpec {
3232

3333
then:
3434
p.name == 'Pineapple'
35-
p.dbo.color == 'Yellow'
3635
p['color'] == 'Yellow'
3736

3837
when:
@@ -43,7 +42,6 @@ class SchemalessSpec extends GormDatastoreSpec {
4342

4443
then:
4544
p.name == 'Pineapple'
46-
p.dbo.color == 'Yellow'
4745
p['color'] == 'Yellow'
4846
p['hasLeaves'] == true
4947

0 commit comments

Comments
 (0)