8e355564e59ffdc573e4728b5ab99c8fee1cc0d4
java/com.sap.sailing.domain.persistence/src/com/sap/sailing/domain/persistence/FieldNames.java
| ... | ... | @@ -198,7 +198,7 @@ public enum FieldNames { |
| 198 | 198 | MARK_PASSINGS_FINGERPRINT, MARK_PASSINGS, |
| 199 | 199 | |
| 200 | 200 | // MANEUVER collection |
| 201 | - MANEUVER_FINGERPRINT, MANEUVER, TYPE, TACK, POSITION_LAT_RAD, POSITION_LNG_RAD, TIMEPOINT, MAIN_CURVE_BOUNDARIES, MANEUVER_CURVE_WITH_STABLE_SPEED_AND_COURSE_BOUNDERIES, MAX_TURNING_RATE_IN_DEGREE_PER_SECOUND, MANEUVER_LOSS, |
|
| 201 | + MANEUVER_FINGERPRINT, MANEUVERS, TYPE, TACK, POSITION_LAT_RAD, POSITION_LNG_RAD, TIMEPOINT, MAIN_CURVE_BOUNDARIES, MANEUVER_CURVE_WITH_STABLE_SPEED_AND_COURSE_BOUNDERIES, MAX_TURNING_RATE_IN_DEGREE_PER_SECOUND, MANEUVER_LOSS, |
|
| 202 | 202 | //Test |
| 203 | 203 | TIMEPOINT_BEFORE, TIMEPOINT_AFTER, SPEED_WITH_BEARING_BEFORE, SPEED_WITH_BEARING_AFTER, DIRECTION_CHANGE_IN_DEGREES, LOWEST_SPEED, HIGHEST_SPEED, |
| 204 | 204 | DISTANCE_SAILED_POMA, DISTANCE_SAILED_INMPOMA, SPEED_WITH_BEARING_BEFORE_DEGREES, SPEED_WITH_BEARING_BEFORE_SPEED, SPEED_WITH_BEARING_AFTER_DEGREES, SPEED_WITH_BEARING_AFTER_SPEED, |
java/com.sap.sailing.domain.persistence/src/com/sap/sailing/domain/persistence/impl/CollectionNames.java
| ... | ... | @@ -130,6 +130,6 @@ public enum CollectionNames { |
| 130 | 130 | * Contains the Hashes for the |
| 131 | 131 | */ |
| 132 | 132 | |
| 133 | - MANEUVER; |
|
| 133 | + MANEUVERS; |
|
| 134 | 134 | |
| 135 | 135 | } |
java/com.sap.sailing.domain.persistence/src/com/sap/sailing/domain/persistence/impl/DomainObjectFactoryImpl.java
| ... | ... | @@ -3293,8 +3293,6 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory { |
| 3293 | 3293 | return new Pair<>(waypoint, markPassing); |
| 3294 | 3294 | } |
| 3295 | 3295 | |
| 3296 | - // Methods for ManeuverFingerprint - not finished |
|
| 3297 | - |
|
| 3298 | 3296 | private Pair<RaceIdentifier, ManeuverRaceFingerprint> loadManeuversFingerprint(final Document currentDocument) { |
| 3299 | 3297 | final RaceIdentifier raceIdentifier = loadRaceIdentifier(currentDocument); |
| 3300 | 3298 | ManeuverRaceFingerprint fingerprint; |
| ... | ... | @@ -3309,10 +3307,9 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory { |
| 3309 | 3307 | return new Pair<>(raceIdentifier, fingerprint); |
| 3310 | 3308 | } |
| 3311 | 3309 | |
| 3312 | - |
|
| 3313 | 3310 | @Override |
| 3314 | 3311 | public Map<RaceIdentifier, ManeuverRaceFingerprint> loadFingerprintsForManeuverHashes() { |
| 3315 | - final MongoCollection<Document> maneuversCollection = database.getCollection(CollectionNames.MANEUVER.name()); |
|
| 3312 | + final MongoCollection<Document> maneuversCollection = database.getCollection(CollectionNames.MANEUVERS.name()); |
|
| 3316 | 3313 | maneuversCollection.createIndex(new Document() |
| 3317 | 3314 | .append(FieldNames.EVENT_NAME.name(), 1) |
| 3318 | 3315 | .append(FieldNames.RACE_NAME.name(), 1), |
| ... | ... | @@ -3336,18 +3333,18 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory { |
| 3336 | 3333 | final Document query = new Document(); |
| 3337 | 3334 | RaceIdentifier raceIdentifier = trackedRace.getRaceIdentifier(); |
| 3338 | 3335 | addRaceIdentifierToQuery(query, raceIdentifier); |
| 3339 | - final MongoCollection<Document> maneuversCollection = database.getCollection(CollectionNames.MANEUVER.name()); |
|
| 3336 | + final MongoCollection<Document> maneuversCollection = database.getCollection(CollectionNames.MANEUVERS.name()); |
|
| 3340 | 3337 | final Document doc = maneuversCollection.find(query).first(); |
| 3341 | 3338 | if (doc != null) { |
| 3342 | 3339 | result = new HashMap<>(); |
| 3343 | - final List<Document> maneuversDoc = doc.getList(FieldNames.MANEUVER.name(), Document.class); |
|
| 3340 | + final List<Document> maneuversDoc = doc.getList(FieldNames.MANEUVERS.name(), Document.class); |
|
| 3344 | 3341 | for (final Document maneuversForOneCompetitorDoc : maneuversDoc) { |
| 3345 | 3342 | final Serializable competitorId = maneuversForOneCompetitorDoc.get(FieldNames.COMPETITOR_ID.name(), Serializable.class); |
| 3346 | 3343 | final Competitor competitor = baseDomainFactory.getExistingCompetitorById(competitorId); |
| 3347 | - for (final Document maneuvers: maneuversForOneCompetitorDoc.getList(FieldNames.MANEUVER.name(), Document.class)) { |
|
| 3344 | + for (final Document maneuvers : maneuversForOneCompetitorDoc.getList(FieldNames.MANEUVERS.name(), Document.class)) { |
|
| 3348 | 3345 | final Maneuver maneuver = loadManeuver(competitor, maneuvers, course, trackedRace); |
| 3349 | 3346 | result.computeIfAbsent(competitor, c -> new ArrayList<>()).add(maneuver); |
| 3350 | - } |
|
| 3347 | + } |
|
| 3351 | 3348 | } |
| 3352 | 3349 | } else { |
| 3353 | 3350 | result = null; |
java/com.sap.sailing.domain.persistence/src/com/sap/sailing/domain/persistence/impl/MongoObjectFactoryImpl.java
| ... | ... | @@ -2050,32 +2050,23 @@ public class MongoObjectFactoryImpl implements MongoObjectFactory { |
| 2050 | 2050 | maneuverDoc.put(FieldNames.POSITION_LAT_RAD.name(), f.getPosition().getLatRad()); |
| 2051 | 2051 | maneuverDoc.put(FieldNames.POSITION_LNG_RAD.name(), f.getPosition().getLngRad()); |
| 2052 | 2052 | maneuverDoc.put(FieldNames.TIMEPOINT.name(), f.getTimePoint().asMillis()); |
| 2053 | - |
|
| 2054 | 2053 | final Document mainCurveBoundariesDoc = new Document(); |
| 2055 | 2054 | maneuverDoc.put(FieldNames.MAIN_CURVE_BOUNDARIES.name(), storeMainCurveBoundaries(f.getMainCurveBoundaries(), mainCurveBoundariesDoc)); |
| 2056 | 2055 | final Document maeuverCurveWithStableSpeedAndBoundariesDoc = new Document(); |
| 2057 | 2056 | maneuverDoc.put(FieldNames.MANEUVER_CURVE_WITH_STABLE_SPEED_AND_COURSE_BOUNDERIES.name(), storeMainCurveBoundaries(f.getManeuverCurveWithStableSpeedAndCourseBoundaries(), maeuverCurveWithStableSpeedAndBoundariesDoc)); |
| 2058 | 2057 | maneuverDoc.put(FieldNames.MAX_TURNING_RATE_IN_DEGREE_PER_SECOUND.name(), f.getMaxTurningRateInDegreesPerSecond()); |
| 2059 | - |
|
| 2060 | - // if umschrieben in einzeiler |
|
| 2061 | - if (f.getMarkPassing() != null) |
|
| 2062 | - maneuverDoc.put(FieldNames.INDEX_OF_PASSED_WAYPOINT.name(), course.getIndexOfWaypoint(f.getMarkPassing().getWaypoint())); |
|
| 2063 | - else |
|
| 2064 | - maneuverDoc.put(FieldNames.INDEX_OF_PASSED_WAYPOINT.name(), -1); |
|
| 2058 | + maneuverDoc.put(FieldNames.INDEX_OF_PASSED_WAYPOINT.name(), f.getMarkPassing() == null ? -1 : course.getIndexOfWaypoint(f.getMarkPassing().getWaypoint())); |
|
| 2065 | 2059 | maneuverDoc.put(FieldNames.TIME_AS_MILLIS.name(), f.getDuration().asMillis()); |
| 2066 | - if (f.getManeuverLoss() != null) |
|
| 2067 | - maneuverDoc.put(FieldNames.MANEUVER_LOSS.name(), storemaneuverLoss(f.getManeuverLoss())); |
|
| 2068 | - else |
|
| 2069 | - maneuverDoc.put(FieldNames.MANEUVER_LOSS.name(), null); |
|
| 2060 | + maneuverDoc.put(FieldNames.MANEUVER_LOSS.name(), f.getManeuverLoss() == null ? null : storeManeuverLoss(f.getManeuverLoss())); |
|
| 2070 | 2061 | maneuverList.add(maneuverDoc); |
| 2071 | 2062 | } |
| 2072 | - competitorManeuver.put(FieldNames.MANEUVER.name(), maneuverList); |
|
| 2063 | + competitorManeuver.put(FieldNames.MANEUVERS.name(), maneuverList); |
|
| 2073 | 2064 | result.add(competitorManeuver); |
| 2074 | 2065 | } |
| 2075 | 2066 | return result; |
| 2076 | 2067 | } |
| 2077 | 2068 | |
| 2078 | - private Document storemaneuverLoss(ManeuverLoss maneuverLoss) { |
|
| 2069 | + private Document storeManeuverLoss(ManeuverLoss maneuverLoss) { |
|
| 2079 | 2070 | final Document maneuverLossDoc = new Document(); |
| 2080 | 2071 | maneuverLossDoc.put(FieldNames.DISTANCE_SAILED_POMA.name(), maneuverLoss.getDistanceSailedIfNotManeuveringProjectedOnMiddleManeuverAngle().getMeters()); |
| 2081 | 2072 | maneuverLossDoc.put(FieldNames.DISTANCE_SAILED_INMPOMA.name(), maneuverLoss.getDistanceSailedIfNotManeuveringProjectedOnMiddleManeuverAngle().getMeters()); |
| ... | ... | @@ -2105,7 +2096,7 @@ public class MongoObjectFactoryImpl implements MongoObjectFactory { |
| 2105 | 2096 | |
| 2106 | 2097 | @Override |
| 2107 | 2098 | public void storeManeuvers(RaceIdentifier raceIdentifier, ManeuverRaceFingerprint fingerprint, Course course, Map<Competitor, List<Maneuver>> maneuvers) { |
| 2108 | - MongoCollection<Document> maneuverCollection = database.getCollection(CollectionNames.MANEUVER.name()); |
|
| 2099 | + MongoCollection<Document> maneuverCollection = database.getCollection(CollectionNames.MANEUVERS.name()); |
|
| 2109 | 2100 | JSONObject fingerprintjson = fingerprint.toJson(); |
| 2110 | 2101 | final Document query = new Document(); |
| 2111 | 2102 | DomainObjectFactoryImpl.addRaceIdentifierToQuery(query, raceIdentifier); |
| ... | ... | @@ -2114,13 +2105,13 @@ public class MongoObjectFactoryImpl implements MongoObjectFactory { |
| 2114 | 2105 | result.put(FieldNames.MANEUVER_FINGERPRINT.name(), fingerprintDoc); |
| 2115 | 2106 | storeRaceIdentifier(result, raceIdentifier); |
| 2116 | 2107 | final List<Document> maneuverDoc = storeManeuvers( maneuvers , raceIdentifier, course); |
| 2117 | - result.put(FieldNames.MANEUVER.name(), maneuverDoc); |
|
| 2108 | + result.put(FieldNames.MANEUVERS.name(), maneuverDoc); |
|
| 2118 | 2109 | maneuverCollection.replaceOne(query, result, new ReplaceOptions().upsert(true)); |
| 2119 | 2110 | } |
| 2120 | 2111 | |
| 2121 | 2112 | @Override |
| 2122 | 2113 | public void removeManeuvers(RaceIdentifier raceIdentifier) { |
| 2123 | - MongoCollection<Document> maneuverCollection = database.getCollection(CollectionNames.MANEUVER.name()); |
|
| 2114 | + MongoCollection<Document> maneuverCollection = database.getCollection(CollectionNames.MANEUVERS.name()); |
|
| 2124 | 2115 | final Document query = new Document(); |
| 2125 | 2116 | DomainObjectFactoryImpl.addRaceIdentifierToQuery(query, raceIdentifier); |
| 2126 | 2117 | maneuverCollection.deleteOne(query); |