changed serialization type of GPSFixes for MongoDB to DBObject instead of Object

This commit is contained in:
Fredrik Teschke committed 2014-05-08 23:46:48 +02:00
1 parent 4dae5ea4c8
commit 7e9274d35a
4 files changed
+7 -7

No files matched your search

@@ -1,5 +1,6 @@
package com.sap.sailing.domain.persistence.racelog.tracking;
import com.mongodb.DBObject;
import com.sap.sailing.domain.common.racelog.tracking.TransformationHandler;
import com.sap.sailing.domain.tracking.GPSFix;
@@ -11,5 +12,5 @@ import com.sap.sailing.domain.tracking.GPSFix;
* @author Fredrik Teschke
*
*/
public interface GPSFixMongoHandler extends TransformationHandler<GPSFix, Object> {
public interface GPSFixMongoHandler extends TransformationHandler<GPSFix, DBObject> {
}
@@ -22,7 +22,7 @@ public class GPSFixMongoHandlerImpl implements GPSFixMongoHandler {
}
@Override
public Object transformForth(GPSFix fix) throws IllegalArgumentException {
public DBObject transformForth(GPSFix fix) throws IllegalArgumentException {
DBObject result = new BasicDBObject();
mof.storeTimed(fix, result);
mof.storePositioned(fix, result);
@@ -30,7 +30,7 @@ public class GPSFixMongoHandlerImpl implements GPSFixMongoHandler {
}
@Override
public GPSFix transformBack(Object object) {
public GPSFix transformBack(DBObject object) {
DBObject dbObject = (DBObject) object;
TimePoint timePoint = dof.loadTimePoint(dbObject);
Position position = dof.loadPosition(dbObject);
@@ -24,7 +24,7 @@ public class GPSFixMovingMongoHandlerImpl implements GPSFixMongoHandler {
}
@Override
public Object transformForth(GPSFix fix) throws IllegalArgumentException {
public DBObject transformForth(GPSFix fix) throws IllegalArgumentException {
DBObject result = new BasicDBObject();
mof.storeTimed(fix, result);
mof.storePositioned(fix, result);
@@ -33,8 +33,7 @@ public class GPSFixMovingMongoHandlerImpl implements GPSFixMongoHandler {
}
@Override
public GPSFix transformBack(Object object) {
DBObject dbObject = (DBObject) object;
public GPSFix transformBack(DBObject dbObject) {
TimePoint timePoint = dof.loadTimePoint(dbObject);
Position position = dof.loadPosition(dbObject);
SpeedWithBearing speed = dof.loadSpeedWithBearing(dbObject);
@@ -57,7 +57,7 @@ public class MongoGPSFixStoreImpl implements MongoGPSFixStore {
private GPSFix loadGPSFix(DBObject object) throws TransformationException, NoCorrespondingServiceRegisteredException {
String type = (String) object.get(FieldNames.GPSFIX_TYPE.name());
Object fixObject = object.get(FieldNames.GPSFIX.name());
DBObject fixObject = (DBObject) object.get(FieldNames.GPSFIX.name());
return fixServiceFinder.findService(type).transformBack(fixObject);
}