fb7f82fde11223c06e1e1a48ec957821b02c46ab
java/com.sap.sailing.domain.common/src/com/sap/sailing/domain/common/racelog/tracking/TrackingTimesRevocationErrorCode.java
| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | +package com.sap.sailing.domain.common.racelog.tracking; |
|
| 2 | + |
|
| 3 | +/** |
|
| 4 | + * Error codes for the revocation of tracking times. These are used to report errors that occur during the revocation |
|
| 5 | + * process, e.g. when there is no regatta leaderboard or when there are no automated tracking times. |
|
| 6 | + * |
|
| 7 | + * @see com.sap.sailing.domain.racelogtracking.TrackingTimesRevocationReport |
|
| 8 | + * |
|
| 9 | + * @author Axel Uhl (d043530) |
|
| 10 | + * |
|
| 11 | + */ |
|
| 12 | +public enum TrackingTimesRevocationErrorCode { |
|
| 13 | + NO_REGATTA_LEADERBOARD, |
|
| 14 | + NO_AUTOMATED_TRACKING_TIMES |
|
| 15 | +} |
|
| ... | ... | \ No newline at end of file |
java/com.sap.sailing.domain.racelogtrackingadapter/src/com/sap/sailing/domain/racelogtracking/RaceLogTrackingAdapter.java
| ... | ... | @@ -141,5 +141,5 @@ public interface RaceLogTrackingAdapter { |
| 141 | 141 | void copyPairingListFromOtherLeaderboard(RegattaLeaderboard sourceLeaderboard, RegattaLeaderboard targetLeaderboard, |
| 142 | 142 | String fromRaceColumnName, String toRaceColumnInclusiveName) throws NotFoundException; |
| 143 | 143 | |
| 144 | - void revokeExplicitTrackingTimes(RegattaLeaderboard leaderboard, RacingEventService raceLogResolver); |
|
| 144 | + TrackingTimesRevocationReport revokeExplicitTrackingTimes(RegattaLeaderboard leaderboard, RacingEventService raceLogResolver); |
|
| 145 | 145 | } |
java/com.sap.sailing.domain.racelogtrackingadapter/src/com/sap/sailing/domain/racelogtracking/TrackingTimesRevocationReport.java
| ... | ... | @@ -0,0 +1,31 @@ |
| 1 | +package com.sap.sailing.domain.racelogtracking; |
|
| 2 | + |
|
| 3 | +import java.util.Map; |
|
| 4 | +import java.util.Set; |
|
| 5 | + |
|
| 6 | +import com.sap.sailing.domain.abstractlog.race.RaceLogEvent; |
|
| 7 | +import com.sap.sailing.domain.base.Fleet; |
|
| 8 | +import com.sap.sailing.domain.base.RaceColumn; |
|
| 9 | +import com.sap.sailing.domain.common.racelog.tracking.TrackingTimesRevocationErrorCode; |
|
| 10 | +import com.sap.sse.common.TimePoint; |
|
| 11 | +import com.sap.sse.common.Util.Pair; |
|
| 12 | + |
|
| 13 | +public interface TrackingTimesRevocationReport { |
|
| 14 | + /** |
|
| 15 | + * @return {@code null} means no error |
|
| 16 | + */ |
|
| 17 | + TrackingTimesRevocationErrorCode getErrorCode(); |
|
| 18 | + |
|
| 19 | + void revoked(RaceColumn raceColumn, Fleet fleet, RaceLogEvent event); |
|
| 20 | + |
|
| 21 | + void notRevokedBecauseOfMissingStartOrFinishTime(RaceColumn raceColumn, Fleet fleet, TimePoint startTime, TimePoint finishedTime); |
|
| 22 | + |
|
| 23 | + void notRevokedBecauseNotForTracking(RaceColumn raceColumn, Fleet fleet); |
|
| 24 | + |
|
| 25 | + Map<Pair<RaceColumn, Fleet>, Pair<TimePoint, TimePoint>> getNotRevokedBecauseOfMissingStartOfFinishTime(); |
|
| 26 | + |
|
| 27 | + Map<Pair<RaceColumn, Fleet>, Set<RaceLogEvent>> getRevokedEvents(); |
|
| 28 | + |
|
| 29 | + Iterable<Pair<RaceColumn, Fleet>> getNotRevokedBecauseNotForTracking(); |
|
| 30 | + |
|
| 31 | +} |
java/com.sap.sailing.domain.racelogtrackingadapter/src/com/sap/sailing/domain/racelogtracking/impl/RaceLogTrackingAdapterImpl.java
| ... | ... | @@ -73,6 +73,7 @@ import com.sap.sailing.domain.leaderboard.Leaderboard; |
| 73 | 73 | import com.sap.sailing.domain.leaderboard.RegattaLeaderboard; |
| 74 | 74 | import com.sap.sailing.domain.racelogtracking.DeviceMappingWithRegattaLogEvent; |
| 75 | 75 | import com.sap.sailing.domain.racelogtracking.RaceLogTrackingAdapter; |
| 76 | +import com.sap.sailing.domain.racelogtracking.TrackingTimesRevocationReport; |
|
| 76 | 77 | import com.sap.sailing.domain.regattalike.LeaderboardThatHasRegattaLike; |
| 77 | 78 | import com.sap.sailing.domain.tracking.RaceHandle; |
| 78 | 79 | import com.sap.sailing.domain.tracking.RaceTrackingHandler; |
| ... | ... | @@ -471,7 +472,8 @@ public class RaceLogTrackingAdapterImpl implements RaceLogTrackingAdapter { |
| 471 | 472 | } |
| 472 | 473 | |
| 473 | 474 | @Override |
| 474 | - public void revokeExplicitTrackingTimes(RegattaLeaderboard leaderboard, RacingEventService service) { |
|
| 475 | + public TrackingTimesRevocationReport revokeExplicitTrackingTimes(RegattaLeaderboard leaderboard, RacingEventService service) { |
|
| 476 | + final TrackingTimesRevocationReportImpl result = new TrackingTimesRevocationReportImpl(/* error code */ null /* meaning no error */); |
|
| 475 | 477 | for (final RaceColumn raceColumn : leaderboard.getRaceColumns()) { |
| 476 | 478 | for (final Fleet fleet : raceColumn.getFleets()) { |
| 477 | 479 | final RaceLog raceLog = raceColumn.getRaceLog(fleet); |
| ... | ... | @@ -489,6 +491,7 @@ public class RaceLogTrackingAdapterImpl implements RaceLogTrackingAdapter { |
| 489 | 491 | if (trackingTimes.getA() != null) { |
| 490 | 492 | try { |
| 491 | 493 | raceLog.revokeEvent(service.getServerAuthor(), trackingTimes.getA(), "revoke explicit start of tracking time"); |
| 494 | + result.revoked(raceColumn, fleet, trackingTimes.getA()); |
|
| 492 | 495 | } catch (NotRevokableException e) { |
| 493 | 496 | logger.log(Level.WARNING, "could not revoke explicit start of tracking time by adding RevokeEvent", e); |
| 494 | 497 | } |
| ... | ... | @@ -496,15 +499,21 @@ public class RaceLogTrackingAdapterImpl implements RaceLogTrackingAdapter { |
| 496 | 499 | if (trackingTimes.getB() != null) { |
| 497 | 500 | try { |
| 498 | 501 | raceLog.revokeEvent(service.getServerAuthor(), trackingTimes.getB(), "revoke explicit end of tracking time"); |
| 502 | + result.revoked(raceColumn, fleet, trackingTimes.getB()); |
|
| 499 | 503 | } catch (NotRevokableException e) { |
| 500 | 504 | logger.log(Level.WARNING, "could not revoke explicit end of tracking time by adding RevokeEvent", e); |
| 501 | 505 | } |
| 502 | 506 | } |
| 503 | 507 | } |
| 508 | + } else { |
|
| 509 | + result.notRevokedBecauseOfMissingStartOrFinishTime(raceColumn, fleet, startTimeFinderResult != null ? startTimeFinderResult.getStartTime() : null, finishedTime); |
|
| 504 | 510 | } |
| 511 | + } else { |
|
| 512 | + result.notRevokedBecauseNotForTracking(raceColumn, fleet); |
|
| 505 | 513 | } |
| 506 | 514 | } |
| 507 | 515 | } |
| 508 | 516 | } |
| 517 | + return result; |
|
| 509 | 518 | } |
| 510 | 519 | } |
java/com.sap.sailing.domain.racelogtrackingadapter/src/com/sap/sailing/domain/racelogtracking/impl/TrackingTimesRevocationReportImpl.java
| ... | ... | @@ -0,0 +1,68 @@ |
| 1 | +package com.sap.sailing.domain.racelogtracking.impl; |
|
| 2 | + |
|
| 3 | +import java.util.ArrayList; |
|
| 4 | +import java.util.Collections; |
|
| 5 | +import java.util.HashSet; |
|
| 6 | +import java.util.LinkedHashMap; |
|
| 7 | +import java.util.List; |
|
| 8 | +import java.util.Map; |
|
| 9 | +import java.util.Set; |
|
| 10 | + |
|
| 11 | +import com.sap.sailing.domain.abstractlog.race.RaceLogEvent; |
|
| 12 | +import com.sap.sailing.domain.base.Fleet; |
|
| 13 | +import com.sap.sailing.domain.base.RaceColumn; |
|
| 14 | +import com.sap.sailing.domain.common.racelog.tracking.TrackingTimesRevocationErrorCode; |
|
| 15 | +import com.sap.sailing.domain.racelogtracking.TrackingTimesRevocationReport; |
|
| 16 | +import com.sap.sse.common.TimePoint; |
|
| 17 | +import com.sap.sse.common.Util.Pair; |
|
| 18 | + |
|
| 19 | +public class TrackingTimesRevocationReportImpl implements TrackingTimesRevocationReport { |
|
| 20 | + private final Map<Pair<RaceColumn, Fleet>, Set<RaceLogEvent>> revokedEvents; |
|
| 21 | + private final Map<Pair<RaceColumn, Fleet>, Pair<TimePoint, TimePoint>> notRevokedBecauseOfMissingStartOrFinishTime; |
|
| 22 | + private final List<Pair<RaceColumn, Fleet>> notRevokedBecauseNotForTracking; |
|
| 23 | + private final TrackingTimesRevocationErrorCode errorCode; |
|
| 24 | + |
|
| 25 | + public TrackingTimesRevocationReportImpl(TrackingTimesRevocationErrorCode errorCode) { |
|
| 26 | + super(); |
|
| 27 | + this.errorCode = errorCode; |
|
| 28 | + this.revokedEvents = new LinkedHashMap<>(); |
|
| 29 | + this.notRevokedBecauseOfMissingStartOrFinishTime = new LinkedHashMap<>(); |
|
| 30 | + this.notRevokedBecauseNotForTracking = new ArrayList<>(); |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + @Override |
|
| 34 | + public TrackingTimesRevocationErrorCode getErrorCode() { |
|
| 35 | + return errorCode; |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + @Override |
|
| 39 | + public void revoked(RaceColumn raceColumn, Fleet fleet, RaceLogEvent event) { |
|
| 40 | + final Set<RaceLogEvent> set = revokedEvents.computeIfAbsent(new Pair<>(raceColumn, fleet), k->new HashSet<>()); |
|
| 41 | + set.add(event); |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + @Override |
|
| 45 | + public void notRevokedBecauseOfMissingStartOrFinishTime(RaceColumn raceColumn, Fleet fleet, TimePoint startTime, TimePoint finishedTime) { |
|
| 46 | + notRevokedBecauseOfMissingStartOrFinishTime.put(new Pair<>(raceColumn, fleet), new Pair<>(startTime, finishedTime)); |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + @Override |
|
| 50 | + public void notRevokedBecauseNotForTracking(RaceColumn raceColumn, Fleet fleet) { |
|
| 51 | + notRevokedBecauseNotForTracking.add(new Pair<>(raceColumn, fleet)); |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + @Override |
|
| 55 | + public Map<Pair<RaceColumn, Fleet>, Pair<TimePoint, TimePoint>> getNotRevokedBecauseOfMissingStartOfFinishTime() { |
|
| 56 | + return Collections.unmodifiableMap(notRevokedBecauseOfMissingStartOrFinishTime); |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + @Override |
|
| 60 | + public Map<Pair<RaceColumn, Fleet>, Set<RaceLogEvent>> getRevokedEvents() { |
|
| 61 | + return Collections.unmodifiableMap(revokedEvents); |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + @Override |
|
| 65 | + public Iterable<Pair<RaceColumn, Fleet>> getNotRevokedBecauseNotForTracking() { |
|
| 66 | + return Collections.unmodifiableList(notRevokedBecauseNotForTracking); |
|
| 67 | + } |
|
| 68 | +} |
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/adminconsole/SmartphoneTrackingEventManagementPanel.java
| ... | ... | @@ -59,6 +59,7 @@ import com.sap.sailing.gwt.ui.shared.RaceLogSetFinishingAndFinishTimeDTO; |
| 59 | 59 | import com.sap.sailing.gwt.ui.shared.RaceLogSetStartTimeAndProcedureDTO; |
| 60 | 60 | import com.sap.sailing.gwt.ui.shared.RegattaDTO; |
| 61 | 61 | import com.sap.sailing.gwt.ui.shared.StrippedLeaderboardDTO; |
| 62 | +import com.sap.sailing.gwt.ui.shared.TrackingTimesRevocationReportDTO; |
|
| 62 | 63 | import com.sap.sse.common.Distance; |
| 63 | 64 | import com.sap.sse.common.Util; |
| 64 | 65 | import com.sap.sse.common.Util.Pair; |
| ... | ... | @@ -227,17 +228,60 @@ public class SmartphoneTrackingEventManagementPanel extends AbstractLeaderboardC |
| 227 | 228 | |
| 228 | 229 | private void revokeExplicitTrackingTimes() { |
| 229 | 230 | if (Window.confirm(stringMessages.confirmRevokeExplicitTrackingTimes(getSelectedLeaderboard().getName()))) { |
| 230 | - sailingServiceWrite.revokeExplicitTrackingTimes(getSelectedLeaderboard().getName(), new AsyncCallback<Void>() { |
|
| 231 | + sailingServiceWrite.revokeExplicitTrackingTimes(getSelectedLeaderboard().getName(), new AsyncCallback<TrackingTimesRevocationReportDTO>() { |
|
| 231 | 232 | @Override |
| 232 | 233 | public void onFailure(Throwable caught) { |
| 233 | 234 | errorReporter.reportError(stringMessages.errorRevokingExplicitTrackingTimes(getSelectedLeaderboard().getName(), caught.getMessage())); |
| 234 | 235 | } |
| 235 | 236 | |
| 236 | 237 | @Override |
| 237 | - public void onSuccess(Void result) { |
|
| 238 | - Notification.notify(stringMessages.successfullyREvokedExplicitTrackingTimes(getSelectedLeaderboard().getName()), NotificationType.SUCCESS); |
|
| 238 | + public void onSuccess(TrackingTimesRevocationReportDTO result) { |
|
| 239 | + Window.alert(result.getErrorCode() == null ? |
|
| 240 | + stringMessages.successfullyRevokedExplicitTrackingTimes(getSelectedLeaderboard().getName(), i18n(result)) : |
|
| 241 | + stringMessages.errorRevokingExplicitTrackingTimes(getSelectedLeaderboard().getName(), i18n(result))); |
|
| 239 | 242 | loadAndRefreshLeaderboard(getSelectedLeaderboard().getName()); |
| 240 | 243 | } |
| 244 | + |
|
| 245 | + private String i18n(TrackingTimesRevocationReportDTO report) { |
|
| 246 | + final StringBuilder result = new StringBuilder(); |
|
| 247 | + if (report.getErrorCode() != null) { |
|
| 248 | + switch (report.getErrorCode()) { |
|
| 249 | + case NO_REGATTA_LEADERBOARD: |
|
| 250 | + result.append(stringMessages.noRegattaLeaderboard(getSelectedLeaderboard().getName())).append("\n"); |
|
| 251 | + break; |
|
| 252 | + case NO_AUTOMATED_TRACKING_TIMES: |
|
| 253 | + result.append(stringMessages.noAutomatedTrackingTimes(getSelectedLeaderboard().getName())).append("\n"); |
|
| 254 | + break; |
|
| 255 | + default: |
|
| 256 | + result.append(stringMessages.unknownError(report.getErrorCode().name())).append("\n"); |
|
| 257 | + } |
|
| 258 | + } else { |
|
| 259 | + result.append(stringMessages.revokedTrackingTimesForEvents()).append("\n"); |
|
| 260 | + report.getRevokedEvents().forEach((raceColumnAndFleet, events)->{ |
|
| 261 | + final String raceColumnName = raceColumnAndFleet.getA().getName(); |
|
| 262 | + final String fleetName = raceColumnAndFleet.getB().getName(); |
|
| 263 | + result.append(" - ").append(raceColumnName).append(" / ").append(fleetName).append("\n"); |
|
| 264 | + events.forEach(event->{ |
|
| 265 | + result.append(" - ").append(event.getType()).append(" (").append(event.getLogicalTimePoint()).append(")\n"); |
|
| 266 | + }); |
|
| 267 | + }); |
|
| 268 | + result.append(stringMessages.notRevokedTrackingTimesBecauseNotForTracking()).append("\n"); |
|
| 269 | + report.getNotRevokedBecauseNotForTracking().forEach(raceColumnAndFleet->{ |
|
| 270 | + final String raceColumnName = raceColumnAndFleet.getA().getName(); |
|
| 271 | + final String fleetName = raceColumnAndFleet.getB().getName(); |
|
| 272 | + result.append(" - ").append(raceColumnName).append(" / ").append(fleetName).append("\n"); |
|
| 273 | + }); |
|
| 274 | + result.append(stringMessages.notRevokedTrackingTimesBecauseOfMissingStartOrFinishTime()).append("\n"); |
|
| 275 | + report.getNotRevokedBecauseOfMissingStartOrFinishTime().forEach((raceColumnAndFleet, startAndEndTime)->{ |
|
| 276 | + final String raceColumnName = raceColumnAndFleet.getA().getName(); |
|
| 277 | + final String fleetName = raceColumnAndFleet.getB().getName(); |
|
| 278 | + result.append(" - ").append(raceColumnName).append(" / ").append(fleetName) |
|
| 279 | + .append(" (").append(stringMessages.startTime()).append(": ").append(startAndEndTime.getA()) |
|
| 280 | + .append(", ").append(stringMessages.finishedTime()).append(": ").append(startAndEndTime.getB()).append(")\n"); |
|
| 281 | + }); |
|
| 282 | + } |
|
| 283 | + return result.toString(); |
|
| 284 | + } |
|
| 241 | 285 | }); |
| 242 | 286 | } |
| 243 | 287 | } |
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/SailingServiceWrite.java
| ... | ... | @@ -84,6 +84,7 @@ import com.sap.sailing.gwt.ui.shared.SwissTimingRaceRecordDTO; |
| 84 | 84 | import com.sap.sailing.gwt.ui.shared.TracTracConfigurationWithSecurityDTO; |
| 85 | 85 | import com.sap.sailing.gwt.ui.shared.TracTracRaceRecordDTO; |
| 86 | 86 | import com.sap.sailing.gwt.ui.shared.TrackFileImportDeviceIdentifierDTO; |
| 87 | +import com.sap.sailing.gwt.ui.shared.TrackingTimesRevocationReportDTO; |
|
| 87 | 88 | import com.sap.sailing.gwt.ui.shared.TypedDeviceMappingDTO; |
| 88 | 89 | import com.sap.sailing.gwt.ui.shared.UrlDTO; |
| 89 | 90 | import com.sap.sailing.gwt.ui.shared.VenueDTO; |
| ... | ... | @@ -763,5 +764,5 @@ public interface SailingServiceWrite extends FileStorageManagementGwtService, Sa |
| 763 | 764 | void copyPairingListFromOtherLeaderboard(String sourceLeaderboardName, String targetLeaderboardName, String fromRaceColumnName, |
| 764 | 765 | String toRaceColumnInclusiveName) throws UnauthorizedException, NotFoundException; |
| 765 | 766 | |
| 766 | - void revokeExplicitTrackingTimes(String leaderboardName) throws NotFoundException; |
|
| 767 | + TrackingTimesRevocationReportDTO revokeExplicitTrackingTimes(String leaderboardName) throws NotFoundException; |
|
| 767 | 768 | } |
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/SailingServiceWriteAsync.java
| ... | ... | @@ -72,6 +72,7 @@ import com.sap.sailing.gwt.ui.shared.SwissTimingRaceRecordDTO; |
| 72 | 72 | import com.sap.sailing.gwt.ui.shared.TracTracConfigurationWithSecurityDTO; |
| 73 | 73 | import com.sap.sailing.gwt.ui.shared.TracTracRaceRecordDTO; |
| 74 | 74 | import com.sap.sailing.gwt.ui.shared.TrackFileImportDeviceIdentifierDTO; |
| 75 | +import com.sap.sailing.gwt.ui.shared.TrackingTimesRevocationReportDTO; |
|
| 75 | 76 | import com.sap.sailing.gwt.ui.shared.TypedDeviceMappingDTO; |
| 76 | 77 | import com.sap.sailing.gwt.ui.shared.UrlDTO; |
| 77 | 78 | import com.sap.sailing.gwt.ui.shared.VenueDTO; |
| ... | ... | @@ -791,5 +792,5 @@ public interface SailingServiceWriteAsync extends FileStorageManagementGwtServic |
| 791 | 792 | * Precondition: The leaderboard must be a {@link RegattaLeaderboard}, and the corresponding regatta must be in more |
| 792 | 793 | * {@link Regatta#isControlTrackingFromStartAndFinishTimes()} |
| 793 | 794 | */ |
| 794 | - void revokeExplicitTrackingTimes(String leaderboardName, AsyncCallback<Void> asyncCallback); |
|
| 795 | + void revokeExplicitTrackingTimes(String leaderboardName, AsyncCallback<TrackingTimesRevocationReportDTO> asyncCallback); |
|
| 795 | 796 | } |
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages.java
| ... | ... | @@ -105,6 +105,7 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages, |
| 105 | 105 | String event(); |
| 106 | 106 | String startTime(); |
| 107 | 107 | String endTime(); |
| 108 | + String finishedTime(); |
|
| 108 | 109 | String startOfTracking(); |
| 109 | 110 | String endOfTracking(); |
| 110 | 111 | String regatta(); |
| ... | ... | @@ -2558,5 +2559,11 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages, |
| 2558 | 2559 | String revokeExplicitTrackingTimes(); |
| 2559 | 2560 | String confirmRevokeExplicitTrackingTimes(String leaderboardName); |
| 2560 | 2561 | String errorRevokingExplicitTrackingTimes(String leaderboardName, String message); |
| 2561 | - String successfullyREvokedExplicitTrackingTimes(String leaderboardName); |
|
| 2562 | + String successfullyRevokedExplicitTrackingTimes(String leaderboardName, String formattedAndTranslatedReport); |
|
| 2563 | + String revokedTrackingTimesForEvents(); |
|
| 2564 | + String notRevokedTrackingTimesBecauseNotForTracking(); |
|
| 2565 | + String notRevokedTrackingTimesBecauseOfMissingStartOrFinishTime(); |
|
| 2566 | + String noRegattaLeaderboard(String leaderboardName); |
|
| 2567 | + String noAutomatedTrackingTimes(String leaderboardName); |
|
| 2568 | + String unknownError(String name); |
|
| 2562 | 2569 | } |
| ... | ... | \ No newline at end of file |
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages.properties
| ... | ... | @@ -111,6 +111,7 @@ regattaName=Regatta name |
| 111 | 111 | eventName=Event name |
| 112 | 112 | event=Event |
| 113 | 113 | startTime=Start time |
| 114 | +finishedTime=Finished time |
|
| 114 | 115 | endTime=End time |
| 115 | 116 | startOfTracking=Start of tracking |
| 116 | 117 | endOfTracking=End of tracking |
| ... | ... | @@ -2594,4 +2595,10 @@ sourceCode=Source Code |
| 2594 | 2595 | revokeExplicitTrackingTimes=Revoke explicit tracking times for races with valid start and finishing times |
| 2595 | 2596 | confirmRevokeExplicitTrackingTimes=Really revoke explicit tracking times for all races of leaderboard {0} that have valid start and finishing times? |
| 2596 | 2597 | errorRevokingExplicitTrackingTimes=Error revoking explicit tracking times for leaderboard {0}: {1} |
| 2597 | -successfullyREvokedExplicitTrackingTimes=Successfully revoked explicit tracking times for leaderboard {0} |
|
| ... | ... | \ No newline at end of file |
| 0 | +successfullyRevokedExplicitTrackingTimes=Successfully revoked explicit tracking times for leaderboard {0}: {1} |
|
| 1 | +revokedTrackingTimesForEvents=Revoked tracking times for events: |
|
| 2 | +notRevokedTrackingTimesBecauseNotForTracking=Not revoked tracking times for events that are not tracked: |
|
| 3 | +notRevokedTrackingTimesBecauseOfMissingStartOrFinishTime=Not revoked tracking times for events with missing start or finish time: |
|
| 4 | +noRegattaLeaderboard=Leaderboard {0} is not a regatta leaderboard. |
|
| 5 | +noAutomatedTrackingTimes=Leaderboard {0} has no automated tracking times. |
|
| 6 | +unknownError=Unknown error: {0} |
|
| ... | ... | \ No newline at end of file |
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages_de.properties
| ... | ... | @@ -112,6 +112,7 @@ regattaName=Name der Regatta |
| 112 | 112 | eventName=Event-Name |
| 113 | 113 | event=Veranstaltung |
| 114 | 114 | startTime=Startzeit |
| 115 | +finishedTime=Zielenlauf-Endezeit |
|
| 115 | 116 | endTime=Schlusszeit |
| 116 | 117 | startOfTracking=Start des Trackings |
| 117 | 118 | endOfTracking=Ende des Trackings |
| ... | ... | @@ -2588,4 +2589,10 @@ sourceCode=Quellcode |
| 2588 | 2589 | revokeExplicitTrackingTimes=Explizite Tracking-Zeiten zurücksetzen für Rennen mit gültigen Start- und Endzeitpunkten |
| 2589 | 2590 | confirmRevokeExplicitTrackingTimes=Wirklich explizite Tracking-Zeiten zurücksetzen für Rennen mit gültigen Start- und Endzeitpunkten der Rangliste {0}? |
| 2590 | 2591 | errorRevokingExplicitTrackingTimes=Fehler beim Zurücksetzen expliziter Tracking-Zeiten für Rennen mit gültigen Start- und Endzeitpunkten der Rangliste {0}: {1} |
| 2591 | -successfullyREvokedExplicitTrackingTimes=Explizite Tracking-Zeiten erfolgreich zurückgesetzt für Rangliste {0} |
|
| ... | ... | \ No newline at end of file |
| 0 | +successfullyRevokedExplicitTrackingTimes=Explizite Tracking-Zeiten erfolgreich zurückgesetzt für Rangliste {0}: {1} |
|
| 1 | +revokedTrackingTimesForEvents=Widerrufene explizite Tracking-Zeiten: |
|
| 2 | +notRevokedTrackingTimesBecauseNotForTracking=Nicht widerrufene explizite Tracking-Zeiten für nicht getrackte Rennen: |
|
| 3 | +notRevokedTrackingTimesBecauseOfMissingStartOrFinishTime=Nicht widerrufene explizite Tracking-Zeiten für Rennen mit ungültigen Start- oder Endzeitpunkten: |
|
| 4 | +noRegattaLeaderboard=Rangliste {0} ist keine Regatta-Rangliste. |
|
| 5 | +noAutomatedTrackingTimes=Rangliste {0} nutzt keine automatisierten Tracking-Zeiten, auf die zurückgesetzt werden könnte. |
|
| 6 | +unknownError=Unbekannter Fehler: {0} |
|
| ... | ... | \ No newline at end of file |
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/server/SailingServiceWriteImpl.java
| ... | ... | @@ -207,6 +207,7 @@ import com.sap.sailing.domain.common.racelog.tracking.DoesNotHaveRegattaLogExcep |
| 207 | 207 | import com.sap.sailing.domain.common.racelog.tracking.MarkAlreadyUsedInRaceException; |
| 208 | 208 | import com.sap.sailing.domain.common.racelog.tracking.NotDenotableForRaceLogTrackingException; |
| 209 | 209 | import com.sap.sailing.domain.common.racelog.tracking.NotDenotedForRaceLogTrackingException; |
| 210 | +import com.sap.sailing.domain.common.racelog.tracking.TrackingTimesRevocationErrorCode; |
|
| 210 | 211 | import com.sap.sailing.domain.common.security.SecuredDomainType; |
| 211 | 212 | import com.sap.sailing.domain.common.security.SecuredDomainType.EventActions; |
| 212 | 213 | import com.sap.sailing.domain.common.tagging.RaceLogNotFoundException; |
| ... | ... | @@ -288,6 +289,7 @@ import com.sap.sailing.gwt.ui.shared.SwissTimingRaceRecordDTO; |
| 288 | 289 | import com.sap.sailing.gwt.ui.shared.TracTracConfigurationWithSecurityDTO; |
| 289 | 290 | import com.sap.sailing.gwt.ui.shared.TracTracRaceRecordDTO; |
| 290 | 291 | import com.sap.sailing.gwt.ui.shared.TrackFileImportDeviceIdentifierDTO; |
| 292 | +import com.sap.sailing.gwt.ui.shared.TrackingTimesRevocationReportDTO; |
|
| 291 | 293 | import com.sap.sailing.gwt.ui.shared.TypedDeviceMappingDTO; |
| 292 | 294 | import com.sap.sailing.gwt.ui.shared.UrlDTO; |
| 293 | 295 | import com.sap.sailing.gwt.ui.shared.VenueDTO; |
| ... | ... | @@ -4197,22 +4199,21 @@ public class SailingServiceWriteImpl extends SailingServiceImpl implements Saili |
| 4197 | 4199 | } |
| 4198 | 4200 | |
| 4199 | 4201 | @Override |
| 4200 | - public void revokeExplicitTrackingTimes(String leaderboardName) throws NotFoundException { |
|
| 4202 | + public TrackingTimesRevocationReportDTO revokeExplicitTrackingTimes(String leaderboardName) throws NotFoundException { |
|
| 4201 | 4203 | final Leaderboard leaderboard = getLeaderboardByName(leaderboardName); |
| 4202 | 4204 | getService().getSecurityService().checkCurrentUserUpdatePermission(leaderboard); |
| 4205 | + final TrackingTimesRevocationReportDTO result; |
|
| 4203 | 4206 | if (leaderboard instanceof RegattaLeaderboard) { |
| 4204 | 4207 | final Regatta regatta = ((RegattaLeaderboard) leaderboard).getRegatta(); |
| 4205 | 4208 | if (regatta.isControlTrackingFromStartAndFinishTimes()) { |
| 4206 | - getRaceLogTrackingAdapter().revokeExplicitTrackingTimes((RegattaLeaderboard) leaderboard, /* raceLogResolver */ getService()); |
|
| 4209 | + result = new TrackingTimesRevocationReportDTO(getRaceLogTrackingAdapter().revokeExplicitTrackingTimes( |
|
| 4210 | + (RegattaLeaderboard) leaderboard, /* raceLogResolver */ getService())); |
|
| 4207 | 4211 | } else { |
| 4208 | - throw new IllegalStateException("Leaderboard " + leaderboardName |
|
| 4209 | - + " is not configured to control tracking from start and finish times, so explicit tracking times should not exist and thus cannot be revoked."); |
|
| 4212 | + result = new TrackingTimesRevocationReportDTO(TrackingTimesRevocationErrorCode.NO_AUTOMATED_TRACKING_TIMES); |
|
| 4210 | 4213 | } |
| 4211 | 4214 | } else { |
| 4212 | - throw new IllegalArgumentException("Leaderboard " + leaderboardName |
|
| 4213 | - + " must be a regatta leaderboard, but was: " + leaderboard.getLeaderboardType()); |
|
| 4215 | + result = new TrackingTimesRevocationReportDTO(TrackingTimesRevocationErrorCode.NO_REGATTA_LEADERBOARD); |
|
| 4214 | 4216 | } |
| 4215 | - // TODO Auto-generated method stub |
|
| 4216 | - |
|
| 4217 | + return result; |
|
| 4217 | 4218 | } |
| 4218 | 4219 | } |
java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/shared/TrackingTimesRevocationReportDTO.java
| ... | ... | @@ -0,0 +1,97 @@ |
| 1 | +package com.sap.sailing.gwt.ui.shared; |
|
| 2 | + |
|
| 3 | +import java.util.ArrayList; |
|
| 4 | +import java.util.HashMap; |
|
| 5 | +import java.util.HashSet; |
|
| 6 | +import java.util.LinkedHashMap; |
|
| 7 | +import java.util.Map.Entry; |
|
| 8 | +import java.util.Set; |
|
| 9 | + |
|
| 10 | +import com.google.gwt.core.shared.GwtIncompatible; |
|
| 11 | +import com.google.gwt.user.client.rpc.IsSerializable; |
|
| 12 | +import com.sap.sailing.domain.abstractlog.race.RaceLogEvent; |
|
| 13 | +import com.sap.sailing.domain.base.Fleet; |
|
| 14 | +import com.sap.sailing.domain.base.RaceColumn; |
|
| 15 | +import com.sap.sailing.domain.common.dto.FleetDTO; |
|
| 16 | +import com.sap.sailing.domain.common.dto.RaceColumnDTO; |
|
| 17 | +import com.sap.sailing.domain.common.racelog.tracking.TrackingTimesRevocationErrorCode; |
|
| 18 | +import com.sap.sailing.domain.racelogtracking.TrackingTimesRevocationReport; |
|
| 19 | +import com.sap.sse.common.TimePoint; |
|
| 20 | +import com.sap.sse.common.Util.Pair; |
|
| 21 | + |
|
| 22 | +public class TrackingTimesRevocationReportDTO implements IsSerializable { |
|
| 23 | + private LinkedHashMap<Pair<RaceColumnDTO, FleetDTO>, HashSet<RaceLogEventDTO>> revokedEvents; |
|
| 24 | + private LinkedHashMap<Pair<RaceColumnDTO, FleetDTO>, Pair<TimePoint, TimePoint>> notRevokedBecauseOfMissingStartOrFinishTime; |
|
| 25 | + private ArrayList<Pair<RaceColumnDTO, FleetDTO>> notRevokedBecauseNotForTracking; |
|
| 26 | + private TrackingTimesRevocationErrorCode errorCode; |
|
| 27 | + |
|
| 28 | + @Deprecated |
|
| 29 | + TrackingTimesRevocationReportDTO() { |
|
| 30 | + // for GWT serialization |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + @GwtIncompatible |
|
| 34 | + public TrackingTimesRevocationReportDTO(TrackingTimesRevocationErrorCode errorCode) { |
|
| 35 | + this.errorCode = errorCode; |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + @GwtIncompatible |
|
| 39 | + public TrackingTimesRevocationReportDTO(TrackingTimesRevocationReport report) { |
|
| 40 | + this.errorCode = report.getErrorCode(); |
|
| 41 | + this.revokedEvents = new LinkedHashMap<>(); |
|
| 42 | + for (final Entry<Pair<RaceColumn, Fleet>, Set<RaceLogEvent>> e : report.getRevokedEvents().entrySet()) { |
|
| 43 | + revokedEvents.put( |
|
| 44 | + new Pair<>(toDTO(e.getKey().getA()), toDTO(e.getKey().getB())), |
|
| 45 | + new HashSet<>(e.getValue().stream().map(this::toDTO) |
|
| 46 | + .collect(java.util.stream.Collectors.toSet()))); |
|
| 47 | + } |
|
| 48 | + this.notRevokedBecauseOfMissingStartOrFinishTime = new LinkedHashMap<>(); |
|
| 49 | + for (final Entry<Pair<RaceColumn, Fleet>, Pair<TimePoint, TimePoint>> e : report.getNotRevokedBecauseOfMissingStartOfFinishTime().entrySet()) { |
|
| 50 | + notRevokedBecauseOfMissingStartOrFinishTime.put( |
|
| 51 | + new Pair<>(toDTO(e.getKey().getA()), toDTO(e.getKey().getB())), |
|
| 52 | + e.getValue()); |
|
| 53 | + } |
|
| 54 | + this.notRevokedBecauseNotForTracking = new ArrayList<>(); |
|
| 55 | + for (final Pair<RaceColumn, Fleet> e : report.getNotRevokedBecauseNotForTracking()) { |
|
| 56 | + notRevokedBecauseNotForTracking.add(new Pair<>(toDTO(e.getA()), toDTO(e.getB()))); |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * @return {@code null} means no error |
|
| 62 | + */ |
|
| 63 | + public TrackingTimesRevocationErrorCode getErrorCode() { |
|
| 64 | + return errorCode; |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + public HashMap<Pair<RaceColumnDTO, FleetDTO>, HashSet<RaceLogEventDTO>> getRevokedEvents() { |
|
| 68 | + return revokedEvents; |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + public HashMap<Pair<RaceColumnDTO, FleetDTO>, Pair<TimePoint, TimePoint>> getNotRevokedBecauseOfMissingStartOrFinishTime() { |
|
| 72 | + return notRevokedBecauseOfMissingStartOrFinishTime; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + public ArrayList<Pair<RaceColumnDTO, FleetDTO>> getNotRevokedBecauseNotForTracking() { |
|
| 76 | + return notRevokedBecauseNotForTracking; |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + @GwtIncompatible |
|
| 80 | + private FleetDTO toDTO(Fleet fleet) { |
|
| 81 | + return new FleetDTO(fleet.getName(), fleet.getOrdering(), fleet.getColor()); |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + @GwtIncompatible |
|
| 85 | + private RaceColumnDTO toDTO(final RaceColumn raceColumn) { |
|
| 86 | + return new RaceColumnDTO(raceColumn.getName(), raceColumn.isOneAlwaysStaysOne()); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + @GwtIncompatible |
|
| 90 | + private RaceLogEventDTO toDTO(RaceLogEvent raceLogEvent) { |
|
| 91 | + return new RaceLogEventDTO(raceLogEvent.getPassId(), raceLogEvent.getAuthor().getName(), |
|
| 92 | + raceLogEvent.getAuthor().getPriority(), |
|
| 93 | + raceLogEvent.getCreatedAt() != null ? raceLogEvent.getCreatedAt().asDate() : null, |
|
| 94 | + raceLogEvent.getLogicalTimePoint() != null ? raceLogEvent.getLogicalTimePoint().asDate() : null, |
|
| 95 | + raceLogEvent.getClass().getSimpleName(), raceLogEvent.getShortInfo()); |
|
| 96 | + } |
|
| 97 | +} |