quick fix for start/end of tracking with race log tracking

This commit is contained in:
Axel Uhl committed 2015-03-26 11:42:43 +01:00
1 parent 74801f78e0
commit ab521dfb78
10 files changed
+171 -68

No files matched your search

@@ -267,8 +267,9 @@ public class RaceLogRaceTracker implements RaceTracker, GPSFixReceivedListener {
}
}
trackedRace.setStartOfTrackingReceived(earliestMappingStart);
trackedRace.setEndOfTrackingReceived(latestMappingEnd);
// FIXME need better way to come to a realistic and adjusting start/end of tracking
// trackedRace.setStartOfTrackingReceived(earliestMappingStart);
// trackedRace.setEndOfTrackingReceived(latestMappingEnd);
}
private <ItemT extends WithID, FixT extends GPSFix> boolean hasMappingAlreadyBeenLoaded(
@@ -66,6 +66,7 @@ import com.sap.sailing.gwt.ui.shared.RaceLogDTO;
import com.sap.sailing.gwt.ui.shared.RaceLogSetStartTimeAndProcedureDTO;
import com.sap.sailing.gwt.ui.shared.RaceTimesInfoDTO;
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
import com.sap.sailing.gwt.ui.shared.RegattaLogDTO;
import com.sap.sailing.gwt.ui.shared.RegattaOverviewEntryDTO;
import com.sap.sailing.gwt.ui.shared.RegattaScoreCorrectionDTO;
import com.sap.sailing.gwt.ui.shared.RemoteSailingServerReferenceDTO;
@@ -397,6 +398,8 @@ public interface SailingService extends RemoteService, FileStorageManagementGwtS
RaceLogDTO getRaceLog(String leaderboardName, RaceColumnDTO raceColumnDTO, FleetDTO fleet);
RegattaLogDTO getRegattaLog(String leaderboardName) throws DoesNotHaveRegattaLogException;
List<String> getLeaderboardGroupNamesFromRemoteServer(String host);
UUID importMasterData(String host, String[] groupNames, boolean override, boolean compress, boolean exportWind);
@@ -586,4 +589,5 @@ public interface SailingService extends RemoteService, FileStorageManagementGwtS
void inviteBuoyTenderViaEmail(String serverUrlWithoutTrailingSlash, EventDTO eventDto, String leaderboardName,
String emails, String localeInfoName) throws MailException;
}
@@ -56,6 +56,7 @@ import com.sap.sailing.gwt.ui.shared.RaceLogDTO;
import com.sap.sailing.gwt.ui.shared.RaceLogSetStartTimeAndProcedureDTO;
import com.sap.sailing.gwt.ui.shared.RaceTimesInfoDTO;
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
import com.sap.sailing.gwt.ui.shared.RegattaLogDTO;
import com.sap.sailing.gwt.ui.shared.RegattaOverviewEntryDTO;
import com.sap.sailing.gwt.ui.shared.RegattaScoreCorrectionDTO;
import com.sap.sailing.gwt.ui.shared.RemoteSailingServerReferenceDTO;
@@ -506,8 +507,9 @@ public interface SailingServiceAsync extends BuildVersionRetriever, FileStorageM
void getRaceLog(String leaderboardName, RaceColumnDTO raceColumnDTO, FleetDTO fleet,
AsyncCallback<RaceLogDTO> callback);
void importMasterData(String host, String[] names, boolean override, boolean compress,
boolean exportWind,
void getRegattaLog(String leaderboardName, AsyncCallback<RegattaLogDTO> callback);
void importMasterData(String host, String[] names, boolean override, boolean compress, boolean exportWind,
AsyncCallback<UUID> asyncCallback);
void getImportOperationProgress(UUID id, AsyncCallback<DataImportProgress> asyncCallback);
@@ -693,4 +695,5 @@ public interface SailingServiceAsync extends BuildVersionRetriever, FileStorageM
void inviteBuoyTenderViaEmail(String serverUrlWithoutTrailingSlash, EventDTO eventDto, String leaderboardName,
String emails, String localeInfoName, AsyncCallback<Void> callback);
}
@@ -74,6 +74,7 @@ import com.sap.sailing.domain.abstractlog.race.tracking.analyzing.impl.DefinedMa
import com.sap.sailing.domain.abstractlog.race.tracking.analyzing.impl.RaceLogOpenEndedDeviceMappingCloser;
import com.sap.sailing.domain.abstractlog.race.tracking.analyzing.impl.RaceLogTrackingStateAnalyzer;
import com.sap.sailing.domain.abstractlog.regatta.RegattaLog;
import com.sap.sailing.domain.abstractlog.regatta.RegattaLogEvent;
import com.sap.sailing.domain.abstractlog.shared.analyzing.DeviceCompetitorMappingFinder;
import com.sap.sailing.domain.abstractlog.shared.analyzing.DeviceMarkMappingFinder;
import com.sap.sailing.domain.abstractlog.shared.analyzing.RegisteredCompetitorsAnalyzer;
@@ -301,6 +302,8 @@ import com.sap.sailing.gwt.ui.shared.RaceMapDataDTO;
import com.sap.sailing.gwt.ui.shared.RaceTimesInfoDTO;
import com.sap.sailing.gwt.ui.shared.RaceWithCompetitorsDTO;
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
import com.sap.sailing.gwt.ui.shared.RegattaLogDTO;
import com.sap.sailing.gwt.ui.shared.RegattaLogEventDTO;
import com.sap.sailing.gwt.ui.shared.RegattaOverviewEntryDTO;
import com.sap.sailing.gwt.ui.shared.RegattaScoreCorrectionDTO;
import com.sap.sailing.gwt.ui.shared.RegattaScoreCorrectionDTO.ScoreCorrectionEntryDTO;
@@ -4251,6 +4254,30 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
return result;
}
@Override
public RegattaLogDTO getRegattaLog(String leaderboardName) throws DoesNotHaveRegattaLogException {
RegattaLogDTO result = null;
RegattaLog regattaLog = getRegattaLogInternal(leaderboardName);
if (regattaLog != null) {
List<RegattaLogEventDTO> entries = new ArrayList<>();
result = new RegattaLogDTO(leaderboardName, entries);
regattaLog.lockForRead();
try {
for(RegattaLogEvent raceLogEvent: regattaLog.getRawFixes()) {
RegattaLogEventDTO entry = new RegattaLogEventDTO(
raceLogEvent.getAuthor().getName(), raceLogEvent.getAuthor().getPriority(),
raceLogEvent.getCreatedAt() != null ? raceLogEvent.getCreatedAt().asDate() : null,
raceLogEvent.getLogicalTimePoint() != null ? raceLogEvent.getLogicalTimePoint().asDate() : null,
raceLogEvent.getClass().getSimpleName(), raceLogEvent.getShortInfo());
entries.add(entry);
}
} finally {
regattaLog.unlockAfterRead();
}
}
return result;
}
@Override
public List<String> getLeaderboardGroupNamesFromRemoteServer(String url) {
com.sap.sse.common.Util.Pair<String, Integer> hostnameAndPort = parseHostAndPort(url);
@@ -4818,7 +4845,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
return getRaceLog(triple.getA(), triple.getB(), triple.getC());
}
private RegattaLog getRegattaLog(String leaderboardName) throws DoesNotHaveRegattaLogException {
private RegattaLog getRegattaLogInternal(String leaderboardName) throws DoesNotHaveRegattaLogException {
Leaderboard l = getService().getLeaderboardByName(leaderboardName);
if (! (l instanceof HasRegattaLike)) {
throw new DoesNotHaveRegattaLogException();
@@ -4844,7 +4871,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
throws DoesNotHaveRegattaLogException {
return convertToCompetitorDTOs(
new RegisteredCompetitorsAnalyzer<>(
getRegattaLog(leaderboardName)).analyze());
getRegattaLogInternal(leaderboardName)).analyze());
}
private Competitor getCompetitor(CompetitorDTO dto) {
@@ -4866,7 +4893,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
@Override
public void setCompetitorRegistrations(String leaderboardName, Set<CompetitorDTO> competitorDTOs)
throws DoesNotHaveRegattaLogException {
RegattaLog regattaLog = getRegattaLog(leaderboardName);
RegattaLog regattaLog = getRegattaLogInternal(leaderboardName);
Set<Competitor> competitors = new HashSet<Competitor>();
for (CompetitorDTO dto : competitorDTOs) {
competitors.add(getCompetitor(dto));
@@ -0,0 +1,28 @@
package com.sap.sailing.gwt.ui.shared;
import java.util.List;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* DTO for a race log with all raw race log entries
*/
public class AbstractLogDTO<E extends AbstractLogEventDTO> implements IsSerializable {
private String leaderboardName;
private List<E> entries;
AbstractLogDTO() {}
public AbstractLogDTO(String leaderboardName, List<E> entries) {
this.leaderboardName = leaderboardName;
this.entries = entries;
}
public String getLeaderboardName() {
return leaderboardName;
}
public List<E> getEntries() {
return entries;
}
}
@@ -0,0 +1,64 @@
package com.sap.sailing.gwt.ui.shared;
import java.util.Date;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* DTO for a race log entry.
*/
public class AbstractLogEventDTO implements IsSerializable {
private String authorName;
private Integer authorPriority;
private Date createdAt;
private Date logicalTimePoint;
/** RaceLogEvent.getClass().getSimpleName() */
private String type;
/** RaceLogEvent.toString() */
private String info;
AbstractLogEventDTO() {}
public AbstractLogEventDTO(String authorName, Integer authorPriority, Date createdAt, Date logicalTimePoint,
String type, String info) {
this.authorName = authorName;
this.authorPriority = authorPriority;
this.createdAt = createdAt;
this.logicalTimePoint = logicalTimePoint;
this.type = type;
this.info = info;
}
public String getAuthorName() {
return authorName;
}
public Integer getAuthorPriority() {
return authorPriority;
}
public Date getLogicalTimePoint() {
return logicalTimePoint;
}
public String getType() {
String result = type;
if(result.startsWith("RaceLog")) {
result = result.substring("RaceLog".length(), result.length());
}
if(result.endsWith("EventImpl")) {
result = result.substring(0, result.length()- "EventImpl".length());
}
return result;
}
public String getInfo() {
return info;
}
public Date getCreatedAt() {
return createdAt;
}
}
@@ -7,25 +7,18 @@ import com.google.gwt.user.client.rpc.IsSerializable;
/**
* DTO for a race log with all raw race log entries
*/
public class RaceLogDTO implements IsSerializable {
private String leaderboardName;
public class RaceLogDTO extends AbstractLogDTO<RaceLogEventDTO> implements IsSerializable {
private String raceColumnName;
private String fleetName;
private Integer currentPassId;
private List<RaceLogEventDTO> entries;
RaceLogDTO() {}
public RaceLogDTO(String leaderboardName, String raceColumnName, String fleetName, Integer currentPassId, List<RaceLogEventDTO> entries) {
this.leaderboardName = leaderboardName;
super(leaderboardName, entries);
this.raceColumnName = raceColumnName;
this.fleetName = fleetName;
this.currentPassId = currentPassId;
this.entries = entries;
}
public String getLeaderboardName() {
return leaderboardName;
}
public String getRaceColumnName() {
@@ -36,10 +29,6 @@ public class RaceLogDTO implements IsSerializable {
return fleetName;
}
public List<RaceLogEventDTO> getEntries() {
return entries;
}
public Integer getCurrentPassId() {
return currentPassId;
}
@@ -7,64 +7,18 @@ import com.google.gwt.user.client.rpc.IsSerializable;
/**
* DTO for a race log entry.
*/
public class RaceLogEventDTO implements IsSerializable {
public class RaceLogEventDTO extends AbstractLogEventDTO implements IsSerializable {
private Integer passId;
private String authorName;
private Integer authorPriority;
private Date createdAt;
private Date logicalTimePoint;
/** RaceLogEvent.getClass().getSimpleName() */
private String type;
/** RaceLogEvent.toString() */
private String info;
RaceLogEventDTO() {}
public RaceLogEventDTO(int passId, String authorName, Integer authorPriority, Date createdAt, Date logicalTimePoint,
String type, String info) {
super(authorName, authorPriority, createdAt, logicalTimePoint, type, info);
this.passId = passId;
this.authorName = authorName;
this.authorPriority = authorPriority;
this.createdAt = createdAt;
this.logicalTimePoint = logicalTimePoint;
this.type = type;
this.info = info;
}
public int getPassId() {
return passId;
}
public String getAuthorName() {
return authorName;
}
public Integer getAuthorPriority() {
return authorPriority;
}
public Date getLogicalTimePoint() {
return logicalTimePoint;
}
public String getType() {
String result = type;
if(result.startsWith("RaceLog")) {
result = result.substring("RaceLog".length(), result.length());
}
if(result.endsWith("EventImpl")) {
result = result.substring(0, result.length()- "EventImpl".length());
}
return result;
}
public String getInfo() {
return info;
}
public Date getCreatedAt() {
return createdAt;
}
}
@@ -0,0 +1,16 @@
package com.sap.sailing.gwt.ui.shared;
import java.util.List;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* DTO for a race log with all raw race log entries
*/
public class RegattaLogDTO extends AbstractLogDTO<RegattaLogEventDTO> implements IsSerializable {
RegattaLogDTO() {}
public RegattaLogDTO(String leaderboardName, List<RegattaLogEventDTO> entries) {
super(leaderboardName, entries);
}
}
@@ -0,0 +1,17 @@
package com.sap.sailing.gwt.ui.shared;
import java.util.Date;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* DTO for a race log entry.
*/
public class RegattaLogEventDTO extends AbstractLogEventDTO implements IsSerializable {
RegattaLogEventDTO() {}
public RegattaLogEventDTO(String authorName, Integer authorPriority, Date createdAt, Date logicalTimePoint,
String type, String info) {
super(authorName, authorPriority, createdAt, logicalTimePoint, type, info);
}
}