9b2ca2a58511dafdc66962aa0afbc3c9478b4546
java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/ParseTracTracJSONServiceOutputTest.java
| ... | ... | @@ -74,7 +74,7 @@ public class ParseTracTracJSONServiceOutputTest { |
| 74 | 74 | @Test |
| 75 | 75 | public void testWeymouthOnline() throws MalformedURLException, IOException, java.text.ParseException, ParseException, URISyntaxException { |
| 76 | 76 | JSONService jsonService = DomainFactory.INSTANCE.parseJSONURLWithRaceRecords(new URL( |
| 77 | - "http://" + TracTracConnectionConstants.HOST_NAME + "/events/event_20110505_SailingTea/jsonservice.php?trickOurProxy=true"), true); |
|
| 77 | + "http://" + TracTracConnectionConstants.HOST_NAME + "/events/event_20110505_SailingTea/jsonservice.php?trickOurProxy=true"), true, AbstractTracTracLiveTest.getTracTracApiToken()); |
|
| 78 | 78 | assertEquals("Academy Tracking 2011", jsonService.getEventName()); |
| 79 | 79 | List<RaceRecord> races = jsonService.getRaceRecords(); |
| 80 | 80 | assertTrue(races.size()>=28); |
| ... | ... | @@ -91,7 +91,7 @@ public class ParseTracTracJSONServiceOutputTest { |
| 91 | 91 | @Test |
| 92 | 92 | public void testWeymouthURIsOnline() throws MalformedURLException, IOException, java.text.ParseException, ParseException, URISyntaxException { |
| 93 | 93 | JSONService jsonService = DomainFactory.INSTANCE.parseJSONURLWithRaceRecords(new URL( |
| 94 | - "http://" + TracTracConnectionConstants.HOST_NAME + "/events/event_20110505_SailingTea/jsonservice.php"), true); |
|
| 94 | + "http://" + TracTracConnectionConstants.HOST_NAME + "/events/event_20110505_SailingTea/jsonservice.php"), true, AbstractTracTracLiveTest.getTracTracApiToken()); |
|
| 95 | 95 | List<RaceRecord> races = jsonService.getRaceRecords(); |
| 96 | 96 | assertFalse(races.isEmpty()); |
| 97 | 97 | for (RaceRecord race : races) { |
| ... | ... | @@ -115,7 +115,7 @@ public class ParseTracTracJSONServiceOutputTest { |
| 115 | 115 | @Test |
| 116 | 116 | public void testHamiltonOnline() throws MalformedURLException, IOException, java.text.ParseException, ParseException, URISyntaxException { |
| 117 | 117 | JSONService jsonService = DomainFactory.INSTANCE.parseJSONURLWithRaceRecords(new URL( |
| 118 | - "http://" + TracTracConnectionConstants.HOST_NAME + "/events/event_20110308_SAPWorldCh/jsonservice.php?humba=trala"), true); |
|
| 118 | + "http://" + TracTracConnectionConstants.HOST_NAME + "/events/event_20110308_SAPWorldCh/jsonservice.php?humba=trala"), true, AbstractTracTracLiveTest.getTracTracApiToken()); |
|
| 119 | 119 | assertEquals("SAP 2011 505 World Championship", jsonService.getEventName()); |
| 120 | 120 | List<RaceRecord> races = jsonService.getRaceRecords(); |
| 121 | 121 | assertEquals(14, races.size()); |
java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/DomainFactory.java
| ... | ... | @@ -244,7 +244,7 @@ public interface DomainFactory { |
| 244 | 244 | URI courseDesignUpdateURI, String tracTracApiToken, IEventSubscriber eventSubscriber, IRaceSubscriber raceSubscriber, boolean ignoreTracTracMarkPassings, |
| 245 | 245 | long timeoutInMilliseconds, RaceTrackingHandler raceTrackingHandler, RaceAndCompetitorStatusWithRaceLogReconciler raceAndCompetitorStatusWithRaceLogReconciler, ReceiverType... types); |
| 246 | 246 | |
| 247 | - JSONService parseJSONURLWithRaceRecords(URL jsonURL, boolean loadClientParams) throws IOException, ParseException, org.json.simple.parser.ParseException, URISyntaxException; |
|
| 247 | + JSONService parseJSONURLWithRaceRecords(URL jsonURL, boolean loadClientParams, String tracTracApiToken) throws IOException, ParseException, org.json.simple.parser.ParseException, URISyntaxException; |
|
| 248 | 248 | |
| 249 | 249 | /** |
| 250 | 250 | * Returns a {@link RaceDefinition} for the race if it already exists, <code>null</code> otherwise. |
| ... | ... | @@ -306,7 +306,7 @@ public interface DomainFactory { |
| 306 | 306 | */ |
| 307 | 307 | Serializable getRaceID(IRace tractracRace); |
| 308 | 308 | |
| 309 | - JSONService parseJSONURLForOneRaceRecord(URL jsonURL, String raceId, boolean loadClientParams) |
|
| 309 | + JSONService parseJSONURLForOneRaceRecord(URL jsonURL, String raceId, boolean loadClientParams, String tracTracApiToken) |
|
| 310 | 310 | throws IOException, ParseException, org.json.simple.parser.ParseException, URISyntaxException; |
| 311 | 311 | |
| 312 | 312 | MetadataParser getMetadataParser(); |
java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/RaceRecord.java
| ... | ... | @@ -18,7 +18,9 @@ import java.util.regex.Matcher; |
| 18 | 18 | import java.util.regex.Pattern; |
| 19 | 19 | |
| 20 | 20 | import com.sap.sse.InvalidDateException; |
| 21 | +import com.sap.sse.common.Duration; |
|
| 21 | 22 | import com.sap.sse.common.TimePoint; |
| 23 | +import com.sap.sse.common.Util; |
|
| 22 | 24 | import com.sap.sse.common.impl.MillisecondsTimePoint; |
| 23 | 25 | import com.sap.sse.util.DateParser; |
| 24 | 26 | import com.sap.sse.util.HttpUrlConnectionHelper; |
| ... | ... | @@ -49,7 +51,7 @@ public class RaceRecord { |
| 49 | 51 | public RaceRecord(URL jsonURL, String regattaName, String name, String replayURL, String paramURLAsString, |
| 50 | 52 | String ID, String trackingstarttime, String trackingendtime, String racestarttime, |
| 51 | 53 | String commaSeparatedBoatClassNames, String status, String visibility, boolean hasReplay, boolean loadLiveAndStoredURI, |
| 52 | - String defaultUpdateURI) |
|
| 54 | + String defaultUpdateURI, String tracTracApiToken) |
|
| 53 | 55 | throws URISyntaxException, IOException { |
| 54 | 56 | super(); |
| 55 | 57 | this.regattaName = regattaName; |
| ... | ... | @@ -109,7 +111,7 @@ public class RaceRecord { |
| 109 | 111 | throw e; |
| 110 | 112 | } |
| 111 | 113 | if (loadLiveAndStoredURI) { |
| 112 | - Map<String, String> paramURLContents = parseParams(paramURL); |
|
| 114 | + Map<String, String> paramURLContents = parseParams(paramURL, tracTracApiToken); |
|
| 113 | 115 | String liveURIAsString = paramURLContents.get(LIVE_URI_PROPERTY); |
| 114 | 116 | liveURI = liveURIAsString == null ? null : new URI(liveURIAsString); |
| 115 | 117 | String storedURIAsString = paramURLContents.get(STORED_URI_PROPERTY); |
| ... | ... | @@ -142,10 +144,17 @@ public class RaceRecord { |
| 142 | 144 | return technicalEventName; |
| 143 | 145 | } |
| 144 | 146 | |
| 145 | - private Map<String, String> parseParams(URL paramURL) throws IOException { |
|
| 147 | + private Map<String, String> parseParams(URL paramURL, String tracTracApiToken) throws IOException { |
|
| 146 | 148 | Map<String, String> result = new HashMap<String, String>(); |
| 147 | 149 | Pattern pattern = Pattern.compile("^([^:]*):(.*)$"); |
| 148 | - final URLConnection connection = HttpUrlConnectionHelper.redirectConnection(paramURL); |
|
| 150 | + final URLConnection connection = HttpUrlConnectionHelper.redirectConnection(paramURL, |
|
| 151 | + /* timeout */ Duration.ONE_MINUTE, |
|
| 152 | + /* pre-connection modifier adds authorization header: */ |
|
| 153 | + c -> { |
|
| 154 | + if (Util.hasLength(tracTracApiToken)) { |
|
| 155 | + c.setRequestProperty("Authorization", "Bearer "+tracTracApiToken); |
|
| 156 | + } |
|
| 157 | + }); |
|
| 149 | 158 | final Charset charset = HttpUrlConnectionHelper.getCharsetFromConnectionOrDefault(connection, "UTF-8"); |
| 150 | 159 | BufferedReader r = new BufferedReader(new InputStreamReader(connection.getInputStream(), charset)); |
| 151 | 160 | String line; |
java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/TracTracAdapter.java
| ... | ... | @@ -93,18 +93,18 @@ public interface TracTracAdapter { |
| 93 | 93 | * {@link #addTracTracRace(URL, URI, URI, WindStore, long)} calls to individually start tracking races of this |
| 94 | 94 | * event, rather than tracking <em>all</em> races in the event which is hardly ever useful. The returned pair's |
| 95 | 95 | * first component is the event name. |
| 96 | - * |
|
| 97 | 96 | * @param loadClientParams |
| 98 | 97 | * shall the properties from the clientparams.php file such as liveURI and storedURI already be loaded? |
| 99 | 98 | * Generally, this is not necessary as the |
| 100 | 99 | * {@link #addTracTracRace(TrackerManager, RegattaIdentifier, URL, URI, URI, URI, TimePoint, TimePoint, RaceLogStore, WindStore, long, boolean, String, String)} |
| 101 | 100 | * and {@link #addTracTracRace(TrackerManager, URL, URI, URI, URI, RaceLogStore, WindStore, long, String, String)} will |
| 102 | 101 | * fetch the JSON and clientparams.php documents to work with up-to-date data. |
| 102 | + * @param tracTracApiToken TODO |
|
| 103 | 103 | */ |
| 104 | - Util.Pair<String, List<RaceRecord>> getTracTracRaceRecords(URL jsonURL, boolean loadClientParams) throws IOException, |
|
| 104 | + Util.Pair<String, List<RaceRecord>> getTracTracRaceRecords(URL jsonURL, boolean loadClientParams, String tracTracApiToken) throws IOException, |
|
| 105 | 105 | ParseException, org.json.simple.parser.ParseException, URISyntaxException; |
| 106 | 106 | |
| 107 | - RaceRecord getSingleTracTracRaceRecord(URL jsonURL, String raceId, boolean loadClientParams) throws Exception; |
|
| 107 | + RaceRecord getSingleTracTracRaceRecord(URL jsonURL, String raceId, boolean loadClientParams, String tracTracApiToken) throws Exception; |
|
| 108 | 108 | |
| 109 | 109 | TracTracConfiguration createTracTracConfiguration(String creatorName, String name, String jsonURL, |
| 110 | 110 | String liveDataURI, String storedDataURI, String courseDesignUpdateURI, String tracTracApiToken); |
java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/DomainFactoryImpl.java
| ... | ... | @@ -1048,8 +1048,9 @@ public class DomainFactoryImpl implements DomainFactory { |
| 1048 | 1048 | } |
| 1049 | 1049 | |
| 1050 | 1050 | @Override |
| 1051 | - public JSONService parseJSONURLWithRaceRecords(URL jsonURL, boolean loadClientParams) throws IOException, ParseException, org.json.simple.parser.ParseException, URISyntaxException { |
|
| 1052 | - return new JSONServiceImpl(jsonURL, loadClientParams); |
|
| 1051 | + public JSONService parseJSONURLWithRaceRecords(URL jsonURL, boolean loadClientParams, String tracTracApiToken) |
|
| 1052 | + throws IOException, ParseException, org.json.simple.parser.ParseException, URISyntaxException { |
|
| 1053 | + return new JSONServiceImpl(jsonURL, loadClientParams, tracTracApiToken); |
|
| 1053 | 1054 | } |
| 1054 | 1055 | |
| 1055 | 1056 | @Override |
| ... | ... | @@ -1073,9 +1074,9 @@ public class DomainFactoryImpl implements DomainFactory { |
| 1073 | 1074 | } |
| 1074 | 1075 | |
| 1075 | 1076 | @Override |
| 1076 | - public JSONService parseJSONURLForOneRaceRecord(URL jsonURL, String raceId, boolean loadClientParams) |
|
| 1077 | + public JSONService parseJSONURLForOneRaceRecord(URL jsonURL, String raceId, boolean loadClientParams, String tracTracApiToken) |
|
| 1077 | 1078 | throws IOException, ParseException, org.json.simple.parser.ParseException, URISyntaxException { |
| 1078 | - return new JSONServiceImpl(jsonURL, raceId, loadClientParams); |
|
| 1079 | + return new JSONServiceImpl(jsonURL, raceId, loadClientParams, tracTracApiToken); |
|
| 1079 | 1080 | } |
| 1080 | 1081 | |
| 1081 | 1082 | @Override |
java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/JSONServiceImpl.java
| ... | ... | @@ -18,17 +18,18 @@ import org.json.simple.parser.JSONParser; |
| 18 | 18 | |
| 19 | 19 | import com.sap.sailing.domain.tractracadapter.JSONService; |
| 20 | 20 | import com.sap.sailing.domain.tractracadapter.RaceRecord; |
| 21 | +import com.sap.sse.common.Util; |
|
| 21 | 22 | import com.sap.sse.util.HttpUrlConnectionHelper; |
| 22 | 23 | |
| 23 | 24 | public class JSONServiceImpl implements JSONService { |
| 24 | 25 | private final String regattaName; |
| 25 | 26 | private final List<RaceRecord> raceRecords; |
| 26 | 27 | |
| 27 | - public JSONServiceImpl(URL jsonURL, boolean loadLiveAndStoredURI) throws IOException, ParseException, org.json.simple.parser.ParseException, URISyntaxException { |
|
| 28 | - this(jsonURL, /* race ID == null means load all race records */ null, loadLiveAndStoredURI); |
|
| 28 | + public JSONServiceImpl(URL jsonURL, boolean loadLiveAndStoredURI, String tracTracApiToken) throws IOException, ParseException, org.json.simple.parser.ParseException, URISyntaxException { |
|
| 29 | + this(jsonURL, /* race ID == null means load all race records */ null, loadLiveAndStoredURI, tracTracApiToken); |
|
| 29 | 30 | } |
| 30 | 31 | |
| 31 | - private RaceRecord createRaceRecord(URL jsonURL, boolean loadLiveAndStoredURI, JSONObject jsonRaceEntry, String defaultUpdateURI) |
|
| 32 | + private RaceRecord createRaceRecord(URL jsonURL, boolean loadLiveAndStoredURI, JSONObject jsonRaceEntry, String defaultUpdateURI, String tracTracApiToken) |
|
| 32 | 33 | throws URISyntaxException, IOException { |
| 33 | 34 | RaceRecord raceRecord = new RaceRecord(jsonURL, regattaName, |
| 34 | 35 | (String) jsonRaceEntry.get("name"), (String) jsonRaceEntry.get("url_html"), |
| ... | ... | @@ -41,7 +42,7 @@ public class JSONServiceImpl implements JSONService { |
| 41 | 42 | (String) jsonRaceEntry.get("status"), |
| 42 | 43 | (String) jsonRaceEntry.get("visibility"), |
| 43 | 44 | Boolean.valueOf((Boolean) jsonRaceEntry.get("has_replay")), |
| 44 | - /*loadLiveAndStoreURI*/ loadLiveAndStoredURI, defaultUpdateURI); |
|
| 45 | + /*loadLiveAndStoreURI*/ loadLiveAndStoredURI, defaultUpdateURI, tracTracApiToken); |
|
| 45 | 46 | return raceRecord; |
| 46 | 47 | } |
| 47 | 48 | |
| ... | ... | @@ -50,8 +51,11 @@ public class JSONServiceImpl implements JSONService { |
| 50 | 51 | * if {@code null}, add all races found to the {@link #raceRecords}; otherwise, add only the race whose |
| 51 | 52 | * ID matches |
| 52 | 53 | */ |
| 53 | - public JSONServiceImpl(URL jsonURL, String raceEntryId, boolean loadLiveAndStoredURI) throws IOException, ParseException, org.json.simple.parser.ParseException, URISyntaxException { |
|
| 54 | + public JSONServiceImpl(URL jsonURL, String raceEntryId, boolean loadLiveAndStoredURI, String tracTracApiToken) throws IOException, ParseException, org.json.simple.parser.ParseException, URISyntaxException { |
|
| 54 | 55 | final URLConnection connection = jsonURL.openConnection(); |
| 56 | + if (Util.hasLength(tracTracApiToken)) { |
|
| 57 | + connection.setRequestProperty("Authorization", "Bearer "+tracTracApiToken); |
|
| 58 | + } |
|
| 55 | 59 | final Charset charset = HttpUrlConnectionHelper.getCharsetFromConnectionOrDefault(connection, "UTF-8"); |
| 56 | 60 | JSONObject jsonObject = parseJSONObject(connection.getInputStream(), charset); |
| 57 | 61 | raceRecords = new ArrayList<RaceRecord>(); |
| ... | ... | @@ -60,7 +64,7 @@ public class JSONServiceImpl implements JSONService { |
| 60 | 64 | for (Object raceEntry : (JSONArray) jsonObject.get("races")) { |
| 61 | 65 | JSONObject jsonRaceEntry = (JSONObject) raceEntry; |
| 62 | 66 | if (raceEntryId == null || jsonRaceEntry.get("id").equals(raceEntryId)) { |
| 63 | - RaceRecord raceRecord = createRaceRecord(jsonURL, loadLiveAndStoredURI, jsonRaceEntry, defaultUpdateURI); |
|
| 67 | + RaceRecord raceRecord = createRaceRecord(jsonURL, loadLiveAndStoredURI, jsonRaceEntry, defaultUpdateURI, tracTracApiToken); |
|
| 64 | 68 | raceRecords.add(raceRecord); |
| 65 | 69 | } |
| 66 | 70 | } |
java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/RaceTrackingConnectivityParametersImpl.java
| ... | ... | @@ -80,6 +80,7 @@ public class RaceTrackingConnectivityParametersImpl extends AbstractRaceTracking |
| 80 | 80 | this.useOfficialEventsToUpdateRaceLog = useOfficialEventsToUpdateRaceLog; |
| 81 | 81 | this.paramURL = paramURL; |
| 82 | 82 | this.timeoutInMillis = timeoutInMillis; |
| 83 | + this.tracTracApiToken = tracTracApiToken; // required before trying getTractracRace() |
|
| 83 | 84 | final IRace tractracRace = getTractracRace(); |
| 84 | 85 | if (preferReplayIfAvailable && isReplayRace(tractracRace) && |
| 85 | 86 | (!Util.equalsWithNull(liveURI, tractracRace.getLiveURI()) || !Util.equalsWithNull(storedURI, tractracRace.getStoredURI()))) { |
| ... | ... | @@ -100,7 +101,6 @@ public class RaceTrackingConnectivityParametersImpl extends AbstractRaceTracking |
| 100 | 101 | this.offsetToStartTimeOfSimulatedRace = offsetToStartTimeOfSimulatedRace; |
| 101 | 102 | this.raceLogStore = raceLogStore; |
| 102 | 103 | this.regattaLogStore = regattaLogStore; |
| 103 | - this.tracTracApiToken = tracTracApiToken; |
|
| 104 | 104 | this.raceStatus = raceStatus; |
| 105 | 105 | this.raceVisibility = raceVisibility; |
| 106 | 106 | this.useInternalMarkPassingAlgorithm = useInternalMarkPassingAlgorithm; |
java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/TracTracAdapterImpl.java
| ... | ... | @@ -81,18 +81,18 @@ public class TracTracAdapterImpl implements TracTracAdapter { |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | @Override |
| 84 | - public Util.Pair<String, List<RaceRecord>> getTracTracRaceRecords(URL jsonURL, boolean loadClientParams) |
|
| 84 | + public Util.Pair<String, List<RaceRecord>> getTracTracRaceRecords(URL jsonURL, boolean loadClientParams, String tracTracApiToken) |
|
| 85 | 85 | throws IOException, ParseException, org.json.simple.parser.ParseException, URISyntaxException { |
| 86 | 86 | logger.info("Retrieving TracTrac race records from " + jsonURL); |
| 87 | - JSONService jsonService = getTracTracDomainFactory().parseJSONURLWithRaceRecords(jsonURL, loadClientParams); |
|
| 87 | + JSONService jsonService = getTracTracDomainFactory().parseJSONURLWithRaceRecords(jsonURL, loadClientParams, tracTracApiToken); |
|
| 88 | 88 | logger.info("OK retrieving TracTrac race records from " + jsonURL); |
| 89 | 89 | return new Util.Pair<String, List<RaceRecord>>(jsonService.getEventName(), jsonService.getRaceRecords()); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | @Override |
| 93 | - public RaceRecord getSingleTracTracRaceRecord(URL jsonURL, String raceId, boolean loadClientParams) |
|
| 93 | + public RaceRecord getSingleTracTracRaceRecord(URL jsonURL, String raceId, boolean loadClientParams, String tracTracApiToken) |
|
| 94 | 94 | throws Exception { |
| 95 | - JSONService service = getTracTracDomainFactory().parseJSONURLForOneRaceRecord(jsonURL, raceId, loadClientParams); |
|
| 95 | + JSONService service = getTracTracDomainFactory().parseJSONURLForOneRaceRecord(jsonURL, raceId, loadClientParams, tracTracApiToken); |
|
| 96 | 96 | if (!service.getRaceRecords().isEmpty()) { |
| 97 | 97 | return service.getRaceRecords().get(0); |
| 98 | 98 | } |
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/TracTracEventManagementPanel.java
| ... | ... | @@ -449,6 +449,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel i |
| 449 | 449 | if (selectedConnections.size() == 1) { |
| 450 | 450 | TracTracConfigurationWithSecurityDTO selectedConnection = selectedConnections.iterator().next(); |
| 451 | 451 | sailingService.listTracTracRacesInEvent(selectedConnection.getJsonUrl(), listHiddenRaces, |
| 452 | + selectedConnection.getTracTracApiToken(), |
|
| 452 | 453 | new MarkedAsyncCallback<com.sap.sse.common.Util.Pair<String, List<TracTracRaceRecordDTO>>>( |
| 453 | 454 | new AsyncCallback<com.sap.sse.common.Util.Pair<String, List<TracTracRaceRecordDTO>>>() { |
| 454 | 455 | @Override |
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/SailingService.java
| ... | ... | @@ -129,7 +129,7 @@ public interface SailingService extends RemoteService, RemoteReplicationService |
| 129 | 129 | List<EventDTO> getEvents() throws Exception; |
| 130 | 130 | |
| 131 | 131 | Util.Pair<String, List<TracTracRaceRecordDTO>> listTracTracRacesInEvent(String eventJsonURL, |
| 132 | - boolean listHiddenRaces) throws UnauthorizedException, Exception; |
|
| 132 | + boolean listHiddenRaces, String tracTracApiToken) throws UnauthorizedException, Exception; |
|
| 133 | 133 | |
| 134 | 134 | void replaySwissTimingRace(RegattaIdentifier regattaIdentifier, Iterable<SwissTimingReplayRaceDTO> replayRaces, |
| 135 | 135 | boolean trackWind, boolean correctWindByDeclination, boolean useInternalMarkPassingAlgorithm) |
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/SailingServiceAsync.java
| ... | ... | @@ -123,11 +123,10 @@ public interface SailingServiceAsync extends RemoteReplicationServiceAsync { |
| 123 | 123 | |
| 124 | 124 | /** |
| 125 | 125 | * The string returned in the callback's pair is the common event name |
| 126 | - * |
|
| 127 | 126 | * @param listHiddenRaces |
| 128 | 127 | */ |
| 129 | 128 | void listTracTracRacesInEvent(String eventJsonURL, boolean listHiddenRaces, |
| 130 | - AsyncCallback<Util.Pair<String, List<TracTracRaceRecordDTO>>> callback); |
|
| 129 | + String tracTracApiToken, AsyncCallback<Util.Pair<String, List<TracTracRaceRecordDTO>>> callback); |
|
| 131 | 130 | |
| 132 | 131 | void replaySwissTimingRace(RegattaIdentifier regattaIdentifier, Iterable<SwissTimingReplayRaceDTO> replayRaces, |
| 133 | 132 | boolean trackWind, boolean correctWindByDeclination, boolean useInternalMarkPassingAlgorithm, |
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/SailingServiceWrite.java
| ... | ... | @@ -115,7 +115,6 @@ import com.sap.sse.security.interfaces.UserStore; |
| 115 | 115 | import com.sap.sse.security.ui.shared.SuccessInfo; |
| 116 | 116 | |
| 117 | 117 | public interface SailingServiceWrite extends FileStorageManagementGwtService, SailingService { |
| 118 | - |
|
| 119 | 118 | void setORCPerformanceCurveScratchBoat(String leaderboardName, String raceColumnName, String fleetName, |
| 120 | 119 | CompetitorDTO newScratchBoatDTO) throws NotFoundException; |
| 121 | 120 |
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/SailingServiceImpl.java
| ... | ... | @@ -1287,9 +1287,9 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet |
| 1287 | 1287 | } |
| 1288 | 1288 | |
| 1289 | 1289 | @Override |
| 1290 | - public com.sap.sse.common.Util.Pair<String, List<TracTracRaceRecordDTO>> listTracTracRacesInEvent(String eventJsonURL, boolean listHiddenRaces) throws MalformedURLException, IOException, ParseException, org.json.simple.parser.ParseException, URISyntaxException { |
|
| 1290 | + public com.sap.sse.common.Util.Pair<String, List<TracTracRaceRecordDTO>> listTracTracRacesInEvent(String eventJsonURL, boolean listHiddenRaces, String tracTracApiToken) throws MalformedURLException, IOException, ParseException, org.json.simple.parser.ParseException, URISyntaxException { |
|
| 1291 | 1291 | com.sap.sse.common.Util.Pair<String,List<RaceRecord>> raceRecords; |
| 1292 | - raceRecords = getTracTracAdapter().getTracTracRaceRecords(new URL(eventJsonURL), /*loadClientParam*/ false); |
|
| 1292 | + raceRecords = getTracTracAdapter().getTracTracRaceRecords(new URL(eventJsonURL), /*loadClientParam*/ false, tracTracApiToken); |
|
| 1293 | 1293 | List<TracTracRaceRecordDTO> result = new ArrayList<TracTracRaceRecordDTO>(); |
| 1294 | 1294 | for (RaceRecord raceRecord : raceRecords.getB()) { |
| 1295 | 1295 | if (listHiddenRaces == false && raceRecord.getRaceVisibility().equals(TracTracConnectionConstants.HIDDEN_VISIBILITY)) { |
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/SailingServiceWriteImpl.java
| ... | ... | @@ -571,10 +571,11 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili |
| 571 | 571 | + " and storedURI " + storedURIFromConfiguration); |
| 572 | 572 | getSecurityService().checkCurrentUserServerPermission(ServerActions.CREATE_OBJECT); |
| 573 | 573 | final TracTracConfiguration config = tractracDomainObjectFactory.getTracTracConfiguration(jsonUrlAsKey); |
| 574 | + final String tracTracApiToken = config == null ? null : config.getTracTracApiToken(); |
|
| 574 | 575 | for (TracTracRaceRecordDTO rr : rrs) { |
| 575 | 576 | try { |
| 576 | 577 | // reload JSON and load clientparams.php |
| 577 | - final RaceRecord record = getTracTracAdapter().getSingleTracTracRaceRecord(new URL(rr.jsonURL), rr.id, /*loadClientParams*/true); |
|
| 578 | + final RaceRecord record = getTracTracAdapter().getSingleTracTracRaceRecord(new URL(rr.jsonURL), rr.id, /*loadClientParams*/true, tracTracApiToken); |
|
| 578 | 579 | logger.info("Loaded race " + record.getName() + " in " + record.getEventName() + " start:" + record.getRaceStartTime() + |
| 579 | 580 | " trackingStart:" + record.getTrackingStartTime() + " trackingEnd:" + record.getTrackingEndTime()); |
| 580 | 581 | // note that the live URI may be null for races that were put into replay mode |
| ... | ... | @@ -605,7 +606,7 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili |
| 605 | 606 | new MillisecondsTimePoint(record.getTrackingStartTime().asMillis()), |
| 606 | 607 | new MillisecondsTimePoint(record.getTrackingEndTime().asMillis()), getRaceLogStore(), |
| 607 | 608 | getRegattaLogStore(), RaceTracker.TIMEOUT_FOR_RECEIVING_RACE_DEFINITION_IN_MILLISECONDS, |
| 608 | - offsetToStartTimeOfSimulatedRace, useInternalMarkPassingAlgorithm, config == null ? null : config.getTracTracApiToken(), |
|
| 609 | + offsetToStartTimeOfSimulatedRace, useInternalMarkPassingAlgorithm, tracTracApiToken, |
|
| 609 | 610 | record.getRaceStatus(), record.getRaceVisibility(), trackWind, |
| 610 | 611 | correctWindByDeclination, useOfficialEventsToUpdateRaceLog, |
| 611 | 612 | liveURIFromConfiguration==null || liveURIFromConfiguration.trim().length() == 0 ? null : new URI(liveURIFromConfiguration), |