mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-26 23:46:36 +00:00
added more commands / operations for replication
This commit is contained in:
+2
-2
@@ -18,12 +18,12 @@ import com.sap.sailing.server.RacingEventService;
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public class TrackRace extends AbstractRaceOperation {
|
||||
public class CreateTrackedRace extends AbstractRaceOperation {
|
||||
private static final long serialVersionUID = 5084401060896514911L;
|
||||
private final long millisecondsOverWhichToAverageWind;
|
||||
private final long millisecondsOverWhichToAverageSpeed;
|
||||
|
||||
public TrackRace(EventAndRaceIdentifier raceIdentifier, long millisecondsOverWhichToAverageWind, long millisecondsOverWhichToAverageSpeed) {
|
||||
public CreateTrackedRace(EventAndRaceIdentifier raceIdentifier, long millisecondsOverWhichToAverageWind, long millisecondsOverWhichToAverageSpeed) {
|
||||
super(raceIdentifier);
|
||||
this.millisecondsOverWhichToAverageWind = millisecondsOverWhichToAverageWind;
|
||||
this.millisecondsOverWhichToAverageSpeed = millisecondsOverWhichToAverageSpeed;
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.sap.sailing.server.operationaltransformation;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import com.sap.sailing.domain.common.EventAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRace;
|
||||
import com.sap.sailing.server.RacingEventService;
|
||||
|
||||
public class SetWindSourcesToExclude extends AbstractRaceOperation {
|
||||
private static final long serialVersionUID = 7639288885720509529L;
|
||||
private final Set<WindSource> windSourcesToExclude;
|
||||
|
||||
public SetWindSourcesToExclude(EventAndRaceIdentifier raceIdentifier, Set<WindSource> windSourcesToExclude) {
|
||||
super(raceIdentifier);
|
||||
this.windSourcesToExclude = windSourcesToExclude;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RacingEventServiceOperation transformClientOp(RacingEventServiceOperation serverOp) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RacingEventServiceOperation transformServerOp(RacingEventServiceOperation clientOp) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RacingEventService applyTo(RacingEventService toState) {
|
||||
DynamicTrackedRace trackedRace = (DynamicTrackedRace) toState.getExistingTrackedRace(getRaceIdentifier());
|
||||
if (trackedRace != null) {
|
||||
trackedRace.setWindSourcesToExclude(windSourcesToExclude);
|
||||
}
|
||||
return toState;
|
||||
}
|
||||
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package com.sap.sailing.server.operationaltransformation;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.leaderboard.Leaderboard;
|
||||
import com.sap.sailing.server.RacingEventService;
|
||||
|
||||
public class UpdateCompetitorDisplayNameInLeaderboard extends AbstractLeaderboardOperation {
|
||||
private static final long serialVersionUID = 366335484317671148L;
|
||||
private final String competitorIdAsString;
|
||||
private final String newDisplayName;
|
||||
|
||||
public UpdateCompetitorDisplayNameInLeaderboard(String leaderboardName, String competitorIdAdString,
|
||||
String newDisplayName) {
|
||||
super(leaderboardName);
|
||||
this.competitorIdAsString = competitorIdAdString;
|
||||
this.newDisplayName = newDisplayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RacingEventServiceOperation transformClientOp(RacingEventServiceOperation serverOp) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RacingEventServiceOperation transformServerOp(RacingEventServiceOperation clientOp) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RacingEventService applyTo(RacingEventService toState) {
|
||||
Leaderboard leaderboard = toState.getLeaderboardByName(getLeaderboardName());
|
||||
Competitor competitor = leaderboard.getCompetitorByIdAsString(competitorIdAsString);
|
||||
if (competitor != null) {
|
||||
leaderboard.setDisplayName(competitor, newDisplayName);
|
||||
toState.updateStoredLeaderboard(leaderboard);
|
||||
}
|
||||
return toState;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user