From 233b2b909f9ba3b886677ddd4ed9ab70c432bfe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Bro=C3=9F?= Date: Sat, 28 Nov 2015 13:45:19 +0100 Subject: [PATCH] Refrain from using CompetitorsInLogAnalyer and RaceLogUsesOwnCompetitorsAnalyzer --- .../sailing/gwt/ui/client/SailingService.java | 44 ++++--- .../gwt/ui/server/SailingServiceImpl.java | 108 ++++++++++++------ .../server/exceptions/NotFoundException.java | 10 ++ .../jaxrs/api/LeaderboardsResource.java | 9 +- 4 files changed, 111 insertions(+), 60 deletions(-) create mode 100644 java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/exceptions/NotFoundException.java diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/SailingService.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/SailingService.java index a6bc8e79a75..36485f872cf 100755 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/SailingService.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/SailingService.java @@ -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 competitors) throws CompetitorRegistrationOnRaceLogDisabledException; + void setCompetitorRegistrationsInRaceLog(String leaderboardName, String raceColumnName, String fleetName, Set 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> course); + void addCourseDefinitionToRaceLog(String leaderboardName, String raceColumnName, String fleetName, List> 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 getDeviceMappingsFromRaceLog(String leaderboardName, String raceColumnName, String fleetName) - throws TransformationException; + throws TransformationException, NotFoundException; List 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 eventIds) - throws NotRevokableException; + throws NotRevokableException, NotFoundException; Collection getGPSFixImporterTypes(); @@ -543,7 +547,7 @@ public interface SailingService extends RemoteService, FileStorageManagementGwtS Integer getStructureImportOperationProgress(); List getDeviceMappingsFromLogHierarchy(String leaderboardName, String raceColumnName, - String fleetName) throws TransformationException; + String fleetName) throws TransformationException, NotFoundException; void inviteCompetitorsForTrackingViaEmail(String serverUrlWithoutTrailingSlash, EventDTO event, String leaderboardName, Collection 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 getTrackingTimes(String leaderboardName, String raceColumnName, String fleetName); + Pair 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 fromTriple, - Set> toTriples); + Set> 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 fromTriple, - Set> toTriples); + Set> 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 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 getCompetitorRegistrationsInRegattaLog(String leaderboardName) throws DoesNotHaveRegattaLogException; + Collection 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 checkIfMarksAreUsedInOtherRaceLogs(String leaderboardName, String raceColumnName, - String fleetName, Set marksToRemove); + String fleetName, Set marksToRemove) throws NotFoundException; } diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/SailingServiceImpl.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/SailingServiceImpl.java index 6d090f0fd99..9ac0525b7a2 100755 --- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/SailingServiceImpl.java +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/SailingServiceImpl.java @@ -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 getTrackingTimes(String leaderboardName, String raceColumnName, String fleetName) { + public Util.Pair getTrackingTimes(String leaderboardName, String raceColumnName, String fleetName) throws NotFoundException { final RaceLog raceLog = getRaceLog(leaderboardName, raceColumnName, fleetName); final Pair times = new TrackingTimesFinder(raceLog).analyze(); return times == null ? null : new Pair(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 triple) { + private RaceLog getRaceLog(com.sap.sse.common.Util.Triple 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 competitorDTOs) throws CompetitorRegistrationOnRaceLogDisabledException { + Set competitorDTOs) throws CompetitorRegistrationOnRaceLogDisabledException, NotFoundException { RaceLog raceLog = getRaceLog(leaderboardName, raceColumnName, fleetName); Set competitors = new HashSet(); 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> courseDTO) { + List> 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 fromTriple, - Set> toTriples) { + Set> toTriples) throws NotFoundException { RaceLog fromRaceLog = getRaceLog(fromTriple); Set toRaceLogs = new HashSet<>(); for (com.sap.sse.common.Util.Triple toTriple : toTriples) { @@ -5189,7 +5189,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S @Override public void copyCompetitorsToOtherRaceLogs(com.sap.sse.common.Util.Triple fromTriple, - Set> toTriples) { + Set> toTriples) throws NotFoundException { RaceLog fromRaceLog = getRaceLog(fromTriple); Set toRaceLogs = new HashSet<>(); for (com.sap.sse.common.Util.Triple toTriple : toTriples) { @@ -5251,7 +5251,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S } private List> getLogHierarchy(String leaderboardName, String raceColumnName, - String fleetName) { + String fleetName) throws NotFoundException { List> result = new ArrayList<>(); RaceLog raceLog = getRaceLog(leaderboardName, raceColumnName, fleetName); @@ -5290,13 +5290,13 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S @Override public List getDeviceMappingsFromLogHierarchy(String leaderboardName, String raceColumnName, - String fleetName) throws TransformationException { + String fleetName) throws TransformationException, NotFoundException { return getDeviceMappingsFromLogs(getLogHierarchy(leaderboardName, raceColumnName, fleetName)); } @Override public List getDeviceMappingsFromRaceLog(String leaderboardName, String raceColumnName, - String fleetName) throws TransformationException { + String fleetName) throws TransformationException, NotFoundException { RaceLog raceLog = getRaceLog(leaderboardName, raceColumnName, fleetName); return getDeviceMappingsFromLogs(Collections.>singletonList(raceLog)); } @@ -5395,7 +5395,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S @Override public void revokeRaceAndRegattaLogEvents(String leaderboardName, String raceColumnName, String fleetName, - List eventIds) throws NotRevokableException { + List eventIds) throws NotRevokableException, NotFoundException { List> logs = getLogHierarchy(leaderboardName, raceColumnName, fleetName); revokeEventsFromLogs(logs, eventIds); } @@ -5871,30 +5871,66 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S @Override public Collection 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 getCompetitorRegistrationsInRegattaLog(String leaderboardName) throws DoesNotHaveRegattaLogException { - RegattaLog regattaLog = getRegattaLogInternal(leaderboardName); + public Collection 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 checkIfMarksAreUsedInOtherRaceLogs(String leaderboardName, String raceColumnName, - String fleetName, Set marksToRemove) { + String fleetName, Set marksToRemove) throws NotFoundException { Set markIds = new HashSet(); for (MarkDTO markDTO : marksToRemove) { markIds.add(markDTO.getIdAsString()); diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/exceptions/NotFoundException.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/exceptions/NotFoundException.java new file mode 100644 index 00000000000..55feda843d9 --- /dev/null +++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/exceptions/NotFoundException.java @@ -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); + } +} diff --git a/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/LeaderboardsResource.java b/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/LeaderboardsResource.java index 4dc01fadc41..2bbc6d03c05 100644 --- a/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/LeaderboardsResource.java +++ b/java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/jaxrs/api/LeaderboardsResource.java @@ -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 registered = new CompetitorsInLogAnalyzer<>(isRegattaLike.getRegattaLog()).analyze(); + Set registered = (Set) 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(); }