mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-08 21:30:57 +00:00
Merge branch 'master' into racecommittee_app
Conflicts: java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages.java java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages.properties java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/client/StringMessages_de.properties
This commit is contained in:
commit
4d02b07304
31 files changed
+240
-39
No files matched your search
+3
-1
@@ -592,7 +592,9 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
|
||||
LeaderboardEntryDTO newLeaderboardEntryDTO = new LeaderboardEntryDTO();
|
||||
cloner.clone(raceColumnNameAndLeaderboardEntry.getValue(), newLeaderboardEntryDTO);
|
||||
// clone the leg details collection to ensure that when we need to manipulate it we don't manipulate the original
|
||||
newLeaderboardEntryDTO.legDetails = new ArrayList<LegEntryDTO>(newLeaderboardEntryDTO.legDetails);
|
||||
if (newLeaderboardEntryDTO.legDetails != null) {
|
||||
newLeaderboardEntryDTO.legDetails = new ArrayList<LegEntryDTO>(newLeaderboardEntryDTO.legDetails);
|
||||
}
|
||||
newFieldsByRaceColumnName.put(raceColumnNameAndLeaderboardEntry.getKey(), newLeaderboardEntryDTO);
|
||||
if (newLeaderboardEntryDTO.legDetails != null) {
|
||||
for (int legDetailsIndex = 0; legDetailsIndex < newLeaderboardEntryDTO.legDetails.size(); legDetailsIndex++) {
|
||||
|
||||
+17
-3
@@ -2,11 +2,13 @@ package com.sap.sailing.domain.persistence.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import com.mongodb.DB;
|
||||
import com.sap.sailing.domain.persistence.DomainObjectFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoObjectFactory;
|
||||
import com.sap.sailing.domain.racelog.RaceLog;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.racelog.RaceLogIdentifier;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
|
||||
@@ -15,23 +17,35 @@ public class MongoRaceLogStoreImpl implements RaceLogStore {
|
||||
private final MongoObjectFactory mongoObjectFactory;
|
||||
private final DomainObjectFactory domainObjectFactory;
|
||||
private final Map<RaceLogIdentifier, RaceLog> raceLogCache;
|
||||
private final WeakHashMap<RaceLog, MongoRaceLogListener> listeners;
|
||||
|
||||
public MongoRaceLogStoreImpl(DB db, MongoObjectFactory mongoObjectFactory, DomainObjectFactory domainObjectFactory) {
|
||||
this.db = db;
|
||||
this.mongoObjectFactory = mongoObjectFactory;
|
||||
this.domainObjectFactory = domainObjectFactory;
|
||||
this.raceLogCache = new HashMap<>();
|
||||
this.listeners = new WeakHashMap<RaceLog, MongoRaceLogListener>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLog getRaceLog(RaceLogIdentifier identifier) {
|
||||
if (raceLogCache.containsKey(identifier)) {
|
||||
public RaceLog getRaceLog(RaceLogIdentifier identifier, boolean ignoreCache) {
|
||||
if (!ignoreCache && raceLogCache.containsKey(identifier)) {
|
||||
return raceLogCache.get(identifier);
|
||||
}
|
||||
RaceLog result = domainObjectFactory.loadRaceLog(identifier);
|
||||
result.addListener(new MongoRaceLogListener(identifier, mongoObjectFactory, db));
|
||||
MongoRaceLogListener listener = new MongoRaceLogListener(identifier, mongoObjectFactory, db);
|
||||
listeners.put(result, listener);
|
||||
result.addListener(listener);
|
||||
raceLogCache.put(identifier, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListenersAddedByStoreFrom(RaceLog raceLog) {
|
||||
RaceLogEventVisitor visitor = listeners.get(raceLog);
|
||||
if (visitor != null) {
|
||||
raceLog.removeListener(visitor);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+12
@@ -1,5 +1,7 @@
|
||||
package com.sap.sailing.domain.racelog;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import com.sap.sailing.domain.common.WithID;
|
||||
import com.sap.sailing.domain.racelog.impl.RaceLogEventComparator;
|
||||
import com.sap.sailing.domain.tracking.Track;
|
||||
@@ -46,6 +48,12 @@ public interface RaceLog extends Track<RaceLogEvent>, WithID {
|
||||
*/
|
||||
void removeListener(RaceLogEventVisitor listener);
|
||||
|
||||
/**
|
||||
* Removes all listeners
|
||||
* @return
|
||||
*/
|
||||
HashSet<RaceLogEventVisitor> removeAllListeners();
|
||||
|
||||
/**
|
||||
* Checks if the race log is empty.
|
||||
*/
|
||||
@@ -54,4 +62,8 @@ public interface RaceLog extends Track<RaceLogEvent>, WithID {
|
||||
Iterable<RaceLogEvent> getRawFixesDescending();
|
||||
|
||||
Iterable<RaceLogEvent> getFixesDescending();
|
||||
|
||||
void addAllListeners(HashSet<RaceLogEventVisitor> listeners);
|
||||
|
||||
Iterable<RaceLogEventVisitor> getAllListeners();
|
||||
}
|
||||
+19
@@ -149,4 +149,23 @@ public class RaceLogImpl extends TrackImpl<RaceLogEvent> implements RaceLog {
|
||||
return getFixes().descendingSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashSet<RaceLogEventVisitor> removeAllListeners() {
|
||||
synchronized(listeners) {
|
||||
HashSet<RaceLogEventVisitor> clonedListeners = new HashSet<RaceLogEventVisitor>(listeners);
|
||||
listeners = new HashSet<RaceLogEventVisitor>();
|
||||
return clonedListeners;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAllListeners(HashSet<RaceLogEventVisitor> listeners) {
|
||||
this.listeners = listeners;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<RaceLogEventVisitor> getAllListeners() {
|
||||
return this.listeners;
|
||||
}
|
||||
|
||||
}
|
||||
+10
-10
@@ -119,15 +119,6 @@ public class LeaderboardDTODiffingTest {
|
||||
|
||||
@Test
|
||||
public void testStrippingExceptOneColumnInOneRace() {
|
||||
Map<Pair<CompetitorDTO, String>, List<LegEntryDTO>> previousLegDetailsBeforeStripping = new HashMap<>();
|
||||
for (Map.Entry<CompetitorDTO, LeaderboardRowDTO> e : previousVersion.rows.entrySet()) {
|
||||
for (Map.Entry<String, LeaderboardEntryDTO> e2 : e.getValue().fieldsByRaceColumnName.entrySet()) {
|
||||
if (e2.getValue().legDetails != null) {
|
||||
previousLegDetailsBeforeStripping.put(new Pair<CompetitorDTO, String>(e.getKey(), e2.getKey()),
|
||||
new ArrayList<>(e2.getValue().legDetails));
|
||||
}
|
||||
}
|
||||
}
|
||||
HashMap<CompetitorDTO, LeaderboardRowDTO> newRows = new HashMap<CompetitorDTO, LeaderboardRowDTO>(newVersion.rows);
|
||||
double newDistance = 1234;
|
||||
String nameOfRaceColumnToChange = "R9";
|
||||
@@ -153,10 +144,19 @@ public class LeaderboardDTODiffingTest {
|
||||
}
|
||||
newVersion.rows = newRows;
|
||||
Map<CompetitorDTO, LeaderboardRowDTO> rowsBeforeStripping = newVersion.rows;
|
||||
Map<Pair<CompetitorDTO, String>, List<LegEntryDTO>> previousLegDetailsBeforeStripping = new HashMap<>();
|
||||
for (Map.Entry<CompetitorDTO, LeaderboardRowDTO> e : rowsBeforeStripping.entrySet()) {
|
||||
for (Map.Entry<String, LeaderboardEntryDTO> e2 : e.getValue().fieldsByRaceColumnName.entrySet()) {
|
||||
if (e2.getValue().legDetails != null) {
|
||||
previousLegDetailsBeforeStripping.put(new Pair<CompetitorDTO, String>(e.getKey(), e2.getKey()),
|
||||
new ArrayList<>(e2.getValue().legDetails));
|
||||
}
|
||||
}
|
||||
}
|
||||
newVersion.strip(previousVersion);
|
||||
// see bug 1455; check that the stripping doesn't kill the previous leaderboard's legDetails lists
|
||||
for (Map.Entry<Pair<CompetitorDTO, String>, List<LegEntryDTO>> e : previousLegDetailsBeforeStripping.entrySet()) {
|
||||
final LeaderboardRowDTO leaderboardRowDTO = previousVersion.rows.get(e.getKey().getA());
|
||||
final LeaderboardRowDTO leaderboardRowDTO = rowsBeforeStripping.get(e.getKey().getA());
|
||||
if (leaderboardRowDTO != null) {
|
||||
List<LegEntryDTO> newLegDetails = leaderboardRowDTO.fieldsByRaceColumnName.get(e.getKey().getB()).legDetails;
|
||||
assertEquals(e.getValue(), newLegDetails);
|
||||
|
||||
@@ -35,6 +35,8 @@ public interface RaceColumn extends Named {
|
||||
*/
|
||||
void setRaceLogInformation(RaceLogInformation information);
|
||||
|
||||
RaceLogInformation getRaceLogInformation();
|
||||
|
||||
/**
|
||||
* Gets the race column's race log associated to the passed fleet.
|
||||
*
|
||||
@@ -159,6 +161,8 @@ public interface RaceColumn extends Named {
|
||||
boolean isStartsWithZeroScore();
|
||||
|
||||
boolean isDiscardable();
|
||||
|
||||
boolean isCarryForward();
|
||||
|
||||
/**
|
||||
* @param factor if <code>null</code>, {@link #getFactor()} will again compute a default value; otherwise, {@link #getFactor()} will
|
||||
@@ -177,5 +181,13 @@ public interface RaceColumn extends Named {
|
||||
* @param fleet
|
||||
* @return
|
||||
*/
|
||||
RaceLogIdentifier getRaceLogIdentifier(Fleet fleet);
|
||||
RaceLogIdentifier getRaceLogIdentifier(Fleet fleet);
|
||||
|
||||
/**
|
||||
* Sets (or reloads) {@link RaceLog} for this column with the given fleet
|
||||
*
|
||||
* @param raceLogInformation
|
||||
* @param fleetImpl
|
||||
*/
|
||||
void setOrReloadRaceLogInformation(RaceLogInformation raceLogInformation, Fleet fleetImpl);
|
||||
}
|
||||
+43
-16
@@ -3,6 +3,7 @@ package com.sap.sailing.domain.base.impl;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@@ -12,8 +13,8 @@ import com.sap.sailing.domain.base.RaceColumn;
|
||||
import com.sap.sailing.domain.common.RaceIdentifier;
|
||||
import com.sap.sailing.domain.common.impl.Util;
|
||||
import com.sap.sailing.domain.racelog.RaceLog;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEventVisitor;
|
||||
import com.sap.sailing.domain.racelog.RaceLogIdentifier;
|
||||
import com.sap.sailing.domain.racelog.RaceLogIdentifierTemplate;
|
||||
import com.sap.sailing.domain.racelog.RaceLogInformation;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.racelog.impl.RaceLogIdentifierImpl;
|
||||
@@ -28,11 +29,11 @@ public abstract class AbstractRaceColumn extends SimpleAbstractRaceColumn implem
|
||||
private final Map<Fleet, RaceLog> raceLogs;
|
||||
|
||||
/**
|
||||
* holds the race log identifer template needed to create the appropriate RaceLogIdentifer that is constructed from the
|
||||
* holds the race log identifier template needed to create the appropriate RaceLogIdentifer that is constructed from the
|
||||
* parent object name, name of this raceColumn and the name of a fleet of this raceColumn to access the RaceLog in the
|
||||
* RaceLogStore for persistence purposes.
|
||||
*/
|
||||
private RaceLogIdentifierTemplate raceLogsIdentifierTemplate;
|
||||
private transient RaceLogInformation raceLogInformation;
|
||||
|
||||
public AbstractRaceColumn() {
|
||||
this.trackedRaces = new HashMap<Fleet, TrackedRace>();
|
||||
@@ -42,25 +43,21 @@ public abstract class AbstractRaceColumn extends SimpleAbstractRaceColumn implem
|
||||
|
||||
@Override
|
||||
public synchronized void setRaceLogInformation(final RaceLogInformation information) {
|
||||
raceLogs.clear();
|
||||
raceLogsIdentifierTemplate = information.getIdentifierTemplate();
|
||||
RaceLogStore store = information.getStore();
|
||||
for (final Fleet fleet : getFleets()) {
|
||||
RaceLogIdentifier identifier = raceLogsIdentifierTemplate.compileRaceLogIdentifier(fleet);
|
||||
RaceLog raceLog = store.getRaceLog(identifier);
|
||||
raceLog.addListener(new RaceColumnRaceLogReplicator(this, identifier));
|
||||
raceLogs.put(fleet, raceLog);
|
||||
setOrReloadRaceLogInformation(information, fleet);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLog getRaceLog(Fleet fleet) {
|
||||
return raceLogs.get(fleet);
|
||||
synchronized (raceLogs) {
|
||||
return raceLogs.get(fleet);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogIdentifier getRaceLogIdentifier(Fleet fleet) {
|
||||
return new RaceLogIdentifierImpl(raceLogsIdentifierTemplate, getName(), fleet);
|
||||
return new RaceLogIdentifierImpl(raceLogInformation.getIdentifierTemplate(), getName(), fleet);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,7 +79,7 @@ public abstract class AbstractRaceColumn extends SimpleAbstractRaceColumn implem
|
||||
}
|
||||
}
|
||||
if (previouslyLinkedRace != null) {
|
||||
RaceLogIdentifierImpl identifier = new RaceLogIdentifierImpl(raceLogsIdentifierTemplate, getName(), fleet);
|
||||
RaceLogIdentifierImpl identifier = new RaceLogIdentifierImpl(raceLogInformation.getIdentifierTemplate(), getName(), fleet);
|
||||
previouslyLinkedRace.detachRaceLog(identifier);
|
||||
getRaceColumnListeners().notifyListenersAboutTrackedRaceUnlinked(this, fleet, previouslyLinkedRace);
|
||||
}
|
||||
@@ -146,22 +143,52 @@ public abstract class AbstractRaceColumn extends SimpleAbstractRaceColumn implem
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogInformation getRaceLogInformation() {
|
||||
return raceLogInformation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrReloadRaceLogInformation(RaceLogInformation information, Fleet fleetImpl) {
|
||||
synchronized(raceLogs) {
|
||||
raceLogInformation = information;
|
||||
RaceLogStore store = information.getStore();
|
||||
HashSet<RaceLogEventVisitor> listeners = new HashSet<RaceLogEventVisitor>();
|
||||
RaceLog raceLogAvailable = raceLogs.get(fleetImpl);
|
||||
if (raceLogAvailable != null) {
|
||||
store.removeListenersAddedByStoreFrom(raceLogAvailable);
|
||||
listeners = raceLogAvailable.removeAllListeners();
|
||||
raceLogs.remove(fleetImpl);
|
||||
}
|
||||
|
||||
RaceLogIdentifier identifier = raceLogInformation.getIdentifierTemplate().compileRaceLogIdentifier(fleetImpl);
|
||||
RaceLog raceLog = store.getRaceLog(identifier, /*ignoreCache*/ true);
|
||||
|
||||
if (listeners.isEmpty()) {
|
||||
RaceColumnRaceLogReplicator listener = new RaceColumnRaceLogReplicator(this, identifier);
|
||||
raceLog.addListener(listener);
|
||||
} else {
|
||||
raceLog.addAllListeners(listeners);
|
||||
}
|
||||
raceLogs.put(fleetImpl, raceLog);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* When deserializing, replication listeners are registered on all race logs.
|
||||
*/
|
||||
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
|
||||
ois.defaultReadObject();
|
||||
|
||||
for (Entry<Fleet, RaceLog> entry : raceLogs.entrySet()) {
|
||||
Fleet fleet = entry.getKey();
|
||||
RaceLog raceLog = entry.getValue();
|
||||
raceLog.addListener(new RaceColumnRaceLogReplicator(this, raceLogsIdentifierTemplate.compileRaceLogIdentifier(fleet)));
|
||||
raceLog.addListener(new RaceColumnRaceLogReplicator(this, raceLogInformation.getIdentifierTemplate().compileRaceLogIdentifier(fleet)));
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
@@ -106,4 +106,9 @@ public class RaceColumnInSeriesImpl extends AbstractRaceColumn implements RaceCo
|
||||
public boolean isDiscardable() {
|
||||
return !isMedalRace() && (!isFirstColumnInSeries() || !getSeries().isFirstColumnIsNonDiscardableCarryForward());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCarryForward() {
|
||||
return isFirstColumnInSeries() && getSeries().isFirstColumnIsNonDiscardableCarryForward();
|
||||
}
|
||||
}
|
||||
+5
@@ -90,4 +90,9 @@ public abstract class SimpleAbstractRaceColumn implements RaceColumn {
|
||||
return !isMedalRace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCarryForward() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+9
-2
@@ -127,8 +127,15 @@ public class LeaderboardTotalRankComparator implements Comparator<Competitor> {
|
||||
o2ScoreSum += o2Score;
|
||||
}
|
||||
if (raceColumn.isMedalRace()) {
|
||||
o1MedalRaceScore = o1Score;
|
||||
o2MedalRaceScore = o2Score;
|
||||
// only count the score for the medal race score if it wasn't a carry-forward column
|
||||
if (!raceColumn.isCarryForward()) {
|
||||
if (o1Score != null) {
|
||||
o1MedalRaceScore += o1Score;
|
||||
}
|
||||
if (o2Score != null) {
|
||||
o2MedalRaceScore += o2Score;
|
||||
}
|
||||
}
|
||||
// similar to compareByFleet, however, tracking is not required; having medal race column points
|
||||
// (tracked or manual) is sufficient
|
||||
preemptiveColumnResult = compareByMedalRaceParticipation(o1Score, o2Score);
|
||||
|
||||
+9
@@ -180,4 +180,13 @@ public class MetaLeaderboardColumn extends SimpleAbstractRaceColumn implements R
|
||||
public RaceLogIdentifier getRaceLogIdentifier(Fleet fleet) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogInformation getRaceLogInformation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrReloadRaceLogInformation(RaceLogInformation raceLogInformation, Fleet fleetImpl) {
|
||||
}
|
||||
}
|
||||
+2
@@ -34,4 +34,6 @@ public interface RaceLogIdentifierTemplate extends Serializable {
|
||||
* @param resolver the resolver that resolves this template, either for {@link Leaderboard} or for {@link Regatta}.
|
||||
*/
|
||||
void resolve(RaceLogIdentifierTemplateResolver resolver);
|
||||
|
||||
String getRaceColumnName();
|
||||
}
|
||||
@@ -34,4 +34,5 @@ public interface RaceLogInformation {
|
||||
* and {@link Fleet}
|
||||
*/
|
||||
RaceLog getRaceLog(RaceColumn raceColumn, Fleet fleet);
|
||||
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package com.sap.sailing.domain.racelog;
|
||||
|
||||
public interface RaceLogStore {
|
||||
|
||||
RaceLog getRaceLog(RaceLogIdentifier identifier);
|
||||
RaceLog getRaceLog(RaceLogIdentifier identifier, boolean ignoreCache);
|
||||
|
||||
void removeListenersAddedByStoreFrom(RaceLog raceLogAvailable);
|
||||
|
||||
}
|
||||
+5
-1
@@ -11,7 +11,11 @@ public enum EmptyRaceLogStore implements RaceLogStore {
|
||||
INSTANCE;
|
||||
|
||||
@Override
|
||||
public RaceLog getRaceLog(RaceLogIdentifier identifier) {
|
||||
public RaceLog getRaceLog(RaceLogIdentifier identifier, boolean ignoreCache) {
|
||||
return new RaceLogImpl(UUID.randomUUID().toString(), identifier.getIdentifier());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListenersAddedByStoreFrom(RaceLog raceLogAvailable) {
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -29,7 +29,7 @@ public class RaceLogInformationImpl implements RaceLogInformation {
|
||||
|
||||
@Override
|
||||
public RaceLog getRaceLog(RaceColumn raceColumn, Fleet fleet) {
|
||||
return store.getRaceLog(identifierTemplate.compileRaceLogIdentifier(fleet));
|
||||
return store.getRaceLog(identifierTemplate.compileRaceLogIdentifier(fleet), false);
|
||||
}
|
||||
|
||||
}
|
||||
+5
@@ -32,4 +32,9 @@ public class RaceLogOnLeaderboardIdentifier implements RaceLogIdentifierTemplate
|
||||
return leaderboardName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRaceColumnName() {
|
||||
return raceColumnName;
|
||||
}
|
||||
|
||||
}
|
||||
+5
@@ -32,4 +32,9 @@ public class RaceLogOnRegattaIdentifier implements RaceLogIdentifierTemplate {
|
||||
return regattaName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRaceColumnName() {
|
||||
return raceColumnName;
|
||||
}
|
||||
|
||||
}
|
||||
+6
@@ -17,6 +17,12 @@ interface AdminConsoleResources extends ClientBundle {
|
||||
@Source("com/sap/sailing/gwt/ui/client/images/edit.png")
|
||||
ImageResource editIcon();
|
||||
|
||||
@Source("com/sap/sailing/gwt/ui/client/images/import.png")
|
||||
ImageResource importIcon();
|
||||
|
||||
@Source("com/sap/sailing/gwt/ui/client/images/reload.png")
|
||||
ImageResource reloadIcon();
|
||||
|
||||
@Source("com/sap/sailing/gwt/ui/client/images/link.png")
|
||||
ImageResource linkIcon();
|
||||
|
||||
|
||||
+16
@@ -492,6 +492,8 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
editRaceColumnOfLeaderboard(object);
|
||||
} else if (LeaderboardRaceConfigImagesBarCell.ACTION_UNLINK.equals(value)) {
|
||||
unlinkRaceColumnFromTrackedRace(object.getA().getRaceColumnName(), object.getB());
|
||||
} else if (LeaderboardRaceConfigImagesBarCell.ACTION_REFRESH_RACELOG.equals(value)) {
|
||||
refreshRaceLog(object.getA(), object.getB());
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -675,6 +677,20 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void refreshRaceLog(final RaceColumnDTO raceColumnDTO, final FleetDTO fleet) {
|
||||
final String selectedLeaderboardName = getSelectedLeaderboardName();
|
||||
sailingService.reloadRaceLog(selectedLeaderboardName, raceColumnDTO, fleet, new AsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError(caught.getMessage());
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
Window.alert(stringMessages.raceLogReloaded());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void removeRaceColumn(final RaceColumnDTO raceColumnDTO) {
|
||||
final String selectedLeaderboardName = getSelectedLeaderboardName();
|
||||
|
||||
+2
@@ -11,6 +11,7 @@ public class LeaderboardRaceConfigImagesBarCell extends ImagesBarCell {
|
||||
public static final String ACTION_REMOVE = "ACTION_REMOVE";
|
||||
public static final String ACTION_UNLINK = "ACTION_UNLINK";
|
||||
public static final String ACTION_EDIT = "ACTION_EDIT";
|
||||
public final static String ACTION_REFRESH_RACELOG = "ACTION_REFRESH_RACE_LOG";
|
||||
private final StringMessages stringMessages;
|
||||
private final SelectedLeaderboardProvider selectedLeaderboardProvider;
|
||||
private static AdminConsoleResources resources = GWT.create(AdminConsoleResources.class);
|
||||
@@ -31,6 +32,7 @@ public class LeaderboardRaceConfigImagesBarCell extends ImagesBarCell {
|
||||
// race columns cannot be removed from a regatta leaderboard; they need to be removed from the regatta instead
|
||||
result.add(new ImageSpec(ACTION_REMOVE, stringMessages.actionRaceRemove(), makeImagePrototype(resources.removeIcon())));
|
||||
}
|
||||
result.add(new ImageSpec(ACTION_REFRESH_RACELOG, stringMessages.refreshRaceLog(), makeImagePrototype(resources.reloadIcon())));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+4
@@ -21,7 +21,9 @@ import com.sap.sailing.domain.common.RegattaIdentifier;
|
||||
import com.sap.sailing.domain.common.ScoringSchemeType;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.FleetDTO;
|
||||
import com.sap.sailing.domain.common.dto.IncrementalOrFullLeaderboardDTO;
|
||||
import com.sap.sailing.domain.common.dto.RaceColumnDTO;
|
||||
import com.sap.sailing.domain.common.dto.RaceColumnInSeriesDTO;
|
||||
import com.sap.sailing.domain.common.dto.RaceDTO;
|
||||
import com.sap.sailing.domain.common.dto.RegattaCreationParametersDTO;
|
||||
@@ -315,4 +317,6 @@ public interface SailingService extends RemoteService {
|
||||
void stopAllReplicas();
|
||||
|
||||
void stopSingleReplicaInstance(String identifier);
|
||||
|
||||
void reloadRaceLog(String selectedLeaderboardName, RaceColumnDTO raceColumnDTO, FleetDTO fleet);
|
||||
}
|
||||
+5
@@ -21,7 +21,9 @@ import com.sap.sailing.domain.common.RegattaNameAndRaceName;
|
||||
import com.sap.sailing.domain.common.ScoringSchemeType;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.FleetDTO;
|
||||
import com.sap.sailing.domain.common.dto.IncrementalOrFullLeaderboardDTO;
|
||||
import com.sap.sailing.domain.common.dto.RaceColumnDTO;
|
||||
import com.sap.sailing.domain.common.dto.RaceColumnInSeriesDTO;
|
||||
import com.sap.sailing.domain.common.dto.RaceDTO;
|
||||
import com.sap.sailing.domain.common.dto.RegattaCreationParametersDTO;
|
||||
@@ -435,6 +437,9 @@ public interface SailingServiceAsync {
|
||||
void stopAllReplicas(AsyncCallback<Void> asyncCallback);
|
||||
|
||||
void stopSingleReplicaInstance(String identifier, AsyncCallback<Void> asyncCallback);
|
||||
|
||||
void reloadRaceLog(String selectedLeaderboardName, RaceColumnDTO raceColumnDTO, FleetDTO fleet,
|
||||
AsyncCallback<Void> asyncCallback);
|
||||
|
||||
}
|
||||
|
||||
+2
@@ -694,4 +694,6 @@ public interface StringMessages extends Messages {
|
||||
String finishAt();
|
||||
String protestEndsAt();
|
||||
String unknown();
|
||||
String refreshRaceLog();
|
||||
String raceLogReloaded();
|
||||
}
|
||||
+4
-1
@@ -686,4 +686,7 @@ showingDetailsOfRace=Showing details for race {0}
|
||||
startAt=Start at
|
||||
finishAt=Finish at
|
||||
protestEndsAt=Protest ends at
|
||||
unknown=Unknown
|
||||
unknown=Unknown
|
||||
earlyStarters=Early starters
|
||||
refreshRaceLog=Refresh race log
|
||||
raceLogReloaded=RaceLog successfully reloaded from database
|
||||
+4
-1
@@ -684,4 +684,7 @@ showingDetailsOfRace=Informationen zu Rennen {0}
|
||||
startAt=Start
|
||||
finishAt=Rennende
|
||||
protestEndsAt=Protestzeit endet
|
||||
unknown=Unbekannt
|
||||
unknown=Unbekannt
|
||||
earlyStarters=Frühstarter
|
||||
refreshRaceLog=RaceLog neu laden
|
||||
raceLogReloaded=RaceLog wurde neu geladen
|
||||
+5
@@ -3274,4 +3274,9 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadRaceLog(String selectedLeaderboardName, RaceColumnDTO raceColumnDTO, FleetDTO fleet) {
|
||||
getService().reloadRaceLog(selectedLeaderboardName, raceColumnDTO, fleet);
|
||||
}
|
||||
}
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 912 B |
@@ -32,6 +32,8 @@ import com.sap.sailing.domain.common.RegattaIdentifier;
|
||||
import com.sap.sailing.domain.common.RegattaName;
|
||||
import com.sap.sailing.domain.common.ScoringSchemeType;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.dto.FleetDTO;
|
||||
import com.sap.sailing.domain.common.dto.RaceColumnDTO;
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
import com.sap.sailing.domain.common.impl.Util.Triple;
|
||||
import com.sap.sailing.domain.common.media.MediaTrack;
|
||||
@@ -523,4 +525,6 @@ public interface RacingEventService extends TrackedRegattaRegistry, RegattaFetch
|
||||
|
||||
Collection<MediaTrack> getAllMediaTracks();
|
||||
|
||||
void reloadRaceLog(String selectedLeaderboardName, RaceColumnDTO raceColumnDTO, FleetDTO fleet);
|
||||
|
||||
}
|
||||
+18
@@ -54,6 +54,7 @@ import com.sap.sailing.domain.common.ScoringSchemeType;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.common.dto.FleetDTO;
|
||||
import com.sap.sailing.domain.common.dto.RaceColumnDTO;
|
||||
import com.sap.sailing.domain.common.dto.RegattaCreationParametersDTO;
|
||||
import com.sap.sailing.domain.common.dto.SeriesCreationParametersDTO;
|
||||
import com.sap.sailing.domain.common.impl.Util;
|
||||
@@ -81,6 +82,7 @@ import com.sap.sailing.domain.persistence.MongoRaceLogStoreFactory;
|
||||
import com.sap.sailing.domain.persistence.media.DBMediaTrack;
|
||||
import com.sap.sailing.domain.persistence.media.MediaDB;
|
||||
import com.sap.sailing.domain.persistence.media.MediaDBFactory;
|
||||
import com.sap.sailing.domain.racelog.RaceLog;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.swisstimingadapter.Race;
|
||||
import com.sap.sailing.domain.swisstimingadapter.SailMasterConnector;
|
||||
@@ -1957,4 +1959,20 @@ public class RacingEventServiceImpl implements RacingEventService, RegattaListen
|
||||
return "RacingEventService: " + this.hashCode() + " Build: " + BuildVersion.getBuildVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadRaceLog(String selectedLeaderboardName, RaceColumnDTO raceColumnDTO, FleetDTO fleet) {
|
||||
Leaderboard leaderboard = getLeaderboardByName(selectedLeaderboardName);
|
||||
if (leaderboard != null) {
|
||||
RaceColumn raceColumn = leaderboard.getRaceColumnByName(raceColumnDTO.getName());
|
||||
if (raceColumn != null) {
|
||||
Fleet fleetImpl = raceColumn.getFleetByName(fleet.getName());
|
||||
RaceLog racelog = raceColumn.getRaceLog(fleetImpl);
|
||||
if (racelog != null) {
|
||||
raceColumn.setOrReloadRaceLogInformation(raceColumn.getRaceLogInformation(), fleetImpl);
|
||||
logger.info("Reloaded race log for fleet " + fleetImpl + " for race column " + raceColumn.getName() + " for leaderboard " + leaderboard.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public abstract class UDPReceiver<MessageType extends UDPMessage, ListenerType extends UDPMessageListener<MessageType>> implements Runnable {
|
||||
@@ -136,9 +137,10 @@ public abstract class UDPReceiver<MessageType extends UDPMessage, ListenerType e
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.log(Level.SEVERE, "Exception while receiving UDP packet", e);
|
||||
}
|
||||
}
|
||||
logger.info("Closing UDP socket on port "+udpSocket.getPort());
|
||||
udpSocket.close();
|
||||
if (udpSocket.isConnected()) {
|
||||
udpSocket.disconnect();
|
||||
|
||||
Reference in new issue
Block a user