mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-16 17:21:00 +00:00
Refrain from using CompetitorsInLogAnalyer and RaceLogUsesOwnCompetitorsAnalyzer
This commit is contained in:
1 parent
26cf9fb84e
commit
233b2b909f
4 files changed
+111
-60
No files matched your search
+25
-19
@@ -45,6 +45,7 @@ import com.sap.sailing.domain.racelog.tracking.GPSFixStore;
|
||||
import com.sap.sailing.domain.racelogtracking.RaceLogTrackingAdapter;
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
import com.sap.sailing.gwt.ui.adminconsole.RaceLogSetTrackingTimesDTO;
|
||||
import com.sap.sailing.gwt.ui.server.exceptions.NotFoundException;
|
||||
import com.sap.sailing.gwt.ui.shared.BulkScoreCorrectionDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompactRaceMapDataDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorsRaceDataDTO;
|
||||
@@ -448,10 +449,11 @@ public interface SailingService extends RemoteService, FileStorageManagementGwtS
|
||||
/**
|
||||
* Revoke the {@link RaceLogDenoteForTrackingEvent}. This does not affect an existing {@code RaceLogRaceTracker}
|
||||
* or {@link TrackedRace} for this {@code RaceLog}.
|
||||
* @throws NotFoundException
|
||||
*
|
||||
* @see RaceLogTrackingAdapter#removeDenotationForRaceLogTracking
|
||||
*/
|
||||
void removeDenotationForRaceLogTracking(String leaderboardName, String raceColumnName, String fleetName);
|
||||
void removeDenotationForRaceLogTracking(String leaderboardName, String raceColumnName, String fleetName) throws NotFoundException;
|
||||
|
||||
void denoteForRaceLogTracking(String leaderboardName) throws Exception;
|
||||
|
||||
@@ -464,15 +466,16 @@ public interface SailingService extends RemoteService, FileStorageManagementGwtS
|
||||
void startRaceLogTracking(String leaderboardName, String raceColumnName, String fleetName, boolean trackWind, boolean correctWindByDeclination)
|
||||
throws NotDenotedForRaceLogTrackingException, Exception;
|
||||
|
||||
void setCompetitorRegistrationsInRaceLog(String leaderboardName, String raceColumnName, String fleetName, Set<CompetitorDTO> competitors) throws CompetitorRegistrationOnRaceLogDisabledException;
|
||||
void setCompetitorRegistrationsInRaceLog(String leaderboardName, String raceColumnName, String fleetName, Set<CompetitorDTO> competitors) throws CompetitorRegistrationOnRaceLogDisabledException, NotFoundException;
|
||||
|
||||
/**
|
||||
* Adds the course definition to the racelog, while trying to reuse existing marks, controlpoints and waypoints
|
||||
* from the previous course definition in the racelog.
|
||||
* @throws NotFoundException
|
||||
*/
|
||||
void addCourseDefinitionToRaceLog(String leaderboardName, String raceColumnName, String fleetName, List<Util.Pair<ControlPointDTO, PassingInstruction>> course);
|
||||
void addCourseDefinitionToRaceLog(String leaderboardName, String raceColumnName, String fleetName, List<Util.Pair<ControlPointDTO, PassingInstruction>> course) throws NotFoundException;
|
||||
|
||||
RaceCourseDTO getLastCourseDefinitionInRaceLog(String leaderboardName, String raceColumnName, String fleetName);
|
||||
RaceCourseDTO getLastCourseDefinitionInRaceLog(String leaderboardName, String raceColumnName, String fleetName) throws NotFoundException;
|
||||
|
||||
/**
|
||||
* Adds a fix to the {@link GPSFixStore}, and creates a mapping with a virtual device for exactly the current timepoint.
|
||||
@@ -481,16 +484,17 @@ public interface SailingService extends RemoteService, FileStorageManagementGwtS
|
||||
void pingMark(String leaderboardName, MarkDTO mark, Position position) throws DoesNotHaveRegattaLogException;
|
||||
|
||||
List<DeviceMappingDTO> getDeviceMappingsFromRaceLog(String leaderboardName, String raceColumnName, String fleetName)
|
||||
throws TransformationException;
|
||||
throws TransformationException, NotFoundException;
|
||||
|
||||
List<String> getDeserializableDeviceIdentifierTypes();
|
||||
|
||||
/**
|
||||
* Revoke the events in the {@code RaceLog} that are identified by the {@code eventIds}.
|
||||
* This only affects such events that implement {@link Revokable}.
|
||||
* @throws NotFoundException
|
||||
*/
|
||||
void revokeRaceAndRegattaLogEvents(String leaderboardName, String raceColumnName, String fleetName, List<UUID> eventIds)
|
||||
throws NotRevokableException;
|
||||
throws NotRevokableException, NotFoundException;
|
||||
|
||||
Collection<String> getGPSFixImporterTypes();
|
||||
|
||||
@@ -543,7 +547,7 @@ public interface SailingService extends RemoteService, FileStorageManagementGwtS
|
||||
Integer getStructureImportOperationProgress();
|
||||
|
||||
List<DeviceMappingDTO> getDeviceMappingsFromLogHierarchy(String leaderboardName, String raceColumnName,
|
||||
String fleetName) throws TransformationException;
|
||||
String fleetName) throws TransformationException, NotFoundException;
|
||||
void inviteCompetitorsForTrackingViaEmail(String serverUrlWithoutTrailingSlash, EventDTO event,
|
||||
String leaderboardName, Collection<CompetitorDTO> competitors, String localeInfo) throws MailException;
|
||||
|
||||
@@ -566,44 +570,46 @@ public interface SailingService extends RemoteService, FileStorageManagementGwtS
|
||||
boolean doesRegattaLogContainCompetitors(String name) throws DoesNotHaveRegattaLogException;
|
||||
|
||||
RegattaAndRaceIdentifier getRaceIdentifier(String regattaLikeName, String raceColumnName, String fleetName);
|
||||
void setTrackingTimes(RaceLogSetTrackingTimesDTO dto);
|
||||
void setTrackingTimes(RaceLogSetTrackingTimesDTO dto) throws NotFoundException;
|
||||
|
||||
Pair<TimePoint, TimePoint> getTrackingTimes(String leaderboardName, String raceColumnName, String fleetName);
|
||||
Pair<TimePoint, TimePoint> getTrackingTimes(String leaderboardName, String raceColumnName, String fleetName) throws NotFoundException;
|
||||
|
||||
/**
|
||||
* @param raceLogFrom identifies the race log to copy from by its leaderboard name, race column name and fleet name
|
||||
* @param raceLogsTo identifies the race log to copy from by their leaderboard name, race column name and fleet name
|
||||
* @throws NotFoundException
|
||||
*/
|
||||
void copyCompetitorsToOtherRaceLogs(Triple<String, String, String> fromTriple,
|
||||
Set<Triple<String, String, String>> toTriples);
|
||||
Set<Triple<String, String, String>> toTriples) throws NotFoundException;
|
||||
|
||||
/**
|
||||
* @param raceLogFrom identifies the race log to copy from by its leaderboard name, race column name and fleet name
|
||||
* @param raceLogsTo identifies the race log to copy from by their leaderboard name, race column name and fleet name
|
||||
* @throws NotFoundException
|
||||
*/
|
||||
void copyCourseToOtherRaceLogs(Triple<String, String, String> fromTriple,
|
||||
Set<Triple<String, String, String>> toTriples);
|
||||
Set<Triple<String, String, String>> toTriples) throws NotFoundException;
|
||||
|
||||
/**
|
||||
* Get the competitors registered for a certain race. This automatically checks, whether competitors are registered
|
||||
* in the raceLog (in case of e.g. splitFleets) or in the RegattaLog (default)
|
||||
* @throws DoesNotHaveRegattaLogException
|
||||
* in the raceLog (in case of e.g. splitFleets) or in the RegattaLog (default)
|
||||
* @throws NotFoundException
|
||||
*/
|
||||
Collection<CompetitorDTO> getCompetitorRegistrationsForRace(String leaderboardName, String raceColumnName,
|
||||
String fleetName) throws DoesNotHaveRegattaLogException;
|
||||
String fleetName) throws DoesNotHaveRegattaLogException, NotFoundException;
|
||||
|
||||
void addMarkToRegattaLog(String leaderboardName, MarkDTO mark) throws DoesNotHaveRegattaLogException;
|
||||
|
||||
void revokeMarkDefinitionEventInRegattaLog(String leaderboardName, MarkDTO markDTO) throws DoesNotHaveRegattaLogException;
|
||||
|
||||
Collection<CompetitorDTO> getCompetitorRegistrationsInRegattaLog(String leaderboardName) throws DoesNotHaveRegattaLogException;
|
||||
Collection<CompetitorDTO> getCompetitorRegistrationsInRegattaLog(String leaderboardName) throws DoesNotHaveRegattaLogException, NotFoundException;
|
||||
|
||||
boolean areCompetitorRegistrationsEnabledForRace(String leaderboardName, String raceColumnName, String fleetName);
|
||||
Boolean areCompetitorRegistrationsEnabledForRace(String leaderboardName, String raceColumnName, String fleetName) throws NotFoundException;
|
||||
|
||||
void deactivateCompetitorRegistrationsForRace(String leaderboardName, String raceColumnName, String fleetName) throws NotRevokableException;
|
||||
void deactivateCompetitorRegistrationsForRace(String leaderboardName, String raceColumnName, String fleetName) throws NotRevokableException, NotFoundException;
|
||||
|
||||
void activateCompetitorRegistrationsForRace(String leaderboardName, String raceColumnName, String fleetName);
|
||||
void activateCompetitorRegistrationsForRace(String leaderboardName, String raceColumnName, String fleetName) throws IllegalArgumentException, NotFoundException;
|
||||
|
||||
Pair<Boolean, String> checkIfMarksAreUsedInOtherRaceLogs(String leaderboardName, String raceColumnName,
|
||||
String fleetName, Set<MarkDTO> marksToRemove);
|
||||
String fleetName, Set<MarkDTO> marksToRemove) throws NotFoundException;
|
||||
}
|
||||
+72
-36
@@ -83,7 +83,6 @@ import com.sap.sailing.domain.abstractlog.race.state.racingprocedure.gate.Readon
|
||||
import com.sap.sailing.domain.abstractlog.race.state.racingprocedure.rrs26.ReadonlyRRS26RacingProcedure;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogUseCompetitorsFromRaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.analyzing.impl.RaceLogTrackingStateAnalyzer;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.analyzing.impl.RaceLogUsesOwnCompetitorsAnalyzer;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.impl.RaceLogUseCompetitorsFromRaceLogEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLog;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEvent;
|
||||
@@ -95,7 +94,6 @@ import com.sap.sailing.domain.abstractlog.regatta.events.impl.RegattaLogDeviceCo
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.impl.RegattaLogDeviceMarkMappingEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.impl.RegattaLogRevokeEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.tracking.analyzing.impl.RegattaLogOpenEndedDeviceMappingCloser;
|
||||
import com.sap.sailing.domain.abstractlog.shared.analyzing.CompetitorsInLogAnalyzer;
|
||||
import com.sap.sailing.domain.abstractlog.shared.analyzing.DeviceCompetitorMappingFinder;
|
||||
import com.sap.sailing.domain.abstractlog.shared.analyzing.DeviceMarkMappingFinder;
|
||||
import com.sap.sailing.domain.base.Boat;
|
||||
@@ -289,6 +287,7 @@ import com.sap.sailing.domain.tractracadapter.TracTracConfiguration;
|
||||
import com.sap.sailing.domain.tractracadapter.TracTracConnectionConstants;
|
||||
import com.sap.sailing.gwt.ui.adminconsole.RaceLogSetTrackingTimesDTO;
|
||||
import com.sap.sailing.gwt.ui.client.SailingService;
|
||||
import com.sap.sailing.gwt.ui.server.exceptions.NotFoundException;
|
||||
import com.sap.sailing.gwt.ui.shared.BulkScoreCorrectionDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompactRaceMapDataDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorRaceDataDTO;
|
||||
@@ -4812,7 +4811,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTrackingTimes(RaceLogSetTrackingTimesDTO dto) {
|
||||
public void setTrackingTimes(RaceLogSetTrackingTimesDTO dto) throws NotFoundException {
|
||||
RaceLog raceLog = getRaceLog(dto.leaderboardName, dto.raceColumnName, dto.fleetName);
|
||||
// TODO If new is null and current is not, current should be revoked.
|
||||
if (!Util.equalsWithNull(dto.newStartOfTracking, dto.currentStartOfTracking)) {
|
||||
@@ -4828,7 +4827,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
}
|
||||
|
||||
@Override
|
||||
public Util.Pair<TimePoint, TimePoint> getTrackingTimes(String leaderboardName, String raceColumnName, String fleetName) {
|
||||
public Util.Pair<TimePoint, TimePoint> getTrackingTimes(String leaderboardName, String raceColumnName, String fleetName) throws NotFoundException {
|
||||
final RaceLog raceLog = getRaceLog(leaderboardName, raceColumnName, fleetName);
|
||||
final Pair<TimePoint, TimePoint> times = new TrackingTimesFinder(raceLog).analyze();
|
||||
return times == null ? null : new Pair<TimePoint, TimePoint>(times.getA(), times.getB());
|
||||
@@ -4963,15 +4962,15 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
@Override
|
||||
public void denoteForRaceLogTracking(String leaderboardName,
|
||||
String raceColumnName, String fleetName) throws Exception {
|
||||
Leaderboard leaderboard = getService().getLeaderboardByName(leaderboardName);
|
||||
RaceColumn raceColumn = getService().getLeaderboardByName(leaderboardName).getRaceColumnByName(raceColumnName);
|
||||
Fleet fleet = raceColumn.getFleetByName(fleetName);
|
||||
Leaderboard leaderboard = getService().getLeaderboardByName(leaderboardName);
|
||||
RaceColumn raceColumn = getRaceColumn(leaderboardName, raceColumnName);
|
||||
Fleet fleet = getFleetByName(raceColumn, fleetName);
|
||||
|
||||
getRaceLogTrackingAdapter().denoteRaceForRaceLogTracking(getService(), leaderboard, raceColumn, fleet, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeDenotationForRaceLogTracking(String leaderboardName, String raceColumnName, String fleetName) {
|
||||
public void removeDenotationForRaceLogTracking(String leaderboardName, String raceColumnName, String fleetName) throws NotFoundException {
|
||||
RaceLog raceLog = getRaceLog(leaderboardName, raceColumnName, fleetName);
|
||||
getRaceLogTrackingAdapter().removeDenotationForRaceLogTracking(getService(), raceLog);
|
||||
}
|
||||
@@ -4985,8 +4984,9 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
/**
|
||||
* @param triple leaderboard and racecolumn and fleet names
|
||||
* @return
|
||||
* @throws NotFoundException
|
||||
*/
|
||||
private RaceLog getRaceLog(com.sap.sse.common.Util.Triple<String, String, String> triple) {
|
||||
private RaceLog getRaceLog(com.sap.sse.common.Util.Triple<String, String, String> triple) throws NotFoundException {
|
||||
return getRaceLog(triple.getA(), triple.getB(), triple.getC());
|
||||
}
|
||||
|
||||
@@ -4998,9 +4998,9 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
return ((HasRegattaLike) l).getRegattaLike().getRegattaLog();
|
||||
}
|
||||
|
||||
private RaceLog getRaceLog(String leaderboardName, String raceColumnName, String fleetName) {
|
||||
RaceColumn raceColumn = getService().getLeaderboardByName(leaderboardName).getRaceColumnByName(raceColumnName);
|
||||
Fleet fleet = raceColumn.getFleetByName(fleetName);
|
||||
private RaceLog getRaceLog(String leaderboardName, String raceColumnName, String fleetName) throws NotFoundException {
|
||||
RaceColumn raceColumn = getRaceColumn(leaderboardName, raceColumnName);
|
||||
Fleet fleet = getFleetByName(raceColumn, fleetName);
|
||||
return raceColumn.getRaceLog(fleet);
|
||||
}
|
||||
|
||||
@@ -5010,7 +5010,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
|
||||
@Override
|
||||
public void setCompetitorRegistrationsInRaceLog(String leaderboardName, String raceColumnName, String fleetName,
|
||||
Set<CompetitorDTO> competitorDTOs) throws CompetitorRegistrationOnRaceLogDisabledException {
|
||||
Set<CompetitorDTO> competitorDTOs) throws CompetitorRegistrationOnRaceLogDisabledException, NotFoundException {
|
||||
RaceLog raceLog = getRaceLog(leaderboardName, raceColumnName, fleetName);
|
||||
Set<Competitor> competitors = new HashSet<Competitor>();
|
||||
for (CompetitorDTO dto : competitorDTOs) {
|
||||
@@ -5086,7 +5086,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
|
||||
@Override
|
||||
public void addCourseDefinitionToRaceLog(String leaderboardName, String raceColumnName, String fleetName,
|
||||
List<com.sap.sse.common.Util.Pair<ControlPointDTO, PassingInstruction>> courseDTO) {
|
||||
List<com.sap.sse.common.Util.Pair<ControlPointDTO, PassingInstruction>> courseDTO) throws NotFoundException {
|
||||
RaceLog raceLog = getRaceLog(leaderboardName, raceColumnName, fleetName);
|
||||
String name = String.format("Course for %s - %s - %s", leaderboardName, raceColumnName, fleetName);
|
||||
|
||||
@@ -5155,7 +5155,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceCourseDTO getLastCourseDefinitionInRaceLog(String leaderboardName, String raceColumnName, String fleetName) {
|
||||
public RaceCourseDTO getLastCourseDefinitionInRaceLog(String leaderboardName, String raceColumnName, String fleetName) throws NotFoundException {
|
||||
RaceLog raceLog = getRaceLog(leaderboardName, raceColumnName, fleetName);
|
||||
CourseBase lastPublishedCourse = new LastPublishedCourseDesignFinder(raceLog).analyze();
|
||||
if (lastPublishedCourse == null) {
|
||||
@@ -5178,7 +5178,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
|
||||
@Override
|
||||
public void copyCourseToOtherRaceLogs(com.sap.sse.common.Util.Triple<String, String, String> fromTriple,
|
||||
Set<com.sap.sse.common.Util.Triple<String, String, String>> toTriples) {
|
||||
Set<com.sap.sse.common.Util.Triple<String, String, String>> toTriples) throws NotFoundException {
|
||||
RaceLog fromRaceLog = getRaceLog(fromTriple);
|
||||
Set<RaceLog> toRaceLogs = new HashSet<>();
|
||||
for (com.sap.sse.common.Util.Triple<String, String, String> toTriple : toTriples) {
|
||||
@@ -5189,7 +5189,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
|
||||
@Override
|
||||
public void copyCompetitorsToOtherRaceLogs(com.sap.sse.common.Util.Triple<String, String, String> fromTriple,
|
||||
Set<com.sap.sse.common.Util.Triple<String, String, String>> toTriples) {
|
||||
Set<com.sap.sse.common.Util.Triple<String, String, String>> toTriples) throws NotFoundException {
|
||||
RaceLog fromRaceLog = getRaceLog(fromTriple);
|
||||
Set<RaceLog> toRaceLogs = new HashSet<>();
|
||||
for (com.sap.sse.common.Util.Triple<String, String, String> toTriple : toTriples) {
|
||||
@@ -5251,7 +5251,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
}
|
||||
|
||||
private List<AbstractLog<?, ?>> getLogHierarchy(String leaderboardName, String raceColumnName,
|
||||
String fleetName) {
|
||||
String fleetName) throws NotFoundException {
|
||||
List<AbstractLog<?, ?>> result = new ArrayList<>();
|
||||
RaceLog raceLog = getRaceLog(leaderboardName, raceColumnName, fleetName);
|
||||
|
||||
@@ -5290,13 +5290,13 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
|
||||
@Override
|
||||
public List<DeviceMappingDTO> getDeviceMappingsFromLogHierarchy(String leaderboardName, String raceColumnName,
|
||||
String fleetName) throws TransformationException {
|
||||
String fleetName) throws TransformationException, NotFoundException {
|
||||
return getDeviceMappingsFromLogs(getLogHierarchy(leaderboardName, raceColumnName, fleetName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceMappingDTO> getDeviceMappingsFromRaceLog(String leaderboardName, String raceColumnName,
|
||||
String fleetName) throws TransformationException {
|
||||
String fleetName) throws TransformationException, NotFoundException {
|
||||
RaceLog raceLog = getRaceLog(leaderboardName, raceColumnName, fleetName);
|
||||
return getDeviceMappingsFromLogs(Collections.<AbstractLog<?, ?>>singletonList(raceLog));
|
||||
}
|
||||
@@ -5395,7 +5395,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
|
||||
@Override
|
||||
public void revokeRaceAndRegattaLogEvents(String leaderboardName, String raceColumnName, String fleetName,
|
||||
List<UUID> eventIds) throws NotRevokableException {
|
||||
List<UUID> eventIds) throws NotRevokableException, NotFoundException {
|
||||
List<AbstractLog<?, ?>> logs = getLogHierarchy(leaderboardName, raceColumnName, fleetName);
|
||||
revokeEventsFromLogs(logs, eventIds);
|
||||
}
|
||||
@@ -5871,30 +5871,66 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
|
||||
@Override
|
||||
public Collection<CompetitorDTO> getCompetitorRegistrationsForRace(String leaderboardName, String raceColumnName,
|
||||
String fleetName) throws DoesNotHaveRegattaLogException {
|
||||
Leaderboard leaderboard = getService().getLeaderboardByName(leaderboardName);
|
||||
RaceColumn raceColumn = leaderboard.getRaceColumnByName(raceColumnName);
|
||||
Fleet fleet = raceColumn.getFleetByName(fleetName);
|
||||
String fleetName) throws NotFoundException {
|
||||
RaceColumn raceColumn = getRaceColumn(leaderboardName, raceColumnName);
|
||||
Fleet fleet = getFleetByName(raceColumn, fleetName);
|
||||
return convertToCompetitorDTOs(raceColumn.getAllCompetitors(fleet));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<CompetitorDTO> getCompetitorRegistrationsInRegattaLog(String leaderboardName) throws DoesNotHaveRegattaLogException {
|
||||
RegattaLog regattaLog = getRegattaLogInternal(leaderboardName);
|
||||
public Collection<CompetitorDTO> getCompetitorRegistrationsInRegattaLog(String leaderboardName) throws DoesNotHaveRegattaLogException, NotFoundException {
|
||||
Leaderboard leaderboard = getLeaderboardByName(leaderboardName);
|
||||
|
||||
return convertToCompetitorDTOs(new CompetitorsInLogAnalyzer<>(regattaLog).analyze());
|
||||
if (! (leaderboard instanceof HasRegattaLike)) {
|
||||
throw new DoesNotHaveRegattaLogException();
|
||||
}
|
||||
HasRegattaLike regattaLikeLeaderboard = ((HasRegattaLike) leaderboard);
|
||||
|
||||
return convertToCompetitorDTOs(regattaLikeLeaderboard.getCompetitorsRegisteredInRegattaLog());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areCompetitorRegistrationsEnabledForRace(String leaderboardName, String raceColumnName,
|
||||
String fleetName) {
|
||||
RaceLog raceLog = getRaceLog(leaderboardName, raceColumnName, fleetName);
|
||||
RaceLogUsesOwnCompetitorsAnalyzer analyzer = new RaceLogUsesOwnCompetitorsAnalyzer(raceLog);
|
||||
return analyzer.analyze();
|
||||
public Boolean areCompetitorRegistrationsEnabledForRace(String leaderboardName, String raceColumnName,
|
||||
String fleetName) throws NotFoundException {
|
||||
RaceColumn raceColumn = getRaceColumn(leaderboardName, raceColumnName);
|
||||
Fleet fleet = getFleetByName(raceColumn, fleetName);
|
||||
return raceColumn.isCompetitorRegistrationInRacelogEnabled(fleet);
|
||||
}
|
||||
|
||||
private Fleet getFleetByName(RaceColumn raceColumn, String fleetName) throws NotFoundException{
|
||||
Fleet fleet = raceColumn.getFleetByName(fleetName);
|
||||
if (fleet == null){
|
||||
throw new NotFoundException("fleet with name "+fleetName+" not found");
|
||||
}
|
||||
|
||||
return fleet;
|
||||
}
|
||||
|
||||
private Leaderboard getLeaderboardByName(String leaderboardName) throws NotFoundException{
|
||||
Leaderboard leaderboard = getService().getLeaderboardByName(leaderboardName);
|
||||
if (leaderboard == null){
|
||||
throw new NotFoundException("Leaderboard with name "+leaderboardName+" not found");
|
||||
}
|
||||
|
||||
return leaderboard;
|
||||
}
|
||||
|
||||
private RaceColumn getRaceColumn(String leaderboardName, String raceColumnName) throws NotFoundException{
|
||||
Leaderboard leaderboard = getService().getLeaderboardByName(leaderboardName);
|
||||
if (leaderboard == null){
|
||||
throw new NotFoundException("leaderboard with name "+leaderboardName+" not found");
|
||||
}
|
||||
|
||||
RaceColumn raceColumn = leaderboard.getRaceColumnByName(raceColumnName);
|
||||
if (raceColumn == null){
|
||||
throw new NotFoundException("raceColumn with name "+raceColumnName+" not found");
|
||||
}
|
||||
|
||||
return raceColumn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deactivateCompetitorRegistrationsForRace(String leaderboardName, String raceColumnName, String fleetName) throws NotRevokableException {
|
||||
public void deactivateCompetitorRegistrationsForRace(String leaderboardName, String raceColumnName, String fleetName) throws NotRevokableException, NotFoundException {
|
||||
if (areCompetitorRegistrationsEnabledForRace(leaderboardName, raceColumnName, fleetName)){
|
||||
RaceLog raceLog = getRaceLog(leaderboardName, raceColumnName, fleetName);
|
||||
|
||||
@@ -5906,7 +5942,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activateCompetitorRegistrationsForRace(String leaderboardName, String raceColumnName, String fleetName) {
|
||||
public void activateCompetitorRegistrationsForRace(String leaderboardName, String raceColumnName, String fleetName) throws IllegalArgumentException, NotFoundException {
|
||||
if (!areCompetitorRegistrationsEnabledForRace(leaderboardName, raceColumnName, fleetName)){
|
||||
RaceLog raceLog = getRaceLog(leaderboardName, raceColumnName, fleetName);
|
||||
int passId = raceLog.getCurrentPassId();
|
||||
@@ -5918,7 +5954,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
|
||||
@Override
|
||||
public Pair<Boolean, String> checkIfMarksAreUsedInOtherRaceLogs(String leaderboardName, String raceColumnName,
|
||||
String fleetName, Set<MarkDTO> marksToRemove) {
|
||||
String fleetName, Set<MarkDTO> marksToRemove) throws NotFoundException {
|
||||
Set<String> markIds = new HashSet<String>();
|
||||
for (MarkDTO markDTO : marksToRemove) {
|
||||
markIds.add(markDTO.getIdAsString());
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.sap.sailing.gwt.ui.server.exceptions;
|
||||
|
||||
public class NotFoundException extends Exception{
|
||||
|
||||
private static final long serialVersionUID = 1690510580423647161L;
|
||||
|
||||
public NotFoundException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
+4
-5
@@ -42,7 +42,6 @@ import com.sap.sailing.domain.abstractlog.regatta.events.impl.RegattaLogCloseOpe
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.impl.RegattaLogDeviceCompetitorMappingEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.events.impl.RegattaLogRegisterCompetitorEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.regatta.impl.OpenEndedDeviceMappingFinder;
|
||||
import com.sap.sailing.domain.abstractlog.shared.analyzing.CompetitorsInLogAnalyzer;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.DomainFactory;
|
||||
import com.sap.sailing.domain.base.Fleet;
|
||||
@@ -367,7 +366,7 @@ public class LeaderboardsResource extends AbstractSailingServerResource {
|
||||
.entity("Leaderboard does not exist or does not hold a RegattaLog").type(MediaType.TEXT_PLAIN)
|
||||
.build();
|
||||
}
|
||||
IsRegattaLike isRegattaLike = ((HasRegattaLike) leaderboard).getRegattaLike();
|
||||
HasRegattaLike hasRegattaLike = (HasRegattaLike) leaderboard;
|
||||
DomainFactory domainFactory = getService().getDomainObjectFactory().getBaseDomainFactory();
|
||||
AbstractLogEventAuthor author = new LogEventAuthorImpl(AbstractLogEventAuthor.NAME_COMPATIBILITY,
|
||||
AbstractLogEventAuthor.PRIORITY_COMPATIBILITY);
|
||||
@@ -406,16 +405,16 @@ public class LeaderboardsResource extends AbstractSailingServerResource {
|
||||
.type(MediaType.TEXT_PLAIN).build();
|
||||
}
|
||||
// add registration if necessary
|
||||
Set<Competitor> registered = new CompetitorsInLogAnalyzer<>(isRegattaLike.getRegattaLog()).analyze();
|
||||
Set<Competitor> registered = (Set<Competitor>) hasRegattaLike.getCompetitorsRegisteredInRegattaLog();
|
||||
if (!registered.contains(mappedTo)) {
|
||||
isRegattaLike.getRegattaLog().add(
|
||||
hasRegattaLike.getRegattaLike().getRegattaLog().add(
|
||||
new RegattaLogRegisterCompetitorEventImpl(now, now, author, UUID.randomUUID(), mappedTo));
|
||||
}
|
||||
DeviceIdentifier device = new SmartphoneUUIDIdentifierImpl(UUID.fromString(deviceUuid));
|
||||
TimePoint from = new MillisecondsTimePoint(fromMillis);
|
||||
event = new RegattaLogDeviceCompetitorMappingEventImpl(now, now, author, UUID.randomUUID(), mappedTo, device,
|
||||
from, null);
|
||||
isRegattaLike.getRegattaLog().add(event);
|
||||
hasRegattaLike.getRegattaLike().getRegattaLog().add(event);
|
||||
logger.fine("Successfully checked in competitor " + mappedTo.getName());
|
||||
return Response.status(Status.OK).build();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user