mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-15 06:49:56 +00:00
factored ORC certificate serialization into a JSON serializer/deserializer pair and use in Mongo persistence
Change-Id: Ia25225b571506287d1dd17087afd868bb19d0c83
This commit is contained in:
1 parent
18b87bddc7
commit
5adffc7d2e
21 files changed
+520
-203
No files matched your search
+12
-60
@@ -44,10 +44,10 @@ import com.mongodb.client.model.RenameCollectionOptions;
|
||||
import com.mongodb.client.result.DeleteResult;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.impl.LogEventAuthorImpl;
|
||||
import com.sap.sailing.domain.abstractlog.orc.RegattaLogORCCertificateAssignmentEvent;
|
||||
import com.sap.sailing.domain.abstractlog.orc.RaceLogORCLegDataEvent;
|
||||
import com.sap.sailing.domain.abstractlog.orc.impl.RegattaLogORCCertificateAssignmentEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.orc.RegattaLogORCCertificateAssignmentEvent;
|
||||
import com.sap.sailing.domain.abstractlog.orc.impl.RaceLogORCLegDataEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.orc.impl.RegattaLogORCCertificateAssignmentEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.CompetitorResult.MergeState;
|
||||
import com.sap.sailing.domain.abstractlog.race.CompetitorResults;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
@@ -194,16 +194,13 @@ import com.sap.sailing.domain.common.WindSourceType;
|
||||
import com.sap.sailing.domain.common.dto.AnniversaryType;
|
||||
import com.sap.sailing.domain.common.dto.EventType;
|
||||
import com.sap.sailing.domain.common.impl.DegreePosition;
|
||||
import com.sap.sailing.domain.common.impl.KnotSpeedImpl;
|
||||
import com.sap.sailing.domain.common.impl.KnotSpeedWithBearingImpl;
|
||||
import com.sap.sailing.domain.common.impl.MeterDistance;
|
||||
import com.sap.sailing.domain.common.impl.NauticalMileDistance;
|
||||
import com.sap.sailing.domain.common.impl.WindImpl;
|
||||
import com.sap.sailing.domain.common.impl.WindSourceImpl;
|
||||
import com.sap.sailing.domain.common.impl.WindSourceWithAdditionalID;
|
||||
import com.sap.sailing.domain.common.orc.ORCCertificate;
|
||||
import com.sap.sailing.domain.common.orc.ORCPerformanceCurveLegTypes;
|
||||
import com.sap.sailing.domain.common.orc.impl.ORCCertificateImpl;
|
||||
import com.sap.sailing.domain.common.racelog.Flags;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sailing.domain.common.racelog.RacingProcedureType;
|
||||
@@ -254,13 +251,13 @@ import com.sap.sailing.server.gateway.deserialization.impl.DeviceConfigurationJs
|
||||
import com.sap.sailing.server.gateway.deserialization.impl.Helpers;
|
||||
import com.sap.sailing.server.gateway.deserialization.impl.LegacyCompetitorWithContainedBoatJsonDeserializer;
|
||||
import com.sap.sailing.server.gateway.deserialization.impl.RegattaConfigurationJsonDeserializer;
|
||||
import com.sap.sailing.server.gateway.deserialization.racelog.impl.ORCCertificateJsonDeserializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.DeviceConfigurationJsonSerializer;
|
||||
import com.sap.sse.common.Bearing;
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.Distance;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.NoCorrespondingServiceRegisteredException;
|
||||
import com.sap.sse.common.Speed;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
import com.sap.sse.common.TypeBasedServiceFinder;
|
||||
@@ -274,7 +271,6 @@ import com.sap.sse.common.impl.DegreeBearingImpl;
|
||||
import com.sap.sse.common.impl.MillisecondsDurationImpl;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
import com.sap.sse.common.impl.RGBColor;
|
||||
import com.sap.sse.common.impl.SecondsDurationImpl;
|
||||
import com.sap.sse.common.impl.TimeRangeImpl;
|
||||
import com.sap.sse.common.media.MimeType;
|
||||
import com.sap.sse.shared.media.ImageDescriptor;
|
||||
@@ -2048,7 +2044,7 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
|
||||
}
|
||||
|
||||
private void loadRegattaLogEvents(RegattaLog targetRegattaLog, Document query,
|
||||
RegattaLikeIdentifier regattaLogIdentifier) {
|
||||
RegattaLikeIdentifier regattaLogIdentifier) throws JsonDeserializationException, ParseException {
|
||||
MongoCollection<Document> collection = database.getCollection(CollectionNames.REGATTA_LOGS.name());
|
||||
for (Document o : collection.find(query)) {
|
||||
try {
|
||||
@@ -2062,7 +2058,8 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
|
||||
}
|
||||
}
|
||||
|
||||
private RegattaLogEvent loadRegattaLogEvent(Document o, RegattaLikeIdentifier regattaLogIdentifier) {
|
||||
private RegattaLogEvent loadRegattaLogEvent(Document o, RegattaLikeIdentifier regattaLogIdentifier)
|
||||
throws JsonDeserializationException, ParseException {
|
||||
Document dbObject = (Document) o.get(FieldNames.REGATTA_LOG_EVENT.name());
|
||||
TimePoint logicalTimePoint = loadTimePoint(dbObject);
|
||||
TimePoint createdAt = loadTimePoint(dbObject, FieldNames.REGATTA_LOG_EVENT_CREATED_AT);
|
||||
@@ -2222,57 +2219,12 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
|
||||
}
|
||||
|
||||
private RegattaLogORCCertificateAssignmentEvent loadRegattaLogORCCertificateAssignmentEvent(TimePoint createdAt,
|
||||
AbstractLogEventAuthor author, TimePoint logicalTimePoint, Serializable id, Document dbObject) {
|
||||
String sailnumber = dbObject.getString(FieldNames.ORC_CERTIFICATE_SAILNUMBER.name());
|
||||
String boatclass = dbObject.getString(FieldNames.ORC_CERTIFICATE_BOATCLASS.name());
|
||||
Distance length = new MeterDistance(dbObject.getDouble(FieldNames.ORC_CERTIFICATE_LENGTH.name()));
|
||||
Duration gph = new SecondsDurationImpl(dbObject.getDouble(FieldNames.ORC_CERTIFICATE_GPH.name()));
|
||||
Double cdl = dbObject.getDouble(FieldNames.ORC_CERTIFICATE_CDL.name());
|
||||
|
||||
Map<Speed, Map<Bearing, Speed>> velocityPredictionsPerTrueWindSpeedAndAngle = new HashMap<>();
|
||||
Map<Speed, Bearing> beatAngles = new HashMap<>();
|
||||
Map<Speed, Speed> beatVMGPredictionPerTrueWindSpeed = new HashMap<>();
|
||||
Map<Speed, Duration> beatAllowancePerTrueWindSpeed = new HashMap<>();
|
||||
Map<Speed, Bearing> runAngles = new HashMap<>();
|
||||
Map<Speed, Speed> runVMGPredictionPerTrueWindSpeed = new HashMap<>();
|
||||
Map<Speed, Duration> runAllowancePerTrueWindSpeed = new HashMap<>();
|
||||
Map<Speed, Speed> circularRandomSpeedPredictionPerTrueWindSpeed = new HashMap<>();
|
||||
Map<Speed, Speed> nonSpinnakerSpeedPredictionPerTrueWindSpeed = new HashMap<>();
|
||||
|
||||
for (Speed tws : ORCCertificateImpl.ALLOWANCES_TRUE_WIND_SPEEDS) {
|
||||
String twsKey = MongoObjectFactoryImpl.speedToKnotsString(tws);
|
||||
beatAngles.put(tws, new DegreeBearingImpl(
|
||||
((Document) dbObject.get(FieldNames.ORC_CERTIFICATE_BEAT_ANGLES.name())).getDouble(twsKey)));
|
||||
beatVMGPredictionPerTrueWindSpeed.put(tws, new KnotSpeedImpl(
|
||||
((Document) dbObject.get(FieldNames.ORC_CERTIFICATE_BEAT_VMG_PREDICTIONS.name())).getDouble(twsKey)));
|
||||
beatAllowancePerTrueWindSpeed.put(tws, new SecondsDurationImpl(
|
||||
((Document) dbObject.get(FieldNames.ORC_CERTIFICATE_BEAT_ALLOWANCES.name())).getDouble(twsKey)));
|
||||
runAngles.put(tws, new DegreeBearingImpl(
|
||||
((Document) dbObject.get(FieldNames.ORC_CERTIFICATE_RUN_ANGLES.name())).getDouble(twsKey)));
|
||||
runVMGPredictionPerTrueWindSpeed.put(tws, new KnotSpeedImpl(
|
||||
((Document) dbObject.get(FieldNames.ORC_CERTIFICATE_RUN_VMG_PREDICTIONS.name())).getDouble(twsKey)));
|
||||
runAllowancePerTrueWindSpeed.put(tws, new SecondsDurationImpl(
|
||||
((Document) dbObject.get(FieldNames.ORC_CERTIFICATE_RUN_ALLOWANCES.name())).getDouble(twsKey)));
|
||||
circularRandomSpeedPredictionPerTrueWindSpeed.put(tws, new KnotSpeedImpl(
|
||||
((Document) dbObject.get(FieldNames.ORC_CERTIFICATE_CIRCULAR_RANDOM_SPEED_PREDICTIONS.name())).getDouble(twsKey)));
|
||||
nonSpinnakerSpeedPredictionPerTrueWindSpeed.put(tws, new KnotSpeedImpl(
|
||||
((Document) dbObject.get(FieldNames.ORC_CERTIFICATE_NON_SPINNAKER_SPEED_PREDICTIONS.name())).getDouble(twsKey)));
|
||||
|
||||
Map<Bearing, Speed> velocityPredictionAtCurrentTrueWindSpeedPerTrueWindAngle = new HashMap<>();
|
||||
for (Bearing twa : ORCCertificateImpl.ALLOWANCES_TRUE_WIND_ANGLES) {
|
||||
String twaKey = MongoObjectFactoryImpl.bearingToDegreeString(twa);
|
||||
velocityPredictionAtCurrentTrueWindSpeedPerTrueWindAngle.put(twa, new KnotSpeedImpl(
|
||||
((Document) ((Document) dbObject.get(FieldNames.ORC_CERTIFICATE_TWA_SPEED_PREDICTIONS.name()))
|
||||
.get(twaKey)).getDouble(twsKey)));
|
||||
}
|
||||
velocityPredictionsPerTrueWindSpeedAndAngle.put(tws, velocityPredictionAtCurrentTrueWindSpeedPerTrueWindAngle);
|
||||
}
|
||||
|
||||
ORCCertificate certificate = new ORCCertificateImpl(sailnumber, boatclass, length, gph, cdl,
|
||||
velocityPredictionsPerTrueWindSpeedAndAngle, beatAngles, beatVMGPredictionPerTrueWindSpeed,
|
||||
beatAllowancePerTrueWindSpeed, runAngles, runVMGPredictionPerTrueWindSpeed,
|
||||
runAllowancePerTrueWindSpeed, circularRandomSpeedPredictionPerTrueWindSpeed,
|
||||
nonSpinnakerSpeedPredictionPerTrueWindSpeed);
|
||||
AbstractLogEventAuthor author, TimePoint logicalTimePoint, Serializable id, Document dbObject)
|
||||
throws JsonDeserializationException, ParseException {
|
||||
final Document certificateDbObject = (Document) dbObject.get(FieldNames.ORC_CERTIFICATE.name());
|
||||
final JsonWriterSettings writerSettings = JsonWriterSettings.builder().outputMode(JsonMode.RELAXED).build();
|
||||
JSONObject json = Helpers.toJSONObjectSafe(new JSONParser().parse(certificateDbObject.toJson(writerSettings)));
|
||||
final ORCCertificate certificate = new ORCCertificateJsonDeserializer().deserialize(json);
|
||||
Serializable competitorId = (Serializable) dbObject.get(FieldNames.COMPETITOR_ID.name());
|
||||
return new RegattaLogORCCertificateAssignmentEventImpl(createdAt, logicalTimePoint, author, id, certificate, competitorId);
|
||||
}
|
||||
|
||||
+23
-92
@@ -27,8 +27,9 @@ import com.mongodb.client.model.IndexOptions;
|
||||
import com.mongodb.client.model.UpdateOptions;
|
||||
import com.mongodb.client.result.DeleteResult;
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.orc.RegattaLogORCCertificateAssignmentEvent;
|
||||
import com.sap.sailing.domain.abstractlog.orc.RaceLogORCCertificateAssignmentEvent;
|
||||
import com.sap.sailing.domain.abstractlog.orc.RaceLogORCLegDataEvent;
|
||||
import com.sap.sailing.domain.abstractlog.orc.RegattaLogORCCertificateAssignmentEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.CompetitorResult;
|
||||
import com.sap.sailing.domain.abstractlog.race.CompetitorResults;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogCourseDesignChangedEvent;
|
||||
@@ -102,7 +103,6 @@ import com.sap.sailing.domain.common.Wind;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.common.dto.AnniversaryType;
|
||||
import com.sap.sailing.domain.common.orc.ORCCertificate;
|
||||
import com.sap.sailing.domain.common.orc.impl.ORCCertificateImpl;
|
||||
import com.sap.sailing.domain.common.racelog.tracking.TransformationException;
|
||||
import com.sap.sailing.domain.leaderboard.FlexibleLeaderboard;
|
||||
import com.sap.sailing.domain.leaderboard.Leaderboard;
|
||||
@@ -129,6 +129,7 @@ import com.sap.sailing.server.gateway.serialization.impl.CompetitorJsonSerialize
|
||||
import com.sap.sailing.server.gateway.serialization.impl.CompetitorWithBoatRefJsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.DeviceConfigurationJsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.RegattaConfigurationJsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.racelog.impl.ORCCertificateJsonSerializer;
|
||||
import com.sap.sse.common.Bearing;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.NoCorrespondingServiceRegisteredException;
|
||||
@@ -998,11 +999,27 @@ public class MongoObjectFactoryImpl implements MongoObjectFactory {
|
||||
return result;
|
||||
}
|
||||
|
||||
private Object storeORCLegDataEvent(RaceLogORCLegDataEvent event) {
|
||||
public Document storeRaceLogEntry(RaceLogIdentifier raceLogIdentifier, RaceLogORCCertificateAssignmentEvent event) {
|
||||
Document result = new Document();
|
||||
storeRaceLogIdentifier(raceLogIdentifier, result);
|
||||
result.put(FieldNames.RACE_LOG_EVENT.name(), storeORCCertificateAssignmentEvent(event));
|
||||
return result;
|
||||
}
|
||||
|
||||
private Document storeORCCertificateAssignmentEvent(RaceLogORCCertificateAssignmentEvent event) {
|
||||
Document result = new Document();
|
||||
storeRaceLogEventProperties(event, result);
|
||||
result.put(FieldNames.RACE_LOG_EVENT_CLASS.name(), RaceLogORCLegDataEvent.class.getSimpleName());
|
||||
result.put(FieldNames.ORC_LEG_NR.name(), event.getLegNr()); // TODO Null handling
|
||||
result.append(FieldNames.COMPETITOR_ID.name(), event.getCompetitorID());
|
||||
result.append(FieldNames.ORC_CERTIFICATE.name(), createORCCertificateObject(event.getCertificate()));
|
||||
return result;
|
||||
}
|
||||
|
||||
private Document storeORCLegDataEvent(RaceLogORCLegDataEvent event) {
|
||||
Document result = new Document();
|
||||
storeRaceLogEventProperties(event, result);
|
||||
result.put(FieldNames.RACE_LOG_EVENT_CLASS.name(), RaceLogORCLegDataEvent.class.getSimpleName());
|
||||
result.put(FieldNames.ORC_LEG_NR.name(), event.getLegNr());
|
||||
result.put(FieldNames.ORC_LEG_LENGTH_IN_NAUTICAL_MILES.name(), event.getLength().getNauticalMiles());
|
||||
result.put(FieldNames.ORC_LEG_TWA_IN_DEG.name(), event.getTwa().getDegrees());
|
||||
result.put(FieldNames.ORC_LEG_TYPE.name(), event.getType().name());
|
||||
@@ -1816,95 +1833,9 @@ public class MongoObjectFactoryImpl implements MongoObjectFactory {
|
||||
}
|
||||
}
|
||||
|
||||
static String speedToKnotsString(Speed speed) {
|
||||
String result = null;
|
||||
if (speed.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_SPEEDS[0])) {
|
||||
result = FieldNames.ORC_CERTIFICATE_TWS_6KT.name();
|
||||
} else if (speed.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_SPEEDS[1])) {
|
||||
result = FieldNames.ORC_CERTIFICATE_TWS_8KT.name();
|
||||
} else if (speed.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_SPEEDS[2])) {
|
||||
result = FieldNames.ORC_CERTIFICATE_TWS_10KT.name();
|
||||
} else if (speed.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_SPEEDS[3])) {
|
||||
result = FieldNames.ORC_CERTIFICATE_TWS_12KT.name();
|
||||
} else if (speed.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_SPEEDS[4])) {
|
||||
result = FieldNames.ORC_CERTIFICATE_TWS_14KT.name();
|
||||
} else if (speed.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_SPEEDS[5])) {
|
||||
result = FieldNames.ORC_CERTIFICATE_TWS_16KT.name();
|
||||
} else if (speed.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_SPEEDS[6])) {
|
||||
result = FieldNames.ORC_CERTIFICATE_TWS_20KT.name();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static String bearingToDegreeString(Bearing bearing) {
|
||||
String result = null;
|
||||
if(bearing.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_ANGLES[0])) {
|
||||
result = FieldNames.ORC_CERTIFICATE_R52_PREDICTION.name();
|
||||
} else if (bearing.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_ANGLES[1])) {
|
||||
result = FieldNames.ORC_CERTIFICATE_R60_PREDICTION.name();
|
||||
} else if (bearing.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_ANGLES[2])) {
|
||||
result = FieldNames.ORC_CERTIFICATE_R75_PREDICTION.name();
|
||||
} else if (bearing.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_ANGLES[3])) {
|
||||
result = FieldNames.ORC_CERTIFICATE_R90_PREDICTION.name();
|
||||
} else if (bearing.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_ANGLES[4])) {
|
||||
result = FieldNames.ORC_CERTIFICATE_R110_PREDICTION.name();
|
||||
} else if (bearing.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_ANGLES[5])) {
|
||||
result = FieldNames.ORC_CERTIFICATE_R120_PREDICTION.name();
|
||||
} else if (bearing.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_ANGLES[6])) {
|
||||
result = FieldNames.ORC_CERTIFICATE_R135_PREDICTION.name();
|
||||
} else if (bearing.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_ANGLES[7])) {
|
||||
result = FieldNames.ORC_CERTIFICATE_R150_PREDICTION.name();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Document createORCCertificateObject(ORCCertificate certificate) {
|
||||
Document result = new Document(FieldNames.ORC_CERTIFICATE_SAILNUMBER.name(), certificate.getSailnumber());
|
||||
result.append(FieldNames.ORC_CERTIFICATE_BOATCLASS.name(), certificate.getBoatclass());
|
||||
result.append(FieldNames.ORC_CERTIFICATE_GPH.name(), certificate.getGPH());
|
||||
result.append(FieldNames.ORC_CERTIFICATE_CDL.name(), certificate.getCDL());
|
||||
result.append(FieldNames.ORC_CERTIFICATE_LENGTH.name(), certificate.getLengthOverAll().getMeters());
|
||||
|
||||
Document beatAngles = new Document();
|
||||
Document runAngles = new Document();
|
||||
Document beatAllowances = new Document();
|
||||
Document runAllowances = new Document();
|
||||
Document beatVMGPredictions = new Document();
|
||||
Document runVMGPredictions = new Document();
|
||||
Document windwardLeewardPredictions = new Document();
|
||||
Document circularRandomPredictions = new Document();
|
||||
Document longDistancePredictions = new Document();
|
||||
Document nonSpinnakerPredictions = new Document();
|
||||
Document velocityPredictionsPerTrueWindSpeedAndAngle = new Document();
|
||||
for (Speed tws : ORCCertificateImpl.ALLOWANCES_TRUE_WIND_SPEEDS) {
|
||||
String keyTWS = speedToKnotsString(tws);
|
||||
Document velocityPredictionsPerTrueWindAngle = new Document();
|
||||
beatAngles.append(keyTWS, certificate.getBeatAngles().get(tws).getDegrees());
|
||||
runAngles.append(keyTWS, certificate.getRunAngles().get(tws).getDegrees());
|
||||
beatAllowances.append(keyTWS, certificate.getBeatAllowances().get(tws).asSeconds());
|
||||
runAllowances.append(keyTWS, certificate.getRunAllowances().get(tws).asSeconds());
|
||||
beatVMGPredictions.append(keyTWS, certificate.getBeatVMGPredictions().get(tws).getKnots());
|
||||
runVMGPredictions.append(keyTWS, certificate.getRunVMGPredictions().get(tws).getKnots());
|
||||
windwardLeewardPredictions.append(keyTWS, certificate.getWindwardLeewardSpeedPrediction().get(tws).getKnots());
|
||||
circularRandomPredictions.append(keyTWS, certificate.getCircularRandomSpeedPredictions().get(tws).getKnots());
|
||||
longDistancePredictions.append(keyTWS, certificate.getLongDistanceSpeedPredictions().get(tws).getKnots());
|
||||
nonSpinnakerPredictions.append(keyTWS, certificate.getNonSpinnakerSpeedPredictions().get(tws).getKnots());
|
||||
for (Bearing twa : ORCCertificateImpl.ALLOWANCES_TRUE_WIND_ANGLES) {
|
||||
String keyTWA = bearingToDegreeString(twa);
|
||||
velocityPredictionsPerTrueWindAngle.append(keyTWA, certificate.getVelocityPredictionPerTrueWindSpeedAndAngle().get(tws).get(twa).getKnots());
|
||||
}
|
||||
velocityPredictionsPerTrueWindSpeedAndAngle.append(keyTWS, velocityPredictionsPerTrueWindAngle);
|
||||
}
|
||||
|
||||
result.append(FieldNames.ORC_CERTIFICATE_BEAT_ANGLES.name(), beatAngles);
|
||||
result.append(FieldNames.ORC_CERTIFICATE_RUN_ANGLES.name(), runAngles);
|
||||
result.append(FieldNames.ORC_CERTIFICATE_BEAT_ALLOWANCES.name(), beatAllowances);
|
||||
result.append(FieldNames.ORC_CERTIFICATE_RUN_ALLOWANCES.name(), runAllowances);
|
||||
result.append(FieldNames.ORC_CERTIFICATE_BEAT_VMG_PREDICTIONS.name(), beatVMGPredictions);
|
||||
result.append(FieldNames.ORC_CERTIFICATE_RUN_VMG_PREDICTIONS.name(), runVMGPredictions);
|
||||
result.append(FieldNames.ORC_CERTIFICATE_CIRCULAR_RANDOM_SPEED_PREDICTIONS.name(), circularRandomPredictions);
|
||||
result.append(FieldNames.ORC_CERTIFICATE_NON_SPINNAKER_SPEED_PREDICTIONS.name(), nonSpinnakerPredictions);
|
||||
result.append(FieldNames.ORC_CERTIFICATE_TWA_SPEED_PREDICTIONS.name(), velocityPredictionsPerTrueWindSpeedAndAngle);
|
||||
final ORCCertificateJsonSerializer serializer = new ORCCertificateJsonSerializer();
|
||||
final Document result = Document.parse(serializer.serialize(certificate).toString());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
+7
@@ -4,6 +4,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.bson.Document;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.orc.RaceLogORCCertificateAssignmentEvent;
|
||||
import com.sap.sailing.domain.abstractlog.orc.RaceLogORCLegDataEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogCourseDesignChangedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogDependentStartTimeEvent;
|
||||
@@ -195,4 +196,10 @@ public class MongoRaceLogStoreVisitor implements RaceLogEventVisitor {
|
||||
Document object = mongoObjectFactory.storeRaceLogEntry(raceLogIdentifier, event);
|
||||
mongoObjectFactory.storeRaceLogEventEvent(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(RaceLogORCCertificateAssignmentEvent event) {
|
||||
Document object = mongoObjectFactory.storeRaceLogEntry(raceLogIdentifier, event);
|
||||
mongoObjectFactory.storeRaceLogEventEvent(object);
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.sap.sailing.domain.abstractlog.orc;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEvent;
|
||||
import com.sap.sailing.domain.common.orc.ORCCertificate;
|
||||
|
||||
public interface ORCCertificateAssignmentEvent<VisitorT> extends AbstractLogEvent<VisitorT> {
|
||||
Serializable getCompetitorID();
|
||||
|
||||
ORCCertificate getCertificate();
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.sap.sailing.domain.abstractlog.orc;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
|
||||
public interface RaceLogORCCertificateAssignmentEvent extends ORCCertificateAssignmentEvent<RaceLogEventVisitor>, RaceLogEvent {
|
||||
}
|
||||
+2
-11
@@ -1,16 +1,7 @@
|
||||
package com.sap.sailing.domain.abstractlog.orc;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEvent;
|
||||
import com.sap.sailing.domain.common.orc.ORCCertificate;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEventVisitor;
|
||||
|
||||
// TODO Here is needed a solution/concept to use this kind of events in race and regatta logs.
|
||||
// Additionally the logic shouldn't be implemented at two different places.
|
||||
public interface RegattaLogORCCertificateAssignmentEvent extends RegattaLogEvent {
|
||||
|
||||
public Serializable getCompetitorID();
|
||||
|
||||
public ORCCertificate getCertificate();
|
||||
|
||||
public interface RegattaLogORCCertificateAssignmentEvent extends ORCCertificateAssignmentEvent<RegattaLogEventVisitor>, RegattaLogEvent {
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package com.sap.sailing.domain.abstractlog.orc.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.impl.AbstractLogEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.orc.ORCCertificateAssignmentEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.orc.ORCCertificate;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public abstract class BaseORCCertificateAssignmentEventImpl<VisitorT> extends AbstractLogEventImpl<VisitorT> implements ORCCertificateAssignmentEvent<VisitorT> {
|
||||
private static final long serialVersionUID = -3186019736784868848L;
|
||||
|
||||
private ORCCertificate certificate;
|
||||
private Serializable competitorID;
|
||||
|
||||
public BaseORCCertificateAssignmentEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, ORCCertificate certificate, Competitor competitor) {
|
||||
super(createdAt, logicalTimePoint, author, pId);
|
||||
this.certificate = certificate;
|
||||
this.competitorID = competitor.getId();
|
||||
}
|
||||
|
||||
public BaseORCCertificateAssignmentEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, ORCCertificate certificate, Serializable competitorID) {
|
||||
super(createdAt, logicalTimePoint, author, pId);
|
||||
this.certificate = certificate;
|
||||
this.competitorID = competitorID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ORCCertificate getCertificate() {
|
||||
return certificate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Serializable getCompetitorID() {
|
||||
return competitorID;
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package com.sap.sailing.domain.abstractlog.orc.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.orc.RaceLogORCCertificateAssignmentEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventData;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogEventDataImpl;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.orc.ORCCertificate;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class RaceLogORCCertificateAssignmentEventImpl extends BaseORCCertificateAssignmentEventImpl<RaceLogEventVisitor> implements RaceLogORCCertificateAssignmentEvent {
|
||||
private static final long serialVersionUID = 3506411337361892600L;
|
||||
private final RaceLogEventData raceLogEventData;
|
||||
|
||||
public RaceLogORCCertificateAssignmentEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, int passId, ORCCertificate certificate, Competitor competitor) {
|
||||
super(createdAt, logicalTimePoint, author, pId, certificate, competitor);
|
||||
this.raceLogEventData = new RaceLogEventDataImpl(/* involvedBoats */ null, passId);
|
||||
}
|
||||
|
||||
public RaceLogORCCertificateAssignmentEventImpl(TimePoint createdAt, TimePoint logicalTimePoint,
|
||||
AbstractLogEventAuthor author, Serializable pId, int passId, ORCCertificate certificate, Serializable competitorID) {
|
||||
super(createdAt, logicalTimePoint, author, pId, certificate, competitorID);
|
||||
this.raceLogEventData = new RaceLogEventDataImpl(/* involvedBoats */ null, passId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(RaceLogEventVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPassId() {
|
||||
return raceLogEventData.getPassId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Competitor> List<T> getInvolvedCompetitors() {
|
||||
return raceLogEventData.getInvolvedCompetitors();
|
||||
}
|
||||
}
|
||||
+28
-26
@@ -1,5 +1,6 @@
|
||||
package com.sap.sailing.domain.abstractlog.race;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.orc.RaceLogORCCertificateAssignmentEvent;
|
||||
import com.sap.sailing.domain.abstractlog.orc.RaceLogORCLegDataEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.scoring.RaceLogAdditionalScoringInformationEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogDenoteForTrackingEvent;
|
||||
@@ -7,55 +8,56 @@ import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogRegisterCompetito
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogStartTrackingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogUseCompetitorsFromRaceLogEvent;
|
||||
|
||||
|
||||
public interface RaceLogEventVisitor {
|
||||
public void visit(RaceLogRevokeEvent event);
|
||||
void visit(RaceLogRevokeEvent event);
|
||||
|
||||
public void visit(RaceLogFlagEvent event);
|
||||
void visit(RaceLogFlagEvent event);
|
||||
|
||||
public void visit(RaceLogPassChangeEvent event);
|
||||
void visit(RaceLogPassChangeEvent event);
|
||||
|
||||
public void visit(RaceLogRaceStatusEvent event);
|
||||
void visit(RaceLogRaceStatusEvent event);
|
||||
|
||||
public void visit(RaceLogStartTimeEvent event);
|
||||
void visit(RaceLogStartTimeEvent event);
|
||||
|
||||
public void visit(RaceLogCourseDesignChangedEvent event);
|
||||
void visit(RaceLogCourseDesignChangedEvent event);
|
||||
|
||||
public void visit(RaceLogFinishPositioningListChangedEvent event);
|
||||
void visit(RaceLogFinishPositioningListChangedEvent event);
|
||||
|
||||
public void visit(RaceLogFinishPositioningConfirmedEvent event);
|
||||
void visit(RaceLogFinishPositioningConfirmedEvent event);
|
||||
|
||||
public void visit(RaceLogPathfinderEvent event);
|
||||
void visit(RaceLogPathfinderEvent event);
|
||||
|
||||
public void visit(RaceLogGateLineOpeningTimeEvent event);
|
||||
void visit(RaceLogGateLineOpeningTimeEvent event);
|
||||
|
||||
public void visit(RaceLogStartProcedureChangedEvent event);
|
||||
void visit(RaceLogStartProcedureChangedEvent event);
|
||||
|
||||
public void visit(RaceLogProtestStartTimeEvent event);
|
||||
void visit(RaceLogProtestStartTimeEvent event);
|
||||
|
||||
public void visit(RaceLogWindFixEvent event);
|
||||
void visit(RaceLogWindFixEvent event);
|
||||
|
||||
public void visit(RaceLogDenoteForTrackingEvent event);
|
||||
void visit(RaceLogDenoteForTrackingEvent event);
|
||||
|
||||
public void visit(RaceLogStartTrackingEvent event);
|
||||
void visit(RaceLogStartTrackingEvent event);
|
||||
|
||||
public void visit(RaceLogRegisterCompetitorEvent event);
|
||||
void visit(RaceLogRegisterCompetitorEvent event);
|
||||
|
||||
public void visit(RaceLogAdditionalScoringInformationEvent additionalScoringInformation);
|
||||
void visit(RaceLogAdditionalScoringInformationEvent additionalScoringInformation);
|
||||
|
||||
public void visit(RaceLogFixedMarkPassingEvent event);
|
||||
void visit(RaceLogFixedMarkPassingEvent event);
|
||||
|
||||
public void visit(RaceLogSuppressedMarkPassingsEvent event);
|
||||
void visit(RaceLogSuppressedMarkPassingsEvent event);
|
||||
|
||||
public void visit(RaceLogDependentStartTimeEvent event);
|
||||
void visit(RaceLogDependentStartTimeEvent event);
|
||||
|
||||
public void visit(RaceLogStartOfTrackingEvent event);
|
||||
void visit(RaceLogStartOfTrackingEvent event);
|
||||
|
||||
public void visit(RaceLogEndOfTrackingEvent event);
|
||||
void visit(RaceLogEndOfTrackingEvent event);
|
||||
|
||||
public void visit(RaceLogUseCompetitorsFromRaceLogEvent event);
|
||||
void visit(RaceLogUseCompetitorsFromRaceLogEvent event);
|
||||
|
||||
public void visit(RaceLogTagEvent event);
|
||||
void visit(RaceLogTagEvent event);
|
||||
|
||||
public void visit(RaceLogORCLegDataEvent event);
|
||||
void visit(RaceLogORCLegDataEvent event);
|
||||
|
||||
void visit(RaceLogORCCertificateAssignmentEvent event);
|
||||
}
|
||||
+6
@@ -1,5 +1,6 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.orc.RaceLogORCCertificateAssignmentEvent;
|
||||
import com.sap.sailing.domain.abstractlog.orc.RaceLogORCLegDataEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogCourseDesignChangedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogDependentStartTimeEvent;
|
||||
@@ -150,4 +151,9 @@ public abstract class AbstractRaceLogChangedVisitor implements RaceLogEventVisit
|
||||
public void visit(RaceLogORCLegDataEvent event) {
|
||||
notifyListenerAboutEventAdded(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(RaceLogORCCertificateAssignmentEvent event) {
|
||||
notifyListenerAboutEventAdded(event);
|
||||
}
|
||||
}
|
||||
+7
-1
@@ -1,5 +1,6 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.orc.RaceLogORCCertificateAssignmentEvent;
|
||||
import com.sap.sailing.domain.abstractlog.orc.RaceLogORCLegDataEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogCourseDesignChangedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogDependentStartTimeEvent;
|
||||
@@ -149,11 +150,16 @@ public abstract class BaseRaceLogEventVisitor implements RaceLogEventVisitor {
|
||||
|
||||
@Override
|
||||
public void visit(RaceLogTagEvent event) {
|
||||
//TODO maybe add overridding visit methods for subclasses of this class D067890
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(RaceLogORCLegDataEvent orcLegDataEventImpl) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(RaceLogORCCertificateAssignmentEvent event) {
|
||||
|
||||
}
|
||||
}
|
||||
-2
@@ -31,8 +31,6 @@ import com.sap.sailing.domain.common.orc.impl.ORCPerformanceCurveCourseImpl;
|
||||
import com.sap.sailing.domain.common.orc.impl.ORCPerformanceCurveLegImpl;
|
||||
import com.sap.sailing.domain.orc.impl.ORCCertificateImporterJSON;
|
||||
import com.sap.sailing.domain.orc.impl.ORCPerformanceCurveImpl;
|
||||
import com.sap.sse.common.Bearing;
|
||||
import com.sap.sse.common.Distance;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.impl.DegreeBearingImpl;
|
||||
|
||||
|
||||
+6
-1
@@ -2,6 +2,7 @@ package com.sap.sailing.domain.base.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.orc.RaceLogORCCertificateAssignmentEvent;
|
||||
import com.sap.sailing.domain.abstractlog.orc.RaceLogORCLegDataEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogCourseDesignChangedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogDependentStartTimeEvent;
|
||||
@@ -173,6 +174,10 @@ public class RaceColumnRaceLogReplicator implements RaceLogEventVisitor, Seriali
|
||||
@Override
|
||||
public void visit(RaceLogORCLegDataEvent event) {
|
||||
notifyOnAdd(event);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(RaceLogORCCertificateAssignmentEvent event) {
|
||||
notifyOnAdd(event);
|
||||
}
|
||||
}
|
||||
-2
@@ -22,10 +22,8 @@ import com.sap.sailing.domain.abstractlog.impl.LogEventAuthorImpl;
|
||||
import com.sap.sailing.domain.abstractlog.orc.RaceLogORCLegDataEvent;
|
||||
import com.sap.sailing.domain.abstractlog.orc.impl.RaceLogORCLegDataEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.base.BoatClass;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.DomainFactory;
|
||||
import com.sap.sailing.domain.base.impl.BoatClassImpl;
|
||||
import com.sap.sailing.domain.common.impl.NauticalMileDistance;
|
||||
import com.sap.sailing.domain.common.orc.ORCPerformanceCurveLegTypes;
|
||||
import com.sap.sailing.domain.persistence.PersistenceFactory;
|
||||
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
package com.sap.sailing.server.gateway.deserialization.racelog.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import com.sap.sailing.domain.common.impl.KnotSpeedImpl;
|
||||
import com.sap.sailing.domain.common.impl.MeterDistance;
|
||||
import com.sap.sailing.domain.common.orc.ORCCertificate;
|
||||
import com.sap.sailing.domain.common.orc.impl.ORCCertificateImpl;
|
||||
import com.sap.sailing.server.gateway.deserialization.JsonDeserializationException;
|
||||
import com.sap.sailing.server.gateway.deserialization.JsonDeserializer;
|
||||
import com.sap.sailing.server.gateway.serialization.racelog.impl.ORCCertificateJsonSerializer;
|
||||
import com.sap.sse.common.Bearing;
|
||||
import com.sap.sse.common.Distance;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.Speed;
|
||||
import com.sap.sse.common.impl.DegreeBearingImpl;
|
||||
import com.sap.sse.common.impl.SecondsDurationImpl;
|
||||
|
||||
public class ORCCertificateJsonDeserializer implements JsonDeserializer<ORCCertificate> {
|
||||
|
||||
@Override
|
||||
public ORCCertificate deserialize(JSONObject json) throws JsonDeserializationException {
|
||||
String sailnumber = (String) json.get(ORCCertificateJsonSerializer.ORC_CERTIFICATE_SAILNUMBER);
|
||||
String boatclass = (String) json.get(ORCCertificateJsonSerializer.ORC_CERTIFICATE_BOATCLASS);
|
||||
Distance length = new MeterDistance(
|
||||
((Number) json.get(ORCCertificateJsonSerializer.ORC_CERTIFICATE_LENGTH)).doubleValue());
|
||||
Duration gph = new SecondsDurationImpl(
|
||||
((Number) json.get(ORCCertificateJsonSerializer.ORC_CERTIFICATE_GPH)).doubleValue());
|
||||
final Number cdlAsNumber = (Number) json.get(ORCCertificateJsonSerializer.ORC_CERTIFICATE_CDL);
|
||||
Double cdl = cdlAsNumber == null ? null : cdlAsNumber.doubleValue();
|
||||
Map<Speed, Map<Bearing, Speed>> velocityPredictionsPerTrueWindSpeedAndAngle = new HashMap<>();
|
||||
Map<Speed, Bearing> beatAngles = new HashMap<>();
|
||||
Map<Speed, Speed> beatVMGPredictionPerTrueWindSpeed = new HashMap<>();
|
||||
Map<Speed, Duration> beatAllowancePerTrueWindSpeed = new HashMap<>();
|
||||
Map<Speed, Bearing> runAngles = new HashMap<>();
|
||||
Map<Speed, Speed> runVMGPredictionPerTrueWindSpeed = new HashMap<>();
|
||||
Map<Speed, Duration> runAllowancePerTrueWindSpeed = new HashMap<>();
|
||||
Map<Speed, Speed> circularRandomSpeedPredictionPerTrueWindSpeed = new HashMap<>();
|
||||
Map<Speed, Speed> nonSpinnakerSpeedPredictionPerTrueWindSpeed = new HashMap<>();
|
||||
for (Speed tws : ORCCertificateImpl.ALLOWANCES_TRUE_WIND_SPEEDS) {
|
||||
String twsKey = ORCCertificateJsonSerializer.speedToKnotsString(tws);
|
||||
beatAngles.put(tws, new DegreeBearingImpl(
|
||||
((Number) ((JSONObject) json.get(ORCCertificateJsonSerializer.ORC_CERTIFICATE_BEAT_ANGLES))
|
||||
.get(twsKey)).doubleValue()));
|
||||
beatVMGPredictionPerTrueWindSpeed.put(tws,
|
||||
new KnotSpeedImpl(((Number) ((JSONObject) json
|
||||
.get(ORCCertificateJsonSerializer.ORC_CERTIFICATE_BEAT_VMG_PREDICTIONS)).get(twsKey))
|
||||
.doubleValue()));
|
||||
beatAllowancePerTrueWindSpeed.put(tws, new SecondsDurationImpl(
|
||||
((Number) ((JSONObject) json.get(ORCCertificateJsonSerializer.ORC_CERTIFICATE_BEAT_ALLOWANCES))
|
||||
.get(twsKey)).doubleValue()));
|
||||
runAngles.put(tws, new DegreeBearingImpl(
|
||||
((Number) ((JSONObject) json.get(ORCCertificateJsonSerializer.ORC_CERTIFICATE_RUN_ANGLES))
|
||||
.get(twsKey)).doubleValue()));
|
||||
runVMGPredictionPerTrueWindSpeed.put(tws,
|
||||
new KnotSpeedImpl(((Number) ((JSONObject) json
|
||||
.get(ORCCertificateJsonSerializer.ORC_CERTIFICATE_RUN_VMG_PREDICTIONS)).get(twsKey))
|
||||
.doubleValue()));
|
||||
runAllowancePerTrueWindSpeed.put(tws, new SecondsDurationImpl(
|
||||
((Number) ((JSONObject) json.get(ORCCertificateJsonSerializer.ORC_CERTIFICATE_RUN_ALLOWANCES))
|
||||
.get(twsKey)).doubleValue()));
|
||||
circularRandomSpeedPredictionPerTrueWindSpeed.put(tws,
|
||||
new KnotSpeedImpl(((Number) ((JSONObject) json
|
||||
.get(ORCCertificateJsonSerializer.ORC_CERTIFICATE_CIRCULAR_RANDOM_SPEED_PREDICTIONS))
|
||||
.get(twsKey)).doubleValue()));
|
||||
nonSpinnakerSpeedPredictionPerTrueWindSpeed.put(tws,
|
||||
new KnotSpeedImpl(((Number) ((JSONObject) json
|
||||
.get(ORCCertificateJsonSerializer.ORC_CERTIFICATE_NON_SPINNAKER_SPEED_PREDICTIONS))
|
||||
.get(twsKey)).doubleValue()));
|
||||
|
||||
Map<Bearing, Speed> velocityPredictionAtCurrentTrueWindSpeedPerTrueWindAngle = new HashMap<>();
|
||||
for (Bearing twa : ORCCertificateImpl.ALLOWANCES_TRUE_WIND_ANGLES) {
|
||||
String twaKey = ORCCertificateJsonSerializer.bearingToDegreeString(twa);
|
||||
velocityPredictionAtCurrentTrueWindSpeedPerTrueWindAngle.put(twa,
|
||||
new KnotSpeedImpl(((Number) ((JSONObject) ((JSONObject) json
|
||||
.get(ORCCertificateJsonSerializer.ORC_CERTIFICATE_TWA_SPEED_PREDICTIONS)).get(twaKey))
|
||||
.get(twsKey)).doubleValue()));
|
||||
}
|
||||
velocityPredictionsPerTrueWindSpeedAndAngle.put(tws,
|
||||
velocityPredictionAtCurrentTrueWindSpeedPerTrueWindAngle);
|
||||
}
|
||||
final ORCCertificate certificate = new ORCCertificateImpl(sailnumber, boatclass, length, gph, cdl,
|
||||
velocityPredictionsPerTrueWindSpeedAndAngle, beatAngles, beatVMGPredictionPerTrueWindSpeed,
|
||||
beatAllowancePerTrueWindSpeed, runAngles, runVMGPredictionPerTrueWindSpeed,
|
||||
runAllowancePerTrueWindSpeed, circularRandomSpeedPredictionPerTrueWindSpeed,
|
||||
nonSpinnakerSpeedPredictionPerTrueWindSpeed);
|
||||
return certificate;
|
||||
}
|
||||
}
|
||||
-1
@@ -32,7 +32,6 @@ public class RaceLogDenoteForTrackingEventDeserializer extends BaseRaceLogEventD
|
||||
BoatClass boatClass = domainFactory.getOrCreateBoatClass(
|
||||
(String) object.get(RaceLogDenoteForTrackingEventSerializer.FIELD_BOAT_CLASS));
|
||||
Serializable raceId = (Serializable) object.get(RaceLogDenoteForTrackingEventSerializer.FIELD_RACE_ID);
|
||||
|
||||
return new RaceLogDenoteForTrackingEventImpl(createdAt, timePoint, author, id, passId, raceName, boatClass, raceId);
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.sap.sailing.server.gateway.deserialization.racelog.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.orc.impl.RaceLogORCCertificateAssignmentEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.impl.DynamicCompetitor;
|
||||
import com.sap.sailing.domain.common.orc.ORCCertificate;
|
||||
import com.sap.sailing.server.gateway.deserialization.JsonDeserializationException;
|
||||
import com.sap.sailing.server.gateway.deserialization.JsonDeserializer;
|
||||
import com.sap.sailing.server.gateway.serialization.racelog.impl.RaceLogORCCertificateAssignmentEventSerializer;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
/**
|
||||
* Deserializer for {@link com.sap.sailing.domain.abstractlog.orc.RaceLogORCLegDataEvent ORCLegDataEvent}.
|
||||
*
|
||||
* @author Daniel Lisunkin (I505543)
|
||||
* @author Axel Uhl (d043530)
|
||||
*/
|
||||
public class RaceLogORCCertificateAssignmentEventDeserializer extends BaseRaceLogEventDeserializer {
|
||||
|
||||
public RaceLogORCCertificateAssignmentEventDeserializer(JsonDeserializer<DynamicCompetitor> competitorDeserializer) {
|
||||
super(competitorDeserializer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RaceLogEvent deserialize(JSONObject object, Serializable id, TimePoint createdAt,
|
||||
AbstractLogEventAuthor author, TimePoint timePoint, int passId, List<Competitor> competitors)
|
||||
throws JsonDeserializationException {
|
||||
final ORCCertificate certificate = new ORCCertificateJsonDeserializer().deserialize((JSONObject) object.get(RaceLogORCCertificateAssignmentEventSerializer.ORC_CERTIFICATE));
|
||||
final Serializable competitorID = (Serializable) object.get(RaceLogORCCertificateAssignmentEventSerializer.ORC_COMPETITOR_ID);
|
||||
return new RaceLogORCCertificateAssignmentEventImpl(createdAt, timePoint, author, id, passId, certificate, competitorID);
|
||||
}
|
||||
|
||||
}
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
package com.sap.sailing.server.gateway.serialization.racelog.impl;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import com.sap.sailing.domain.common.orc.ORCCertificate;
|
||||
import com.sap.sailing.domain.common.orc.impl.ORCCertificateImpl;
|
||||
import com.sap.sailing.server.gateway.serialization.JsonSerializer;
|
||||
import com.sap.sse.common.Bearing;
|
||||
import com.sap.sse.common.Speed;
|
||||
|
||||
public class ORCCertificateJsonSerializer implements JsonSerializer<ORCCertificate> {
|
||||
public static final String ORC_CERTIFICATE_BEAT_ANGLES = "beatAngles";
|
||||
public static final String ORC_CERTIFICATE_RUN_ANGLES = "runAngles";
|
||||
public static final String ORC_CERTIFICATE_BEAT_ALLOWANCES = "beatAllowances";
|
||||
public static final String ORC_CERTIFICATE_RUN_ALLOWANCES = "runAllowances";
|
||||
public static final String ORC_CERTIFICATE_BEAT_VMG_PREDICTIONS = "beatVmgPredictions";
|
||||
public static final String ORC_CERTIFICATE_RUN_VMG_PREDICTIONS = "runVmgPredictions";
|
||||
public static final String ORC_CERTIFICATE_CIRCULAR_RANDOM_SPEED_PREDICTIONS = "circularRandomSpeedPredictions";
|
||||
public static final String ORC_CERTIFICATE_NON_SPINNAKER_SPEED_PREDICTIONS = "nonSpinnakerSpeedPredictions";
|
||||
public static final String ORC_CERTIFICATE_TWA_SPEED_PREDICTIONS = "twaSpeedPredictions";
|
||||
public static final String ORC_CERTIFICATE_SAILNUMBER = "sailNumber";
|
||||
public static final String ORC_CERTIFICATE_BOATCLASS = "boatClass";
|
||||
public static final String ORC_CERTIFICATE_GPH = "gph";
|
||||
public static final String ORC_CERTIFICATE_CDL = "cdl";
|
||||
public static final String ORC_CERTIFICATE_LENGTH = "length";
|
||||
public static final String ORC_CERTIFICATE_TWS_6KT = "ORC_CERTIFICATE_TWS_6KT";
|
||||
public static final String ORC_CERTIFICATE_TWS_8KT = "ORC_CERTIFICATE_TWS_8KT";
|
||||
public static final String ORC_CERTIFICATE_TWS_10KT = "ORC_CERTIFICATE_TWS_10KT";
|
||||
public static final String ORC_CERTIFICATE_TWS_12KT = "ORC_CERTIFICATE_TWS_12KT";
|
||||
public static final String ORC_CERTIFICATE_TWS_14KT = "ORC_CERTIFICATE_TWS_14KT";
|
||||
public static final String ORC_CERTIFICATE_TWS_16KT = "ORC_CERTIFICATE_TWS_16KT";
|
||||
public static final String ORC_CERTIFICATE_TWS_20KT = "ORC_CERTIFICATE_TWS_20KT";
|
||||
public static final String ORC_CERTIFICATE_R52_PREDICTION = "ORC_CERTIFICATE_R52_PREDICTION";
|
||||
public static final String ORC_CERTIFICATE_R60_PREDICTION = "ORC_CERTIFICATE_R60_PREDICTION";
|
||||
public static final String ORC_CERTIFICATE_R75_PREDICTION = "ORC_CERTIFICATE_R75_PREDICTION";
|
||||
public static final String ORC_CERTIFICATE_R90_PREDICTION = "ORC_CERTIFICATE_R90_PREDICTION";
|
||||
public static final String ORC_CERTIFICATE_R110_PREDICTION = "ORC_CERTIFICATE_R110_PREDICTION";
|
||||
public static final String ORC_CERTIFICATE_R120_PREDICTION = "ORC_CERTIFICATE_R120_PREDICTION";
|
||||
public static final String ORC_CERTIFICATE_R135_PREDICTION = "ORC_CERTIFICATE_R135_PREDICTION";
|
||||
public static final String ORC_CERTIFICATE_R150_PREDICTION = "ORC_CERTIFICATE_R150_PREDICTION";
|
||||
|
||||
@Override
|
||||
public JSONObject serialize(ORCCertificate certificate) {
|
||||
JSONObject result = new JSONObject();
|
||||
result.put(ORC_CERTIFICATE_SAILNUMBER, certificate.getSailnumber());
|
||||
result.put(ORC_CERTIFICATE_BOATCLASS, certificate.getBoatclass());
|
||||
result.put(ORC_CERTIFICATE_GPH, certificate.getGPH());
|
||||
result.put(ORC_CERTIFICATE_CDL, certificate.getCDL());
|
||||
result.put(ORC_CERTIFICATE_LENGTH, certificate.getLengthOverAll().getMeters());
|
||||
|
||||
JSONObject beatAngles = new JSONObject();
|
||||
JSONObject runAngles = new JSONObject();
|
||||
JSONObject beatAllowances = new JSONObject();
|
||||
JSONObject runAllowances = new JSONObject();
|
||||
JSONObject beatVMGPredictions = new JSONObject();
|
||||
JSONObject runVMGPredictions = new JSONObject();
|
||||
JSONObject windwardLeewardPredictions = new JSONObject();
|
||||
JSONObject circularRandomPredictions = new JSONObject();
|
||||
JSONObject longDistancePredictions = new JSONObject();
|
||||
JSONObject nonSpinnakerPredictions = new JSONObject();
|
||||
JSONObject velocityPredictionsPerTrueWindSpeedAndAngle = new JSONObject();
|
||||
for (Speed tws : ORCCertificateImpl.ALLOWANCES_TRUE_WIND_SPEEDS) {
|
||||
String keyTWS = speedToKnotsString(tws);
|
||||
JSONObject velocityPredictionsPerTrueWindAngle = new JSONObject();
|
||||
beatAngles.put(keyTWS, certificate.getBeatAngles().get(tws).getDegrees());
|
||||
runAngles.put(keyTWS, certificate.getRunAngles().get(tws).getDegrees());
|
||||
beatAllowances.put(keyTWS, certificate.getBeatAllowances().get(tws).asSeconds());
|
||||
runAllowances.put(keyTWS, certificate.getRunAllowances().get(tws).asSeconds());
|
||||
beatVMGPredictions.put(keyTWS, certificate.getBeatVMGPredictions().get(tws).getKnots());
|
||||
runVMGPredictions.put(keyTWS, certificate.getRunVMGPredictions().get(tws).getKnots());
|
||||
windwardLeewardPredictions.put(keyTWS, certificate.getWindwardLeewardSpeedPrediction().get(tws).getKnots());
|
||||
circularRandomPredictions.put(keyTWS, certificate.getCircularRandomSpeedPredictions().get(tws).getKnots());
|
||||
longDistancePredictions.put(keyTWS, certificate.getLongDistanceSpeedPredictions().get(tws).getKnots());
|
||||
nonSpinnakerPredictions.put(keyTWS, certificate.getNonSpinnakerSpeedPredictions().get(tws).getKnots());
|
||||
for (Bearing twa : ORCCertificateImpl.ALLOWANCES_TRUE_WIND_ANGLES) {
|
||||
String keyTWA = bearingToDegreeString(twa);
|
||||
velocityPredictionsPerTrueWindAngle.put(keyTWA, certificate.getVelocityPredictionPerTrueWindSpeedAndAngle().get(tws).get(twa).getKnots());
|
||||
}
|
||||
velocityPredictionsPerTrueWindSpeedAndAngle.put(keyTWS, velocityPredictionsPerTrueWindAngle);
|
||||
}
|
||||
|
||||
result.put(ORC_CERTIFICATE_BEAT_ANGLES, beatAngles);
|
||||
result.put(ORC_CERTIFICATE_RUN_ANGLES, runAngles);
|
||||
result.put(ORC_CERTIFICATE_BEAT_ALLOWANCES, beatAllowances);
|
||||
result.put(ORC_CERTIFICATE_RUN_ALLOWANCES, runAllowances);
|
||||
result.put(ORC_CERTIFICATE_BEAT_VMG_PREDICTIONS, beatVMGPredictions);
|
||||
result.put(ORC_CERTIFICATE_RUN_VMG_PREDICTIONS, runVMGPredictions);
|
||||
result.put(ORC_CERTIFICATE_CIRCULAR_RANDOM_SPEED_PREDICTIONS, circularRandomPredictions);
|
||||
result.put(ORC_CERTIFICATE_NON_SPINNAKER_SPEED_PREDICTIONS, nonSpinnakerPredictions);
|
||||
result.put(ORC_CERTIFICATE_TWA_SPEED_PREDICTIONS, velocityPredictionsPerTrueWindSpeedAndAngle);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String speedToKnotsString(Speed speed) {
|
||||
String result = null;
|
||||
if (speed.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_SPEEDS[0])) {
|
||||
result = ORC_CERTIFICATE_TWS_6KT;
|
||||
} else if (speed.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_SPEEDS[1])) {
|
||||
result = ORC_CERTIFICATE_TWS_8KT;
|
||||
} else if (speed.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_SPEEDS[2])) {
|
||||
result = ORC_CERTIFICATE_TWS_10KT;
|
||||
} else if (speed.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_SPEEDS[3])) {
|
||||
result = ORC_CERTIFICATE_TWS_12KT;
|
||||
} else if (speed.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_SPEEDS[4])) {
|
||||
result = ORC_CERTIFICATE_TWS_14KT;
|
||||
} else if (speed.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_SPEEDS[5])) {
|
||||
result = ORC_CERTIFICATE_TWS_16KT;
|
||||
} else if (speed.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_SPEEDS[6])) {
|
||||
result = ORC_CERTIFICATE_TWS_20KT;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String bearingToDegreeString(Bearing bearing) {
|
||||
String result = null;
|
||||
if (bearing.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_ANGLES[0])) {
|
||||
result = ORC_CERTIFICATE_R52_PREDICTION;
|
||||
} else if (bearing.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_ANGLES[1])) {
|
||||
result = ORC_CERTIFICATE_R60_PREDICTION;
|
||||
} else if (bearing.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_ANGLES[2])) {
|
||||
result = ORC_CERTIFICATE_R75_PREDICTION;
|
||||
} else if (bearing.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_ANGLES[3])) {
|
||||
result = ORC_CERTIFICATE_R90_PREDICTION;
|
||||
} else if (bearing.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_ANGLES[4])) {
|
||||
result = ORC_CERTIFICATE_R110_PREDICTION;
|
||||
} else if (bearing.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_ANGLES[5])) {
|
||||
result = ORC_CERTIFICATE_R120_PREDICTION;
|
||||
} else if (bearing.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_ANGLES[6])) {
|
||||
result = ORC_CERTIFICATE_R135_PREDICTION;
|
||||
} else if (bearing.equals(ORCCertificateImpl.ALLOWANCES_TRUE_WIND_ANGLES[7])) {
|
||||
result = ORC_CERTIFICATE_R150_PREDICTION;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
+12
-4
@@ -2,6 +2,7 @@ package com.sap.sailing.server.gateway.serialization.racelog.impl;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.orc.RaceLogORCCertificateAssignmentEvent;
|
||||
import com.sap.sailing.domain.abstractlog.orc.RaceLogORCLegDataEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogCourseDesignChangedEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogDependentStartTimeEvent;
|
||||
@@ -84,7 +85,8 @@ public class RaceLogEventSerializer implements JsonSerializer<RaceLogEvent>, Rac
|
||||
new RaceLogUseCompetitorsFromRaceLogEventSerializer(competitorSerializer),
|
||||
new RaceLogEndOfTrackingEventSerializer(competitorSerializer),
|
||||
new RaceLogTagEventSerializer(competitorSerializer),
|
||||
new RaceLogORCLegDataEventSerializer(competitorSerializer));
|
||||
new RaceLogORCLegDataEventSerializer(competitorSerializer),
|
||||
new RaceLogORCCertificateAssignmentEventSerializer(competitorSerializer));
|
||||
}
|
||||
|
||||
private final JsonSerializer<RaceLogEvent> flagEventSerializer;
|
||||
@@ -112,6 +114,7 @@ public class RaceLogEventSerializer implements JsonSerializer<RaceLogEvent>, Rac
|
||||
private final JsonSerializer<RaceLogEvent> endOfTrackingEventSerializer;
|
||||
private final JsonSerializer<RaceLogEvent> tagSerializer;
|
||||
private final JsonSerializer<RaceLogEvent> orcLegDataEventSerializer;
|
||||
private final JsonSerializer<RaceLogEvent> orcCertificateAssignmentEventSerializer;
|
||||
|
||||
private JsonSerializer<RaceLogEvent> chosenSerializer;
|
||||
|
||||
@@ -141,8 +144,8 @@ public class RaceLogEventSerializer implements JsonSerializer<RaceLogEvent>, Rac
|
||||
JsonSerializer<RaceLogEvent> useCompetitorsFromRaceLogEventSerializer,
|
||||
JsonSerializer<RaceLogEvent> endOfTrackingEventSerializer,
|
||||
JsonSerializer<RaceLogEvent> tagSerializer,
|
||||
JsonSerializer<RaceLogEvent> orcLegDataEventSerializer) {
|
||||
|
||||
JsonSerializer<RaceLogEvent> orcLegDataEventSerializer,
|
||||
JsonSerializer<RaceLogEvent> orcCertificateAssignmentEventSerializer) {
|
||||
this.flagEventSerializer = flagEventSerializer;
|
||||
this.startTimeSerializer = startTimeSerializer;
|
||||
this.raceStatusSerializer = raceStatusSerializer;
|
||||
@@ -168,7 +171,7 @@ public class RaceLogEventSerializer implements JsonSerializer<RaceLogEvent>, Rac
|
||||
this.useCompetitorsFromRaceLogEventSerializer = useCompetitorsFromRaceLogEventSerializer;
|
||||
this.tagSerializer = tagSerializer;
|
||||
this.orcLegDataEventSerializer = orcLegDataEventSerializer;
|
||||
|
||||
this.orcCertificateAssignmentEventSerializer = orcCertificateAssignmentEventSerializer;
|
||||
this.chosenSerializer = null;
|
||||
}
|
||||
|
||||
@@ -310,4 +313,9 @@ public class RaceLogEventSerializer implements JsonSerializer<RaceLogEvent>, Rac
|
||||
public void visit(RaceLogORCLegDataEvent event) {
|
||||
chosenSerializer = orcLegDataEventSerializer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(RaceLogORCCertificateAssignmentEvent event) {
|
||||
chosenSerializer = orcCertificateAssignmentEventSerializer;
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.sap.sailing.server.gateway.serialization.racelog.impl;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.orc.RaceLogORCCertificateAssignmentEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.server.gateway.serialization.JsonSerializer;
|
||||
|
||||
/**
|
||||
* Serializer for {@link com.sap.sailing.domain.abstractlog.orc.RaceLogORCLegDataEvent ORCLegDataEvent}.
|
||||
*
|
||||
* @author Daniel Lisunkin (i505543)
|
||||
* @author Axel Uhl (d043530)
|
||||
*/
|
||||
public class RaceLogORCCertificateAssignmentEventSerializer extends BaseRaceLogEventSerializer {
|
||||
|
||||
public static final String VALUE_CLASS = RaceLogORCCertificateAssignmentEvent.class.getSimpleName();
|
||||
public static final String ORC_CERTIFICATE = "certificate";
|
||||
public static final String ORC_COMPETITOR_ID = "competitorId";
|
||||
|
||||
public RaceLogORCCertificateAssignmentEventSerializer(JsonSerializer<Competitor> competitorSerializer) {
|
||||
super(competitorSerializer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject serialize(RaceLogEvent object) {
|
||||
RaceLogORCCertificateAssignmentEvent certificateAssignmentEvent = (RaceLogORCCertificateAssignmentEvent) object;
|
||||
JSONObject result = super.serialize(certificateAssignmentEvent);
|
||||
result.put(ORC_CERTIFICATE, new ORCCertificateJsonSerializer().serialize(certificateAssignmentEvent.getCertificate()));
|
||||
result.put(ORC_COMPETITOR_ID, certificateAssignmentEvent.getCompetitorID());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getClassFieldValue() {
|
||||
return VALUE_CLASS;
|
||||
}
|
||||
}
|
||||
+5
-3
@@ -72,7 +72,8 @@ public class RaceLogEventSerializerTest {
|
||||
private JsonSerializer<RaceLogEvent> endOfTrackingEventSerializer;
|
||||
private JsonSerializer<RaceLogEvent> tagEventSerializer;
|
||||
private JsonSerializer<RaceLogEvent> orcLegDataEventSerializer;
|
||||
|
||||
private JsonSerializer<RaceLogEvent> orcCertificateAssignmentEventSerializer;
|
||||
|
||||
private AbstractLogEventAuthor author = new LogEventAuthorImpl("Test Author", 1);
|
||||
|
||||
|
||||
@@ -104,7 +105,7 @@ public class RaceLogEventSerializerTest {
|
||||
endOfTrackingEventSerializer = mock(JsonSerializer.class);
|
||||
tagEventSerializer = mock(JsonSerializer.class);
|
||||
orcLegDataEventSerializer = mock(JsonSerializer.class);
|
||||
|
||||
orcCertificateAssignmentEventSerializer = mock(JsonSerializer.class);
|
||||
serializer = new RaceLogEventSerializer(flagEventSerializer, startTimeSerializer, raceStatusSerializer,
|
||||
passChangedSerializer, courseDesignChangedEventSerializer,
|
||||
finishPositioningListChangedEventSerializer, finishPositioningConfirmedEventSerializer,
|
||||
@@ -115,7 +116,8 @@ public class RaceLogEventSerializerTest {
|
||||
fixedMarkPassingEventSerializer, suppressedMarkPassingsSerializer,
|
||||
additionalScoringInformationSerializer, dependentStartTimeEventSerializer,
|
||||
startOfTrackingEventSerializer, useCompetitorsFromRaceLogEventSerializer,
|
||||
endOfTrackingEventSerializer, tagEventSerializer, orcLegDataEventSerializer);
|
||||
endOfTrackingEventSerializer, tagEventSerializer, orcLegDataEventSerializer,
|
||||
orcCertificateAssignmentEventSerializer);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user