mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-13 22:15:26 +00:00
Merge remote-tracking branch 'origin/master' into bug4811
This commit is contained in:
commit
ccb0e5b259
11 files changed
+41
-54
No files matched your search
+4
-1
@@ -483,6 +483,7 @@ import com.sap.sse.replication.ReplicationMasterDescriptor;
|
||||
import com.sap.sse.replication.ReplicationService;
|
||||
import com.sap.sse.security.Action;
|
||||
import com.sap.sse.security.SecurityService;
|
||||
import com.sap.sse.security.SessionUtils;
|
||||
import com.sap.sse.security.shared.AccessControlListAnnotation;
|
||||
import com.sap.sse.security.shared.HasPermissions;
|
||||
import com.sap.sse.security.shared.HasPermissions.DefaultActions;
|
||||
@@ -3827,7 +3828,9 @@ public class SailingServiceImpl extends ResultCachingProxiedRemoteServiceServlet
|
||||
if (entry.getValue() != null) {
|
||||
try {
|
||||
eventURLs.put(toLocale(entry.getKey()), new URL(entry.getValue()));
|
||||
} catch(Exception e) {
|
||||
} catch (Exception e) {
|
||||
logger.warning("User "+SessionUtils.getPrincipal()+
|
||||
" provided "+entry.getValue()+" as URL which didn't parse");
|
||||
// broken URLs or Locales are not being stored
|
||||
}
|
||||
}
|
||||
|
||||
+9
-9
@@ -1269,16 +1269,16 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili
|
||||
new Callable<EventDTO>() {
|
||||
@Override
|
||||
public EventDTO call() throws Exception {
|
||||
TimePoint startTimePoint = startDate != null ? new MillisecondsTimePoint(startDate) : null;
|
||||
TimePoint endTimePoint = endDate != null ? new MillisecondsTimePoint(endDate) : null;
|
||||
URL officialWebsiteURL = officialWebsiteURLAsString != null
|
||||
? new URL(officialWebsiteURLAsString)
|
||||
: null;
|
||||
URL baseURL = baseURLAsString != null ? new URL(baseURLAsString) : null;
|
||||
Map<Locale, URL> sailorsInfoWebsiteURLs = convertToLocalesAndUrls(
|
||||
final TimePoint startTimePoint = startDate != null ? new MillisecondsTimePoint(startDate) : null;
|
||||
final TimePoint endTimePoint = endDate != null ? new MillisecondsTimePoint(endDate) : null;
|
||||
final URL officialWebsiteURL = officialWebsiteURLAsString != null
|
||||
? new URL(officialWebsiteURLAsString)
|
||||
: null;
|
||||
final URL baseURL = baseURLAsString != null ? new URL(baseURLAsString) : null;
|
||||
final Map<Locale, URL> sailorsInfoWebsiteURLs = convertToLocalesAndUrls(
|
||||
sailorsInfoWebsiteURLsByLocaleName);
|
||||
List<ImageDescriptor> eventImages = convertToImages(images);
|
||||
List<VideoDescriptor> eventVideos = convertToVideos(videos);
|
||||
final List<ImageDescriptor> eventImages = convertToImages(images);
|
||||
final List<VideoDescriptor> eventVideos = convertToVideos(videos);
|
||||
getService().apply(new CreateEvent(eventName, eventDescription, startTimePoint, endTimePoint,
|
||||
venue, isPublic, eventUuid, officialWebsiteURL, baseURL, sailorsInfoWebsiteURLs,
|
||||
eventImages, eventVideos, leaderboardGroupIds));
|
||||
|
||||
+17
-10
@@ -6,6 +6,7 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
@@ -118,8 +119,18 @@ public class EventBaseDTO extends NamedDTO implements WithID, IsSerializable {
|
||||
return officialWebsiteURL;
|
||||
}
|
||||
|
||||
private String getUrlWithHttpsAsDefaultProtocolIfMissing(String url) {
|
||||
final String result;
|
||||
if (url != null && !url.contains("://")) {
|
||||
result = "https://" + url;
|
||||
} else {
|
||||
result = url;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setOfficialWebsiteURL(String officialWebsiteURL) {
|
||||
this.officialWebsiteURL = officialWebsiteURL;
|
||||
this.officialWebsiteURL = getUrlWithHttpsAsDefaultProtocolIfMissing(officialWebsiteURL);
|
||||
}
|
||||
|
||||
public Map<String, String> getSailorsInfoWebsiteURLs() {
|
||||
@@ -131,17 +142,17 @@ public class EventBaseDTO extends NamedDTO implements WithID, IsSerializable {
|
||||
}
|
||||
|
||||
public void setSailorsInfoWebsiteURL(String locale, String url) {
|
||||
if(url == null || url.isEmpty()) {
|
||||
if (url == null || url.isEmpty()) {
|
||||
sailorsInfoWebsiteURLs.remove(locale);
|
||||
} else {
|
||||
sailorsInfoWebsiteURLs.put(locale, url);
|
||||
sailorsInfoWebsiteURLs.put(locale, getUrlWithHttpsAsDefaultProtocolIfMissing(url));
|
||||
}
|
||||
}
|
||||
|
||||
public void setSailorsInfoWebsiteURLs(Map<String, String> sailorsInfoWebsiteURLs) {
|
||||
this.sailorsInfoWebsiteURLs.clear();
|
||||
if(sailorsInfoWebsiteURLs != null) {
|
||||
this.sailorsInfoWebsiteURLs.putAll(sailorsInfoWebsiteURLs);
|
||||
for (final Entry<String, String> e : sailorsInfoWebsiteURLs.entrySet()) {
|
||||
this.sailorsInfoWebsiteURLs.put(e.getKey(), getUrlWithHttpsAsDefaultProtocolIfMissing(e.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,11 +171,7 @@ public class EventBaseDTO extends NamedDTO implements WithID, IsSerializable {
|
||||
* NOTE: <code>https://</code> will be assumed if no protocol has been provided.
|
||||
*/
|
||||
public void setBaseURL(String baseURL) {
|
||||
if (baseURL != null && !baseURL.contains("://")) {
|
||||
this.baseURL = "https://" + baseURL;
|
||||
} else {
|
||||
this.baseURL = baseURL;
|
||||
}
|
||||
this.baseURL = getUrlWithHttpsAsDefaultProtocolIfMissing(baseURL);
|
||||
}
|
||||
|
||||
public Iterable<? extends LeaderboardGroupBaseDTO> getLeaderboardGroups() {
|
||||
|
||||
+2
-4
@@ -56,10 +56,8 @@ public class CompetitorApiTest extends AbstractSeleniumTest {
|
||||
assertEquals(competitor.getTimeOnTimeFactor(), competitorReloaded.getTimeOnTimeFactor());
|
||||
assertEquals(competitor.getTimeOnDistanceAllowanceInSecondsPerNauticalMile(),
|
||||
competitorReloaded.getTimeOnDistanceAllowanceInSecondsPerNauticalMile());
|
||||
assertEquals(competitor.getNationalityISO2(), competitorReloaded.get("countryCode"));
|
||||
assertEquals(competitor.getColor(), competitorReloaded.get("color"));
|
||||
assertEquals(competitor.getFlagImageUri(), competitorReloaded.get("flagImage"));
|
||||
assertEquals(competitor.getTeam().getTeamImageUri(), competitorReloaded.get("teamImageUri"));
|
||||
assertEquals(competitor.getNationalityISO2(), competitorReloaded.getNationalityISO2());
|
||||
assertEquals(competitor.getNationalityISO3(), competitorReloaded.getNationalityISO3());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
-10
@@ -144,16 +144,6 @@ public class CompetitorJsonSerializer implements JsonSerializer<Competitor> {
|
||||
result.put(CompetitorJsonConstants.FIELD_TIME_ON_DISTANCE_ALLOWANCE_IN_SECONDS_PER_NAUTICAL_MILE,
|
||||
competitor.getTimeOnDistanceAllowancePerNauticalMile() == null ? null :
|
||||
competitor.getTimeOnDistanceAllowancePerNauticalMile().asSeconds());
|
||||
// adding redundant values to migrate CompetitorsResource to use this serializer instead of its own; see also bug5289
|
||||
result.put(CompetitorJsonConstants.FIELD_COLOR, color == null ? null : color.getAsHtml());
|
||||
result.put(CompetitorJsonConstants.FIELD_COUNTRY_CODE,
|
||||
countryCode == null ? "" : countryCode.getTwoLetterISOCode());
|
||||
result.put(CompetitorJsonConstants.FIELD_FLAG_IMAGE,
|
||||
competitor.getFlagImage() != null ? competitor.getFlagImage().toString() : null);
|
||||
result.put(CompetitorJsonConstants.FIELD_TEAM_IMAGE_URI,
|
||||
competitor.getTeam() != null
|
||||
? competitor.getTeam().getImage() != null ? competitor.getTeam().getImage().toString() : null
|
||||
: null);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -37,6 +37,6 @@ public class CompetitorsResourceTest extends AbstractJaxRsApiTest {
|
||||
assertEquals(id, json.get("id"));
|
||||
assertEquals(name, json.get("name"));
|
||||
assertEquals(nationality, json.get("nationality"));
|
||||
assertEquals(countryCode, json.get("countryCode"));
|
||||
assertEquals(countryCode, json.get("nationalityISO2"));
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -35,7 +35,7 @@ public class MasterDataImportResource extends AbstractSailingServerResource {
|
||||
@FormParam("targetServerUsername") String targetServerUsername,
|
||||
@FormParam("targetServerPassword") String targetServerPassword,
|
||||
@FormParam("targetServerBearerToken") String targetServerBearerToken,
|
||||
@FormParam("uuids[]") List<UUID> requestedLeaderboardGroupIds,
|
||||
@FormParam("UUID[]") List<UUID> requestedLeaderboardGroupIds,
|
||||
@FormParam("override") Boolean override,
|
||||
@FormParam("compress") Boolean compress,
|
||||
@FormParam("exportWind") Boolean exportWind,
|
||||
|
||||
@@ -10,9 +10,7 @@
|
||||
<body>
|
||||
<h1>SAP Sailing Analytics Webservices API Version 1.0</h1>
|
||||
<h2>URL: /api/v1/competitors/{id}</h2>
|
||||
<p class="deprecationMessage">This API contains deprecated fields. These fields will be removed in near future.<br>
|
||||
The deprecated fields are marked as deprecated in the example below.<br>
|
||||
</p>
|
||||
|
||||
<br>
|
||||
<b>Description:</b>
|
||||
<p>Gets the details of a competitor</p>
|
||||
@@ -91,11 +89,7 @@
|
||||
},
|
||||
"timeOnTimeFactor": 2.4,
|
||||
"timeOnDistanceAllowanceInSecondsPerNauticalMile": 10000.0,
|
||||
<i class="deprecationMessage">deprecated - use "displayColor" instead </i>color": "#ABCDEF",
|
||||
<i class="deprecationMessage">deprecated - use "nationalityISO2" instead </i>"countryCode": "DE",
|
||||
<i class="deprecationMessage">deprecated - use "flagImageUri" instead </i>"flagImage": "http:\/\/flagimage.url",
|
||||
<i class="deprecationMessage">deprecated - use "team"/"imageUri" instead</i>"teamImageUri": "http:\/\/teamimage.url"
|
||||
}
|
||||
|
||||
</pre>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
+1
-8
@@ -10,9 +10,6 @@
|
||||
<body>
|
||||
<h1>SAP Sailing Analytics Webservices API Version 1.0</h1>
|
||||
<h2>URL: /api/v1/leaderboards/{name}/competitors/{competitorId}</h2>
|
||||
<p class="deprecationMessage">This API contains deprecated fields. These fields will be removed in near future.<br>
|
||||
The deprecated fields are marked as deprecated in the example below.<br>
|
||||
</p>
|
||||
|
||||
<b>Description:</b>
|
||||
<p>Gets the leaderboard-specific version of a competitor</p>
|
||||
@@ -89,11 +86,7 @@
|
||||
}
|
||||
},
|
||||
"timeOnTimeFactor": 2.4,
|
||||
"timeOnDistanceAllowanceInSecondsPerNauticalMile": 10000.0,
|
||||
<i class="deprecationMessage">deprecated - use "displayColor" instead </i>color": "#ABCDEF",
|
||||
<i class="deprecationMessage">deprecated - use "nationalityISO2" instead </i>"countryCode": "DE",
|
||||
<i class="deprecationMessage">deprecated - use "flagImageUri" instead </i>"flagImage": "http:\/\/flagimage.url",
|
||||
<i class="deprecationMessage">deprecated - use "team"/"imageUri" instead</i>"teamImageUri": "http:\/\/teamimage.url"
|
||||
"timeOnDistanceAllowanceInSecondsPerNauticalMile": 10000.0
|
||||
}
|
||||
</pre>
|
||||
</td>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<td>Mandatory parameters:</td>
|
||||
<td>
|
||||
<div>targetServerUrlAsString, the remote server from which to import.</div>
|
||||
<div>uuids[], the UUIDs of the leaderboardgroups to be requested from the remote server.</div>
|
||||
<div>UUID[], the UUIDs of the leaderboardgroups to be requested from the remote server.</div>
|
||||
<div>override, whether to override a leaderboardgroup already available on the server.</div>
|
||||
<div>compress, use only if remote server instance is at least running with commit 0fbf6071dea125bec4a56dee55d61c99def4a62e.</div>
|
||||
<div>exportWind, if false no wind data will be imported.</div>
|
||||
@@ -50,7 +50,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Example:</td>
|
||||
<td>curl -X POST http://127.0.0.1:8889/sailingserver/api/v1/masterdataimport -d "targetServerUrl=127.0.0.1:8888" -d "uuids[]=75e86618-8b0f-4291-9661-6b2a1fa47dff" -d "override=false" -d "compress=true" -d "exportWind=false" -d "exportDeviceConfigs=false" -d "exportTrackedRacesAndStartTracking=false" -d "targetServerUsername=admin" -d "targetServerPassword=admin" -H "Authorization: Basic YWRtaW46YWRtaW4="<br>
|
||||
<td>curl -X POST http://127.0.0.1:8889/sailingserver/api/v1/masterdataimport -d "targetServerUrl=127.0.0.1:8888" -d "UUID[]=75e86618-8b0f-4291-9661-6b2a1fa47dff" -d "override=false" -d "compress=true" -d "exportWind=false" -d "exportDeviceConfigs=false" -d "exportTrackedRacesAndStartTracking=false" -d "targetServerUsername=admin" -d "targetServerPassword=admin" -H "Authorization: Basic YWRtaW46YWRtaW4="<br>
|
||||
produces output:<pre>
|
||||
{
|
||||
"LeaderboardgroupsImported": {
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
<li>The file upload size limit was increased to a more contemporary 8GB.</li>
|
||||
<li>Added a field <tt>courseAreaId</tt> to the REST API output for regattas which now tells
|
||||
for each race in the regatta on which course area it saw its last start attempt.</li>
|
||||
<li>When creating or editing an event, URLs entered without protocol will now automatically be
|
||||
completed with "https://" as the protocol specification to avoid unnecessary errors.</li>
|
||||
</ul>
|
||||
<h2 class="articleSubheadline">June 2020</h2>
|
||||
<ul class="bulletList">
|
||||
|
||||
Reference in new issue
Block a user