diff --git a/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/EventsResource.java b/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/EventsResource.java index ce5d5465aa3..65912538800 100644 --- a/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/EventsResource.java +++ b/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/EventsResource.java @@ -18,6 +18,7 @@ import java.util.Locale; import java.util.Map; import java.util.Spliterator; import java.util.UUID; +import java.util.logging.Logger; import java.util.stream.Collectors; import java.util.stream.Stream; import java.util.stream.StreamSupport; @@ -104,6 +105,7 @@ import com.sap.sse.shared.media.VideoDescriptor; @Path("/v1/events") public class EventsResource extends AbstractSailingServerResource { + private static final Logger logger = Logger.getLogger(EventsResource.class.getName()); private static final SimpleDateFormat dateTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -170,6 +172,8 @@ public class EventsResource extends AbstractSailingServerResource { } if (eventAndLeaderboardGroupAndLeaderboard.getC() != null) { jsonResponse.put("regatta", eventAndLeaderboardGroupAndLeaderboard.getC().getRegatta().getName()); + jsonResponse.put("registrationSecret", + eventAndLeaderboardGroupAndLeaderboard.getC().getRegatta().getRegistrationLinkSecret()); jsonResponse.put("leaderboard", eventAndLeaderboardGroupAndLeaderboard.getC().getName()); } response = ok(jsonResponse.toJSONString(), MediaType.APPLICATION_JSON); @@ -354,6 +358,9 @@ public class EventsResource extends AbstractSailingServerResource { if (regattaNameParam == null) { throw new IllegalArgumentException(ExceptionManager.parameterRequiredMsg("regattaName")); } + if (competitorRegistrationSecret == null) { + throw new IllegalArgumentException(ExceptionManager.parameterRequiredMsg("competitorRegistrationSecret")); + } if (boatClassNameParam == null) { throw new IllegalArgumentException(ExceptionManager.parameterRequiredMsg("boatClassName")); } @@ -458,11 +465,18 @@ public class EventsResource extends AbstractSailingServerResource { } final RegattaLeaderboard leaderboard; if (createRegatta) { + String localCompetitorRegistrationSecret = competitorRegistrationSecret; + if (localCompetitorRegistrationSecret == null) { + localCompetitorRegistrationSecret = UUID.randomUUID().toString(); + logger.warning( + "Got request that created a new Regatta without a registrationSecret, generated a new one"); + } leaderboard = validateAndCreateRegatta(event.getName(), boatClassName, /* scoringSchemeParam */ null, courseArea.getId(), /* buoyZoneRadiusInHullLengthsParam */ null, /* useStartTimeInterferenceParam */ null, /* controlTrackingFromStartAndFinishTimesParam */ null, /* rankingMetricParam */ null, /* leaderboardDiscardThresholdsParam */ null, - numberOfRacesParam, canBoatsOfCompetitorsChangePerRace, competitorRegistrationType, competitorRegistrationSecret); + numberOfRacesParam, canBoatsOfCompetitorsChangePerRace, competitorRegistrationType, + localCompetitorRegistrationSecret); if (leaderboardGroup != null) { getService().apply(new UpdateLeaderboardGroup(leaderboardGroup.getName(), leaderboardGroup.getName(), leaderboardGroup.getDescription(), leaderboardGroup.getDisplayName(), diff --git a/java/com.sap.sailing.server.gateway/webservices/api/v1/eventCreateEvent.html b/java/com.sap.sailing.server.gateway/webservices/api/v1/eventCreateEvent.html index fa28a48b92e..8aa96902454 100755 --- a/java/com.sap.sailing.server.gateway/webservices/api/v1/eventCreateEvent.html +++ b/java/com.sap.sailing.server.gateway/webservices/api/v1/eventCreateEvent.html @@ -60,7 +60,7 @@ consumption of this service simple.

numberofraces tells how many races shall be created in the default series; by default the series remains empty
canBoatsOfCompetitorsChangePerRace If true, boats and competitors can change per race, also it is necessary to register them in this case for each race!
competitorRegistrationType defines the registration type for competitor self registration to the regatta. Allowed values are CLOSED (no self registration) or OPEN_UNMODERATED (self registration for competitors is allowed)
-
secret a string that is used to verify competitor self registrations
+
secret a string that is used to verify competitor self registrations, if not given the server will generate one
@@ -79,6 +79,7 @@ consumption of this service simple.

"leaderboardgroupid":99859e24-2fe0-4c4e-bcbb-2df272a26c2c, "regatta":"Session admin 24-08-2017 16:46:40", "leaderboard":"Session admin 24-08-2017 16:46:40" + "secret":"123456789-fd82-45f6-a0a3-2920eb3307cb", }