Skip to content

Commit 883bfbe

Browse files
committed
Added Eclipse formatter settings.
Formatted cross-store module with the Spring Data formatter.
1 parent 7502ac1 commit 883bfbe

File tree

6 files changed

+513
-230
lines changed

6 files changed

+513
-230
lines changed

Diff for: etc/formatting.xml

+291
Large diffs are not rendered by default.

Diff for: spring-data-mongodb-cross-store/src/main/java/org/springframework/data/mongodb/crossstore/MongoChangeSetPersister.java

+10-19
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,8 @@ public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory) {
5858
this.entityManagerFactory = entityManagerFactory;
5959
}
6060

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 {
6563

6664
if (id == null) {
6765
log.debug("Unable to load MongoDB data for null id");
@@ -77,8 +75,7 @@ public void getPersistentState(Class<? extends ChangeSetBacked> entityClass,
7775
log.debug("Loading MongoDB data for " + dbk);
7876
}
7977
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 {
8279
for (DBObject dbo : collection.find(dbk)) {
8380
String key = (String) dbo.get(ENTITY_FIELD_NAME);
8481
if (log.isDebugEnabled()) {
@@ -87,9 +84,8 @@ public Object doInCollection(DBCollection collection)
8784
if (!changeSet.getValues().containsKey(key)) {
8885
String className = (String) dbo.get(ENTITY_FIELD_CLASS);
8986
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");
9389
}
9490
Class<?> clazz = ClassUtils.resolveClassName(className, ClassUtils.getDefaultClassLoader());
9591
Object value = mongoTemplate.getConverter().read(clazz, dbo);
@@ -135,10 +131,8 @@ public Object persistState(ChangeSetBacked entity, ChangeSet cs) throws DataAcce
135131
dbQuery.put(ENTITY_ID, getPersistentId(entity, cs));
136132
dbQuery.put(ENTITY_CLASS, entity.getClass().getName());
137133
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 {
142136
return collection.findOne(dbQuery);
143137
}
144138
});
@@ -147,14 +141,12 @@ public DBObject doInCollection(DBCollection collection)
147141
log.debug("Flush: removing: " + dbQuery);
148142
}
149143
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 {
152145
collection.remove(dbQuery);
153146
return null;
154147
}
155148
});
156-
}
157-
else {
149+
} else {
158150
final DBObject dbDoc = new BasicDBObject();
159151
dbDoc.putAll(dbQuery);
160152
if (log.isDebugEnabled()) {
@@ -166,8 +158,7 @@ public Object doInCollection(DBCollection collection)
166158
dbDoc.put("_id", dbId.get("_id"));
167159
}
168160
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 {
171162
collection.save(dbDoc);
172163
return null;
173164
}

0 commit comments

Comments
 (0)