@@ -58,10 +58,8 @@ public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory) {
58
58
this .entityManagerFactory = entityManagerFactory ;
59
59
}
60
60
61
-
62
- public void getPersistentState (Class <? extends ChangeSetBacked > entityClass ,
63
- Object id , final ChangeSet changeSet )
64
- throws DataAccessException , NotFoundException {
61
+ public void getPersistentState (Class <? extends ChangeSetBacked > entityClass , Object id , final ChangeSet changeSet )
62
+ throws DataAccessException , NotFoundException {
65
63
66
64
if (id == null ) {
67
65
log .debug ("Unable to load MongoDB data for null id" );
@@ -77,8 +75,7 @@ public void getPersistentState(Class<? extends ChangeSetBacked> entityClass,
77
75
log .debug ("Loading MongoDB data for " + dbk );
78
76
}
79
77
mongoTemplate .execute (collName , new CollectionCallback <Object >() {
80
- public Object doInCollection (DBCollection collection )
81
- throws MongoException , DataAccessException {
78
+ public Object doInCollection (DBCollection collection ) throws MongoException , DataAccessException {
82
79
for (DBObject dbo : collection .find (dbk )) {
83
80
String key = (String ) dbo .get (ENTITY_FIELD_NAME );
84
81
if (log .isDebugEnabled ()) {
@@ -87,9 +84,8 @@ public Object doInCollection(DBCollection collection)
87
84
if (!changeSet .getValues ().containsKey (key )) {
88
85
String className = (String ) dbo .get (ENTITY_FIELD_CLASS );
89
86
if (className == null ) {
90
- throw new DataIntegrityViolationException (
91
- "Unble to convert property " + key
92
- + ": Invalid metadata, " + ENTITY_FIELD_CLASS + " not available" );
87
+ throw new DataIntegrityViolationException ("Unble to convert property " + key + ": Invalid metadata, "
88
+ + ENTITY_FIELD_CLASS + " not available" );
93
89
}
94
90
Class <?> clazz = ClassUtils .resolveClassName (className , ClassUtils .getDefaultClassLoader ());
95
91
Object value = mongoTemplate .getConverter ().read (clazz , dbo );
@@ -135,10 +131,8 @@ public Object persistState(ChangeSetBacked entity, ChangeSet cs) throws DataAcce
135
131
dbQuery .put (ENTITY_ID , getPersistentId (entity , cs ));
136
132
dbQuery .put (ENTITY_CLASS , entity .getClass ().getName ());
137
133
dbQuery .put (ENTITY_FIELD_NAME , key );
138
- DBObject dbId = mongoTemplate .execute (collName ,
139
- new CollectionCallback <DBObject >() {
140
- public DBObject doInCollection (DBCollection collection )
141
- throws MongoException , DataAccessException {
134
+ DBObject dbId = mongoTemplate .execute (collName , new CollectionCallback <DBObject >() {
135
+ public DBObject doInCollection (DBCollection collection ) throws MongoException , DataAccessException {
142
136
return collection .findOne (dbQuery );
143
137
}
144
138
});
@@ -147,14 +141,12 @@ public DBObject doInCollection(DBCollection collection)
147
141
log .debug ("Flush: removing: " + dbQuery );
148
142
}
149
143
mongoTemplate .execute (collName , new CollectionCallback <Object >() {
150
- public Object doInCollection (DBCollection collection )
151
- throws MongoException , DataAccessException {
144
+ public Object doInCollection (DBCollection collection ) throws MongoException , DataAccessException {
152
145
collection .remove (dbQuery );
153
146
return null ;
154
147
}
155
148
});
156
- }
157
- else {
149
+ } else {
158
150
final DBObject dbDoc = new BasicDBObject ();
159
151
dbDoc .putAll (dbQuery );
160
152
if (log .isDebugEnabled ()) {
@@ -166,8 +158,7 @@ public Object doInCollection(DBCollection collection)
166
158
dbDoc .put ("_id" , dbId .get ("_id" ));
167
159
}
168
160
mongoTemplate .execute (collName , new CollectionCallback <Object >() {
169
- public Object doInCollection (DBCollection collection )
170
- throws MongoException , DataAccessException {
161
+ public Object doInCollection (DBCollection collection ) throws MongoException , DataAccessException {
171
162
collection .save (dbDoc );
172
163
return null ;
173
164
}
0 commit comments