Add parameter for user regsitration to regatta

This commit is contained in:
Thomas Wiese
2018-09-18 16:09:41 +02:00
parent 1159eaf5ce
commit d992a3e9a0
77 changed files with 260 additions and 135 deletions
@@ -1280,10 +1280,15 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
canBoatsOfCompetitorsChangePerRace = false;
createMigratableRegatta = true;
}
Boolean canCompetitorsRegisterToOpenRegatta = (Boolean) dbRegatta
.get(FieldNames.REGATTA_CAN_COMPETITORS_REGISTER_TO_OPEN_REGATTA.name());
if (canCompetitorsRegisterToOpenRegatta == null) {
canCompetitorsRegisterToOpenRegatta = Boolean.FALSE;
}
final RankingMetricConstructor rankingMetricConstructor = loadRankingMetricConstructor(dbRegatta);
if (createMigratableRegatta) {
result = new MigratableRegattaImpl(getRaceLogStore(), getRegattaLogStore(), name, boatClass,
canBoatsOfCompetitorsChangePerRace, startDate, endDate, series, /* persistent */true,
canBoatsOfCompetitorsChangePerRace, canCompetitorsRegisterToOpenRegatta, startDate, endDate, series, /* persistent */true,
loadScoringScheme(dbRegatta), id, courseArea,
buoyZoneRadiusInHullLengths == null ? Regatta.DEFAULT_BUOY_ZONE_RADIUS_IN_HULL_LENGTHS
: buoyZoneRadiusInHullLengths,
@@ -1292,7 +1297,7 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
rankingMetricConstructor, new MongoObjectFactoryImpl(database));
} else {
result = new RegattaImpl(getRaceLogStore(), getRegattaLogStore(), name, boatClass,
canBoatsOfCompetitorsChangePerRace, startDate, endDate, series, /* persistent */true,
canBoatsOfCompetitorsChangePerRace, canCompetitorsRegisterToOpenRegatta, startDate, endDate, series, /* persistent */true,
loadScoringScheme(dbRegatta), id, courseArea,
buoyZoneRadiusInHullLengths == null ? Regatta.DEFAULT_BUOY_ZONE_RADIUS_IN_HULL_LENGTHS
: buoyZoneRadiusInHullLengths,
@@ -39,6 +39,7 @@ public enum FieldNames {
REGATTA_USE_START_TIME_INFERENCE,
REGATTA_CONTROL_TRACKING_FROM_START_AND_FINISH_TIMES,
REGATTA_CAN_BOATS_OF_COMPETITORS_CHANGE_PER_RACE,
REGATTA_CAN_COMPETITORS_REGISTER_TO_OPEN_REGATTA,
SERIES_NAME,
SERIES_IS_MEDAL,
SERIES_IS_FLEETS_CAN_RUN_IN_PARALLEL,
@@ -27,11 +27,12 @@ public class MigratableRegattaImpl extends RegattaImpl implements MigratableRega
private transient final MongoObjectFactory mongoObjectFactory;
public <S extends Series> MigratableRegattaImpl(RaceLogStore raceLogStore, RegattaLogStore regattaLogStore, String name,
BoatClass boatClass, boolean canBoatsOfCompetitorsChangePerRace, TimePoint startDate, TimePoint endDate,
BoatClass boatClass, boolean canBoatsOfCompetitorsChangePerRace, boolean canCompetitorsRegisterToOpenRegatta,
TimePoint startDate, TimePoint endDate,
Iterable<S> series, boolean persistent, ScoringScheme scoringScheme, Serializable id, CourseArea courseArea,
Double buoyZoneRadiusInHullLengths, boolean useStartTimeInference,
boolean controlTrackingFromStartAndFinishTimes, RankingMetricConstructor rankingMetricConstructor, MongoObjectFactory mongoObjectFactory) {
super(raceLogStore, regattaLogStore, name, boatClass, canBoatsOfCompetitorsChangePerRace, startDate, endDate, series,
super(raceLogStore, regattaLogStore, name, boatClass, canBoatsOfCompetitorsChangePerRace, canCompetitorsRegisterToOpenRegatta, startDate, endDate, series,
persistent, scoringScheme, id, courseArea, buoyZoneRadiusInHullLengths, useStartTimeInference,
controlTrackingFromStartAndFinishTimes, rankingMetricConstructor);
this.mongoObjectFactory = mongoObjectFactory;
@@ -42,6 +43,7 @@ public class MigratableRegattaImpl extends RegattaImpl implements MigratableRega
// It should not be possible to call this after races have been already added to this regatta.
assert !canBoatsOfCompetitorsChangePerRace() && Util.size(getAllRaces()) == 0;
super.setCanBoatsOfCompetitorsChangePerRace(true);
super.setCanCompetitorsRegisterToOpenRegatta(false);
if (mongoObjectFactory != null) {
logger.log(Level.INFO, "Bug2822 DB-Migration: Store migrated regatta '" + getName() + "' having now canBoatsOfCompetitorsChangePerRace=true.");
mongoObjectFactory.storeRegatta(this);
@@ -716,6 +716,7 @@ public class MongoObjectFactoryImpl implements MongoObjectFactory {
dbRegatta.put(FieldNames.REGATTA_USE_START_TIME_INFERENCE.name(), regatta.useStartTimeInference());
dbRegatta.put(FieldNames.REGATTA_CONTROL_TRACKING_FROM_START_AND_FINISH_TIMES.name(), regatta.isControlTrackingFromStartAndFinishTimes());
dbRegatta.put(FieldNames.REGATTA_CAN_BOATS_OF_COMPETITORS_CHANGE_PER_RACE.name(), regatta.canBoatsOfCompetitorsChangePerRace());
dbRegatta.put(FieldNames.REGATTA_CAN_COMPETITORS_REGISTER_TO_OPEN_REGATTA.name(), regatta.canCompetitorsRegisterToOpenRegatta());
dbRegatta.put(FieldNames.REGATTA_RANKING_METRIC.name(), storeRankingMetric(regatta));
boolean success = false;
final int MAX_TRIES = 3;
@@ -124,7 +124,7 @@ public class AbstractGPSFixStoreTest extends RaceLogTrackingTestHelper {
protected DynamicTrackedRaceImpl createDynamicTrackedRace(BoatClass boatClass, RaceDefinition raceDefinition) {
DynamicTrackedRegatta regatta = new DynamicTrackedRegattaImpl(new RegattaImpl(EmptyRaceLogStore.INSTANCE,
EmptyRegattaLogStore.INSTANCE, RegattaImpl.getDefaultName("regatta", boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */ null, /* endDate */null, null, null, "a", null));
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false, /* startDate */ null, /* endDate */null, null, null, "a", null));
return new DynamicTrackedRaceImpl(regatta, raceDefinition, Collections.<Sideline> emptyList(),
EmptyWindStore.INSTANCE, 0, 0, 0, /* useMarkPassingCalculator */ false, OneDesignRankingMetric::new,
mock(RaceLogResolver.class));
@@ -97,7 +97,7 @@ public class CreateAndTrackWithRaceLogTest extends RaceLogTrackingTestHelper {
Series series = new SeriesImpl("series", /* isMedal */ false, /* isFleetsCanRunInParallel */ true, Collections.singletonList(fleet), Collections.emptySet(),
service);
regatta = service.createRegatta(RegattaImpl.getDefaultName("regatta", "Laser"), "Laser",
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */null, /* endDate */null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false, /* startDate */null, /* endDate */null,
UUID.randomUUID(), Collections.<Series> singletonList(series), /* persistent */ true,
new HighPoint(), UUID.randomUUID(), /*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
series.addRaceColumn(columnName, /* trackedRegattaRegistry */null);
@@ -101,7 +101,8 @@ public class RaceLogFixTrackerManagerTest {
RaceDefinition race = new RaceDefinitionImpl("race", course, boatClass, competitorsAndBoats);
DynamicTrackedRegatta regatta = new DynamicTrackedRegattaImpl(new RegattaImpl(EmptyRaceLogStore.INSTANCE,
EmptyRegattaLogStore.INSTANCE, RegattaImpl.getDefaultName("regatta", boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */ null, /* endDate */null, null, null, "a", null));
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false,
/* startDate */ null, /* endDate */null, null, null, "a", null));
trackedRace = new DynamicTrackedRaceImpl(regatta, race, Collections.<Sideline> emptyList(),
EmptyWindStore.INSTANCE, 0, 0, 0, /* useMarkPassingCalculator */ false, OneDesignRankingMetric::new,
mock(RaceLogResolver.class));
@@ -167,7 +167,8 @@ public class SensorFixStoreAndLoadTest {
RaceDefinition race = new RaceDefinitionImpl("race", course, boatClass, competitorsAndBoats);
DynamicTrackedRegatta regatta = new DynamicTrackedRegattaImpl(new RegattaImpl(EmptyRaceLogStore.INSTANCE,
EmptyRegattaLogStore.INSTANCE, RegattaImpl.getDefaultName("regatta", boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */ null, /* endDate */null, null, null, "a", null));
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false,
/* startDate */ null, /* endDate */null, null, null, "a", null));
trackedRace = new DynamicTrackedRaceImpl(regatta, race, Collections.<Sideline> emptyList(),
EmptyWindStore.INSTANCE, 0, 0, 0, /* useMarkPassingCalculator */ false, OneDesignRankingMetric::new,
mock(RaceLogResolver.class));
@@ -77,7 +77,8 @@ public class TrackedRaceStartTimeInferenceTest extends AbstractGPSFixStoreTest {
TrackedRegatta regatta = new DynamicTrackedRegattaImpl(new RegattaImpl(EmptyRaceLogStore.INSTANCE,
EmptyRegattaLogStore.INSTANCE, RegattaImpl.getDefaultName("regatta", boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */ null, /* endDate */null, null, null, "a", null));
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false,
/* startDate */ null, /* endDate */null, null, null, "a", null));
final DynamicTrackedRaceImpl trackedRace = new DynamicTrackedRaceImpl(regatta, race,
Collections.<Sideline> emptyList(), EmptyWindStore.INSTANCE, 0, 0, 0,
/* useMarkPassingCalculator */ false,
@@ -153,7 +154,8 @@ public class TrackedRaceStartTimeInferenceTest extends AbstractGPSFixStoreTest {
RaceDefinition race = new RaceDefinitionImpl("race", course, boatClass, competitorsAndBoats);
TrackedRegatta regatta = new DynamicTrackedRegattaImpl(new RegattaImpl(EmptyRaceLogStore.INSTANCE,
EmptyRegattaLogStore.INSTANCE, RegattaImpl.getDefaultName("regatta", boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */ null, /* endDate */null, null, null, "a", null));
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false,
/* startDate */ null, /* endDate */null, null, null, "a", null));
final DynamicTrackedRaceImpl trackedRace = new DynamicTrackedRaceImpl(regatta, race,
Collections.<Sideline> emptyList(), EmptyWindStore.INSTANCE, 0, 0, 0,
/* useMarkPassingCalculator */ false,
@@ -195,7 +197,8 @@ public class TrackedRaceStartTimeInferenceTest extends AbstractGPSFixStoreTest {
RaceDefinition race = new RaceDefinitionImpl("race", course, boatClass, competitorsAndBoats);
TrackedRegatta regatta = new DynamicTrackedRegattaImpl(new RegattaImpl(EmptyRaceLogStore.INSTANCE,
EmptyRegattaLogStore.INSTANCE, RegattaImpl.getDefaultName("regatta", boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */ null, /* endDate */null, null, null, "a", null));
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false,
/* startDate */ null, /* endDate */null, null, null, "a", null));
final DynamicTrackedRaceImpl trackedRace = new DynamicTrackedRaceImpl(regatta, race,
Collections.<Sideline> emptyList(), EmptyWindStore.INSTANCE, 0, 0, 0,
/* useMarkPassingCalculator */ false,
@@ -240,7 +243,8 @@ public class TrackedRaceStartTimeInferenceTest extends AbstractGPSFixStoreTest {
RaceDefinition race = new RaceDefinitionImpl("race", course, boatClass, competitorsAndBoats);
TrackedRegatta regatta = new DynamicTrackedRegattaImpl(new RegattaImpl(EmptyRaceLogStore.INSTANCE,
EmptyRegattaLogStore.INSTANCE, RegattaImpl.getDefaultName("regatta", boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */ null, /* endDate */null, null, null, "a", null));
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false,
/* startDate */ null, /* endDate */null, null, null, "a", null));
assertTrue(regatta.getRegatta().useStartTimeInference());
final DynamicTrackedRaceImpl trackedRace = new DynamicTrackedRaceImpl(regatta, race,
Collections.<Sideline> emptyList(), EmptyWindStore.INSTANCE, 0, 0, 0,
@@ -354,7 +358,8 @@ public class TrackedRaceStartTimeInferenceTest extends AbstractGPSFixStoreTest {
RaceDefinition race = new RaceDefinitionImpl("race", course, boatClass, competitorsAndBoats);
TrackedRegatta regatta = new DynamicTrackedRegattaImpl(new RegattaImpl(EmptyRaceLogStore.INSTANCE,
EmptyRegattaLogStore.INSTANCE, RegattaImpl.getDefaultName("regatta", boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */null, /* endDate */null, null, null, "a", null));
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false,
/* startDate */null, /* endDate */null, null, null, "a", null));
final DynamicTrackedRaceImpl trackedRace = new DynamicTrackedRaceImpl(regatta, race,
Collections.<Sideline> emptyList(), EmptyWindStore.INSTANCE, 0, 0, 0,
/* useMarkPassingCalculator */ false,
@@ -109,7 +109,7 @@ public class SimpleDomainFactoryTest {
public void testCourseConfigForMark() throws PatchFailedException {
DomainFactory domainFactory = DomainFactory.INSTANCE;
Regatta regatta = new RegattaImpl(EmptyRaceLogStore.INSTANCE, EmptyRegattaLogStore.INSTANCE, "TestEvent",
/* boatClass */ null, /* canBoatsOfCompetitorsChangePerRace */ true,
/* boatClass */ null, /* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false,
/*startDate*/ null, /*endDate*/ null, new RacingEventServiceImpl(),
com.sap.sailing.domain.base.DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), "123", null);
Race race = new RaceImpl("1234", "R1", "Race 1234");
@@ -136,7 +136,7 @@ public class SimpleDomainFactoryTest {
public void testCourseConfigForGate() throws PatchFailedException {
DomainFactory domainFactory = DomainFactory.INSTANCE;
Regatta regatta = new RegattaImpl(EmptyRaceLogStore.INSTANCE, EmptyRegattaLogStore.INSTANCE,
"TestEvent", /* boatClass */ null, /* canBoatsOfCompetitorsChangePerRace */ true,
"TestEvent", /* boatClass */ null, /* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false,
/*startDate*/ null, /*endDate*/ null, new RacingEventServiceImpl(),
com.sap.sailing.domain.base.DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), "123", null);
Race race = new RaceImpl("1234", "R1", "Race 1234");
@@ -118,7 +118,8 @@ public class DomainFactoryImpl implements DomainFactory {
Calendar calendar = Calendar.getInstance();
result = new RegattaImpl(raceLogStore, regattaLogStore, RegattaImpl.getDefaultName(
"ST Regatta " + calendar.get(Calendar.YEAR) + " for race " + raceID, regattaBoatClass.getName()),
regattaBoatClass, /* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null,
regattaBoatClass, /* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false,
/*startDate*/ null, /*endDate*/ null,
trackedRegattaRegistry, getBaseDomainFactory().createScoringScheme(
ScoringSchemeType.LOW_POINT), raceID, null);
logger.info("Created regatta "+result.getName()+" ("+result.hashCode()+")");
@@ -97,7 +97,8 @@ public class TestFarthestAheadWithSkippedMarkPassing {
BoatClassImpl boatClass = new BoatClassImpl("Some Handicap Boat Class", /* typicallyStartsUpwind */ true);
Regatta regatta = new RegattaImpl(EmptyRaceLogStore.INSTANCE, EmptyRegattaLogStore.INSTANCE,
RegattaImpl.getDefaultName("Test Regatta", boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null, /* trackedRegattaRegistry */ null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false,
/*startDate*/ null, /*endDate*/ null, /* trackedRegattaRegistry */ null,
DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), "123", /* courseArea */ null, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
TrackedRegatta trackedRegatta = new DynamicTrackedRegattaImpl(regatta);
List<Waypoint> waypoints = new ArrayList<Waypoint>();
@@ -79,7 +79,7 @@ public class TestSimpleTimeOnTimeRankingWithOneUpwindLeg {
BoatClassImpl boatClass = new BoatClassImpl("Some Handicap Boat Class", /* typicallyStartsUpwind */ true);
Regatta regatta = new RegattaImpl(EmptyRaceLogStore.INSTANCE, EmptyRegattaLogStore.INSTANCE,
RegattaImpl.getDefaultName("Test Regatta", boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null, /* trackedRegattaRegistry */ null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false, /*startDate*/ null, /*endDate*/ null, /* trackedRegattaRegistry */ null,
DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), "123", /* courseArea */ null, /* controlTrackingFromStartAndFinishTimes */ false, TimeOnTimeAndDistanceRankingMetric::new);
TrackedRegatta trackedRegatta = new DynamicTrackedRegattaImpl(regatta);
List<Waypoint> waypoints = new ArrayList<Waypoint>();
@@ -78,7 +78,7 @@ public class CompetitorProviderCacheInvalidationTest extends AbstractLeaderboard
competitorProviderFlexibleLeaderboard = new CompetitorProviderFromRaceColumnsAndRegattaLike(flexibleLeaderboard);
regatta = new RegattaImpl(EmptyRaceLogStore.INSTANCE,
EmptyRegattaLogStore.INSTANCE, "Test Regatta", new BoatClassImpl("49er", BoatClassMasterdata._49ER),
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */ null, /* endDate */null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false, /* startDate */ null, /* endDate */null,
/* trackedRegattaRegistry */null, new LowPoint(), UUID.randomUUID(),
courseArea);
regattaLeaderboard = new RegattaLeaderboardImpl(regatta, new ThresholdBasedResultDiscardingRuleImpl(new int[0]));
@@ -308,7 +308,7 @@ public class CourseTest {
final Map<Competitor,Boat> competitorsAndBoats = new HashMap<>();
competitorsAndBoats.put(hasso, hasso.getBoat());
DynamicTrackedRace trackedRace = new DynamicTrackedRaceImpl(/* trackedRegatta */new DynamicTrackedRegattaImpl(
new RegattaImpl("test", null, true, null, null, new HashSet<Series>(), false, null, "test", null, OneDesignRankingMetric::new)),
new RegattaImpl("test", null, true, false, null, null, new HashSet<Series>(), false, null, "test", null, OneDesignRankingMetric::new)),
new RaceDefinitionImpl("Test Race", course, boatClass, competitorsAndBoats),
Collections.<Sideline> emptyList(), EmptyWindStore.INSTANCE, /* delayToLiveInMillis */3000,
/* millisecondsOverWhichToAverageWind */30000,
@@ -342,7 +342,7 @@ public class CourseTest {
final Map<Competitor,Boat> competitorsAndBoats = new HashMap<>();
competitorsAndBoats.put(hasso, hasso.getBoat());
DynamicTrackedRace trackedRace = new DynamicTrackedRaceImpl(/* trackedRegatta */ new DynamicTrackedRegattaImpl(
new RegattaImpl("test", null, true, null, null, new HashSet<Series>(), false, null, "test", null, OneDesignRankingMetric::new)),
new RegattaImpl("test", null, true, false, null, null, new HashSet<Series>(), false, null, "test", null, OneDesignRankingMetric::new)),
new RaceDefinitionImpl("Test Race", course, boatClass, competitorsAndBoats), Collections.<Sideline> emptyList(),
EmptyWindStore.INSTANCE, /* delayToLiveInMillis */ 3000,
/* millisecondsOverWhichToAverageWind */ 30000,
@@ -77,7 +77,8 @@ public class CourseUpdateDuringNonAtomicSerializationTest implements Serializabl
course = new CourseImpl("Test Course", waypoints);
Regatta regatta = new RegattaImpl(EmptyRaceLogStore.INSTANCE, EmptyRegattaLogStore.INSTANCE, "Test Regatta",
new BoatClassImpl("505", BoatClassMasterdata._5O5),
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null, /* trackedRegattaRegistry */ null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false,
/*startDate*/ null, /*endDate*/ null, /* trackedRegattaRegistry */ null,
new LowPoint(), UUID.randomUUID(), new CourseAreaImpl("Alpha", UUID.randomUUID()));
TrackedRegatta trackedRegatta = new TrackedRegattaImpl(regatta);
RaceDefinition race = new RaceDefinitionImpl("Test Race", course, regatta.getBoatClass(), Collections.<Competitor,Boat>emptyMap());
@@ -91,7 +91,7 @@ public class LeaderboardCourseChangeTest {
RaceColumn raceColumn = series.addRaceColumn(raceColumnName, trackedRegattaRegistry);
ScoringScheme scoringScheme = new LowPoint();
Regatta mockedRegatta = new RegattaImpl(RegattaImpl.getDefaultName("TestRegatta", boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null, seriesSet, false, scoringScheme,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null, seriesSet, false, scoringScheme,
UUID.randomUUID(), mock(CourseArea.class), OneDesignRankingMetric::new);
ControlPoint start = new MarkImpl("Start");
ControlPoint m1 = new MarkImpl("M1");
@@ -1714,7 +1714,8 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
TrackedRegattaRegistry trackedRegattaRegistry = mock(TrackedRegattaRegistry.class);
Regatta dummyRegatta = new RegattaImpl(EmptyRaceLogStore.INSTANCE, EmptyRegattaLogStore.INSTANCE, "Dummy",
new BoatClassImpl("Extreme40", false),
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null, trackedRegattaRegistry,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false,
/*startDate*/ null, /*endDate*/ null, trackedRegattaRegistry,
new HighPointFirstGets10Or8AndLastBreaksTie(), "578876345345",
new CourseAreaImpl("Humba", UUID.randomUUID()));
trackedRegattaRegistry.getOrCreateTrackedRegatta(dummyRegatta);
@@ -2326,7 +2327,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
}
final BoatClass boatClass = DomainFactory.INSTANCE.getOrCreateBoatClass("Extreme40", /* typicallyStartsUpwind */ false);
Regatta regatta = new RegattaImpl(RegattaImpl.getDefaultName("Test Regatta", boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null,
series, /* persistent */false, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.HIGH_POINT_FIRST_GETS_TEN), "123", /* course area */null, OneDesignRankingMetric::new);
List<Competitor> competitors = createCompetitors(12);
final int firstYellowCompetitorIndex = 3;
@@ -2445,7 +2446,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
}
final BoatClass boatClass = DomainFactory.INSTANCE.getOrCreateBoatClass("470", /* typicallyStartsUpwind */ true);
Regatta regatta = new RegattaImpl(RegattaImpl.getDefaultName("Test Regatta", boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null,
series, /* persistent */false, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), "123", /* course area */null, OneDesignRankingMetric::new);
List<Competitor> competitors = createCompetitors(12);
final int firstYellowCompetitorIndex = 3;
@@ -2558,7 +2559,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
}
final BoatClass boatClass = DomainFactory.INSTANCE.getOrCreateBoatClass("470", /* typicallyStartsUpwind */ true);
Regatta regatta = new RegattaImpl(RegattaImpl.getDefaultName("Test Regatta", boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null,
series, /* persistent */false, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), "123", /* course area */null, OneDesignRankingMetric::new);
List<Competitor> competitors = createCompetitors(12);
final int firstYellowCompetitorIndex = 3;
@@ -2647,7 +2648,7 @@ public class LeaderboardScoringAndRankingTest extends LeaderboardScoringAndRanki
}
final BoatClass boatClass = DomainFactory.INSTANCE.getOrCreateBoatClass("470", /* typicallyStartsUpwind */ true);
Regatta regatta = new RegattaImpl(RegattaImpl.getDefaultName("Test Regatta", boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null,
series, /* persistent */false, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), "123", /* course area */null, OneDesignRankingMetric::new);
final int TOTAL_NUMBER_OF_COMPETITORS = 100;
List<Competitor> competitors = createCompetitors(TOTAL_NUMBER_OF_COMPETITORS);
@@ -126,7 +126,7 @@ public class LeaderboardScoringAndRankingTestBase extends AbstractLeaderboardTes
series.add(defaultSeries);
Regatta regatta = new RegattaImpl(RegattaImpl.getDefaultName(regattaName, boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */null, /* endDate */null, series,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /* startDate */null, /* endDate */null, series,
/* persistent */false, scoringScheme, "123", null, OneDesignRankingMetric::new);
return regatta;
}
@@ -182,7 +182,7 @@ public class LeaderboardScoringAndRankingTestBase extends AbstractLeaderboardTes
}
Regatta regatta = new RegattaImpl(RegattaImpl.getDefaultName(regattaBaseName, boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null, series,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null, series,
/* persistent */ false, scoringScheme, "123", null, OneDesignRankingMetric::new);
return regatta;
}
@@ -228,7 +228,7 @@ public class LeaderboardScoringAndRankingTestBase extends AbstractLeaderboardTes
}
}
Regatta regatta = new RegattaImpl(RegattaImpl.getDefaultName(regattaBaseName, boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null, series,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null, series,
/* persistent */ false, scoringScheme, /* ID */ "123", /* course area */ null, OneDesignRankingMetric::new);
return regatta;
}
@@ -65,7 +65,7 @@ public class LeaderboardScoringAndRankingTestForLowPoints extends LeaderboardSco
private Regatta setupRegatta(boolean useFirstTwoWins) {
final BoatClass boatClass = DomainFactory.INSTANCE.getOrCreateBoatClass("470", /* typicallyStartsUpwind */ true);
Regatta regatta = new RegattaImpl(RegattaImpl.getDefaultName("Test Regatta", boatClass.getName()), boatClass,
false, /* startDate */ null, /* endDate */ null, series, /* persistent */false,
false, /* canCompetitorsRegisterToOpenRegatta */ false, /* startDate */ null, /* endDate */ null, series, /* persistent */false,
DomainFactory.INSTANCE
.createScoringScheme(useFirstTwoWins ? ScoringSchemeType.LOW_POINT_FIRST_TO_WIN_TWO_RACES
: ScoringSchemeType.LOW_POINT),
@@ -229,7 +229,7 @@ public class RaceExecutionOrderProvdiderAttachDetachTest extends TrackBasedTest
raceColumnInSeries = series.addRaceColumn(RACECOLUMN_SERIES, null);
ScoringScheme scoringScheme = new LowPoint();
regatta = new RegattaImpl(RegattaImpl.getDefaultName(REGATTA, boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */null, /* endDate */null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /* startDate */null, /* endDate */null,
seriesSet, false, scoringScheme, UUID.randomUUID(), null, OneDesignRankingMetric::new);
}
@@ -94,7 +94,8 @@ public class ReachingLegTest extends TrackBasedTest {
BoatClassImpl boatClass = new BoatClassImpl(boatClassName, /* typicallyStartsUpwind */ true);
Regatta regatta = new RegattaImpl(EmptyRaceLogStore.INSTANCE, EmptyRegattaLogStore.INSTANCE,
RegattaImpl.getDefaultName(regattaName, boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null, /* trackedRegattaRegistry */ null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false,
/*startDate*/ null, /*endDate*/ null, /* trackedRegattaRegistry */ null,
DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), "123", null);
TrackedRegatta trackedRegatta = new DynamicTrackedRegattaImpl(regatta);
List<Waypoint> waypoints = new ArrayList<Waypoint>();
@@ -115,7 +115,7 @@ public class RegattaLogEventNotificationForwardingTest extends AbstractSerializa
@Test
public void testRegattaLeaderboardRegattaLogEventForwarding() {
Regatta regatta = new RegattaImpl("test", null, true, null, null, new HashSet<Series>(), false, null, "test", null, OneDesignRankingMetric::new);
Regatta regatta = new RegattaImpl("test", null, true, false, null, null, new HashSet<Series>(), false, null, "test", null, OneDesignRankingMetric::new);
final RegattaLogEvent[] receivedRegattaLogEvent = new RegattaLogEvent[1];
regatta.addRaceColumnListener(new RaceColumnListenerWithDefaultAction() {
private static final long serialVersionUID = -3835439531940986851L;
@@ -136,7 +136,7 @@ public class RegattaLogEventNotificationForwardingTest extends AbstractSerializa
@Test
public void testRegattaLeaderboardRegattaLogEventForwardingAfterRegattaDeserialization() throws ClassNotFoundException, IOException {
Regatta regatta = new RegattaImpl("test", null, true, null, null, new HashSet<Series>(), false, null, "test", null, OneDesignRankingMetric::new);
Regatta regatta = new RegattaImpl("test", null, true, false, null, null, new HashSet<Series>(), false, null, "test", null, OneDesignRankingMetric::new);
Regatta deserializedRegatta = cloneBySerialization(regatta, DomainFactory.INSTANCE);
final RegattaLogEvent[] receivedRegattaLogEvent = new RegattaLogEvent[1];
deserializedRegatta.addRaceColumnListener(new RaceColumnListenerWithDefaultAction() {
@@ -181,7 +181,7 @@ public class RegattaLogEventNotificationForwardingTest extends AbstractSerializa
Series series = new SeriesImpl("Test Series", /* isMedal */ false, /* isFleetsCanRunInParallel */ true,
/* fleets */ Collections.singleton(new FleetImpl("Default")),
Collections.singleton("R1"), /* trackedRegattaRegistry */ null);
Regatta regatta = new RegattaImpl("test", null, true, null, null, Collections.singleton(series), false,
Regatta regatta = new RegattaImpl("test", null, true, false, null, null, Collections.singleton(series), false,
new LowPoint(), "test", null, OneDesignRankingMetric::new);
return regatta;
}
@@ -34,7 +34,8 @@ public class SerializeRankingMetricTest extends AbstractSerializationTest {
final BoatClass _49er = DomainFactory.INSTANCE.getOrCreateBoatClass("49er");
final TrackedRace trackedRace = new DynamicTrackedRaceImpl(new DynamicTrackedRegattaImpl(
new RegattaImpl(EmptyRaceLogStore.INSTANCE, EmptyRegattaLogStore.INSTANCE, "Regatta", /* boatClass */ _49er,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */ null, /* endDate */ null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false,
/* startDate */ null, /* endDate */ null,
/* trackedRegattaRegistry */ null, new LowPoint(), UUID.randomUUID(), /* courseArea */ null)),
new RaceDefinitionImpl("Race", new CourseImpl("Course", Collections.<Waypoint>emptyList()) ,
/* boatClass */ _49er, Collections.<Competitor,Boat>emptyMap()),
@@ -50,7 +50,8 @@ public class TestDeadlockInRegattaListener {
final String regattaName = "Test Regatta";
final RegattaImpl regatta = new RegattaImpl(
/* raceLogStore */ null, EmptyRegattaLogStore.INSTANCE, regattaName,
new BoatClassImpl("49er", true), /* can boats change */ false, /* startDate */ null, /* endDate */ null,
new BoatClassImpl("49er", true), /* can boats change */ false, /* canCompetitorsRegisterToOpenRegatta*/ false,
/* startDate */ null, /* endDate */ null,
/* trackedRegattaRegistry */ null, new LowPoint(), UUID.randomUUID(),
/* courseArea */ null, /* controlTrackingFromStartAndFinishTimes */ true,
OneDesignRankingMetric::new);
@@ -161,7 +161,8 @@ public abstract class TrackBasedTest {
BoatClassImpl boatClass = new BoatClassImpl(boatClassName, /* typicallyStartsUpwind */ true);
Regatta regatta = new RegattaImpl(EmptyRaceLogStore.INSTANCE, EmptyRegattaLogStore.INSTANCE,
RegattaImpl.getDefaultName(regattaName, boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null, /* trackedRegattaRegistry */ null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false,
/*startDate*/ null, /*endDate*/ null, /* trackedRegattaRegistry */ null,
DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), "123", null);
TrackedRegatta trackedRegatta = new DynamicTrackedRegattaImpl(regatta);
List<Waypoint> waypoints = new ArrayList<Waypoint>();
@@ -211,7 +212,7 @@ public abstract class TrackBasedTest {
TrackedRegattaRegistry trackedRegattaRegistry = mock(TrackedRegattaRegistry.class);
Series series = new SeriesImpl("series name", isMedal, /* isFleetsCanRunInParallel */ true, regattaFleets, raceColumnNames, trackedRegattaRegistry);
Iterable<? extends Series> regattaSeries = Collections.singleton(series);
return new RegattaImpl(regattaName, boatClass, /* canBoatsOfCompetitorsChangePerRace */ true,
return new RegattaImpl(regattaName, boatClass, /* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false,
startDate, endDate, regattaSeries, persistent, scoringScheme, regatteId , courseArea, OneDesignRankingMetric::new);
}
@@ -44,7 +44,7 @@ public class UpdateMarkPassingTest {
when(race.getBoatClass()).thenReturn(new BoatClassImpl("49er", /* typicallyStartsUpwind */ true));
when(race.getCompetitors()).thenReturn(Collections.singleton(competitor));
DynamicTrackedRaceImpl trackedRace = new DynamicTrackedRaceImpl(
/* trackedRegatta */new DynamicTrackedRegattaImpl(new RegattaImpl("test", null, true, null, null, new HashSet<Series>(), false, null,
/* trackedRegatta */new DynamicTrackedRegattaImpl(new RegattaImpl("test", null, true, false, null, null, new HashSet<Series>(), false, null,
"test", null, OneDesignRankingMetric::new)),
race, Collections.<Sideline> emptyList(), EmptyWindStore.INSTANCE,
/* delayToLiveInMillis */1000, /* millisecondsOverWhichToAverageWind */30000,
@@ -304,7 +304,8 @@ public class WindTest {
DynamicTrackedRace trackedRace = new DynamicTrackedRaceImpl(new DynamicTrackedRegattaImpl(
new RegattaImpl(EmptyRaceLogStore.INSTANCE, EmptyRegattaLogStore.INSTANCE,
RegattaImpl.getDefaultName("Test Regatta", boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false,
/*startDate*/ null, /*endDate*/ null,
/* trackedRegattaRegistry */ null, domainFactory.createScoringScheme(ScoringSchemeType.LOW_POINT), "123", null)),
new RaceDefinitionImpl("Test Race",
new CourseImpl("Test Course", Arrays.asList(new Waypoint[] { w1, w2, w3 })),
@@ -72,7 +72,8 @@ public class AbstractMockedRaceMarkPassingTest {
Waypoint w4 = new WaypointImpl(m, PassingInstruction.Starboard);
Waypoint w5 = new WaypointImpl(cp, PassingInstruction.Line);
waypoints = Arrays.asList(w1, w2, w3, w4, w5);
Regatta r = new RegattaImpl(RegattaImpl.getDefaultName("regatta", boatClass.getName()), boatClass, /* canBoatsOfCompetitorsChangePerRace */ true,
Regatta r = new RegattaImpl(RegattaImpl.getDefaultName("regatta", boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false,
/*startDate*/ null, /*endDate*/ null, Arrays.asList(new SeriesImpl("Series", true, /* isFleetsCanRunInParallel */ true, Arrays.asList(new FleetImpl("fleet")),
new ArrayList<String>(), null)), true, new HighPoint(), "ID", new CourseAreaImpl("area", new UUID(5, 5)), OneDesignRankingMetric::new);
Course course = new CourseImpl("course", waypoints);
@@ -344,6 +344,11 @@ public class MockedTrackedRace implements DynamicTrackedRace {
return false;
}
@Override
public boolean canCompetitorsRegisterToOpenRegatta() {
return false;
}
@Override
public void addRace(RaceDefinition race) {
}
@@ -48,7 +48,8 @@ public class TrackedRegattaTest {
public void setUp() {
regatta = new DynamicTrackedRegattaImpl(new RegattaImpl(EmptyRaceLogStore.INSTANCE,
EmptyRegattaLogStore.INSTANCE, RegattaImpl.getDefaultName("regatta", boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ false, /* startDate */ null, /* endDate */null, null, null, "a", null));
/* canBoatsOfCompetitorsChangePerRace */ false, /* canCompetitorsRegisterToOpenRegatta*/ false,
/* startDate */ null, /* endDate */null, null, null, "a", null));
}
@Test(expected = TimeoutException.class)
@@ -456,7 +456,8 @@ public class DomainFactoryImpl implements DomainFactory {
if (result == null) {
result = new RegattaImpl(raceLogStore, regattaLogStore, RegattaImpl.getDefaultName(
defaultRegattaNameAndBoatClass.getA(), boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ false, /*startDate*/ null, /*endDate*/ null,
/* canBoatsOfCompetitorsChangePerRace */ false, /* canCompetitorsRegisterToOpenRegatta*/ false,
/*startDate*/ null, /*endDate*/ null,
trackedRegattaRegistry,
// use the low-point system as the default scoring scheme
getBaseDomainFactory().createScoringScheme(ScoringSchemeType.LOW_POINT), race.getId(), null);
@@ -152,6 +152,8 @@ public class RegattaImpl extends NamedImpl implements Regatta, RaceColumnListene
private boolean canBoatsOfCompetitorsChangePerRace;
private boolean canCompetitorsRegisterToOpenRegatta;
/**
* Defaults to <code>true</code>. See {@link Regatta#useStartTimeInference()}.
*/
@@ -166,10 +168,12 @@ public class RegattaImpl extends NamedImpl implements Regatta, RaceColumnListene
* Constructs a regatta with an empty {@link RaceLogStore} and with
* {@link Regatta#isControlTrackingFromStartAndFinishTimes()} set to {@code false}.
*/
public RegattaImpl(String name, BoatClass boatClass, boolean canBoatsOfCompetitorsChangePerRace, TimePoint startDate, TimePoint endDate,
public RegattaImpl(String name, BoatClass boatClass, boolean canBoatsOfCompetitorsChangePerRace, boolean canCompetitorsRegisterToOpenRegatta,
TimePoint startDate, TimePoint endDate,
Iterable<? extends Series> series, boolean persistent, ScoringScheme scoringScheme, Serializable id,
CourseArea courseArea, RankingMetricConstructor rankingMetricConstructor) {
this(EmptyRaceLogStore.INSTANCE, EmptyRegattaLogStore.INSTANCE, name, boatClass, canBoatsOfCompetitorsChangePerRace, startDate, endDate, series,
this(EmptyRaceLogStore.INSTANCE, EmptyRegattaLogStore.INSTANCE, name, boatClass, canBoatsOfCompetitorsChangePerRace, canCompetitorsRegisterToOpenRegatta,
startDate, endDate, series,
persistent, scoringScheme, id, courseArea, 0.0, /* useStartTimeInference */true, /* controlTrackingFromStartAndFinishTimes */ false,
rankingMetricConstructor);
}
@@ -187,9 +191,11 @@ public class RegattaImpl extends NamedImpl implements Regatta, RaceColumnListene
* carried out.
*/
public RegattaImpl(RaceLogStore raceLogStore, RegattaLogStore regattaLogStore, String name, BoatClass boatClass,
boolean canBoatsOfCompetitorsChangePerRace, TimePoint startDate, TimePoint endDate, TrackedRegattaRegistry trackedRegattaRegistry,
boolean canBoatsOfCompetitorsChangePerRace, boolean canCompetitorsRegisterToOpenRegatta,
TimePoint startDate, TimePoint endDate, TrackedRegattaRegistry trackedRegattaRegistry,
ScoringScheme scoringScheme, Serializable id, CourseArea courseArea) {
this(raceLogStore, regattaLogStore, name, boatClass, canBoatsOfCompetitorsChangePerRace, startDate, endDate, trackedRegattaRegistry, scoringScheme,
this(raceLogStore, regattaLogStore, name, boatClass, canBoatsOfCompetitorsChangePerRace, canCompetitorsRegisterToOpenRegatta,
startDate, endDate, trackedRegattaRegistry, scoringScheme,
id, courseArea, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
}
@@ -204,11 +210,12 @@ public class RegattaImpl extends NamedImpl implements Regatta, RaceColumnListene
* carried out.
*/
public RegattaImpl(RaceLogStore raceLogStore, RegattaLogStore regattaLogStore, String name, BoatClass boatClass,
boolean canBoatsOfCompetitorsChangePerRace, TimePoint startDate, TimePoint endDate, TrackedRegattaRegistry trackedRegattaRegistry,
boolean canBoatsOfCompetitorsChangePerRace, boolean canCompetitorsRegisterToOpenRegatta,
TimePoint startDate, TimePoint endDate, TrackedRegattaRegistry trackedRegattaRegistry,
ScoringScheme scoringScheme, Serializable id, CourseArea courseArea,
boolean controlTrackingFromStartAndFinishTimes, RankingMetricConstructor rankingMetricConstructor) {
this(raceLogStore, regattaLogStore, name, boatClass, canBoatsOfCompetitorsChangePerRace, startDate, endDate, Collections
.singletonList(new SeriesImpl(LeaderboardNameConstants.DEFAULT_SERIES_NAME,
this(raceLogStore, regattaLogStore, name, boatClass, canBoatsOfCompetitorsChangePerRace, canCompetitorsRegisterToOpenRegatta,
startDate, endDate, Collections.singletonList(new SeriesImpl(LeaderboardNameConstants.DEFAULT_SERIES_NAME,
/* isMedal */false, /* isFleetsCanRunInParallel */ true, Collections
.singletonList(new FleetImpl(LeaderboardNameConstants.DEFAULT_FLEET_NAME)),
/* race column names */new ArrayList<String>(), trackedRegattaRegistry)), /* persistent */false,
@@ -222,7 +229,8 @@ public class RegattaImpl extends NamedImpl implements Regatta, RaceColumnListene
* this new regatta.
*/
public <S extends Series> RegattaImpl(RaceLogStore raceLogStore, RegattaLogStore regattaLogStore, String name,
BoatClass boatClass, boolean canBoatsOfCompetitorsChangePerRace, TimePoint startDate, TimePoint endDate, Iterable<S> series, boolean persistent,
BoatClass boatClass, boolean canBoatsOfCompetitorsChangePerRace, boolean canCompetitorsRegisterToOpenRegatta,
TimePoint startDate, TimePoint endDate, Iterable<S> series, boolean persistent,
ScoringScheme scoringScheme, Serializable id, CourseArea courseArea, Double buoyZoneRadiusInHullLengths, boolean useStartTimeInference,
boolean controlTrackingFromStartAndFinishTimes, RankingMetricConstructor rankingMetricConstructor) {
super(name);
@@ -236,6 +244,7 @@ public class RegattaImpl extends NamedImpl implements Regatta, RaceColumnListene
raceColumnListeners = new RaceColumnListeners();
this.boatClass = boatClass;
this.canBoatsOfCompetitorsChangePerRace = canBoatsOfCompetitorsChangePerRace;
this.canCompetitorsRegisterToOpenRegatta = canCompetitorsRegisterToOpenRegatta;
this.startDate = startDate;
this.endDate = endDate;
final List<S> seriesList = new ArrayList<S>();
@@ -758,6 +767,15 @@ public class RegattaImpl extends NamedImpl implements Regatta, RaceColumnListene
this.canBoatsOfCompetitorsChangePerRace = canBoatsOfCompetitorsChangePerRace;
}
@Override
public boolean canCompetitorsRegisterToOpenRegatta() {
return this.canCompetitorsRegisterToOpenRegatta;
}
public void setCanCompetitorsRegisterToOpenRegatta(boolean canCompetitorsRegisterToOpenRegatta) {
this.canCompetitorsRegisterToOpenRegatta = canCompetitorsRegisterToOpenRegatta;
}
@Override
public RegattaLog getRegattaLog() {
return regattaLikeHelper.getRegattaLog();
@@ -377,6 +377,11 @@ public class FlexibleLeaderboardImpl extends AbstractLeaderboardImpl implements
return false;
}
@Override
public boolean canCompetitorsRegisterToOpenRegatta() {
return false;
}
/**
* In addition to invoking the superclass implementation, a flexible leaderboard also
* detaches all race logs from any tracked race currently linked to any of the race columns
@@ -66,6 +66,11 @@ public abstract class BaseRegattaLikeImpl implements IsRegattaLike {
return false;
}
@Override
public boolean canCompetitorsRegisterToOpenRegatta() {
return false;
}
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
ois.defaultReadObject();
listeners = new HashSet<>();
@@ -31,7 +31,13 @@ public interface IsRegattaLike extends Serializable {
* @return true when the competitors change their boats, false otherwise
*/
boolean canBoatsOfCompetitorsChangePerRace();
/**
* Can a user register himself to this regatta.
* @return true if user can register to regatta
*/
boolean canCompetitorsRegisterToOpenRegatta();
RaceColumn getRaceColumnByName(String raceColumnName);
RegattaLikeIdentifier getRegattaLikeIdentifier();
@@ -40,7 +40,7 @@ public class PingMarkViaRegattaLogTest {
Series series = new SeriesImpl("series", false, /* isFleetsCanRunInParallel */ true, Collections.singletonList(fleet),
Collections.singletonList(columnName), service);
Regatta regatta = service.createRegatta(RegattaImpl.getDefaultName("regatta", "Laser"), "Laser",
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null,
UUID.randomUUID(), Collections.<Series>singletonList(series),
false, new HighPoint(), UUID.randomUUID(), /*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true,
/* controlTrackingFromStartAndFinishTimes */ false, RankingMetricsFactory.getRankingMetricConstructor(RankingMetrics.ONE_DESIGN));
@@ -95,7 +95,7 @@ public class SlicingTest {
new SeriesCreationParametersDTO(fleets, false, false, true, false, new int[0], false, 0));
final RegattaCreationParametersDTO regattaCreationParameters = new RegattaCreationParametersDTO(
seriesCreationParameters);
final RegattaDTO regatta = sailingService.createRegatta(regattaName, boatClassName, false, null, null,
final RegattaDTO regatta = sailingService.createRegatta(regattaName, boatClassName, false, false, null, null,
regattaCreationParameters, false, ScoringSchemeType.HIGH_POINT, null, 3.0, false, false,
RankingMetrics.ONE_DESIGN);
final List<Pair<String, Integer>> columnNames = new ArrayList<>();
@@ -64,7 +64,7 @@ public class CreateRegattaCallback implements DialogCallback<RegattaDTO>{
seriesStructure.put(seriesDTO.getName(), seriesPair);
}
sailingService.createRegatta(newRegatta.getName(), newRegatta.boatClass==null?null:newRegatta.boatClass.getName(),
newRegatta.canBoatsOfCompetitorsChangePerRace, newRegatta.startDate, newRegatta.endDate,
newRegatta.canBoatsOfCompetitorsChangePerRace, newRegatta.canCompetitorsRegisterToOpenRegatta, newRegatta.startDate, newRegatta.endDate,
new RegattaCreationParametersDTO(seriesStructure), true,
newRegatta.scoringScheme, newRegatta.defaultCourseAreaUuid, newRegatta.buoyZoneRadiusInHullLengths, newRegatta.useStartTimeInference,
newRegatta.controlTrackingFromStartAndFinishTimes,
@@ -61,6 +61,7 @@ public class RegattaDetailsComposite extends Composite {
private final Label useStartTimeInference;
private final Label controlTrackingFromStartAndFinishTimes;
private final Label canBoatsOfCompetitorsChangePerRace;
private final Label canCompetitorsRegisterToOpenRegatta;
private final Label configuration;
private final Label buoyZoneRadiusInHullLengths;
@@ -81,7 +82,7 @@ public class RegattaDetailsComposite extends Composite {
VerticalPanel vPanel = new VerticalPanel();
mainPanel.add(vPanel);
int rows = 13;
int rows = 14;
Grid grid = new Grid(rows, 2);
vPanel.add(grid);
@@ -95,6 +96,7 @@ public class RegattaDetailsComposite extends Composite {
useStartTimeInference = createLabelAndValueWidget(grid, currentRow++, stringMessages.useStartTimeInference(), "UseStartTimeInferenceLabel");
controlTrackingFromStartAndFinishTimes = createLabelAndValueWidget(grid, currentRow++, stringMessages.controlTrackingFromStartAndFinishTimes(), "UseStartTimeInferenceLabel");
canBoatsOfCompetitorsChangePerRace = createLabelAndValueWidget(grid, currentRow++, stringMessages.canBoatsOfCompetitorsChangePerRace(), "CanBoatsOfCompetitorsChangePerRaceLabel");
canCompetitorsRegisterToOpenRegatta = createLabelAndValueWidget(grid, currentRow++, stringMessages.canCompetitorsRegisterToOpenRegatta(), "CanCompetitorsRegisterToOpenRegatta");
buoyZoneRadiusInHullLengths = createLabelAndValueWidget(grid, currentRow++, stringMessages.buoyZoneRadiusInHullLengths(), "BuoyZoneRadiusInHullLengthsLabel");
configuration = createLabelAndValueWidget(grid, currentRow++, stringMessages.racingProcedureConfiguration(), "RacingProcedureLabel");
scoringSystem = createLabelAndValueWidget(grid, currentRow++, stringMessages.scoringSystem(), "ScoringSystemLabel");
@@ -403,6 +405,7 @@ public class RegattaDetailsComposite extends Composite {
useStartTimeInference.setText(regatta.useStartTimeInference ? stringMessages.yes() : stringMessages.no());
controlTrackingFromStartAndFinishTimes.setText(regatta.controlTrackingFromStartAndFinishTimes ? stringMessages.yes() : stringMessages.no());
canBoatsOfCompetitorsChangePerRace.setText(regatta.canBoatsOfCompetitorsChangePerRace ? stringMessages.yes() : stringMessages.no());
canCompetitorsRegisterToOpenRegatta.setText(regatta.canCompetitorsRegisterToOpenRegatta ? stringMessages.yes() : stringMessages.no());
buoyZoneRadiusInHullLengths.setText(String.valueOf(regatta.buoyZoneRadiusInHullLengths));
if (regatta.configuration != null) {
@@ -172,6 +172,16 @@ public class RegattaListComposite extends Composite implements RegattasDisplayer
regattaCanBoatsOfCompetitorsChangePerRaceColumn.setSortable(true);
columnSortHandler.setComparator(regattaCanBoatsOfCompetitorsChangePerRaceColumn,
(r1, r2)->Boolean.valueOf(r1.canBoatsOfCompetitorsChangePerRace).compareTo(Boolean.valueOf(r2.canBoatsOfCompetitorsChangePerRace)));
TextColumn<RegattaDTO> regattaCanCompetitorsRegisterToOpenRegatta = new TextColumn<RegattaDTO>() {
@Override
public String getValue(RegattaDTO regatta) {
return regatta.canCompetitorsRegisterToOpenRegatta ? stringMessages.yes() : stringMessages.no();
}
};
regattaCanCompetitorsRegisterToOpenRegatta.setSortable(true);
columnSortHandler.setComparator(regattaCanCompetitorsRegisterToOpenRegatta,
(r1, r2)->Boolean.valueOf(r1.canCompetitorsRegisterToOpenRegatta).compareTo(Boolean.valueOf(r2.canCompetitorsRegisterToOpenRegatta)));
TextColumn<RegattaDTO> startEndDateColumn = new TextColumn<RegattaDTO>() {
@Override
@@ -244,6 +254,7 @@ public class RegattaListComposite extends Composite implements RegattasDisplayer
table.addColumn(regattaSelectionCheckboxColumn, regattaSelectionCheckboxColumn.getHeader());
table.addColumn(regattaNameColumn, stringMessages.regattaName());
table.addColumn(regattaCanBoatsOfCompetitorsChangePerRaceColumn, stringMessages.canBoatsChange());
table.addColumn(regattaCanCompetitorsRegisterToOpenRegatta, stringMessages.canRegisterIfOpen());
table.addColumn(startEndDateColumn, stringMessages.from() + "/" + stringMessages.to());
table.addColumn(regattaBoatClassColumn, stringMessages.boatClass());
table.addColumn(rankingMetricColumn, stringMessages.rankingMetric());
@@ -22,6 +22,7 @@ public abstract class RegattaWithSeriesAndFleetsDialog extends AbstractRegattaWi
protected TextBox nameEntryField;
protected SuggestBox boatClassEntryField;
protected CheckBox canBoatsOfCompetitorsChangePerRaceCheckBox;
protected CheckBox canCompetitorsRegisterToOpenRegattaCheckBox;
public RegattaWithSeriesAndFleetsDialog(RegattaDTO regatta, Iterable<SeriesDTO> series, List<EventDTO> existingEvents, EventDTO defaultEvent,
String title, String okButton, StringMessages stringMessages,
@@ -40,6 +41,10 @@ public abstract class RegattaWithSeriesAndFleetsDialog extends AbstractRegattaWi
canBoatsOfCompetitorsChangePerRaceCheckBox = createCheckbox("");
canBoatsOfCompetitorsChangePerRaceCheckBox.ensureDebugId("CanBoatsOfCompetitorsChangePerRaceCheckBox");
canBoatsOfCompetitorsChangePerRaceCheckBox.setValue(regatta.canBoatsOfCompetitorsChangePerRace);
canCompetitorsRegisterToOpenRegattaCheckBox = createCheckbox("");
canCompetitorsRegisterToOpenRegattaCheckBox.ensureDebugId("CanCompetitorsRegisterToOpenRegattaCheckBox");
canCompetitorsRegisterToOpenRegattaCheckBox.setValue(regatta.canCompetitorsRegisterToOpenRegatta);
}
@Override
@@ -55,6 +60,7 @@ public abstract class RegattaWithSeriesAndFleetsDialog extends AbstractRegattaWi
result.setName(nameEntryField.getText().trim()); // trim to particularly avoid trailing blanks
result.boatClass = new BoatClassDTO(boatClassEntryField.getText(), Distance.NULL, Distance.NULL);
result.canBoatsOfCompetitorsChangePerRace = canBoatsOfCompetitorsChangePerRaceCheckBox.getValue();
result.canCompetitorsRegisterToOpenRegatta = canCompetitorsRegisterToOpenRegattaCheckBox.getValue();
return result;
}
@@ -69,5 +75,7 @@ public abstract class RegattaWithSeriesAndFleetsDialog extends AbstractRegattaWi
formGrid.setWidget(1, 1, boatClassEntryField);
formGrid.setWidget(2, 0, new Label(stringMessages.canBoatsOfCompetitorsChangePerRace() + ":"));
formGrid.setWidget(2, 1, canBoatsOfCompetitorsChangePerRaceCheckBox);
formGrid.setWidget(3, 0, new Label(stringMessages.canCompetitorsRegisterToOpenRegatta() + ":"));
formGrid.setWidget(3, 1, canCompetitorsRegisterToOpenRegattaCheckBox);
}
}
@@ -2,6 +2,7 @@ package com.sap.sailing.gwt.ui.adminconsole;
import java.util.Collection;
import java.util.List;
import java.util.logging.Logger;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
@@ -232,7 +232,8 @@ public interface SailingService extends RemoteService, FileStorageManagementGwtS
void moveLeaderboardColumnDown(String leaderboardName, String columnName);
RegattaDTO createRegatta(String regattaName, String boatClassName, boolean canBoatsOfCompetitorsChangePerRace, Date startDate, Date endDate,
RegattaDTO createRegatta(String regattaName, String boatClassName, boolean canBoatsOfCompetitorsChangePerRace,
boolean canCompetitorsRegisterToOpenRegatta, Date startDate, Date endDate,
RegattaCreationParametersDTO seriesNamesWithFleetNamesAndFleetOrderingAndMedal, boolean persistent,
ScoringSchemeType scoringSchemeType, UUID defaultCourseAreaId, Double buoyZoneRadiusInHullLengths, boolean useStartTimeInference,
boolean controlTrackingFromStartAndFinishTimes, RankingMetrics rankingMetricType);
@@ -455,7 +455,8 @@ public interface SailingServiceAsync extends ServerInfoRetriever, FileStorageMan
void moveRaceColumnInSeriesDown(RegattaIdentifier regattaIdentifier, String seriesName, String columnName,
AsyncCallback<Void> callback);
void createRegatta(String regattaName, String boatClassName, boolean canBoatsOfCompetitorsChangePerRace, Date startDate, Date endDate,
void createRegatta(String regattaName, String boatClassName, boolean canBoatsOfCompetitorsChangePerRace,
boolean canCompetitorsRegisterToOpenRegatta, Date startDate, Date endDate,
RegattaCreationParametersDTO seriesNamesWithFleetNamesAndFleetOrderingAndMedal, boolean persistent,
ScoringSchemeType scoringSchemeType, UUID defaultCourseAreaId, Double buoyZoneRadiusInHullLengths, boolean useStartTimeInference,
boolean controlTrackingFromStartAndFinishTimes, RankingMetrics rankingMetricType,
@@ -1190,8 +1190,10 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages,
String setTimeToNow();
String useStartTimeInference();
String controlTrackingFromStartAndFinishTimes();
String canBoatsOfCompetitorsChangePerRace();
String canBoatsOfCompetitorsChangePerRace();
String canCompetitorsRegisterToOpenRegatta();
String canBoatsChange();
String canRegisterIfOpen();
String canNotRegisterBoats();
String numberOfQueueMessagesSent();
String totalSize();
@@ -1178,7 +1178,9 @@ setTimeToNow=Set time to ''now''
useStartTimeInference=Use start time inference from start mark passings
controlTrackingFromStartAndFinishTimes=Control tracking from start and finish times
canBoatsOfCompetitorsChangePerRace=Can boats of competitors change per race
canCompetitorsRegisterToOpenRegatta=Can competitors register to an already opened regatta
canBoatsChange=Can boats change
canRegisterIfOpen=Can register if open
canNotRegisterBoats=Boats can only be registered here when they can change per race, otherwise they are registered together with the competitor.
numberOfQueueMessagesSent=Number of queue messages sent
totalSize=Total Size
@@ -1165,7 +1165,9 @@ setTimeToNow=Setze den Zeitpunkt auf ''Jetzt''
useStartTimeInference=Startzeit aus Startlinienüberquerungen automatisch ableiten
controlTrackingFromStartAndFinishTimes=Tracking durch Start- und Ende-Zeiten automatisch steuern
canBoatsOfCompetitorsChangePerRace=Das Boot des Teilnehmers kann sich pro Wettfahrt ändern
canCompetitorsRegisterToOpenRegatta=Teilnehmer können sich an einer bereits geöffneten Ragatta registrieren
canBoatsChange=Boot kann sich ändern
canRegisterIfOpen=Registrierung wenn offen
canNotRegisterBoats=Boote können hier nur registriert werden, wenn sie sich pro Wettfahrt ändern, ansonsten werden sie zusammen mit dem Teilnehmer registriert.
numberOfQueueMessagesSent=Anzahl verschickter Queue Nachrichten
totalSize=Gesamtgröße
@@ -998,6 +998,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
regattaDTO.useStartTimeInference = regatta.useStartTimeInference();
regattaDTO.controlTrackingFromStartAndFinishTimes = regatta.isControlTrackingFromStartAndFinishTimes();
regattaDTO.canBoatsOfCompetitorsChangePerRace = regatta.canBoatsOfCompetitorsChangePerRace();
regattaDTO.canCompetitorsRegisterToOpenRegatta = regatta.canCompetitorsRegisterToOpenRegatta();
regattaDTO.configuration = convertToRegattaConfigurationDTO(regatta.getRegattaConfiguration());
regattaDTO.rankingMetricType = regatta.getRankingMetricType();
return regattaDTO;
@@ -4424,7 +4425,8 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
}
@Override
public RegattaDTO createRegatta(String regattaName, String boatClassName, boolean canBoatsOfCompetitorsChangePerRace, Date startDate, Date endDate,
public RegattaDTO createRegatta(String regattaName, String boatClassName, boolean canBoatsOfCompetitorsChangePerRace,
boolean canCompetitorsRegisterToOpenRegatta, Date startDate, Date endDate,
RegattaCreationParametersDTO seriesNamesWithFleetNamesAndFleetOrderingAndMedal,
boolean persistent, ScoringSchemeType scoringSchemeType, UUID defaultCourseAreaId, Double buoyZoneRadiusInHullLengths, boolean useStartTimeInference,
boolean controlTrackingFromStartAndFinishTimes, RankingMetrics rankingMetricType) {
@@ -4433,7 +4435,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
TimePoint endTimePoint = endDate != null ? new MillisecondsTimePoint(endDate) : null;
Regatta regatta = getService().apply(
new AddSpecificRegatta(
regattaName, boatClassName, canBoatsOfCompetitorsChangePerRace, startTimePoint, endTimePoint, UUID.randomUUID(),
regattaName, boatClassName, canBoatsOfCompetitorsChangePerRace, canCompetitorsRegisterToOpenRegatta, startTimePoint, endTimePoint, UUID.randomUUID(),
seriesNamesWithFleetNamesAndFleetOrderingAndMedal,
persistent, baseDomainFactory.createScoringScheme(scoringSchemeType), defaultCourseAreaId, buoyZoneRadiusInHullLengths, useStartTimeInference,
controlTrackingFromStartAndFinishTimes, rankingMetricType));
@@ -4683,8 +4685,10 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
}
private void createRegattaFromRegattaDTO(RegattaDTO regatta) {
logger.info("Create Regatta from DTO " + regatta);
SecurityUtils.getSubject().checkPermission(Permission.REGATTA.getStringPermissionForObjects(Mode.CREATE, regatta.getName()));
this.createRegatta(regatta.getName(), regatta.boatClass.getName(), regatta.canBoatsOfCompetitorsChangePerRace, regatta.startDate, regatta.endDate,
this.createRegatta(regatta.getName(), regatta.boatClass.getName(), regatta.canBoatsOfCompetitorsChangePerRace,
regatta.canCompetitorsRegisterToOpenRegatta, regatta.startDate, regatta.endDate,
new RegattaCreationParametersDTO(getSeriesCreationParameters(regatta)),
true, regatta.scoringScheme, regatta.defaultCourseAreaUuid, regatta.buoyZoneRadiusInHullLengths, regatta.useStartTimeInference,
regatta.controlTrackingFromStartAndFinishTimes, regatta.rankingMetricType);
@@ -37,6 +37,7 @@ public class RegattaDTO extends NamedDTO {
public boolean useStartTimeInference = true;
public boolean controlTrackingFromStartAndFinishTimes = false;
public boolean canBoatsOfCompetitorsChangePerRace = false;
public boolean canCompetitorsRegisterToOpenRegatta = false;
public RankingMetrics rankingMetricType;
public Double buoyZoneRadiusInHullLengths;
@@ -70,6 +71,7 @@ public class RegattaDTO extends NamedDTO {
this.useStartTimeInference = other.useStartTimeInference;
this.controlTrackingFromStartAndFinishTimes = other.controlTrackingFromStartAndFinishTimes;
this.canBoatsOfCompetitorsChangePerRace = other.canBoatsOfCompetitorsChangePerRace;
this.canCompetitorsRegisterToOpenRegatta = other.canCompetitorsRegisterToOpenRegatta;
this.buoyZoneRadiusInHullLengths = other.buoyZoneRadiusInHullLengths;
}
@@ -62,7 +62,8 @@ public abstract class AbstractTestStoringAndRetrievingRaceLogInRegatta extends R
List<Series> series = createSeriesForTestRegatta();
Regatta regatta = new RegattaImpl(getRaceLogStore(), getRegattaLogStore(), RegattaImpl.getDefaultName(regattaBaseName,
boatClass == null ? null : boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null, series, persistent, scoringScheme, "123",
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false,
/*startDate*/ null, /*endDate*/ null, series, persistent, scoringScheme, "123",
courseArea, /*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
return regatta;
}
@@ -49,7 +49,7 @@ public class RaceLogConnectivityParamsLoadAndStoreTest extends AbstractConnectiv
final SeriesImpl theSeries = new SeriesImpl("Default", /* isMedal */ false, /* isFleetsCanRunInParallel */ true,
Arrays.<Fleet>asList(fleet), Collections.emptyList(), racingEventService);
final Iterable<? extends Series> series = Arrays.<Series>asList(theSeries);
final Regatta regatta = racingEventService.createRegatta("My Regatta", "12mR", true, MillisecondsTimePoint.now(), MillisecondsTimePoint.now().plus(Duration.ONE_DAY),
final Regatta regatta = racingEventService.createRegatta("My Regatta", "12mR", true, false, MillisecondsTimePoint.now(), MillisecondsTimePoint.now().plus(Duration.ONE_DAY),
UUID.randomUUID(), series, /* persistent */ true, new LowPoint(), new CourseAreaImpl("Default", UUID.randomUUID()),
/* buoyZoneRadiusInHullLengths */ 2.0, /* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false,
OneDesignRankingMetric::new);
@@ -421,7 +421,7 @@ public class TestStoringAndLoadingEventsAndRegattas extends AbstractMongoDBTest
/* canBoatsOfCompetitorsChangePerRace */ false, regattaStartDate, regattaEndDate, /* persistent */ true, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), null, OneDesignRankingMetric::new);
final String regattaName = regattaProxy.getName();
Regatta regatta = res.createRegatta(regattaName, regattaProxy.getBoatClass().getName(),
/* canBoatsOfCompetitorsChangePerRace */ false, regattaStartDate, regattaEndDate,
/* canBoatsOfCompetitorsChangePerRace */ false, /* canCompetitorsRegisterToOpenRegatta */ false, regattaStartDate, regattaEndDate,
"123", regattaProxy.getSeries(), regattaProxy.isPersistent(), DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT),
/* defaultCourseAreaId */ null, /*buoyZoneRadiusInHullLengths*/ 2.0, /* useStartTimeInference */ true,
/* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
@@ -496,7 +496,7 @@ public class TestStoringAndLoadingEventsAndRegattas extends AbstractMongoDBTest
Regatta regattaProxy = createRegatta(RegattaImpl.getDefaultName(regattaBaseName, boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, regattaStartDate, regattaEndDate, /* persistent */ true, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), null, OneDesignRankingMetric::new);
Regatta regatta = res.createRegatta(regattaProxy.getName(), regattaProxy.getBoatClass().getName(),
regattaProxy.canBoatsOfCompetitorsChangePerRace(), regattaProxy.getStartDate(), regattaProxy.getEndDate(),
regattaProxy.canBoatsOfCompetitorsChangePerRace(), regattaProxy.canCompetitorsRegisterToOpenRegatta(), regattaProxy.getStartDate(), regattaProxy.getEndDate(),
"123", regattaProxy.getSeries(), regattaProxy.isPersistent(), DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), null, /*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
trackedRegatta[0] = new DynamicTrackedRegattaImpl(regatta);
addRaceColumns(numberOfQualifyingRaces, numberOfFinalRaces, regatta);
@@ -915,7 +915,7 @@ public class TestStoringAndLoadingEventsAndRegattas extends AbstractMongoDBTest
medalFleets.add(new FleetImpl("Medal"));
Series medalSeries = new SeriesImpl("Medal", /* isMedal */ true, /* isFleetsCanRunInParallel */ true, medalFleets, emptyRaceColumnNames, /* trackedRegattaRegistry */ null);
series.add(medalSeries);
Regatta regatta = new RegattaImpl(regattaName, boatClass, canBoatsOfCompetitorsChangePerRace, startDate, endDate,
Regatta regatta = new RegattaImpl(regattaName, boatClass, canBoatsOfCompetitorsChangePerRace, /* canCompetitorsRegisterToOpenRegatta */ false, startDate, endDate,
series, persistent, scoringScheme, "123", courseArea, rankingMetricConstructor);
return regatta;
}
@@ -21,6 +21,7 @@ public class RegattaJsonSerializer implements JsonSerializer<Regatta> {
public static final String FIELD_TRACKED_RACES = "trackedRaces";
public static final String FIELD_COURSE_AREA_ID = "courseAreaId";
public static final String FIELD_CAN_BOATS_OF_COMPETITORS_CHANGE_PER_RACE = "canBoatsOfCompetitorsChangePerRace";
public static final String FIELD_CAN_COMPETITORS_REGISTER_TO_OPEN_REGATTA = "canCompetitorsRegisterToOpenRegatta";
private final JsonSerializer<Series> seriesSerializer;
private final JsonSerializer<Competitor> competitorSerializer;
@@ -47,6 +48,7 @@ public class RegattaJsonSerializer implements JsonSerializer<Regatta> {
result.put(FIELD_COURSE_AREA_ID,
regatta.getDefaultCourseArea() != null ? regatta.getDefaultCourseArea().getId().toString() : null);
result.put(FIELD_CAN_BOATS_OF_COMPETITORS_CHANGE_PER_RACE, regatta.canBoatsOfCompetitorsChangePerRace());
result.put(FIELD_CAN_COMPETITORS_REGISTER_TO_OPEN_REGATTA, regatta.canCompetitorsRegisterToOpenRegatta());
if (seriesSerializer != null) {
JSONArray seriesJson = new JSONArray();
for (Series series : regatta.getSeries()) {
@@ -125,7 +125,7 @@ public class EventResourceTest extends AbstractJaxRsApiTest {
/* venueNameParam */ randomName, /* venueLat */ null, /* venueLng */ null, /* isPublicParam */ null,
/* officialWebsiteURLParam */ null, /* baseURLParam */ null, /* leaderboardGroupIdsListParam */ null,
/* createLeaderboardGroupParam */ "true", /* createRegattaParam */ "false",
/* boatClassNameParam */ null, /* numberOfRacesParam */ null, false);
/* boatClassNameParam */ null, /* numberOfRacesParam */ null, false, /* canCompetitorsRegisterToOpenRegatta */ false);
}
private Response createEvent() throws ParseException, NotFoundException, NumberFormatException, IOException,
@@ -135,7 +135,7 @@ public class EventResourceTest extends AbstractJaxRsApiTest {
/* venueNameParam */ randomName, /* venueLat */ null, /* venueLng */ null, /* isPublicParam */ null,
/* officialWebsiteURLParam */ null, /* baseURLParam */ null, /* leaderboardGroupIdsListParam */ null,
/* createLeaderboardGroupParam */ "false", /* createRegattaParam */ "false",
/* boatClassNameParam */ null, /* numberOfRacesParam */ null, false);
/* boatClassNameParam */ null, /* numberOfRacesParam */ null, false, /* canCompetitorsRegisterToOpenRegatta */ false);
}
private Response createEventAtLocation(Position location) throws ParseException, NotFoundException,
@@ -146,7 +146,7 @@ public class EventResourceTest extends AbstractJaxRsApiTest {
/* venueLng */ "" + location.getLngDeg(), /* isPublicParam */ null, /* officialWebsiteURLParam */ null,
/* baseURLParam */ null, /* leaderboardGroupIdsListParam */ null,
/* createLeaderboardGroupParam */ "false", /* createRegattaParam */ "false",
/* boatClassNameParam */ null, /* numberOfRacesParam */ null, false);
/* boatClassNameParam */ null, /* numberOfRacesParam */ null, false, /* canCompetitorsRegisterToOpenRegatta */ false);
}
private Response createEventWithLeaderboardGroupAndRegatta() throws ParseException, NotFoundException,
@@ -156,7 +156,7 @@ public class EventResourceTest extends AbstractJaxRsApiTest {
/* venueNameParam */ randomName, /* venueLat */ null, /* venueLng */ null, /* isPublicParam */ null,
/* officialWebsiteURLParam */ null, /* baseURLParam */ null, /* leaderboardGroupIdsListParam */ null,
/* createLeaderboardGroupParam */ "true", /* createRegattaParam */ "true",
/* boatClassNameParam */ "A_CAT", /* numberOfRacesParam */ null, false);
/* boatClassNameParam */ "A_CAT", /* numberOfRacesParam */ null, false, /* canCompetitorsRegisterToOpenRegatta */ false);
}
private Response getLeaderboard(String name) {
@@ -50,7 +50,7 @@ public class LeaderboardGroupResourceTest extends AbstractJaxRsApiTest {
raceColumnNames, /* trackedRegattaRegistry */null);
series.add(testSeries);
regatta = racingEventService.createRegatta(RegattaImpl.getDefaultName(regattaName, boatClassName), boatClassName,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null, UUID.randomUUID(), series, /*persistent*/ true,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null, UUID.randomUUID(), series, /*persistent*/ true,
DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), null, /*buoyZoneRadiusInHullLengths*/2.0,
/* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
testSeries.addRaceColumn("R1", /* trackedRegattaRegistry */ null);
@@ -56,8 +56,8 @@ public class LeaderboardsResourceCheckinAndOutTest extends AbstractJaxRsApiTest
competitor = racingEventService.getBaseDomainFactory().getOrCreateCompetitorWithBoat(c.getId(), c.getName(), c.getShortName(),
c.getColor(), c.getEmail(), c.getFlagImage(), (DynamicTeam) c.getTeam(),
/* timeOnTimeFactor */ null, /* timeOnDistanceAllowancePerNauticalMile */ null, null, (DynamicBoat) boat);
Regatta regatta = new RegattaImpl("regatta", boatClass, /* canBoatsOfCompetitorsChangePerRace */ false, MillisecondsTimePoint.now(),
MillisecondsTimePoint.now(), Collections.singleton(new SeriesImpl("series", false, /* isFleetsCanRunInParallel */ true, Collections
Regatta regatta = new RegattaImpl("regatta", boatClass, /* canBoatsOfCompetitorsChangePerRace */ false, /* canCompetitorsRegisterToOpenRegatta */ false,
MillisecondsTimePoint.now(), MillisecondsTimePoint.now(), Collections.singleton(new SeriesImpl("series", false, /* isFleetsCanRunInParallel */ true, Collections
.singleton(new FleetImpl("fleet")), Arrays.asList("column"), racingEventService)), false,
new HighPoint(), 0, null, OneDesignRankingMetric::new);
racingEventService.addRegattaWithoutReplication(regatta);
@@ -60,8 +60,8 @@ public class LeaderboardsResourcePingMarkTest extends AbstractJaxRsApiTest {
public void setUp() throws Exception {
super.setUp();
mark = racingEventService.getBaseDomainFactory().getOrCreateMark("id", "name");
Regatta regatta = new RegattaImpl("regatta", new BoatClassImpl("49er", false), /* canBoatsOfCompetitorsChangePerRace */ true, MillisecondsTimePoint.now(),
MillisecondsTimePoint.now(), Collections.singleton(new SeriesImpl("series", false, /* isFleetsCanRunInParallel */ true, Collections
Regatta regatta = new RegattaImpl("regatta", new BoatClassImpl("49er", false), /* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false,
MillisecondsTimePoint.now(), MillisecondsTimePoint.now(), Collections.singleton(new SeriesImpl("series", false, /* isFleetsCanRunInParallel */ true, Collections
.singleton(new FleetImpl("fleet")), Arrays.asList("column"), racingEventService)), false,
new HighPoint(), 0, null, OneDesignRankingMetric::new);
racingEventService.addRegattaWithoutReplication(regatta);
@@ -58,7 +58,7 @@ public class LeaderboardsResourceTest extends AbstractJaxRsApiTest {
raceColumnNames, /* trackedRegattaRegistry */null);
series.add(testSeries);
regatta = racingEventService.createRegatta(RegattaImpl.getDefaultName(regattaBaseName, boatClassName), boatClassName,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null, UUID.randomUUID(), series, /*persistent*/ true,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null, UUID.randomUUID(), series, /*persistent*/ true,
DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), null,
/*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
testSeries.addRaceColumn("R1", /* trackedRegattaRegistry */ null);
@@ -48,7 +48,7 @@ public class RegattasResourceTest extends AbstractJaxRsApiTest {
Series testSeries = new SeriesImpl("TestSeries", /* isMedal */false, /* isFleetsCanRunInParallel */ true, fleets, raceColumnNames, /* trackedRegattaRegistry */null);
series.add(testSeries);
racingEventService.createRegatta(RegattaImpl.getDefaultName(regattaName, boatClassName), boatClassName,
/* canBoatsOfCompetitorsChangePerRace */ true, startDate, endDate, UUID.randomUUID(), series, /*persistent*/ true,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, startDate, endDate, UUID.randomUUID(), series, /*persistent*/ true,
DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), null, /*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
testSeries.addRaceColumn("R1", /* trackedRegattaRegistry */ null);
testSeries.addRaceColumn("R2", /* trackedRegattaRegistry */ null);
@@ -135,7 +135,8 @@ public class EventsResource extends AbstractSailingServerResource {
@FormParam("createregatta") String createRegattaParam,
@FormParam("boatclassname") String boatClassNameParam,
@FormParam("numberofraces") String numberOfRacesParam,
@FormParam("canBoatsOfCompetitorsChangePerRace") boolean canBoatsOfCompetitorsChangePerRace) throws ParseException, NotFoundException,
@FormParam("canBoatsOfCompetitorsChangePerRace") boolean canBoatsOfCompetitorsChangePerRace,
@FormParam("canCompetitorsRegisterToOpenRegatta") boolean canCompetitorsRegisterToOpenRegatta) throws ParseException, NotFoundException,
NumberFormatException, IOException, org.json.simple.parser.ParseException, InvalidDateException {
if (enforceSecurityChecks) {
SecurityUtils.getSubject().checkPermission(Permission.EVENT.getStringPermission(Mode.CREATE));
@@ -148,7 +149,7 @@ public class EventsResource extends AbstractSailingServerResource {
startDateAsMillis, endDateParam, endDateAsMillis, venueNameParam,
/* venue latitude */ venueLat, /* venue longitude */ venueLng, isPublicParam, officialWebsiteURLParam,
baseURLParam, leaderboardGroupIdsListParam, createLeaderboardGroupParam, createRegattaParam,
boatClassNameParam, numberOfRacesParam, canBoatsOfCompetitorsChangePerRace);
boatClassNameParam, numberOfRacesParam, canBoatsOfCompetitorsChangePerRace, canCompetitorsRegisterToOpenRegatta);
final JSONObject jsonResponse = new JSONObject();
jsonResponse.put("eventid", eventAndLeaderboardGroupAndLeaderboard.getA().getId().toString());
jsonResponse.put("eventname", eventAndLeaderboardGroupAndLeaderboard.getA().getName());
@@ -335,7 +336,8 @@ public class EventsResource extends AbstractSailingServerResource {
private RegattaLeaderboard validateAndCreateRegatta(String regattaNameParam, String boatClassNameParam, String scoringSchemeParam,
UUID courseAreaId, String buoyZoneRadiusInHullLengthsParam, String useStartTimeInterferenceParam, String controlTrackingFromStartAndFinishTimesParam,
String rankingMetricParam, List<Integer> leaderboardDiscardThresholdsParam, String numberOfRacesParam, boolean canBoatsOfCompetitorsChangePerRace)
String rankingMetricParam, List<Integer> leaderboardDiscardThresholdsParam, String numberOfRacesParam, boolean canBoatsOfCompetitorsChangePerRace,
boolean canCompetitorsRegisterToOpenRegatta)
throws ParseException, NotFoundException {
boolean controlTrackingFromStartAndFinishTimes = controlTrackingFromStartAndFinishTimesParam == null ? false : Boolean.parseBoolean(controlTrackingFromStartAndFinishTimesParam);
boolean useStartTimeInterference = useStartTimeInterferenceParam == null ? true : Boolean.parseBoolean(useStartTimeInterferenceParam);
@@ -355,7 +357,7 @@ public class EventsResource extends AbstractSailingServerResource {
RegattaCreationParametersDTO regattaCreationParametersDTO = new RegattaCreationParametersDTO(
createDefaultSeriesCreationParameters(regattaName, numberOfRaces));
UUID regattaId = UUID.randomUUID();
addRegatta(regattaName, canBoatsOfCompetitorsChangePerRace, controlTrackingFromStartAndFinishTimes, useStartTimeInterference,
addRegatta(regattaName, canBoatsOfCompetitorsChangePerRace, canCompetitorsRegisterToOpenRegatta, controlTrackingFromStartAndFinishTimes, useStartTimeInterference,
buoyZoneRadiusInHullLengths, courseAreaId, boatClassName, /* startDate */ null, /* endDate */ null, scoringScheme,
rankingMetric, regattaId, regattaCreationParametersDTO, leaderboardDiscardThresholds, numberOfRaces);
final RegattaLeaderboard leaderboard = addLeaderboard(regattaName, leaderboardDiscardThresholds);
@@ -376,7 +378,8 @@ public class EventsResource extends AbstractSailingServerResource {
String venueNameParam, String venueLat, String venueLng, String isPublicParam,
String officialWebsiteURLParam, String baseURLParam, List<String> leaderboardGroupIdsListParam,
String createLeaderboardGroupParam, String createRegattaParam, String boatClassName,
String numberOfRacesParam, boolean canBoatsOfCompetitorsChangePerRace) throws ParseException, NotFoundException, NumberFormatException, IOException,
String numberOfRacesParam, boolean canBoatsOfCompetitorsChangePerRace,
boolean canCompetitorsRegisterToOpenRegatta) throws ParseException, NotFoundException, NumberFormatException, IOException,
org.json.simple.parser.ParseException, InvalidDateException {
boolean isPublic = isPublicParam == null ? false : Boolean.parseBoolean(isPublicParam);
boolean createRegatta = createRegattaParam == null ? true : Boolean.parseBoolean(createRegattaParam);
@@ -414,7 +417,7 @@ public class EventsResource extends AbstractSailingServerResource {
/* scoringSchemeParam */ null, courseArea.getId(), /* buoyZoneRadiusInHullLengthsParam */ null,
/* useStartTimeInterferenceParam */ null, /* controlTrackingFromStartAndFinishTimesParam */ null,
/* rankingMetricParam */ null, /* leaderboardDiscardThresholdsParam */ null,
numberOfRacesParam, canBoatsOfCompetitorsChangePerRace);
numberOfRacesParam, canBoatsOfCompetitorsChangePerRace, canCompetitorsRegisterToOpenRegatta);
if (leaderboardGroup != null) {
getService().apply(new UpdateLeaderboardGroup(leaderboardGroup.getName(), leaderboardGroup.getName(),
leaderboardGroup.getDescription(), leaderboardGroup.getDisplayName(),
@@ -538,7 +541,8 @@ public class EventsResource extends AbstractSailingServerResource {
return getService().apply(new AddCourseAreas(eventId, courseAreaNames, courseAreaIds))[0];
}
private Regatta addRegatta(String regattaName, boolean canBoatsOfCompetitorsChangePerRace, boolean controlTrackingFromStartAndFinishTimes, boolean useStartTimeInterference,
private Regatta addRegatta(String regattaName, boolean canBoatsOfCompetitorsChangePerRace,
boolean canCompetitorsRegisterToOpenRegatta, boolean controlTrackingFromStartAndFinishTimes, boolean useStartTimeInterference,
double buoyZoneRadiusInHullLengths, UUID courseAreaId, String boatClassName,
MillisecondsTimePoint startDate, MillisecondsTimePoint endDate, ScoringScheme scoringScheme,
RankingMetrics rankingMetric, UUID regattaId, RegattaCreationParametersDTO regattaCreationParametersDTO,
@@ -546,7 +550,8 @@ public class EventsResource extends AbstractSailingServerResource {
if (enforceSecurityChecks) {
SecurityUtils.getSubject().checkPermission(Permission.REGATTA.getStringPermissionForObjects(Mode.CREATE, regattaName));
}
Regatta regatta = getService().apply(new AddSpecificRegatta(regattaName, boatClassName, canBoatsOfCompetitorsChangePerRace, startDate, endDate, regattaId,
Regatta regatta = getService().apply(new AddSpecificRegatta(regattaName, boatClassName, canBoatsOfCompetitorsChangePerRace,
canCompetitorsRegisterToOpenRegatta, startDate, endDate, regattaId,
regattaCreationParametersDTO, /* isPersistent */ true, scoringScheme, courseAreaId, buoyZoneRadiusInHullLengths,
useStartTimeInterference, controlTrackingFromStartAndFinishTimes, rankingMetric));
return regatta;
@@ -625,7 +625,7 @@ public class ExpeditionAllInOneImporter {
/*hasSplitFleetContiguousScoring*/ false, /*maximumNumberOfDiscards*/ null));
final RegattaCreationParametersDTO regattaCreationParameters = new RegattaCreationParametersDTO(seriesCreationParameters);
regatta = service.apply(new AddSpecificRegatta(regattaNameAndleaderboardName, boatClassName,
/* can boats of competitors change */ false,
/* can boats of competitors change */ false, /* canCompetitorsRegisterToOpenRegatta */ false,
/* start date */ null, /* end date */ null, UUID.randomUUID(),
regattaCreationParameters, true, scoringScheme, courseAreaId, buoyZoneRadiusInHullLengths, true,
false, rankingMetric));
@@ -103,7 +103,7 @@ public abstract class AbstractLogReplicationTest<LogT extends AbstractLog<EventT
// 1. Install some race column on master...
RegattaCreationParametersDTO regattaCreationParams = new RegattaCreationParametersDTO(seriesCreationParameters);
AddSpecificRegatta addRegattaOperation = new AddSpecificRegatta(regattaName, boatClassName,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false, /*startDate*/ null, /*endDate*/ null,
/* regatta ID */ UUID.randomUUID(), regattaCreationParams, /* persistent */ true,
new LowPoint(), /* default course area ID */ UUID.randomUUID(), /*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true,
/* controlTrackingFromStartAndFinishTimes */ false, RankingMetrics.ONE_DESIGN);
@@ -74,7 +74,7 @@ public class BoatReplicationTest extends AbstractServerReplicationTest {
Integer regattaId = 12345;
Iterable<Series> series = Collections.emptyList();
Regatta masterRegatta = master.createRegatta(RegattaImpl.getDefaultName(baseEventName, boatClassName), boatClassName,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null, regattaId, series,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null, regattaId, series,
/* persistent */ true, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), null, /*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true,
/* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
Iterable<Waypoint> emptyWaypointList = Collections.emptyList();
@@ -82,7 +82,7 @@ public class CompetitorReplicationTest extends AbstractServerReplicationTest {
URI flagImageURI = new URI("http://www.sapsailing.com");
Iterable<Series> series = Collections.emptyList();
Regatta masterRegatta = master.createRegatta(RegattaImpl.getDefaultName(baseEventName, boatClassName), boatClassName,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null, regattaId, series,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null, regattaId, series,
/* persistent */ true, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), null, /*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true,
/* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
Iterable<Waypoint> emptyWaypointList = Collections.emptyList();
@@ -126,7 +126,7 @@ public class InitialLoadReplicationObjectIdentityTest extends AbstractServerRepl
final String boatClassName = "49er";
final Iterable<Series> series = Collections.emptyList();
Regatta masterRegatta = master.createRegatta(RegattaImpl.getDefaultName(baseEventName, boatClassName), boatClassName,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null, UUID.randomUUID(), series,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null, UUID.randomUUID(), series,
/* persistent */ true, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), null, /*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true,
/* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric.CONSTRUCTOR);
assertNotNull(master.getRegatta(masterRegatta.getRegattaIdentifier()));
@@ -45,7 +45,7 @@ public class RegattaReplicationTest extends AbstractServerReplicationTest {
final Iterable<Series> series = Collections.emptyList();
final UUID regattaId = UUID.randomUUID();
Regatta masterRegatta = master.createRegatta(RegattaImpl.getDefaultName(baseEventName, boatClassName), boatClassName,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null, regattaId, series,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null, regattaId, series,
/* persistent */ true, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), null,
/*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
@@ -71,11 +71,11 @@ public class RegattaReplicationTest extends AbstractServerReplicationTest {
final UUID regattaId1 = UUID.randomUUID();
final UUID regattaId2 = UUID.randomUUID();
Regatta masterRegatta1 = master.createRegatta(RegattaImpl.getDefaultName(baseEventName, boatClass1Name), boatClass1Name,
canBoatsOfCompetitorsChangePerRaceRegatta1, /*startDate*/ null, /*endDate*/ null, regattaId1, series,
canBoatsOfCompetitorsChangePerRaceRegatta1, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null, regattaId1, series,
/* persistent */ true, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), null,
/*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
Regatta masterRegatta2 = master.createRegatta(RegattaImpl.getDefaultName(baseEventName, boatClass2Name), boatClass2Name,
canBoatsOfCompetitorsChangePerRaceRegatta2, /*startDate*/ null, /*endDate*/ null, regattaId2, series,
canBoatsOfCompetitorsChangePerRaceRegatta2, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null, regattaId2, series,
/* persistent */ true, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), null,
/*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
@@ -104,7 +104,7 @@ public class RegattaReplicationTest extends AbstractServerReplicationTest {
UUID currentCourseAreaId = null;
Regatta masterRegatta = master.createRegatta(RegattaImpl.getDefaultName("Kiel Week 2012", "49er"), "49er",
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null,
UUID.randomUUID(), Collections.<Series>emptyList(),
/* persistent */ true, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), currentCourseAreaId,
/*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
@@ -157,7 +157,7 @@ public class RegattaReplicationTest extends AbstractServerReplicationTest {
UUID currentCourseAreaId = null;
Regatta masterRegatta = master.createRegatta(RegattaImpl.getDefaultName("RR", "49er"), "49er",
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null,
UUID.randomUUID(), Collections.<Series>emptyList(),
true, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), currentCourseAreaId,
/*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
@@ -206,7 +206,7 @@ public class RegattaReplicationTest extends AbstractServerReplicationTest {
Series medal = new SeriesImpl("Medal", /* isMedal */ true, /* isFleetsCanRunInParallel */ true,
Arrays.asList(new Fleet[] { new FleetImpl("Medal") }), emptyRaceColumnNamesList, /* trackedRegattaRegistry */ null);
Regatta masterRegatta = master.createRegatta(RegattaImpl.getDefaultName(baseEventName, boatClassName), boatClassName,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null,
UUID.randomUUID(), Arrays.asList(new Series[] { qualification, finals, medal }), /* persistent */ true, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), null,
/*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
Thread.sleep(1000);
@@ -243,7 +243,7 @@ public class RegattaReplicationTest extends AbstractServerReplicationTest {
Series qualification = new SeriesImpl("Qualification", /* isMedal */ false, /* isFleetsCanRunInParallel */ true,
Arrays.asList(new Fleet[] { new FleetImpl("Yellow"), new FleetImpl("Blue") }), emptyRaceColumnNamesList, /* trackedRegattaRegistry */ null);
Regatta masterRegatta = master.createRegatta(RegattaImpl.getDefaultName(baseEventName, boatClassName), boatClassName,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null,
UUID.randomUUID(), Arrays.asList(new Series[] { qualification }), /* persistent */ true, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), null,
/*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
Thread.sleep(1000);
@@ -288,7 +288,7 @@ public class RegattaReplicationTest extends AbstractServerReplicationTest {
Series qualification = new SeriesImpl("Qualification", /* isMedal */ false, /* isFleetsCanRunInParallel */ true,
Arrays.asList(new Fleet[] { new FleetImpl("Yellow"), new FleetImpl("Blue") }), emptyRaceColumnNamesList, /* trackedRegattaRegistry */ null);
Regatta masterRegatta = master.createRegatta(RegattaImpl.getDefaultName(baseEventName, boatClassName), boatClassName,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null,
UUID.randomUUID(), Arrays.asList(new Series[] { qualification }), /* persistent */ true,
DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), null,
/*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false,
@@ -327,7 +327,7 @@ public class RegattaReplicationTest extends AbstractServerReplicationTest {
CourseArea masterCourseArea = master.addCourseAreas(masterEvent.getId(), new String[] {courseArea}, new UUID[] {UUID.randomUUID()})[0];
Regatta masterRegatta = master.createRegatta(RegattaImpl.getDefaultName(eventName, boatClassName), boatClassName,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null, UUID.randomUUID(), series,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null, UUID.randomUUID(), series,
/* persistent */ true, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), masterCourseArea.getId(),
/*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
Thread.sleep(1000);
@@ -97,6 +97,7 @@ public class TrackRaceBoatCompetitorMetadataReplicationTest extends AbstractServ
private void startTrackingOnMaster() throws Exception {
final Regatta regatta = master.createRegatta("Test regatta", "J/70",
/* canBoatsOfCompetitorsChangePerRace==true because it's a league race we're using for this test */ true,
/* canCompetitorsRegisterToOpenRegatta */ false,
/* startDate */ null, /* endDate */ null, UUID.randomUUID(),
/* start with no series */ Collections.emptySet(),
/* persistent */ true, new LowPoint(), /* defaultCourseAreaId */ UUID.randomUUID(),
@@ -70,8 +70,8 @@ public class StatisticsTest {
@Before
public void setUp() {
regatta = new DynamicTrackedRegattaImpl(new RegattaImpl(EmptyRaceLogStore.INSTANCE,
EmptyRegattaLogStore.INSTANCE, RegattaImpl.getDefaultName("regatta", boatClass.getName()), boatClass, false,
/* startDate */ null, /* endDate */null, null, null, "a", null));
EmptyRegattaLogStore.INSTANCE, RegattaImpl.getDefaultName("regatta", boatClass.getName()), boatClass, false,
/* canCompetitorsRegisterToOpenRegatta*/ false, /* startDate */ null, /* endDate */null, null, null, "a", null));
final Course course = new CourseImpl("course",
Arrays.asList(new Waypoint[] { waypoint1, waypoint2, waypoint3 }));
@@ -231,7 +231,8 @@ public class MasterDataImportTest {
UUID regattaUUID = UUID.randomUUID();
Regatta regatta = sourceService.createRegatta(
RegattaImpl.getDefaultName(TEST_REGATTA_NAME, TEST_BOAT_CLASS_NAME), TEST_BOAT_CLASS_NAME,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */null, /* endDate */null, regattaUUID, series, true, new LowPoint(), courseAreaUUID, /*buoyZoneRadiusInHullLengths*/2.0,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false,
/* startDate */null, /* endDate */null, regattaUUID, series, true, new LowPoint(), courseAreaUUID, /*buoyZoneRadiusInHullLengths*/2.0,
/* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
for (String name : raceColumnNames) {
@@ -554,7 +555,7 @@ public class MasterDataImportTest {
UUID regattaUUID = UUID.randomUUID();
Regatta regatta = sourceService.createRegatta(
RegattaImpl.getDefaultName(TEST_REGATTA_NAME, TEST_BOAT_CLASS_NAME), TEST_BOAT_CLASS_NAME,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */null, /* endDate */null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /* startDate */null, /* endDate */null,
regattaUUID, series, true, new LowPoint(), courseAreaUUID, /*buoyZoneRadiusInHullLengths*/2.0,
/* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
for (String name : raceColumnNames) {
@@ -710,7 +711,7 @@ public class MasterDataImportTest {
series.add(new SeriesImpl("testSeries", false, /* isFleetsCanRunInParallel */ true, fleets, emptyRaceColumnNamesList, sourceService));
UUID regattaUUID = UUID.randomUUID();
Regatta regatta = sourceService.createRegatta(RegattaImpl.getDefaultName("testRegatta", "29er"), "29er",
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */null, /* endDate */null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /* startDate */null, /* endDate */null,
regattaUUID, series, true, new LowPoint(), courseAreaUUID, /*buoyZoneRadiusInHullLengths*/2.0,
/* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
for (String name : raceColumnNames) {
@@ -874,7 +875,7 @@ public class MasterDataImportTest {
UUID regattaUUID = UUID.randomUUID();
Regatta regatta = sourceService.createRegatta(
RegattaImpl.getDefaultName(TEST_REGATTA_NAME, TEST_BOAT_CLASS_NAME), TEST_BOAT_CLASS_NAME,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */null, /* endDate */null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /* startDate */null, /* endDate */null,
regattaUUID, series, true, new LowPoint(), courseAreaUUID, /*buoyZoneRadiusInHullLengths*/2.0,
/* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
@@ -1033,7 +1034,7 @@ public class MasterDataImportTest {
UUID regattaUUID = UUID.randomUUID();
Regatta regatta = sourceService.createRegatta(
RegattaImpl.getDefaultName(TEST_REGATTA_NAME, TEST_BOAT_CLASS_NAME), TEST_BOAT_CLASS_NAME,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */null, /* endDate */null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /* startDate */null, /* endDate */null,
regattaUUID, series, true, new LowPoint(), courseAreaUUID, /*buoyZoneRadiusInHullLengths*/2.0,
/* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
for (String name : raceColumnNames) {
@@ -1145,7 +1146,7 @@ public class MasterDataImportTest {
destService));
Regatta regattaNotToOverride = destService.createRegatta(
RegattaImpl.getDefaultName(TEST_REGATTA_NAME, TEST_BOAT_CLASS_NAME), TEST_BOAT_CLASS_NAME,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */ null, /* endDate */null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /* startDate */ null, /* endDate */null,
regattaUUID, seriesNotToOverride, true, new LowPoint(), courseAreaUUID, /*buoyZoneRadiusInHullLengths*/2.0,
/* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
@@ -1234,7 +1235,7 @@ public class MasterDataImportTest {
UUID regattaUUID = UUID.randomUUID();
Regatta regatta = sourceService.createRegatta(
RegattaImpl.getDefaultName(TEST_REGATTA_NAME, TEST_BOAT_CLASS_NAME), TEST_BOAT_CLASS_NAME,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */null, /* endDate */null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /* startDate */null, /* endDate */null,
regattaUUID, series, true, new LowPoint(), courseAreaUUID, /*buoyZoneRadiusInHullLengths*/2.0,
/* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
@@ -1343,7 +1344,7 @@ public class MasterDataImportTest {
destService));
Regatta regattaToOverride = destService.createRegatta(
RegattaImpl.getDefaultName(TEST_REGATTA_NAME, TEST_BOAT_CLASS_NAME), TEST_BOAT_CLASS_NAME,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */ null, /* endDate */null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /* startDate */ null, /* endDate */null,
regattaUUID, seriesToOverride, true, new LowPoint(), courseAreaUUID, /*buoyZoneRadiusInHullLengths*/2.0,
/* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
@@ -1453,7 +1454,7 @@ public class MasterDataImportTest {
Regatta regatta = sourceService.createRegatta(
RegattaImpl.getDefaultName(TEST_REGATTA_NAME, TEST_BOAT_CLASS_NAME), TEST_BOAT_CLASS_NAME,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /* startDate */
null, /* endDate */null, UUID.randomUUID(), new ArrayList<Series>(), true, new LowPoint(),
defaultCourseArea.getId(), /*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
// Let's use the setters directly because we are not testing replication
@@ -1536,7 +1537,7 @@ public class MasterDataImportTest {
Regatta regatta = sourceService.createRegatta(
RegattaImpl.getDefaultName(TEST_REGATTA_NAME, TEST_BOAT_CLASS_NAME), TEST_BOAT_CLASS_NAME,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */null, /* endDate */null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /* startDate */null, /* endDate */null,
regattaUUID, series, true, new LowPoint(),
defaultCourseArea.getId(), /*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */true,
/* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
@@ -1670,7 +1671,7 @@ public class MasterDataImportTest {
UUID regattaUUID = UUID.randomUUID();
Regatta regatta = sourceService.createRegatta(
RegattaImpl.getDefaultName(TEST_REGATTA_NAME, TEST_BOAT_CLASS_NAME), TEST_BOAT_CLASS_NAME,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */null, /* endDate */null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /* startDate */null, /* endDate */null,
regattaUUID, series, true, new LowPoint(), courseAreaUUID, /*buoyZoneRadiusInHullLengths*/2.0,
/* useStartTimeInference */true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
@@ -1913,7 +1914,8 @@ public class MasterDataImportTest {
UUID regattaUUID = UUID.randomUUID();
Regatta regatta = sourceService.createRegatta(
RegattaImpl.getDefaultName(TEST_REGATTA_NAME, TEST_BOAT_CLASS_NAME), TEST_BOAT_CLASS_NAME,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */null, /* endDate */null, regattaUUID, series, true, new LowPoint(), courseAreaUUID, /*buoyZoneRadiusInHullLengths*/2.0,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false,
/* startDate */null, /* endDate */null, regattaUUID, series, true, new LowPoint(), courseAreaUUID, /*buoyZoneRadiusInHullLengths*/2.0,
/* useStartTimeInference */true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
for (String name : raceColumnNames) {
@@ -2142,7 +2144,7 @@ public class MasterDataImportTest {
UUID regattaUUID = UUID.randomUUID();
Regatta regatta = sourceService.createRegatta(
RegattaImpl.getDefaultName(TEST_REGATTA_NAME, TEST_BOAT_CLASS_NAME), TEST_BOAT_CLASS_NAME,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */ null, /* endDate */null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /* startDate */ null, /* endDate */null,
regattaUUID, seriesOnSource, true, new LowPoint(), courseAreaUUID, /*buoyZoneRadiusInHullLengths*/2.0,
/* useStartTimeInference */true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
for (String name : raceColumnNames) {
@@ -2269,7 +2271,7 @@ public class MasterDataImportTest {
Regatta regattaOnTarget = destService.createRegatta(
RegattaImpl.getDefaultName(TEST_REGATTA_NAME, TEST_BOAT_CLASS_NAME), TEST_BOAT_CLASS_NAME,
/* canBoatsOfCompetitorsChangePerRace */ true, /* startDate */null, /* endDate */null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /* startDate */null, /* endDate */null,
regattaUUID, seriesOnTarget, true, new LowPoint(),
courseAreaUUID, /*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */true, /* controlTrackingFromStartAndFinishTimes */ false, OneDesignRankingMetric::new);
@@ -73,7 +73,8 @@ public class RaceTrackerStartStopTest {
boatClass = new BoatClassImpl(BOATCLASSNAME, /* typicallyStartsUpwind */ true);
regatta = new RegattaImpl(EmptyRaceLogStore.INSTANCE, EmptyRegattaLogStore.INSTANCE,
RegattaImpl.getDefaultName(EVENTNAME, boatClass.getName()), boatClass,
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null, /* trackedRegattaRegistry */
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta*/ false,
/*startDate*/ null, /*endDate*/ null, /* trackedRegattaRegistry */
null, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), UUID.randomUUID(), null);
racingEventService.getRegattasByName().put(EVENTNAME, regatta);
TrackedRegatta trackedRegatta1 = racingEventService.getOrCreateTrackedRegatta(regatta);
@@ -89,7 +89,7 @@ public class RemoveLeaderboardTest {
boatClass = new BoatClassImpl(BOATCLASSNAME, /* typicallyStartsUpwind */ true);
regatta = new RegattaImpl(EmptyRaceLogStore.INSTANCE, EmptyRegattaLogStore.INSTANCE,
RegattaImpl.getDefaultName(EVENTNAME, boatClass.getName()), boatClass, /* canBoatsOfCompetitorsChangePerRace*/ true,
RegattaImpl.getDefaultName(EVENTNAME, boatClass.getName()), boatClass, /* canBoatsOfCompetitorsChangePerRace*/ true, /* canCompetitorsRegisterToOpenRegatta*/ false,
/*startDate*/ null, /*endDate*/ null, /* trackedRegattaRegistry */
null, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), UUID.randomUUID(), null);
TrackedRegatta trackedRegatta1 = server.getOrCreateTrackedRegatta(regatta);
@@ -139,7 +139,7 @@ public class SearchServiceTest {
/* medal */false, /* fleetsCanRunInParallel */ true, /* startsWithZero */false, /* firstColumnIsNonDiscardableCarryForward */false,
/* discardingThresholds */null, /* hasSplitFleetContiguousScoring */false, /* maximumNumberOfDiscards */ null));
pfingstbusch29er = server.apply(new AddSpecificRegatta(RegattaImpl.getDefaultName("Pfingstbusch", "29er"), "29er",
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null, UUID.randomUUID(),
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null, UUID.randomUUID(),
new RegattaCreationParametersDTO(seriesCreationParams), /* persistent */
true, new LowPoint(), kielAlpha.getId(), /*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, RankingMetrics.ONE_DESIGN));
server.apply(new AddColumnToSeries(pfingstbusch29er.getRegattaIdentifier(), "Default", "R1"));
@@ -148,7 +148,7 @@ public class SearchServiceTest {
RegattaLeaderboard pfingstbusch29erLeaderboard = server.apply(new CreateRegattaLeaderboard(pfingstbusch29er.getRegattaIdentifier(),
/* leaderboardDisplayName */ null, /* discardThresholds */ new int[0]));
pfingstbusch470 = server.apply(new AddSpecificRegatta(RegattaImpl.getDefaultName("Pfingstbusch", "470"), "470",
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null,
UUID.randomUUID(), new RegattaCreationParametersDTO(seriesCreationParams), /* persistent */
true, new LowPoint(), kielBravo.getId(), /*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, RankingMetrics.ONE_DESIGN));
server.apply(new AddColumnToSeries(pfingstbusch470.getRegattaIdentifier(), "Default", "R1"));
@@ -171,7 +171,7 @@ public class SearchServiceTest {
final CourseAreaImpl flensburgStandard = new CourseAreaImpl("Standard", UUID.randomUUID());
flensburg.addCourseArea(flensburgStandard);
aalRegatta = server.apply(new AddSpecificRegatta(RegattaImpl.getDefaultName("Aalregatta", "ORC"), "ORC",
/* canBoatsOfCompetitorsChangePerRace */ true, /*startDate*/ null, /*endDate*/ null, UUID.randomUUID(),
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false, /*startDate*/ null, /*endDate*/ null, UUID.randomUUID(),
new RegattaCreationParametersDTO(seriesCreationParams), /* persistent */
true, new LowPoint(), flensburgStandard.getId(), /*buoyZoneRadiusInHullLengths*/2.0, /* useStartTimeInference */ true, /* controlTrackingFromStartAndFinishTimes */ false, RankingMetrics.ONE_DESIGN));
server.apply(new AddColumnToSeries(aalRegatta.getRegattaIdentifier(), "Default", "R1"));
@@ -334,7 +334,8 @@ public interface RacingEventService extends TrackedRegattaRegistry, RegattaFetch
* @param controlTrackingFromStartAndFinishTimes
* cannot be {@code true} if {@link useStartTimeInference} is also {@code true}
*/
Regatta createRegatta(String regattaName, String boatClassName, boolean canBoatsOfCompetitorsChangePerRace, TimePoint startDate, TimePoint endDate, Serializable id, Iterable<? extends Series> series,
Regatta createRegatta(String regattaName, String boatClassName, boolean canBoatsOfCompetitorsChangePerRace,
boolean canCompetitorsRegisterToOpenRegatta, TimePoint startDate, TimePoint endDate, Serializable id, Iterable<? extends Series> series,
boolean persistent, ScoringScheme scoringScheme, Serializable defaultCourseAreaId, Double buoyZoneRadiusInHullLengths,
boolean useStartTimeInference, boolean controlTrackingFromStartAndFinishTimes, RankingMetricConstructor rankingMetricConstructor);
@@ -494,7 +495,8 @@ public interface RacingEventService extends TrackedRegattaRegistry, RegattaFetch
* the call
*/
Util.Pair<Regatta, Boolean> getOrCreateRegattaWithoutReplication(String fullRegattaName, String boatClassName,
boolean canBoatsOfCompetitorsChangePerRace, TimePoint startDate, TimePoint endDate, Serializable id,
boolean canBoatsOfCompetitorsChangePerRace, boolean canCompetitorsRegisterToOpenRegatta,
TimePoint startDate, TimePoint endDate, Serializable id,
Iterable<? extends Series> series, boolean persistent, ScoringScheme scoringScheme,
Serializable defaultCourseAreaId, Double buoyZoneRadiusInHullLengths, boolean useStartTimeInference,
boolean controlTrackingFromStartAndFinishTimes, RankingMetricConstructor rankingMetricConstructor);
@@ -1425,7 +1425,7 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
Regatta result = regattasByName.get(name);
if (result == null) {
result = new RegattaImpl(getRaceLogStore(), getRegattaLogStore(), name, getBaseDomainFactory()
.getOrCreateBoatClass(boatClassName), /* canBoatsOfCompetitorsChangePerRace*/ false,
.getOrCreateBoatClass(boatClassName), /* canBoatsOfCompetitorsChangePerRace*/ false, /* canCompetitorsRegisterToOpenRegatta*/ false,
/* startDate */null, /* endDate */null, this,
getBaseDomainFactory().createScoringScheme(ScoringSchemeType.LOW_POINT), id, /* course area */ null);
logger.info("Created default regatta " + result.getName() + " (" + hashCode() + ") on " + this);
@@ -1445,7 +1445,8 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
}
@Override
public Regatta createRegatta(String fullRegattaName, String boatClassName, boolean canBoatsOfCompetitorsChangePerRace, TimePoint startDate, TimePoint endDate,
public Regatta createRegatta(String fullRegattaName, String boatClassName, boolean canBoatsOfCompetitorsChangePerRace,
boolean canCompetitorsRegisterToOpenRegatta, TimePoint startDate, TimePoint endDate,
Serializable id, Iterable<? extends Series> series, boolean persistent, ScoringScheme scoringScheme,
Serializable defaultCourseAreaId, Double buoyZoneRadiusInHullLengths, boolean useStartTimeInference, boolean controlTrackingFromStartAndFinishTimes,
RankingMetricConstructor rankingMetricConstructor) {
@@ -1453,7 +1454,7 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
throw new IllegalArgumentException("Cannot set both of useStartTimeInference and controlTrackingFromStartAndFinishTimes to true");
}
com.sap.sse.common.Util.Pair<Regatta, Boolean> regattaWithCreatedFlag = getOrCreateRegattaWithoutReplication(
fullRegattaName, boatClassName, canBoatsOfCompetitorsChangePerRace, startDate, endDate, id, series, persistent, scoringScheme,
fullRegattaName, boatClassName, canBoatsOfCompetitorsChangePerRace, canCompetitorsRegisterToOpenRegatta, startDate, endDate, id, series, persistent, scoringScheme,
defaultCourseAreaId, buoyZoneRadiusInHullLengths, useStartTimeInference, controlTrackingFromStartAndFinishTimes, rankingMetricConstructor);
Regatta regatta = regattaWithCreatedFlag.getA();
if (regattaWithCreatedFlag.getB()) {
@@ -1485,13 +1486,14 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
@Override
public com.sap.sse.common.Util.Pair<Regatta, Boolean> getOrCreateRegattaWithoutReplication(String fullRegattaName,
String boatClassName, boolean canBoatsOfCompetitorsChangePerRace, TimePoint startDate, TimePoint endDate, Serializable id,
String boatClassName, boolean canBoatsOfCompetitorsChangePerRace, boolean canCompetitorsRegisterToOpenRegatta,
TimePoint startDate, TimePoint endDate, Serializable id,
Iterable<? extends Series> series, boolean persistent, ScoringScheme scoringScheme,
Serializable defaultCourseAreaId, Double buoyZoneRadiusInHullLengths, boolean useStartTimeInference, boolean controlTrackingFromStartAndFinishTimes,
RankingMetricConstructor rankingMetricConstructor) {
CourseArea courseArea = getCourseArea(defaultCourseAreaId);
Regatta regatta = new RegattaImpl(getRaceLogStore(), getRegattaLogStore(), fullRegattaName,
getBaseDomainFactory().getOrCreateBoatClass(boatClassName), canBoatsOfCompetitorsChangePerRace, startDate, endDate, series, persistent,
getBaseDomainFactory().getOrCreateBoatClass(boatClassName), canBoatsOfCompetitorsChangePerRace, canCompetitorsRegisterToOpenRegatta, startDate, endDate, series, persistent,
scoringScheme, id, courseArea, buoyZoneRadiusInHullLengths, useStartTimeInference, controlTrackingFromStartAndFinishTimes, rankingMetricConstructor);
boolean wasCreated = addAndConnectRegatta(persistent, defaultCourseAreaId, regatta);
if (wasCreated) {
@@ -1694,7 +1696,7 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
courseAreaId = regatta.getDefaultCourseArea().getId();
}
replicate(new AddSpecificRegatta(regatta.getName(), regatta.getBoatClass() == null ? null : regatta
.getBoatClass().getName(), regatta.canBoatsOfCompetitorsChangePerRace(),
.getBoatClass().getName(), regatta.canBoatsOfCompetitorsChangePerRace(), regatta.canCompetitorsRegisterToOpenRegatta(),
regatta.getStartDate(), regatta.getEndDate(), regatta.getId(),
getSeriesWithoutRaceColumnsConstructionParametersAsMap(regatta), regatta.isPersistent(),
regatta.getScoringScheme(), courseAreaId, regatta.getBuoyZoneRadiusInHullLengths(), regatta.useStartTimeInference(), regatta.isControlTrackingFromStartAndFinishTimes(),
@@ -33,14 +33,17 @@ public class AddSpecificRegatta extends AbstractAddRegattaOperation {
private final boolean useStartTimeInference;
private final boolean controlTrackingFromStartAndFinishTimes;
private final boolean canBoatsOfCompetitorsChangePerRace;
private final boolean canCompetitorsRegisterToOpenRegatta;
private final RankingMetrics rankingMetricType;
public AddSpecificRegatta(String regattaName, String boatClassName, boolean canBoatsOfCompetitorsChangePerRace, TimePoint startDate, TimePoint endDate, Serializable id,
public AddSpecificRegatta(String regattaName, String boatClassName, boolean canBoatsOfCompetitorsChangePerRace,
boolean canCompetitorsRegisterToOpenRegatta, TimePoint startDate, TimePoint endDate, Serializable id,
RegattaCreationParametersDTO seriesNamesWithFleetNamesAndFleetOrderingAndMedalAndDiscardingThresholds,
boolean persistent, ScoringScheme scoringScheme, Serializable defaultCourseAreaId, Double buoyZoneRadiusInHullLengths, boolean useStartTimeInference,
boolean controlTrackingFromStartAndFinishTimes, RankingMetrics rankingMetricType) {
super(regattaName, boatClassName, startDate, endDate, id);
this.canBoatsOfCompetitorsChangePerRace = canBoatsOfCompetitorsChangePerRace;
this.canCompetitorsRegisterToOpenRegatta = canCompetitorsRegisterToOpenRegatta;
this.seriesNamesWithFleetNamesAndFleetOrderingAndMedalAndStartsWithZeroScoreAndDiscardingThresholds = seriesNamesWithFleetNamesAndFleetOrderingAndMedalAndDiscardingThresholds;
this.persistent = persistent;
this.scoringScheme = scoringScheme;
@@ -53,7 +56,8 @@ public class AddSpecificRegatta extends AbstractAddRegattaOperation {
@Override
public Regatta internalApplyTo(RacingEventService toState) throws Exception {
Regatta regatta = toState.createRegatta(getRegattaName(), getBoatClassName(), canBoatsOfCompetitorsChangePerRace, getStartDate(), getEndDate(), getId(), createSeries(toState),
Regatta regatta = toState.createRegatta(getRegattaName(), getBoatClassName(), canBoatsOfCompetitorsChangePerRace,
canCompetitorsRegisterToOpenRegatta, getStartDate(), getEndDate(), getId(), createSeries(toState),
persistent, scoringScheme, defaultCourseAreaId, buoyZoneRadiusInHullLengths, useStartTimeInference, controlTrackingFromStartAndFinishTimes, RankingMetricsFactory.getRankingMetricConstructor(rankingMetricType));
return regatta;
}
@@ -101,7 +101,8 @@ public class StructureImporter {
RegattaImpl regatta = new RegattaImpl(RegattaImpl.getDefaultName(event.getTitle(), ((Division) event
.getRaceOrDivisionOrRegattaSeriesResult().get(0)).getTitle()),
baseDomainFactory.getOrCreateBoatClass(result.getA().getBoatClass()),
/* canBoatsOfCompetitorsChangePerRace */ true, startDate, endDate, getSeries(buildStructure), false,
/* canBoatsOfCompetitorsChangePerRace */ true, /* canCompetitorsRegisterToOpenRegatta */ false,
startDate, endDate, getSeries(buildStructure), false,
this.baseDomainFactory.createScoringScheme(ScoringSchemeType.LOW_POINT), event.getEventID(), null, OneDesignRankingMetric::new);
addSpecificRegattas.add(regatta);
}