mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-29 08:56:43 +00:00
Merge branch 'master' into dev
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -6,7 +6,8 @@ Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: SAP
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Fragment-Host: com.sap.sailing.gwt.ui
|
||||
Require-Bundle: com.sap.sailing.server
|
||||
Require-Bundle: com.sap.sailing.server,
|
||||
org.hamcrest.core;bundle-version="1.1.0"
|
||||
Bundle-ClassPath: .
|
||||
Import-Package: javax.jms;version="1.1.0",
|
||||
javax.servlet;version="2.5.0",
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
package com.sap.sailing.gwt.ui.test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -82,7 +83,7 @@ public class GwtTestCaseColumnToggling extends GWTTestCase {
|
||||
}
|
||||
|
||||
private void trackRace(){
|
||||
service.trackWithTracTrac(/* regattaToAddTo */null, rrDao, tractracTunnel ? "tcp://" + tractracTunnelHost + ":"
|
||||
service.trackWithTracTrac(/* regattaToAddTo */null, Collections.singleton(rrDao), tractracTunnel ? "tcp://" + tractracTunnelHost + ":"
|
||||
+ TracTracConnectionConstants.PORT_TUNNEL_LIVE : "tcp://" + TracTracConnectionConstants.HOST_NAME + ":"
|
||||
+ TracTracConnectionConstants.PORT_LIVE, tractracTunnel ? "tcp://" + tractracTunnelHost + ":"
|
||||
+ TracTracConnectionConstants.PORT_TUNNEL_STORED : "tcp://" + TracTracConnectionConstants.HOST_NAME
|
||||
|
||||
+8
-5
@@ -870,13 +870,16 @@ public class LeaderboardConfigPanel extends FormPanel implements RegattaDisplaye
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeTrackingRace(RegattaAndRaceIdentifier regattaAndRaceIdentifier, boolean isTracked) {
|
||||
for (Pair<RaceColumnDTO, FleetDTO> raceColumnAndFleetName : raceColumnAndFleetList.getList()) {
|
||||
if (raceColumnAndFleetName.getA().getRaceColumnName().equals(regattaAndRaceIdentifier.getRaceName())) {
|
||||
raceColumnAndFleetName.getA().setRaceIdentifier(raceColumnAndFleetName.getB(), regattaAndRaceIdentifier);
|
||||
public void changeTrackingRace(Iterable<? extends RegattaAndRaceIdentifier> regattaAndRaceIdentifiers, boolean isTracked) {
|
||||
for (RegattaAndRaceIdentifier regattaAndRaceIdentifier : regattaAndRaceIdentifiers) {
|
||||
for (Pair<RaceColumnDTO, FleetDTO> raceColumnAndFleetName : raceColumnAndFleetList.getList()) {
|
||||
if (raceColumnAndFleetName.getA().getRaceColumnName().equals(regattaAndRaceIdentifier.getRaceName())) {
|
||||
raceColumnAndFleetName.getA().setRaceIdentifier(raceColumnAndFleetName.getB(),
|
||||
regattaAndRaceIdentifier);
|
||||
}
|
||||
}
|
||||
raceColumnAndFleetList.refresh();
|
||||
}
|
||||
raceColumnAndFleetList.refresh();
|
||||
}
|
||||
|
||||
private void createFlexibleLeaderboard() {
|
||||
|
||||
+12
-9
@@ -339,24 +339,27 @@ public class SwissTimingEventManagementPanel extends AbstractEventManagementPane
|
||||
private void trackSelectedRaces(boolean trackWind, boolean correctWindByDeclination) {
|
||||
String hostname = hostnameTextbox.getValue();
|
||||
int port = portIntegerbox.getValue();
|
||||
for (final SwissTimingRaceRecordDTO rr : raceList.getList()) {
|
||||
if (raceTable.getSelectionModel().isSelected(rr)) {
|
||||
sailingService.trackWithSwissTiming(/* regattaToAddTo */ null, // TODO allow user to select a pre-defined regatta
|
||||
rr, hostname, port, /* canSendRequests */false,
|
||||
trackWind, correctWindByDeclination, new AsyncCallback<Void>() {
|
||||
final List<SwissTimingRaceRecordDTO> selectedRaces = new ArrayList<SwissTimingRaceRecordDTO>();
|
||||
for (final SwissTimingRaceRecordDTO race : this.raceList.getList()) {
|
||||
if (raceTable.getSelectionModel().isSelected(race)) {
|
||||
selectedRaces.add(race);
|
||||
}
|
||||
}
|
||||
sailingService.trackWithSwissTiming(
|
||||
/* regattaToAddTo */null, // TODO allow user to select a pre-defined regatta
|
||||
selectedRaces, hostname, port, /* canSendRequests */false, trackWind, correctWindByDeclination,
|
||||
new AsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Error trying to register race " + rr.ID + " for tracking: "
|
||||
errorReporter.reportError("Error trying to register races " + selectedRaces + " for tracking: "
|
||||
+ caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
regattaRefresher.fillRegattas();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updatePanelFromSelectedStoredConfiguration() {
|
||||
|
||||
+10
-8
@@ -387,14 +387,18 @@ public class SwissTimingReplayConnectorPanel extends AbstractEventManagementPane
|
||||
}
|
||||
}
|
||||
|
||||
for (final SwissTimingReplayRaceDTO replayRace : raceList.getList()) {
|
||||
if (raceTable.getSelectionModel().isSelected(replayRace)) {
|
||||
sailingService.replaySwissTimingRace(regattaIdentifier, replayRace, trackWind,
|
||||
correctWindByDeclination, simulateWithStartTimeNow, new AsyncCallback<Void>() {
|
||||
final List<SwissTimingReplayRaceDTO> selectedRaces = new ArrayList<SwissTimingReplayRaceDTO>();
|
||||
for (final SwissTimingReplayRaceDTO race : this.raceList.getList()) {
|
||||
if (raceTable.getSelectionModel().isSelected(race)) {
|
||||
selectedRaces.add(race);
|
||||
}
|
||||
}
|
||||
sailingService.replaySwissTimingRace(regattaIdentifier, selectedRaces, trackWind, correctWindByDeclination,
|
||||
simulateWithStartTimeNow, new AsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Error trying to register race " + replayRace.name + " for tracking: "
|
||||
+ caught.getMessage()+". Check live/stored URI syntax.");
|
||||
errorReporter.reportError("Error trying to register races " + selectedRaces
|
||||
+ " for tracking: " + caught.getMessage() + ". Check live/stored URI syntax.");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -402,8 +406,6 @@ public class SwissTimingReplayConnectorPanel extends AbstractEventManagementPane
|
||||
regattaRefresher.fillRegattas();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fillRaceListFromAvailableRacesApplyingFilter(String text) {
|
||||
|
||||
+7
-5
@@ -662,13 +662,17 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
}
|
||||
}
|
||||
|
||||
final List<TracTracRaceRecordDTO> selectedRaces = new ArrayList<TracTracRaceRecordDTO>();
|
||||
for (final TracTracRaceRecordDTO race : this.raceList.getList()) {
|
||||
if (selectionModel.isSelected(race)) {
|
||||
this.sailingService.trackWithTracTrac(regattaIdentifier, race, liveURI, storedURI, trackWind,
|
||||
correctWind, simulateWithStartTimeNow, new MarkedAsyncCallback<Void>() {
|
||||
selectedRaces.add(race);
|
||||
}
|
||||
}
|
||||
this.sailingService.trackWithTracTrac(regattaIdentifier, selectedRaces, liveURI, storedURI, trackWind, correctWind,
|
||||
simulateWithStartTimeNow, new MarkedAsyncCallback<Void>() {
|
||||
@Override
|
||||
public void handleFailure(Throwable caught) {
|
||||
reportError("Error trying to register race " + race.name + " for tracking: "
|
||||
reportError("Error trying to register races " + selectedRaces + " for tracking: "
|
||||
+ caught.getMessage() + ". Check live/stored URI syntax.");
|
||||
}
|
||||
|
||||
@@ -677,8 +681,6 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
TracTracEventManagementPanel.this.regattaRefresher.fillRegattas();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updatePanelFromSelectedStoredConfiguration() {
|
||||
|
||||
+1
-1
@@ -3,5 +3,5 @@ package com.sap.sailing.gwt.ui.adminconsole;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
|
||||
public interface TrackedRaceChangedListener {
|
||||
void changeTrackingRace(RegattaAndRaceIdentifier regattaAndRaceIdentifier, boolean isTracked);
|
||||
void changeTrackingRace(Iterable<? extends RegattaAndRaceIdentifier> regattaAndRaceIdentifiers, boolean isTracked);
|
||||
}
|
||||
|
||||
+14
-12
@@ -1,5 +1,7 @@
|
||||
package com.sap.sailing.gwt.ui.adminconsole;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -50,20 +52,24 @@ public class TrackedRacesListComposite extends AbstractTrackedRacesListComposite
|
||||
this.raceIsTrackedRaceChangeListener.add(listener);
|
||||
}
|
||||
|
||||
private void stopTrackingRace(final RaceDTO race) {
|
||||
final RegattaAndRaceIdentifier regattaAndRaceIdentifier = race.getRaceIdentifier();
|
||||
sailingService.stopTrackingRace(regattaAndRaceIdentifier, new AsyncCallback<Void>() {
|
||||
private void stopTrackingRaces(final Iterable<RaceDTO> races) {
|
||||
final List<RegattaAndRaceIdentifier> racesToStopTracking = new ArrayList<RegattaAndRaceIdentifier>();
|
||||
for (RaceDTO race : races) {
|
||||
if (race.isTracked) {
|
||||
racesToStopTracking.add(race.getRaceIdentifier());
|
||||
}
|
||||
}
|
||||
sailingService.stopTrackingRaces(racesToStopTracking, new AsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Exception trying to stop tracking race " + race.name + "in event "
|
||||
+ race.getRegattaName() + ": " + caught.getMessage());
|
||||
errorReporter.reportError("Exception trying to stop tracking races " + races + ": " + caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
regattaRefresher.fillRegattas();
|
||||
for (TrackedRaceChangedListener listener : raceIsTrackedRaceChangeListener) {
|
||||
listener.changeTrackingRace(regattaAndRaceIdentifier, false);
|
||||
listener.changeTrackingRace(racesToStopTracking, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -83,7 +89,7 @@ public class TrackedRacesListComposite extends AbstractTrackedRacesListComposite
|
||||
public void onSuccess(Void result) {
|
||||
regattaRefresher.fillRegattas();
|
||||
for (TrackedRaceChangedListener listener : raceIsTrackedRaceChangeListener) {
|
||||
listener.changeTrackingRace(regattaNameAndRaceName, false);
|
||||
listener.changeTrackingRace(Collections.singleton(regattaNameAndRaceName), false);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -108,11 +114,7 @@ public class TrackedRacesListComposite extends AbstractTrackedRacesListComposite
|
||||
btnUntrack.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent click) {
|
||||
for (RaceDTO selectedRace : getSelectedRaces()) {
|
||||
if (selectedRace.isTracked) {
|
||||
stopTrackingRace(selectedRace);
|
||||
}
|
||||
}
|
||||
stopTrackingRaces(getSelectedRaces());
|
||||
}
|
||||
});
|
||||
btnUntrack.setEnabled(false);
|
||||
|
||||
+6
-6
@@ -65,17 +65,20 @@ public interface SailingService extends RemoteService {
|
||||
|
||||
Pair<String, List<TracTracRaceRecordDTO>> listTracTracRacesInEvent(String eventJsonURL) throws Exception;
|
||||
|
||||
void trackWithTracTrac(RegattaIdentifier regattaToAddTo, TracTracRaceRecordDTO rr, String liveURI,
|
||||
void trackWithTracTrac(RegattaIdentifier regattaToAddTo, Iterable<TracTracRaceRecordDTO> rrs, String liveURI,
|
||||
String storedURI, boolean trackWind, boolean correctWindByDeclination, boolean simulateWithStartTimeNow) throws Exception;
|
||||
|
||||
void trackWithSwissTiming(RegattaIdentifier regattaToAddTo, SwissTimingRaceRecordDTO rr, String hostname, int port,
|
||||
void trackWithSwissTiming(RegattaIdentifier regattaToAddTo, Iterable<SwissTimingRaceRecordDTO> rrs, String hostname, int port,
|
||||
boolean canSendRequests, boolean trackWind, boolean correctWindByDeclination) throws Exception;
|
||||
|
||||
void replaySwissTimingRace(RegattaIdentifier regattaIdentifier, Iterable<SwissTimingReplayRaceDTO> replayRaces,
|
||||
boolean trackWind, boolean correctWindByDeclination, boolean simulateWithStartTimeNow);
|
||||
|
||||
void storeTracTracConfiguration(String name, String jsonURL, String liveDataURI, String storedDataURI) throws Exception;
|
||||
|
||||
void stopTrackingEvent(RegattaIdentifier eventIdentifier) throws Exception;
|
||||
|
||||
void stopTrackingRace(RegattaAndRaceIdentifier regattaAndRaceIdentifier) throws Exception;
|
||||
void stopTrackingRaces(Iterable<RegattaAndRaceIdentifier> racesToStopTracking) throws Exception;
|
||||
|
||||
void removeAndUntrackRace(RegattaAndRaceIdentifier regattaAndRaceidentifier) throws Exception;
|
||||
|
||||
@@ -273,9 +276,6 @@ public interface SailingService extends RemoteService {
|
||||
|
||||
List<SwissTimingReplayRaceDTO> listSwissTiminigReplayRaces(String swissTimingUrl);
|
||||
|
||||
void replaySwissTimingRace(RegattaIdentifier regattaIdentifier, SwissTimingReplayRaceDTO replayRace,
|
||||
boolean trackWind, boolean correctWindByDeclination, boolean simulateWithStartTimeNow);
|
||||
|
||||
List<Pair<String, List<CompetitorDTO>>> getRankedCompetitorsFromBestToWorstAfterEachRaceColumn(String leaderboardName, Date date) throws NoWindException;
|
||||
|
||||
List<String> getOverallLeaderboardNamesContaining(String leaderboardName);
|
||||
|
||||
+10
-18
@@ -83,9 +83,17 @@ public interface SailingServiceAsync {
|
||||
* {@link TracTracRaceRecordDTO#storedURI} from the <code>rr</code> race record.
|
||||
*/
|
||||
void trackWithTracTrac(RegattaIdentifier regattaToAddTo,
|
||||
TracTracRaceRecordDTO rr, String liveURI, String storedURI, boolean trackWind, boolean correctWindByDeclination,
|
||||
Iterable<TracTracRaceRecordDTO> rrs, String liveURI, String storedURI, boolean trackWind, boolean correctWindByDeclination,
|
||||
boolean simulateWithStartTimeNow, AsyncCallback<Void> callback);
|
||||
|
||||
void trackWithSwissTiming(RegattaIdentifier regattaToAddTo, Iterable<SwissTimingRaceRecordDTO> rrs,
|
||||
String hostname, int port, boolean canSendRequests, boolean trackWind, boolean correctWindByDeclination,
|
||||
AsyncCallback<Void> asyncCallback);
|
||||
|
||||
void replaySwissTimingRace(RegattaIdentifier regattaIdentifier, Iterable<SwissTimingReplayRaceDTO> replayRaces,
|
||||
boolean trackWind, boolean correctWindByDeclination, boolean simulateWithStartTimeNow,
|
||||
AsyncCallback<Void> asyncCallback);
|
||||
|
||||
void getPreviousTracTracConfigurations(AsyncCallback<List<TracTracConfigurationDTO>> callback);
|
||||
|
||||
void storeTracTracConfiguration(String name, String jsonURL, String liveDataURI, String storedDataURI,
|
||||
@@ -93,7 +101,7 @@ public interface SailingServiceAsync {
|
||||
|
||||
void stopTrackingEvent(RegattaIdentifier eventIdentifier, AsyncCallback<Void> callback);
|
||||
|
||||
void stopTrackingRace(RegattaAndRaceIdentifier raceIdentifier, AsyncCallback<Void> asyncCallback);
|
||||
void stopTrackingRaces(Iterable<RegattaAndRaceIdentifier> racesToStopTracking, AsyncCallback<Void> asyncCallback);
|
||||
|
||||
/**
|
||||
* Untracks the race and removes it from the regatta. It will also be removed in all leaderboards
|
||||
@@ -264,18 +272,6 @@ public interface SailingServiceAsync {
|
||||
|
||||
void storeSwissTimingConfiguration(String configName, String hostname, int port, boolean canSendRequests, AsyncCallback<Void> asyncCallback);
|
||||
|
||||
/**
|
||||
* @param regattaToAddTo
|
||||
* if <code>null</code>, an existing regatta by the name of the TracTrac event with the boat class name
|
||||
* appended in parentheses will be looked up; if not found, a default regatta with that name will be
|
||||
* created, with a single default series and a single default fleet. If a valid {@link RegattaIdentifier}
|
||||
* is specified, a regatta lookup is performed with that identifier; if the regatta is found, it is used
|
||||
* to add the races to. Otherwise, a default regatta as described above will be created and used.
|
||||
*/
|
||||
void trackWithSwissTiming(RegattaIdentifier regattaToAddTo, SwissTimingRaceRecordDTO rr, String hostname, int port,
|
||||
boolean canSendRequests, boolean trackWind, boolean correctWindByDeclination,
|
||||
AsyncCallback<Void> asyncCallback);
|
||||
|
||||
void sendSwissTimingDummyRace(String racMessage, String stlMesssage, String ccgMessage, AsyncCallback<Void> callback);
|
||||
|
||||
void getCountryCodes(AsyncCallback<String[]> callback);
|
||||
@@ -420,10 +416,6 @@ public interface SailingServiceAsync {
|
||||
|
||||
void listSwissTiminigReplayRaces(String swissTimingUrl, AsyncCallback<List<SwissTimingReplayRaceDTO>> asyncCallback);
|
||||
|
||||
void replaySwissTimingRace(RegattaIdentifier regattaIdentifier, SwissTimingReplayRaceDTO replayRace,
|
||||
boolean trackWind, boolean correctWindByDeclination, boolean simulateWithStartTimeNow,
|
||||
AsyncCallback<Void> asyncCallback);
|
||||
|
||||
void getRankedCompetitorsFromBestToWorstAfterEachRaceColumn(String leaderboardName, Date date,
|
||||
AsyncCallback<List<Pair<String, List<CompetitorDTO>>>> callback);
|
||||
|
||||
|
||||
+70
-56
@@ -1123,29 +1123,32 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trackWithTracTrac(RegattaIdentifier regattaToAddTo, TracTracRaceRecordDTO rr, String liveURI, String storedURI,
|
||||
public void trackWithTracTrac(RegattaIdentifier regattaToAddTo, Iterable<TracTracRaceRecordDTO> rrs, String liveURI, String storedURI,
|
||||
boolean trackWind, final boolean correctWindByDeclination, final boolean simulateWithStartTimeNow) throws Exception {
|
||||
if (liveURI == null || liveURI.trim().length() == 0) {
|
||||
liveURI = rr.liveURI;
|
||||
}
|
||||
if (storedURI == null || storedURI.trim().length() == 0) {
|
||||
storedURI = rr.storedURI;
|
||||
}
|
||||
final RacesHandle raceHandle = getService().addTracTracRace(regattaToAddTo, new URL(rr.paramURL),
|
||||
new URI(liveURI), new URI(storedURI), new MillisecondsTimePoint(rr.trackingStartTime),
|
||||
new MillisecondsTimePoint(rr.trackingEndTime),
|
||||
MongoWindStoreFactory.INSTANCE.getMongoWindStore(mongoObjectFactory, domainObjectFactory),
|
||||
RaceTracker.TIMEOUT_FOR_RECEIVING_RACE_DEFINITION_IN_MILLISECONDS, simulateWithStartTimeNow);
|
||||
if (trackWind) {
|
||||
new Thread("Wind tracking starter for race "+rr.regattaName+"/"+rr.name) {
|
||||
public void run() {
|
||||
try {
|
||||
startTrackingWind(raceHandle, correctWindByDeclination, RaceTracker.TIMEOUT_FOR_RECEIVING_RACE_DEFINITION_IN_MILLISECONDS);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
for (TracTracRaceRecordDTO rr : rrs) {
|
||||
if (liveURI == null || liveURI.trim().length() == 0) {
|
||||
liveURI = rr.liveURI;
|
||||
}
|
||||
if (storedURI == null || storedURI.trim().length() == 0) {
|
||||
storedURI = rr.storedURI;
|
||||
}
|
||||
final RacesHandle raceHandle = getService().addTracTracRace(regattaToAddTo, new URL(rr.paramURL),
|
||||
new URI(liveURI), new URI(storedURI), new MillisecondsTimePoint(rr.trackingStartTime),
|
||||
new MillisecondsTimePoint(rr.trackingEndTime),
|
||||
MongoWindStoreFactory.INSTANCE.getMongoWindStore(mongoObjectFactory, domainObjectFactory),
|
||||
RaceTracker.TIMEOUT_FOR_RECEIVING_RACE_DEFINITION_IN_MILLISECONDS, simulateWithStartTimeNow);
|
||||
if (trackWind) {
|
||||
new Thread("Wind tracking starter for race " + rr.regattaName + "/" + rr.name) {
|
||||
public void run() {
|
||||
try {
|
||||
startTrackingWind(raceHandle, correctWindByDeclination,
|
||||
RaceTracker.TIMEOUT_FOR_RECEIVING_RACE_DEFINITION_IN_MILLISECONDS);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1179,8 +1182,10 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopTrackingRace(RegattaAndRaceIdentifier regattaAndRaceIdentifier) throws Exception {
|
||||
getService().apply(new StopTrackingRace(regattaAndRaceIdentifier));
|
||||
public void stopTrackingRaces(Iterable<RegattaAndRaceIdentifier> regattaAndRaceIdentifiers) throws Exception {
|
||||
for (RegattaAndRaceIdentifier regattaAndRaceIdentifier : regattaAndRaceIdentifiers) {
|
||||
getService().apply(new StopTrackingRace(regattaAndRaceIdentifier));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2356,22 +2361,25 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trackWithSwissTiming(RegattaIdentifier regattaToAddTo, SwissTimingRaceRecordDTO rr, String hostname, int port,
|
||||
public void trackWithSwissTiming(RegattaIdentifier regattaToAddTo, Iterable<SwissTimingRaceRecordDTO> rrs, String hostname, int port,
|
||||
boolean canSendRequests, boolean trackWind, final boolean correctWindByDeclination) throws Exception {
|
||||
final RacesHandle raceHandle = getService().addSwissTimingRace(regattaToAddTo, rr.ID, hostname, port,
|
||||
canSendRequests,
|
||||
MongoWindStoreFactory.INSTANCE.getMongoWindStore(mongoObjectFactory, domainObjectFactory),
|
||||
RaceTracker.TIMEOUT_FOR_RECEIVING_RACE_DEFINITION_IN_MILLISECONDS);
|
||||
if (trackWind) {
|
||||
new Thread("Wind tracking starter for race "+rr.ID+"/"+rr.description) {
|
||||
public void run() {
|
||||
try {
|
||||
startTrackingWind(raceHandle, correctWindByDeclination, RaceTracker.TIMEOUT_FOR_RECEIVING_RACE_DEFINITION_IN_MILLISECONDS);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
for (SwissTimingRaceRecordDTO rr : rrs) {
|
||||
final RacesHandle raceHandle = getService().addSwissTimingRace(regattaToAddTo, rr.ID, hostname, port,
|
||||
canSendRequests,
|
||||
MongoWindStoreFactory.INSTANCE.getMongoWindStore(mongoObjectFactory, domainObjectFactory),
|
||||
RaceTracker.TIMEOUT_FOR_RECEIVING_RACE_DEFINITION_IN_MILLISECONDS);
|
||||
if (trackWind) {
|
||||
new Thread("Wind tracking starter for race " + rr.ID + "/" + rr.description) {
|
||||
public void run() {
|
||||
try {
|
||||
startTrackingWind(raceHandle, correctWindByDeclination,
|
||||
RaceTracker.TIMEOUT_FOR_RECEIVING_RACE_DEFINITION_IN_MILLISECONDS);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2392,30 +2400,36 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replaySwissTimingRace(RegattaIdentifier regattaIdentifier, SwissTimingReplayRaceDTO replayRaceDTO,
|
||||
public void replaySwissTimingRace(RegattaIdentifier regattaIdentifier, Iterable<SwissTimingReplayRaceDTO> replayRaceDTOs,
|
||||
boolean trackWind, boolean correctWindByDeclination, boolean simulateWithStartTimeNow) {
|
||||
Regatta regatta;
|
||||
if (regattaIdentifier == null) {
|
||||
String boatClass = replayRaceDTO.boat_class;
|
||||
for (String genderIndicator : new String[] { "Man", "Woman", "Men", "Women", "M", "W" }) {
|
||||
Pattern p = Pattern.compile("(( - )|-| )"+genderIndicator+"$");
|
||||
Matcher m = p.matcher(boatClass.trim());
|
||||
if (m.find()) {
|
||||
boatClass = boatClass.trim().substring(0, m.start(1));
|
||||
break;
|
||||
for (SwissTimingReplayRaceDTO replayRaceDTO : replayRaceDTOs) {
|
||||
if (regattaIdentifier == null) {
|
||||
String boatClass = replayRaceDTO.boat_class;
|
||||
for (String genderIndicator : new String[] { "Man", "Woman", "Men", "Women", "M", "W" }) {
|
||||
Pattern p = Pattern.compile("(( - )|-| )" + genderIndicator + "$");
|
||||
Matcher m = p.matcher(boatClass.trim());
|
||||
if (m.find()) {
|
||||
boatClass = boatClass.trim().substring(0, m.start(1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
regatta = getService().createRegatta(
|
||||
replayRaceDTO.rsc,
|
||||
boatClass.trim(),
|
||||
RegattaImpl.getFullName(replayRaceDTO.rsc, replayRaceDTO.boat_class),
|
||||
Collections.singletonList(new SeriesImpl("Default", /* isMedal */false, Collections
|
||||
.singletonList(new FleetImpl("Default")), /* race column names */
|
||||
new ArrayList<String>(), getService())), false,
|
||||
baseDomainFactory.createScoringScheme(ScoringSchemeType.LOW_POINT));
|
||||
} else {
|
||||
regatta = getService().getRegatta(regattaIdentifier);
|
||||
}
|
||||
regatta = getService().createRegatta(replayRaceDTO.rsc, boatClass.trim(),
|
||||
RegattaImpl.getFullName(replayRaceDTO.rsc, replayRaceDTO.boat_class),
|
||||
Collections.singletonList(new SeriesImpl("Default", /* isMedal */false, Collections
|
||||
.singletonList(new FleetImpl("Default")), /* race column names */new ArrayList<String>(),
|
||||
getService())),
|
||||
false, baseDomainFactory.createScoringScheme(ScoringSchemeType.LOW_POINT));
|
||||
} else {
|
||||
regatta = getService().getRegatta(regattaIdentifier);
|
||||
SwissTimingReplayService replayService = SwissTimingReplayServiceFactory.INSTANCE
|
||||
.createSwissTimingReplayService();
|
||||
replayService.loadRaceData(replayRaceDTO.link, getService().getSwissTimingDomainFactory(), regatta,
|
||||
getService());
|
||||
}
|
||||
SwissTimingReplayService replayService = SwissTimingReplayServiceFactory.INSTANCE.createSwissTimingReplayService();
|
||||
replayService.loadRaceData(replayRaceDTO.link, getService().getSwissTimingDomainFactory(), regatta, getService());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user