mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-13 22:15:26 +00:00
Merge branch 'master' into bug4371_2
Change-Id: If3601289907a4cdc2e200b191dc17212b4462983
This commit is contained in:
commit
722c56669e
189 files changed
+1926
-2245
No files matched your search
+2
-2
@@ -7,7 +7,7 @@ import com.sap.sailing.dashboards.gwt.shared.dispatch.DashboardAction;
|
||||
import com.sap.sailing.dashboards.gwt.shared.dispatch.DashboardDispatchContext;
|
||||
import com.sap.sailing.dashboards.gwt.shared.dto.LeaderboardCompetitorsDTO;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.leaderboard.Leaderboard;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
import com.sap.sse.gwt.dispatch.shared.exceptions.DispatchException;
|
||||
@@ -34,7 +34,7 @@ public class GetCompetitorInLeaderboardAction implements DashboardAction<Leaderb
|
||||
LeaderboardCompetitorsDTO result = new LeaderboardCompetitorsDTO();
|
||||
Leaderboard lb = dashboardDispatchContext.getRacingEventService().getLeaderboardByName(this.leaderboarName);
|
||||
List<Competitor> competitorsFromBestToWorst = lb.getCompetitorsFromBestToWorst(MillisecondsTimePoint.now());
|
||||
List<CompetitorDTO> competitorDTOs = dashboardDispatchContext.getRacingEventService().getBaseDomainFactory().getCompetitorDTOList(competitorsFromBestToWorst);
|
||||
List<CompetitorWithBoatDTO> competitorDTOs = dashboardDispatchContext.getRacingEventService().getBaseDomainFactory().getCompetitorDTOList(competitorsFromBestToWorst);
|
||||
result.setCompetitors(competitorDTOs);
|
||||
return result;
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package com.sap.sailing.dashboards.gwt.client.popups.competitorselection;
|
||||
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
|
||||
public interface CompetitorSelectionListener {
|
||||
|
||||
public void didClickOKWithSelectedCompetitor(CompetitorDTO competitor);
|
||||
public void didClickOKWithSelectedCompetitor(CompetitorWithBoatDTO competitor);
|
||||
}
|
||||
+5
-5
@@ -16,7 +16,7 @@ import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.dashboards.gwt.client.popups.competitorselection.table.CompetitorTable;
|
||||
import com.sap.sailing.dashboards.gwt.client.popups.competitorselection.table.CompetitorTableRowSelectionListener;
|
||||
import com.sap.sailing.dashboards.gwt.client.widgets.ActionPanel;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
|
||||
public class CompetitorSelectionPopup extends Composite implements HasWidgets, CompetitorTableRowSelectionListener {
|
||||
|
||||
@@ -38,7 +38,7 @@ public class CompetitorSelectionPopup extends Composite implements HasWidgets, C
|
||||
@UiField(provided = true)
|
||||
ActionPanel okButton;
|
||||
|
||||
private CompetitorDTO currentCompetitorSelected;
|
||||
private CompetitorWithBoatDTO currentCompetitorSelected;
|
||||
private boolean isVisible;
|
||||
private CompetitorSelectionPopupResources competitorSelectionPopupResources = CompetitorSelectionPopupResources.INSTANCE;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class CompetitorSelectionPopup extends Composite implements HasWidgets, C
|
||||
okButton.getElement().setInnerText("OK");
|
||||
}
|
||||
|
||||
public void show(List<CompetitorDTO> competitorList) {
|
||||
public void show(List<CompetitorWithBoatDTO> competitorList) {
|
||||
competitortable.setTableContent(competitorList);
|
||||
RootLayoutPanel.get().add(this);
|
||||
competitorselectionpopup.addStyleName(competitorSelectionPopupResources.gss().popupshow());
|
||||
@@ -88,7 +88,7 @@ public class CompetitorSelectionPopup extends Composite implements HasWidgets, C
|
||||
this.competitorSelectionPopupListener.remove(o);
|
||||
}
|
||||
|
||||
public void notifyListenerAboutOKButtonClickedWithSelectedCompetitorName(CompetitorDTO competitor) {
|
||||
public void notifyListenerAboutOKButtonClickedWithSelectedCompetitorName(CompetitorWithBoatDTO competitor) {
|
||||
for (CompetitorSelectionListener newStartAnalysisListener : competitorSelectionPopupListener) {
|
||||
newStartAnalysisListener.didClickOKWithSelectedCompetitor(competitor);
|
||||
}
|
||||
@@ -127,7 +127,7 @@ public class CompetitorSelectionPopup extends Composite implements HasWidgets, C
|
||||
}
|
||||
|
||||
@Override
|
||||
public void didSelectedRowWithCompetitorName(CompetitorDTO competitor) {
|
||||
public void didSelectedRowWithCompetitorName(CompetitorWithBoatDTO competitor) {
|
||||
currentCompetitorSelected = competitor;
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -10,46 +10,46 @@ import com.google.gwt.user.cellview.client.TextColumn;
|
||||
import com.google.gwt.user.client.ui.AbsolutePanel;
|
||||
import com.google.gwt.view.client.SelectionChangeEvent;
|
||||
import com.google.gwt.view.client.SingleSelectionModel;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sse.gwt.client.celltable.BaseCelltable;
|
||||
|
||||
public class CompetitorTable extends AbsolutePanel {
|
||||
|
||||
private CellTable<CompetitorDTO> table;
|
||||
private CellTable<CompetitorWithBoatDTO> table;
|
||||
private CompetitorTableRowSelectionListener competitorTableRowSelectionListener;
|
||||
|
||||
public CompetitorTable(CompetitorTableRowSelectionListener competitorTableRowSelectionListener) {
|
||||
this.competitorTableRowSelectionListener = competitorTableRowSelectionListener;
|
||||
}
|
||||
|
||||
public void setTableContent(List<CompetitorDTO> competitorNames) {
|
||||
public void setTableContent(List<CompetitorWithBoatDTO> competitorNames) {
|
||||
if (table == null) {
|
||||
initTable(competitorNames);
|
||||
}
|
||||
}
|
||||
|
||||
private void initTable(List<CompetitorDTO> competitorNames) {
|
||||
private void initTable(List<CompetitorWithBoatDTO> competitorNames) {
|
||||
CellTable.Resources tableRes = GWT.create(CompetitorTableStyleResource.class);
|
||||
|
||||
table = new BaseCelltable<CompetitorDTO>(15, tableRes);
|
||||
table = new BaseCelltable<CompetitorWithBoatDTO>(15, tableRes);
|
||||
table.getElement().getStyle().setWidth(100, Unit.PCT);
|
||||
table.setSkipRowHoverStyleUpdate(true);
|
||||
table.setSkipRowHoverCheck(true);
|
||||
table.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
|
||||
final SingleSelectionModel<CompetitorDTO> selectionModel = new SingleSelectionModel<CompetitorDTO>();
|
||||
final SingleSelectionModel<CompetitorWithBoatDTO> selectionModel = new SingleSelectionModel<CompetitorWithBoatDTO>();
|
||||
table.setSelectionModel(selectionModel);
|
||||
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
|
||||
public void onSelectionChange(SelectionChangeEvent event) {
|
||||
CompetitorDTO selected = selectionModel.getSelectedObject();
|
||||
CompetitorWithBoatDTO selected = selectionModel.getSelectedObject();
|
||||
if (selected != null) {
|
||||
competitorTableRowSelectionListener.didSelectedRowWithCompetitorName(selected);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
TextColumn<CompetitorDTO> competitorNameCollumn = new TextColumn<CompetitorDTO>() {
|
||||
TextColumn<CompetitorWithBoatDTO> competitorNameCollumn = new TextColumn<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public String getValue(CompetitorDTO competitor) {
|
||||
public String getValue(CompetitorWithBoatDTO competitor) {
|
||||
return competitor.getName();
|
||||
}
|
||||
};
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package com.sap.sailing.dashboards.gwt.client.popups.competitorselection.table;
|
||||
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
|
||||
public interface CompetitorTableRowSelectionListener {
|
||||
|
||||
public void didSelectedRowWithCompetitorName(CompetitorDTO competitor);
|
||||
public void didSelectedRowWithCompetitorName(CompetitorWithBoatDTO competitor);
|
||||
}
|
||||
+3
-3
@@ -40,7 +40,7 @@ import com.sap.sailing.dashboards.gwt.shared.DashboardURLParameters;
|
||||
import com.sap.sailing.dashboards.gwt.shared.dto.LeaderboardCompetitorsDTO;
|
||||
import com.sap.sailing.dashboards.gwt.shared.dto.StartAnalysesDTO;
|
||||
import com.sap.sailing.dashboards.gwt.shared.dto.StartAnalysisDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.shared.racemap.RaceMapResources;
|
||||
|
||||
@@ -240,7 +240,7 @@ public class StartAnalysisWidget extends Composite implements HasWidgets, PollsL
|
||||
competitorSelectionPopup.addListener(new CompetitorSelectionListener() {
|
||||
|
||||
@Override
|
||||
public void didClickOKWithSelectedCompetitor(CompetitorDTO competitor) {
|
||||
public void didClickOKWithSelectedCompetitor(CompetitorWithBoatDTO competitor) {
|
||||
if (competitor != null) {
|
||||
Cookies.removeCookie(cookieKeyForSelectedCompetitorInLeaderboard);
|
||||
Cookies.setCookie(cookieKeyForSelectedCompetitorInLeaderboard, competitor.getIdAsString(), new Date(new Date().getTime()+SELECTED_COMPETITOR_ID_COOKIE_KEY_EXPIRE_TIME_IN_MILLIS));
|
||||
@@ -421,7 +421,7 @@ public class StartAnalysisWidget extends Composite implements HasWidgets, PollsL
|
||||
private String getCompetitorIdAsStringFromFirstDisplayedStartAnalysis() {
|
||||
String result = null;
|
||||
if (starts != null && starts.size() > 0) {
|
||||
CompetitorDTO competitor = starts.get(0).competitor;
|
||||
CompetitorWithBoatDTO competitor = starts.get(0).competitor;
|
||||
if (competitor != null)
|
||||
result = starts.get(0).competitor.getIdAsString();
|
||||
}
|
||||
|
||||
+1
-5
@@ -24,8 +24,6 @@ import com.sap.sailing.dashboards.gwt.client.widgets.startanalysis.rankingtable.
|
||||
import com.sap.sailing.dashboards.gwt.shared.StartlineAdvantageType;
|
||||
import com.sap.sailing.dashboards.gwt.shared.dto.StartAnalysisDTO;
|
||||
import com.sap.sailing.domain.common.racelog.RacingProcedureType;
|
||||
import com.sap.sailing.gwt.ui.client.CompetitorColorProvider;
|
||||
import com.sap.sailing.gwt.ui.client.CompetitorColorProviderImpl;
|
||||
import com.sap.sailing.gwt.ui.client.RaceCompetitorSelectionModel;
|
||||
import com.sap.sailing.gwt.ui.client.RaceTimesInfoProvider;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
@@ -75,7 +73,6 @@ public class StartAnalysisCard extends Composite implements HasWidgets, StartAna
|
||||
private SailingServiceAsync sailingServiceAsync;
|
||||
private StringMessages stringMessages;
|
||||
private final RaceCompetitorSelectionModel competitorSelectionModel;
|
||||
private final CompetitorColorProvider colorProvider;
|
||||
|
||||
private final double WIND_LINE_ADVANTAGE_DIV_WIDTH_IN_PT = 185;
|
||||
private final double GEOMETRIC_LINE_ADVANTAGE_DIV_WIDTH_IN_PT = 210;
|
||||
@@ -87,8 +84,7 @@ public class StartAnalysisCard extends Composite implements HasWidgets, StartAna
|
||||
stringMessages = StringMessages.INSTANCE;
|
||||
this.sailingServiceAsync = sailingServiceAsync;
|
||||
this.raceMapResources = raceMapResources;
|
||||
colorProvider = new CompetitorColorProviderImpl();
|
||||
competitorSelectionModel = new RaceCompetitorSelectionModel(/* hasMultiSelection */true, colorProvider);
|
||||
competitorSelectionModel = new RaceCompetitorSelectionModel(/* hasMultiSelection */true);
|
||||
competitorSelectionModel.setCompetitors(startAnalysisDTO.getCompetitorDTOsFromStartAnaylsisCompetitorDTOs(),
|
||||
raceMap);
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@ package com.sap.sailing.dashboards.gwt.shared.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sse.gwt.dispatch.shared.commands.Result;
|
||||
|
||||
/**
|
||||
@@ -11,15 +11,15 @@ import com.sap.sse.gwt.dispatch.shared.commands.Result;
|
||||
*/
|
||||
public class LeaderboardCompetitorsDTO implements Result {
|
||||
|
||||
private List<CompetitorDTO> competitors;
|
||||
private List<CompetitorWithBoatDTO> competitors;
|
||||
|
||||
public LeaderboardCompetitorsDTO() {}
|
||||
|
||||
public List<CompetitorDTO> getCompetitors() {
|
||||
public List<CompetitorWithBoatDTO> getCompetitors() {
|
||||
return competitors;
|
||||
}
|
||||
|
||||
public void setCompetitors(List<CompetitorDTO> competitors) {
|
||||
public void setCompetitors(List<CompetitorWithBoatDTO> competitors) {
|
||||
this.competitors = competitors;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -2,12 +2,12 @@ package com.sap.sailing.dashboards.gwt.shared.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
|
||||
public class StartAnalysisCompetitorDTO implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = -4236444628127858568L;
|
||||
|
||||
public CompetitorDTO competitorDTO;
|
||||
public CompetitorWithBoatDTO competitorDTO;
|
||||
public StartAnalysisRankingTableEntryDTO rankingTableEntryDTO;
|
||||
}
|
||||
+4
-4
@@ -5,7 +5,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.racelog.RacingProcedureType;
|
||||
|
||||
public class StartAnalysisDTO implements Serializable, Comparable<StartAnalysisDTO> {
|
||||
@@ -13,7 +13,7 @@ public class StartAnalysisDTO implements Serializable, Comparable<StartAnalysisD
|
||||
private static final long serialVersionUID = -1325150193180234561L;
|
||||
|
||||
public String raceName;
|
||||
public CompetitorDTO competitor;
|
||||
public CompetitorWithBoatDTO competitor;
|
||||
public WindAndAdvantagesInfoForStartLineDTO startAnalysisWindLineInfoDTO;
|
||||
public List<StartAnalysisCompetitorDTO> startAnalysisCompetitorDTOs;
|
||||
public long timeOfStartInMilliSeconds;
|
||||
@@ -29,8 +29,8 @@ public class StartAnalysisDTO implements Serializable, Comparable<StartAnalysisD
|
||||
return raceName.compareTo(o.raceName);
|
||||
}
|
||||
|
||||
public List<CompetitorDTO> getCompetitorDTOsFromStartAnaylsisCompetitorDTOs() {
|
||||
List<CompetitorDTO> competitorDTOs = new ArrayList<CompetitorDTO>();
|
||||
public List<CompetitorWithBoatDTO> getCompetitorDTOsFromStartAnaylsisCompetitorDTOs() {
|
||||
List<CompetitorWithBoatDTO> competitorDTOs = new ArrayList<CompetitorWithBoatDTO>();
|
||||
for (StartAnalysisCompetitorDTO startAnalysisCompetitorDTO : startAnalysisCompetitorDTOs) {
|
||||
competitorDTOs.add(startAnalysisCompetitorDTO.competitorDTO);
|
||||
}
|
||||
|
||||
+7
-7
@@ -23,8 +23,8 @@ public abstract class AbstractLeaderboardDTO implements Serializable {
|
||||
public String name;
|
||||
|
||||
private List<RaceColumnDTO> races;
|
||||
public Map<CompetitorDTO, String> competitorDisplayNames;
|
||||
public Map<CompetitorDTO, LeaderboardRowDTO> rows;
|
||||
public Map<CompetitorWithBoatDTO, String> competitorDisplayNames;
|
||||
public Map<CompetitorWithBoatDTO, LeaderboardRowDTO> rows;
|
||||
public boolean hasCarriedPoints;
|
||||
public int[] discardThresholds;
|
||||
|
||||
@@ -53,7 +53,7 @@ public abstract class AbstractLeaderboardDTO implements Serializable {
|
||||
|
||||
private void collectBoatClasses(Collection<BoatClassDTO> boatClasses) {
|
||||
if (rows != null) {
|
||||
for (CompetitorDTO competitor : rows.keySet()) {
|
||||
for (CompetitorWithBoatDTO competitor : rows.keySet()) {
|
||||
boatClasses.add(competitor.getBoatClass());
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ public abstract class AbstractLeaderboardDTO implements Serializable {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public String getDisplayName(CompetitorDTO competitor) {
|
||||
public String getDisplayName(CompetitorWithBoatDTO competitor) {
|
||||
if (competitorDisplayNames == null || competitorDisplayNames.get(competitor) == null) {
|
||||
return competitor.getName();
|
||||
} else {
|
||||
@@ -115,7 +115,7 @@ public abstract class AbstractLeaderboardDTO implements Serializable {
|
||||
* Tells if the <code>competitor</code> scored (and therefore presumably participated) in a medal race represented
|
||||
* in this leaderboard.
|
||||
*/
|
||||
public boolean scoredInMedalRace(CompetitorDTO competitor) {
|
||||
public boolean scoredInMedalRace(CompetitorWithBoatDTO competitor) {
|
||||
LeaderboardRowDTO row = rows.get(competitor);
|
||||
for (RaceColumnDTO race : races) {
|
||||
if (race.isMedalRace() && row.fieldsByRaceColumnName.get(race.getRaceColumnName()).netPoints > 0) {
|
||||
@@ -125,7 +125,7 @@ public abstract class AbstractLeaderboardDTO implements Serializable {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Double getTotalPoints(CompetitorDTO competitor, String nameOfLastRaceSoFar) {
|
||||
public Double getTotalPoints(CompetitorWithBoatDTO competitor, String nameOfLastRaceSoFar) {
|
||||
Double totalPoints = null;
|
||||
final LeaderboardRowDTO row = rows.get(competitor);
|
||||
if (row != null) {
|
||||
@@ -431,7 +431,7 @@ public abstract class AbstractLeaderboardDTO implements Serializable {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isDisplayNameSet(CompetitorDTO competitor) {
|
||||
public boolean isDisplayNameSet(CompetitorWithBoatDTO competitor) {
|
||||
return competitorDisplayNames.get(competitor) != null;
|
||||
}
|
||||
|
||||
|
||||
Executable → Regular
+35
-24
@@ -1,36 +1,47 @@
|
||||
package com.sap.sailing.domain.common.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.common.racelog.tracking.MappableToDevice;
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.Duration;
|
||||
|
||||
/**
|
||||
* Equality and hash code are based on the {@link #getIdAsString() ID}, the {@link #getSailID() sail number}, the
|
||||
* {@link #getBoatClass() boat class} (whose equality and hash code, in turn, depends on its name) and the
|
||||
* {@link #getThreeLetterIocCountryCode() IOC country code}. Note that the three latter properties are subject
|
||||
* to change for a competitor while the ID remains unchanged.
|
||||
*
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
* Equality and hash code are based on the {@link #getIdAsString() ID} and all contained attributes like name, shortName, email, etc.
|
||||
*/
|
||||
public interface CompetitorDTO extends CompetitorWithoutBoatDTO {
|
||||
// TODO bug2822: Should we remove this?
|
||||
String getSailID();
|
||||
public interface CompetitorDTO extends Serializable, MappableToDevice {
|
||||
|
||||
String getTwoLetterIsoCountryCode();
|
||||
|
||||
String getThreeLetterIocCountryCode();
|
||||
|
||||
String getCountryName();
|
||||
|
||||
String getIdAsString();
|
||||
|
||||
String getSearchTag();
|
||||
|
||||
/**
|
||||
* Returns a derived short information about a competitor depending on the information available
|
||||
* If we have a short name set on the competitor this name will be returned.
|
||||
* If no short name exist but a boat the either the sailId or the boat name will returned.
|
||||
* If all these attributes have no value null is returned.
|
||||
* If the {@code searchTag} is not contained in {@link #getSearchTag()}, appends it to the search tag, separated by a space character
|
||||
*/
|
||||
String getShortInfo();
|
||||
void addToSearchTag(String searchTag);
|
||||
|
||||
String getName();
|
||||
|
||||
BoatDTO getBoat();
|
||||
String getShortName();
|
||||
|
||||
void setBoat(BoatDTO boat);
|
||||
Color getColor();
|
||||
|
||||
String getEmail();
|
||||
|
||||
boolean hasEmail();
|
||||
|
||||
// TODO bug2822: Should we remove this?
|
||||
BoatClassDTO getBoatClass();
|
||||
String getFlagImageURL();
|
||||
|
||||
String getImageURL();
|
||||
|
||||
Double getTimeOnTimeFactor();
|
||||
|
||||
Duration getTimeOnDistanceAllowancePerNauticalMile();
|
||||
|
||||
/**
|
||||
* A regular instance will simply return this object. A compacted version may compute the result by looking it up
|
||||
* from the previous version of the enclosing leaderboard.
|
||||
*/
|
||||
CompetitorDTO getCompetitorFromPrevious(LeaderboardDTO previousVersion);
|
||||
}
|
||||
Executable → Regular
+154
-43
@@ -5,36 +5,64 @@ import java.io.Serializable;
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.Duration;
|
||||
|
||||
public class CompetitorDTOImpl extends CompetitorWithoutBoatDTOImpl implements CompetitorDTO, Serializable {
|
||||
private static final long serialVersionUID = -4997852354821083154L;
|
||||
private BoatDTO boat;
|
||||
/**
|
||||
* Equality and hash code are based on the {@link #getIdAsString() ID}, the {@link #getSailID() sail number}, the
|
||||
* {@link #getBoatClass() boat class} (whose equality and hash code, in turn, depends on its name) and the
|
||||
* {@link #getThreeLetterIocCountryCode() IOC country code}. Note that the three latter properties are subject
|
||||
* to change for a competitor while the ID remains unchanged.
|
||||
*
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public class CompetitorDTOImpl extends NamedDTO implements CompetitorDTO, Serializable {
|
||||
private static final long serialVersionUID = 3019126418065082622L;
|
||||
private String countryName;
|
||||
private String twoLetterIsoCountryCode;
|
||||
private String threeLetterIocCountryCode;
|
||||
private Color color;
|
||||
private String shortName;
|
||||
private String email;
|
||||
private String searchTag;
|
||||
private String idAsString;
|
||||
private String imageURL;
|
||||
private String flagImageURL;
|
||||
private Double timeOnTimeFactor;
|
||||
private Duration timeOnDistanceAllowancePerNauticalMile;
|
||||
|
||||
public CompetitorDTOImpl() {
|
||||
boat = new BoatDTO();
|
||||
}
|
||||
public CompetitorDTOImpl() {}
|
||||
|
||||
public CompetitorDTOImpl(String name, String shortName, Color color, String email, String twoLetterIsoCountryCode, String threeLetterIocCountryCode,
|
||||
String countryName, String idAsString, String imageURL, String flagImageURL,
|
||||
Double timeOnTimeFactor, Duration timeOnDistanceAllowancePerNauticalMile, String searchTag, BoatDTO boat) {
|
||||
super(name, shortName, color, email, twoLetterIsoCountryCode, threeLetterIocCountryCode,
|
||||
countryName, idAsString, imageURL, flagImageURL,
|
||||
timeOnTimeFactor, timeOnDistanceAllowancePerNauticalMile, searchTag);
|
||||
this.boat = boat;
|
||||
}
|
||||
|
||||
public CompetitorDTOImpl(CompetitorWithoutBoatDTO c, BoatDTO boat) {
|
||||
super(c.getName(), c.getShortName(), c.getColor(), c.getEmail(),
|
||||
c.getTwoLetterIsoCountryCode(), c.getThreeLetterIocCountryCode(), c.getCountryName(), c.getIdAsString(),
|
||||
c.getImageURL(), c.getFlagImageURL(), c.getTimeOnTimeFactor(),
|
||||
c.getTimeOnDistanceAllowancePerNauticalMile(), c.getSearchTag());
|
||||
this.boat = boat;
|
||||
Double timeOnTimeFactor, Duration timeOnDistanceAllowancePerNauticalMile, String searchTag) {
|
||||
super(name);
|
||||
this.shortName = shortName;
|
||||
this.color = color;
|
||||
this.email = email;
|
||||
this.twoLetterIsoCountryCode = twoLetterIsoCountryCode;
|
||||
this.threeLetterIocCountryCode = threeLetterIocCountryCode;
|
||||
this.countryName = countryName;
|
||||
this.idAsString = idAsString;
|
||||
this.imageURL = imageURL;
|
||||
this.flagImageURL = flagImageURL;
|
||||
this.timeOnTimeFactor = timeOnTimeFactor;
|
||||
this.timeOnDistanceAllowancePerNauticalMile = timeOnDistanceAllowancePerNauticalMile;
|
||||
this.searchTag = searchTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((boat == null) ? 0 : boat.hashCode());
|
||||
result = prime * result + ((idAsString == null) ? 0 : idAsString.hashCode());
|
||||
result = prime * result + ((color == null) ? 0 : color.hashCode());
|
||||
result = prime * result + ((email == null) ? 0 : email.hashCode());
|
||||
result = prime * result + ((shortName == null) ? 0 : shortName.hashCode());
|
||||
result = prime * result + ((threeLetterIocCountryCode == null) ? 0 : threeLetterIocCountryCode.hashCode());
|
||||
result = prime * result + ((imageURL == null) ? 0 : imageURL.hashCode());
|
||||
result = prime * result + ((flagImageURL == null) ? 0 : flagImageURL.hashCode());
|
||||
result = prime * result + ((timeOnTimeFactor == null) ? 0 : timeOnTimeFactor.hashCode());
|
||||
result = prime * result + ((timeOnDistanceAllowancePerNauticalMile == null) ? 0 : timeOnDistanceAllowancePerNauticalMile.hashCode());
|
||||
result = prime * result + ((searchTag == null) ? 0 : searchTag.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -47,47 +75,130 @@ public class CompetitorDTOImpl extends CompetitorWithoutBoatDTOImpl implements C
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
CompetitorDTOImpl other = (CompetitorDTOImpl) obj;
|
||||
if (boat == null) {
|
||||
if (other.boat != null)
|
||||
if (idAsString == null) {
|
||||
if (other.idAsString != null)
|
||||
return false;
|
||||
} else if (!boat.equals(other.boat))
|
||||
} else if (!idAsString.equals(other.idAsString))
|
||||
return false;
|
||||
if (threeLetterIocCountryCode == null) {
|
||||
if (other.threeLetterIocCountryCode != null)
|
||||
return false;
|
||||
} else if (!threeLetterIocCountryCode.equals(other.threeLetterIocCountryCode))
|
||||
return false;
|
||||
if (color == null) {
|
||||
if (other.color != null)
|
||||
return false;
|
||||
} else if (!color.equals(other.color))
|
||||
return false;
|
||||
if (email == null) {
|
||||
if (other.email != null)
|
||||
return false;
|
||||
} else if (!email.equals(other.email))
|
||||
return false;
|
||||
if (shortName == null) {
|
||||
if (other.shortName != null)
|
||||
return false;
|
||||
} else if (!shortName.equals(other.shortName))
|
||||
return false;
|
||||
if (imageURL == null) {
|
||||
if (other.imageURL != null)
|
||||
return false;
|
||||
} else if (!imageURL.equals(other.imageURL))
|
||||
return false;
|
||||
if (flagImageURL == null) {
|
||||
if (other.flagImageURL != null)
|
||||
return false;
|
||||
} else if (!flagImageURL.equals(other.flagImageURL))
|
||||
return false;
|
||||
if (timeOnTimeFactor == null) {
|
||||
if (other.timeOnTimeFactor != null)
|
||||
return false;
|
||||
} else if (!timeOnTimeFactor.equals(other.timeOnTimeFactor))
|
||||
return false;
|
||||
if (timeOnDistanceAllowancePerNauticalMile == null) {
|
||||
if (other.timeOnDistanceAllowancePerNauticalMile != null)
|
||||
return false;
|
||||
} else if (!timeOnDistanceAllowancePerNauticalMile.equals(other.timeOnDistanceAllowancePerNauticalMile))
|
||||
return false;
|
||||
if (searchTag == null) {
|
||||
if (other.searchTag != null)
|
||||
return false;
|
||||
} else if (!searchTag.equals(other.searchTag))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompetitorDTO getCompetitorFromPrevious(LeaderboardDTO previousVersion) {
|
||||
return this;
|
||||
public String getTwoLetterIsoCountryCode() {
|
||||
return twoLetterIsoCountryCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
String result = null;
|
||||
if (getShortName() != null && !getShortName().trim().isEmpty()) {
|
||||
result = getShortName();
|
||||
} else if (getBoat() != null) {
|
||||
result = getBoat().getSailId() != null ? getBoat().getSailId() : getBoat().getName();
|
||||
}
|
||||
return result;
|
||||
public String getThreeLetterIocCountryCode() {
|
||||
return threeLetterIocCountryCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSailID() {
|
||||
return boat == null ? null : boat.getSailId();
|
||||
public String getCountryName() {
|
||||
return countryName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortName() {
|
||||
return shortName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getImageURL() {
|
||||
return imageURL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFlagImageURL() {
|
||||
return flagImageURL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdAsString() {
|
||||
return idAsString;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSearchTag() {
|
||||
return searchTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoatClassDTO getBoatClass() {
|
||||
return boat == null ? null : boat.getBoatClass();
|
||||
public void addToSearchTag(String searchTag) {
|
||||
if (this.searchTag == null) {
|
||||
this.searchTag = searchTag;
|
||||
} else if (!this.searchTag.contains(searchTag)) {
|
||||
this.searchTag += " "+searchTag;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBoat(BoatDTO boat) {
|
||||
this.boat = boat;
|
||||
}
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEmail() {
|
||||
return email != null && !email.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoatDTO getBoat() {
|
||||
return boat;
|
||||
}
|
||||
public Double getTimeOnTimeFactor() {
|
||||
return timeOnTimeFactor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Duration getTimeOnDistanceAllowancePerNauticalMile() {
|
||||
return timeOnDistanceAllowancePerNauticalMile;
|
||||
}
|
||||
}
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
package com.sap.sailing.domain.common.dto;
|
||||
|
||||
/**
|
||||
* Equality and hash code are based on the {@link #getIdAsString() ID}, the {@link #getSailID() sail number}, the
|
||||
* {@link #getBoatClass() boat class} (whose equality and hash code, in turn, depends on its name) and the
|
||||
* {@link #getThreeLetterIocCountryCode() IOC country code}. Note that the three latter properties are subject
|
||||
* to change for a competitor while the ID remains unchanged.
|
||||
*
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public interface CompetitorWithBoatDTO extends CompetitorDTO {
|
||||
// TODO bug2822: Should we remove this?
|
||||
String getSailID();
|
||||
|
||||
/**
|
||||
* Returns a derived short information about a competitor depending on the information available
|
||||
* If we have a short name set on the competitor this name will be returned.
|
||||
* If no short name exist but a boat the either the sailId or the boat name will returned.
|
||||
* If all these attributes have no value null is returned.
|
||||
*/
|
||||
String getShortInfo();
|
||||
|
||||
BoatDTO getBoat();
|
||||
|
||||
void setBoat(BoatDTO boat);
|
||||
|
||||
// TODO bug2822: Should we remove this?
|
||||
BoatClassDTO getBoatClass();
|
||||
|
||||
/**
|
||||
* A regular instance will simply return this object. A compacted version may compute the result by looking it up
|
||||
* from the previous version of the enclosing leaderboard.
|
||||
*/
|
||||
CompetitorWithBoatDTO getCompetitorFromPrevious(LeaderboardDTO previousVersion);
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
package com.sap.sailing.domain.common.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.Duration;
|
||||
|
||||
public class CompetitorWithBoatDTOImpl extends CompetitorDTOImpl implements CompetitorWithBoatDTO, Serializable {
|
||||
private static final long serialVersionUID = -4997852354821083154L;
|
||||
private BoatDTO boat;
|
||||
|
||||
public CompetitorWithBoatDTOImpl() {
|
||||
boat = new BoatDTO();
|
||||
}
|
||||
|
||||
public CompetitorWithBoatDTOImpl(String name, String shortName, Color color, String email, String twoLetterIsoCountryCode, String threeLetterIocCountryCode,
|
||||
String countryName, String idAsString, String imageURL, String flagImageURL,
|
||||
Double timeOnTimeFactor, Duration timeOnDistanceAllowancePerNauticalMile, String searchTag, BoatDTO boat) {
|
||||
super(name, shortName, color, email, twoLetterIsoCountryCode, threeLetterIocCountryCode,
|
||||
countryName, idAsString, imageURL, flagImageURL,
|
||||
timeOnTimeFactor, timeOnDistanceAllowancePerNauticalMile, searchTag);
|
||||
this.boat = boat;
|
||||
}
|
||||
|
||||
public CompetitorWithBoatDTOImpl(CompetitorDTO c, BoatDTO boat) {
|
||||
super(c.getName(), c.getShortName(), c.getColor(), c.getEmail(),
|
||||
c.getTwoLetterIsoCountryCode(), c.getThreeLetterIocCountryCode(), c.getCountryName(), c.getIdAsString(),
|
||||
c.getImageURL(), c.getFlagImageURL(), c.getTimeOnTimeFactor(),
|
||||
c.getTimeOnDistanceAllowancePerNauticalMile(), c.getSearchTag());
|
||||
this.boat = boat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((boat == null) ? 0 : boat.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (!super.equals(obj))
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
CompetitorWithBoatDTOImpl other = (CompetitorWithBoatDTOImpl) obj;
|
||||
if (boat == null) {
|
||||
if (other.boat != null)
|
||||
return false;
|
||||
} else if (!boat.equals(other.boat))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompetitorWithBoatDTO getCompetitorFromPrevious(LeaderboardDTO previousVersion) {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
String result = null;
|
||||
if (getShortName() != null && !getShortName().trim().isEmpty()) {
|
||||
result = getShortName();
|
||||
} else if (getBoat() != null) {
|
||||
result = getBoat().getSailId() != null ? getBoat().getSailId() : getBoat().getName();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSailID() {
|
||||
return boat == null ? null : boat.getSailId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoatClassDTO getBoatClass() {
|
||||
return boat == null ? null : boat.getBoatClass();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBoat(BoatDTO boat) {
|
||||
this.boat = boat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoatDTO getBoat() {
|
||||
return boat;
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -4,18 +4,18 @@ import java.util.Objects;
|
||||
|
||||
public class CompetitorWithToolTipDTO {
|
||||
|
||||
private CompetitorDTO competitor;
|
||||
private CompetitorWithBoatDTO competitor;
|
||||
private String toolTipMessage;
|
||||
|
||||
public CompetitorWithToolTipDTO() {
|
||||
}
|
||||
|
||||
public CompetitorWithToolTipDTO(CompetitorDTO competitor, String toolTipMessage) {
|
||||
public CompetitorWithToolTipDTO(CompetitorWithBoatDTO competitor, String toolTipMessage) {
|
||||
this.competitor = competitor;
|
||||
this.toolTipMessage = toolTipMessage;
|
||||
}
|
||||
|
||||
public CompetitorDTO getCompetitor() {
|
||||
public CompetitorWithBoatDTO getCompetitor() {
|
||||
return competitor;
|
||||
}
|
||||
|
||||
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
package com.sap.sailing.domain.common.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sailing.domain.common.racelog.tracking.MappableToDevice;
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.Duration;
|
||||
|
||||
/**
|
||||
* Equality and hash code are based on the {@link #getIdAsString() ID} and all contained attributes like name, shortName, email, etc.
|
||||
*/
|
||||
public interface CompetitorWithoutBoatDTO extends Serializable, MappableToDevice {
|
||||
|
||||
String getTwoLetterIsoCountryCode();
|
||||
|
||||
String getThreeLetterIocCountryCode();
|
||||
|
||||
String getCountryName();
|
||||
|
||||
String getIdAsString();
|
||||
|
||||
String getSearchTag();
|
||||
|
||||
/**
|
||||
* If the {@code searchTag} is not contained in {@link #getSearchTag()}, appends it to the search tag, separated by a space character
|
||||
*/
|
||||
void addToSearchTag(String searchTag);
|
||||
|
||||
String getName();
|
||||
|
||||
String getShortName();
|
||||
|
||||
Color getColor();
|
||||
|
||||
String getEmail();
|
||||
|
||||
boolean hasEmail();
|
||||
|
||||
String getFlagImageURL();
|
||||
|
||||
String getImageURL();
|
||||
|
||||
Double getTimeOnTimeFactor();
|
||||
|
||||
Duration getTimeOnDistanceAllowancePerNauticalMile();
|
||||
|
||||
}
|
||||
-204
@@ -1,204 +0,0 @@
|
||||
package com.sap.sailing.domain.common.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.Duration;
|
||||
|
||||
/**
|
||||
* Equality and hash code are based on the {@link #getIdAsString() ID}, the {@link #getSailID() sail number}, the
|
||||
* {@link #getBoatClass() boat class} (whose equality and hash code, in turn, depends on its name) and the
|
||||
* {@link #getThreeLetterIocCountryCode() IOC country code}. Note that the three latter properties are subject
|
||||
* to change for a competitor while the ID remains unchanged.
|
||||
*
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public class CompetitorWithoutBoatDTOImpl extends NamedDTO implements CompetitorWithoutBoatDTO, Serializable {
|
||||
private static final long serialVersionUID = 3019126418065082622L;
|
||||
private String countryName;
|
||||
private String twoLetterIsoCountryCode;
|
||||
private String threeLetterIocCountryCode;
|
||||
private Color color;
|
||||
private String shortName;
|
||||
private String email;
|
||||
private String searchTag;
|
||||
private String idAsString;
|
||||
private String imageURL;
|
||||
private String flagImageURL;
|
||||
private Double timeOnTimeFactor;
|
||||
private Duration timeOnDistanceAllowancePerNauticalMile;
|
||||
|
||||
public CompetitorWithoutBoatDTOImpl() {}
|
||||
|
||||
public CompetitorWithoutBoatDTOImpl(String name, String shortName, Color color, String email, String twoLetterIsoCountryCode, String threeLetterIocCountryCode,
|
||||
String countryName, String idAsString, String imageURL, String flagImageURL,
|
||||
Double timeOnTimeFactor, Duration timeOnDistanceAllowancePerNauticalMile, String searchTag) {
|
||||
super(name);
|
||||
this.shortName = shortName;
|
||||
this.color = color;
|
||||
this.email = email;
|
||||
this.twoLetterIsoCountryCode = twoLetterIsoCountryCode;
|
||||
this.threeLetterIocCountryCode = threeLetterIocCountryCode;
|
||||
this.countryName = countryName;
|
||||
this.idAsString = idAsString;
|
||||
this.imageURL = imageURL;
|
||||
this.flagImageURL = flagImageURL;
|
||||
this.timeOnTimeFactor = timeOnTimeFactor;
|
||||
this.timeOnDistanceAllowancePerNauticalMile = timeOnDistanceAllowancePerNauticalMile;
|
||||
this.searchTag = searchTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((idAsString == null) ? 0 : idAsString.hashCode());
|
||||
result = prime * result + ((color == null) ? 0 : color.hashCode());
|
||||
result = prime * result + ((email == null) ? 0 : email.hashCode());
|
||||
result = prime * result + ((shortName == null) ? 0 : shortName.hashCode());
|
||||
result = prime * result + ((threeLetterIocCountryCode == null) ? 0 : threeLetterIocCountryCode.hashCode());
|
||||
result = prime * result + ((imageURL == null) ? 0 : imageURL.hashCode());
|
||||
result = prime * result + ((flagImageURL == null) ? 0 : flagImageURL.hashCode());
|
||||
result = prime * result + ((timeOnTimeFactor == null) ? 0 : timeOnTimeFactor.hashCode());
|
||||
result = prime * result + ((timeOnDistanceAllowancePerNauticalMile == null) ? 0 : timeOnDistanceAllowancePerNauticalMile.hashCode());
|
||||
result = prime * result + ((searchTag == null) ? 0 : searchTag.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (!super.equals(obj))
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
CompetitorWithoutBoatDTOImpl other = (CompetitorWithoutBoatDTOImpl) obj;
|
||||
if (idAsString == null) {
|
||||
if (other.idAsString != null)
|
||||
return false;
|
||||
} else if (!idAsString.equals(other.idAsString))
|
||||
return false;
|
||||
if (threeLetterIocCountryCode == null) {
|
||||
if (other.threeLetterIocCountryCode != null)
|
||||
return false;
|
||||
} else if (!threeLetterIocCountryCode.equals(other.threeLetterIocCountryCode))
|
||||
return false;
|
||||
if (color == null) {
|
||||
if (other.color != null)
|
||||
return false;
|
||||
} else if (!color.equals(other.color))
|
||||
return false;
|
||||
if (email == null) {
|
||||
if (other.email != null)
|
||||
return false;
|
||||
} else if (!email.equals(other.email))
|
||||
return false;
|
||||
if (shortName == null) {
|
||||
if (other.shortName != null)
|
||||
return false;
|
||||
} else if (!shortName.equals(other.shortName))
|
||||
return false;
|
||||
if (imageURL == null) {
|
||||
if (other.imageURL != null)
|
||||
return false;
|
||||
} else if (!imageURL.equals(other.imageURL))
|
||||
return false;
|
||||
if (flagImageURL == null) {
|
||||
if (other.flagImageURL != null)
|
||||
return false;
|
||||
} else if (!flagImageURL.equals(other.flagImageURL))
|
||||
return false;
|
||||
if (timeOnTimeFactor == null) {
|
||||
if (other.timeOnTimeFactor != null)
|
||||
return false;
|
||||
} else if (!timeOnTimeFactor.equals(other.timeOnTimeFactor))
|
||||
return false;
|
||||
if (timeOnDistanceAllowancePerNauticalMile == null) {
|
||||
if (other.timeOnDistanceAllowancePerNauticalMile != null)
|
||||
return false;
|
||||
} else if (!timeOnDistanceAllowancePerNauticalMile.equals(other.timeOnDistanceAllowancePerNauticalMile))
|
||||
return false;
|
||||
if (searchTag == null) {
|
||||
if (other.searchTag != null)
|
||||
return false;
|
||||
} else if (!searchTag.equals(other.searchTag))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTwoLetterIsoCountryCode() {
|
||||
return twoLetterIsoCountryCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getThreeLetterIocCountryCode() {
|
||||
return threeLetterIocCountryCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCountryName() {
|
||||
return countryName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortName() {
|
||||
return shortName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getImageURL() {
|
||||
return imageURL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFlagImageURL() {
|
||||
return flagImageURL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdAsString() {
|
||||
return idAsString;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSearchTag() {
|
||||
return searchTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addToSearchTag(String searchTag) {
|
||||
if (this.searchTag == null) {
|
||||
this.searchTag = searchTag;
|
||||
} else if (!this.searchTag.contains(searchTag)) {
|
||||
this.searchTag += " "+searchTag;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEmail() {
|
||||
return email != null && !email.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getTimeOnTimeFactor() {
|
||||
return timeOnTimeFactor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Duration getTimeOnDistanceAllowancePerNauticalMile() {
|
||||
return timeOnDistanceAllowancePerNauticalMile;
|
||||
}
|
||||
}
|
||||
+42
-42
@@ -40,8 +40,8 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
|
||||
|
||||
/**
|
||||
* If <code>null</code>, {@link #competitors} is filled and must not be touched; otherwise, the size of the array tells the new size
|
||||
* of {@link #competitors}, and for each index it either tells the index of the {@link CompetitorDTO} object to use in the previous
|
||||
* leaderboard's {@link #competitors} list, or holds -1, meaning that the next {@link CompetitorDTO} object is to be used from
|
||||
* of {@link #competitors}, and for each index it either tells the index of the {@link CompetitorWithBoatDTO} object to use in the previous
|
||||
* leaderboard's {@link #competitors} list, or holds -1, meaning that the next {@link CompetitorWithBoatDTO} object is to be used from
|
||||
* {@link #addedCompetitors} which only needs to hold a valid collection if at least one new competitor exists.
|
||||
*/
|
||||
private int[] competitorIndexesInPreviousCompetitorsList;
|
||||
@@ -50,7 +50,7 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
|
||||
* The "uncompacted" original competitors that were added. There is no need to try to compact these because they haven't existed
|
||||
* in the previous leaderboard and therefore need to be transmitted in their entirety.
|
||||
*/
|
||||
private List<CompetitorDTO> addedCompetitors;
|
||||
private List<CompetitorWithBoatDTO> addedCompetitors;
|
||||
|
||||
private boolean suppressedCompetitorsUnchanged;
|
||||
private boolean competitorDisplayNamesUnchanged;
|
||||
@@ -160,14 +160,14 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
|
||||
* Creates a bit set that is large enough to hold the bit for the index of <code>competitor</code> in the previous leaderboard's competitors
|
||||
* list and sets the bit for that competitor.
|
||||
*/
|
||||
private long[] createBitSet(CompetitorDTO competitor) {
|
||||
private long[] createBitSet(CompetitorWithBoatDTO competitor) {
|
||||
final int indexOfCompetitor = previousLeaderboard.competitors.indexOf(competitor);
|
||||
long[] result = new long[1+indexOfCompetitor/Long.SIZE];
|
||||
result[indexOfCompetitor/Long.SIZE] = 1l << (indexOfCompetitor%Long.SIZE);
|
||||
return result;
|
||||
}
|
||||
|
||||
private int getIndexOfCompetitor(CompetitorDTO competitor) {
|
||||
private int getIndexOfCompetitor(CompetitorWithBoatDTO competitor) {
|
||||
return previousLeaderboard.competitors.indexOf(competitor);
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
|
||||
* @param previousVersion
|
||||
* needed because after serialization/deserialization, the transient {@link #previousLeaderboard}
|
||||
* will be <code>null</code>.
|
||||
* @return a map whose keys are the {@link CompetitorDTO#getIdAsString()} of the competitors for which the value
|
||||
* @return a map whose keys are the {@link CompetitorWithBoatDTO#getIdAsString()} of the competitors for which the value
|
||||
* tells the set of keys that are unchanged
|
||||
*/
|
||||
public Map<String, Set<K>> getAllUnchangedCompetitorIdsAsStringAndKeys(LeaderboardDTO previousVersion) {
|
||||
@@ -188,7 +188,7 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
|
||||
final long[] bitset = raceColumnNameAndBitSet.getValue();
|
||||
if (bitset == null) {
|
||||
// this means that all entries for the column are unchanged for all competitors
|
||||
for (CompetitorDTO competitor : previousVersion.competitors) {
|
||||
for (CompetitorWithBoatDTO competitor : previousVersion.competitors) {
|
||||
Util.add(result, competitor.getIdAsString(), raceColumnNameAndBitSet.getKey());
|
||||
}
|
||||
} else {
|
||||
@@ -219,7 +219,7 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
|
||||
* @param competitor
|
||||
* a competitor that already existed in the previous version of the leaderboard
|
||||
*/
|
||||
public void unchanged(CompetitorDTO competitor, K key) {
|
||||
public void unchanged(CompetitorWithBoatDTO competitor, K key) {
|
||||
assert getIndexOfCompetitor(competitor) >= 0;
|
||||
long[] bitset = getUnchangedBitset(key);
|
||||
if (bitset == null) {
|
||||
@@ -258,7 +258,7 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
|
||||
/**
|
||||
* A specialized, bit set-based structure for marking leg details that haven't changed. The key is a composite of
|
||||
* the race column name and the zero-based leg index. If <code>null</code> is used for the leg index in a call to
|
||||
* {@link #unchanged(CompetitorDTO, Object)}, this means that all leg details in that race were unchanged for the
|
||||
* {@link #unchanged(CompetitorWithBoatDTO, Object)}, this means that all leg details in that race were unchanged for the
|
||||
* competitor, e.g., because they were <code>null</code> both in the old and new version.
|
||||
*
|
||||
* @author Axel Uhl (d043530)
|
||||
@@ -331,8 +331,8 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
|
||||
// other than strings when there is a map or set to be implemented that has a lot of strain on the
|
||||
// put / add / contains methods. For this, we use the competitor's getIdAsString() result that
|
||||
// identifies them reasonably well.
|
||||
final Map<String, CompetitorDTO> competitorsOfPreviousVersionByIdAsString = new HashMap<>();
|
||||
for (final CompetitorDTO c : previousVersion.competitors) {
|
||||
final Map<String, CompetitorWithBoatDTO> competitorsOfPreviousVersionByIdAsString = new HashMap<>();
|
||||
for (final CompetitorWithBoatDTO c : previousVersion.competitors) {
|
||||
competitorsOfPreviousVersionByIdAsString.put(c.getIdAsString(), c);
|
||||
}
|
||||
if (this.updatedFromPreviousVersionWithId != null) {
|
||||
@@ -363,8 +363,8 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
|
||||
this.regattaName = previousVersion.regattaName;
|
||||
}
|
||||
if (this.competitorIndexesInPreviousCompetitorsList != null) {
|
||||
this.competitors = new ArrayList<CompetitorDTO>(competitorIndexesInPreviousCompetitorsList.length);
|
||||
Iterator<CompetitorDTO> addedCompetitorsIter = null;
|
||||
this.competitors = new ArrayList<CompetitorWithBoatDTO>(competitorIndexesInPreviousCompetitorsList.length);
|
||||
Iterator<CompetitorWithBoatDTO> addedCompetitorsIter = null;
|
||||
for (int i=0; i<competitorIndexesInPreviousCompetitorsList.length; i++) {
|
||||
if (competitorIndexesInPreviousCompetitorsList[i] == -1) {
|
||||
if (addedCompetitorsIter==null) {
|
||||
@@ -376,11 +376,11 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
|
||||
}
|
||||
}
|
||||
}
|
||||
List<CompetitorDTO> suppressedCompetitors = new ArrayList<CompetitorDTO>();
|
||||
List<CompetitorWithBoatDTO> suppressedCompetitors = new ArrayList<CompetitorWithBoatDTO>();
|
||||
if (suppressedCompetitorsUnchanged) {
|
||||
Util.addAll(previousVersion.getSuppressedCompetitors(), suppressedCompetitors);
|
||||
} else {
|
||||
for (CompetitorDTO compactSuppressedCompetitor : getSuppressedCompetitors()) {
|
||||
for (CompetitorWithBoatDTO compactSuppressedCompetitor : getSuppressedCompetitors()) {
|
||||
suppressedCompetitors.add(compactSuppressedCompetitor.getCompetitorFromPrevious(previousVersion));
|
||||
}
|
||||
}
|
||||
@@ -388,8 +388,8 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
|
||||
if (competitorDisplayNamesUnchanged) {
|
||||
competitorDisplayNames = previousVersion.competitorDisplayNames;
|
||||
} else {
|
||||
Map<CompetitorDTO, String> expandedCompetitorDisplayNames = new HashMap<CompetitorDTO, String>();
|
||||
for (Map.Entry<CompetitorDTO, String> e : competitorDisplayNames.entrySet()) {
|
||||
Map<CompetitorWithBoatDTO, String> expandedCompetitorDisplayNames = new HashMap<CompetitorWithBoatDTO, String>();
|
||||
for (Map.Entry<CompetitorWithBoatDTO, String> e : competitorDisplayNames.entrySet()) {
|
||||
expandedCompetitorDisplayNames.put(e.getKey().getCompetitorFromPrevious(previousVersion), e.getValue());
|
||||
}
|
||||
competitorDisplayNames = expandedCompetitorDisplayNames;
|
||||
@@ -409,17 +409,17 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
|
||||
}
|
||||
// expand all other ordered competitor lists for all races where it changed
|
||||
for (String columnNameForWhichToExpandCompetitorOrderingPerRace : columnNamesForWhichToExpandCompetitorOrderingPerRace) {
|
||||
List<CompetitorDTO> competitorsFromBestToWorstForRace = getCompetitorsFromBestToWorst(columnNameForWhichToExpandCompetitorOrderingPerRace);
|
||||
List<CompetitorWithBoatDTO> competitorsFromBestToWorstForRace = getCompetitorsFromBestToWorst(columnNameForWhichToExpandCompetitorOrderingPerRace);
|
||||
for (int i=competitorsFromBestToWorstForRace.size()-1; i>=0; i--) {
|
||||
competitorsFromBestToWorstForRace.set(i, competitorsFromBestToWorstForRace.get(i).getCompetitorFromPrevious(previousVersion));
|
||||
}
|
||||
}
|
||||
if (rows == null) {
|
||||
rows = new HashMap<CompetitorDTO, LeaderboardRowDTO>();
|
||||
rows = new HashMap<CompetitorWithBoatDTO, LeaderboardRowDTO>();
|
||||
}
|
||||
// expand all keys and remove values from compact keys and re-enter with expanded keys; expand their competitor field
|
||||
for (CompetitorDTO compactCompetitor : new ArrayList<CompetitorDTO>(rows.keySet())) {
|
||||
final CompetitorDTO expandedCompetitor = compactCompetitor.getCompetitorFromPrevious(previousVersion);
|
||||
for (CompetitorWithBoatDTO compactCompetitor : new ArrayList<CompetitorWithBoatDTO>(rows.keySet())) {
|
||||
final CompetitorWithBoatDTO expandedCompetitor = compactCompetitor.getCompetitorFromPrevious(previousVersion);
|
||||
final LeaderboardRowDTO row = rows.remove(compactCompetitor);
|
||||
row.competitor = expandedCompetitor;
|
||||
rows.put(expandedCompetitor, row);
|
||||
@@ -428,7 +428,7 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
|
||||
if (rowsUnchanged != null) {
|
||||
for (Entry<String, Set<Void>> rowUnchanged : rowsUnchanged.getAllUnchangedCompetitorIdsAsStringAndKeys(previousVersion).entrySet()) {
|
||||
rowsUnchangedForCompetitorsWithIdAsString.add(rowUnchanged.getKey());
|
||||
final CompetitorDTO previousCompetitor = competitorsOfPreviousVersionByIdAsString.get(rowUnchanged.getKey());
|
||||
final CompetitorWithBoatDTO previousCompetitor = competitorsOfPreviousVersionByIdAsString.get(rowUnchanged.getKey());
|
||||
rows.put(previousCompetitor, previousVersion.rows.get(previousCompetitor));
|
||||
}
|
||||
}
|
||||
@@ -437,7 +437,7 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
|
||||
unchangedLeaderboardEntries.getAllUnchangedCompetitorIdsAsStringAndKeys(previousVersion);
|
||||
if (unchangedLeaderboardEntries != null) {
|
||||
for (Entry<String, Set<String>> competitorAndColumnNames : allUnchangedLeaderboardEntriesAsCompetitorIdsAsStringAndColumnNames.entrySet()) {
|
||||
CompetitorDTO previousCompetitor = competitorsOfPreviousVersionByIdAsString.get(competitorAndColumnNames.getKey());
|
||||
CompetitorWithBoatDTO previousCompetitor = competitorsOfPreviousVersionByIdAsString.get(competitorAndColumnNames.getKey());
|
||||
for (final String columnName : competitorAndColumnNames.getValue()) {
|
||||
if (!rowsUnchangedForCompetitorsWithIdAsString.contains(competitorAndColumnNames.getKey())) { // only care if not the entire row was marked unchanged
|
||||
LeaderboardEntryDTO previousEntry = previousVersion.rows.get(previousCompetitor).fieldsByRaceColumnName.get(columnName);
|
||||
@@ -452,7 +452,7 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
|
||||
if (legDetailsUnchanged != null) {
|
||||
for (Entry<String, Set<Pair<String, Integer>>> competitorInPreviosAndColumnNameAndLegDetailsIndex :
|
||||
legDetailsUnchanged.getAllUnchangedCompetitorIdsAsStringAndKeys(previousVersion).entrySet()) {
|
||||
CompetitorDTO previousCompetitor = competitorsOfPreviousVersionByIdAsString.get(competitorInPreviosAndColumnNameAndLegDetailsIndex.getKey());
|
||||
CompetitorWithBoatDTO previousCompetitor = competitorsOfPreviousVersionByIdAsString.get(competitorInPreviosAndColumnNameAndLegDetailsIndex.getKey());
|
||||
for (final Pair<String, Integer> columnNameAndLegDetailsIndex : competitorInPreviosAndColumnNameAndLegDetailsIndex.getValue()) {
|
||||
final String raceColumnName = columnNameAndLegDetailsIndex.getA();
|
||||
// if it's already clear that the entire LeaderboardEntryDTO was unchanged, the entry in legDetailsUnchanged was
|
||||
@@ -526,19 +526,19 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
|
||||
// for this stripping run, remembers the mapping of real CompetitorDTO objects to the compact form that only holds an int as reference to the
|
||||
// previous version's competitors list; those will be used to replace the real CompetitorDTO objects where possible and will be replaced the other
|
||||
// way in applyThisToPreviousVersionByUpdatingThis(...).
|
||||
Map<CompetitorDTO, CompetitorDTO> compactCompetitorMap = new HashMap<CompetitorDTO, CompetitorDTO>();
|
||||
Map<CompetitorWithBoatDTO, CompetitorWithBoatDTO> compactCompetitorMap = new HashMap<CompetitorWithBoatDTO, CompetitorWithBoatDTO>();
|
||||
int i=0;
|
||||
for (CompetitorDTO competitor : competitors) {
|
||||
for (CompetitorWithBoatDTO competitor : competitors) {
|
||||
int indexInPrevious = previousVersion.competitors.indexOf(competitor);
|
||||
competitorIndexesInPreviousCompetitorsList[i++] = indexInPrevious;
|
||||
if (indexInPrevious == -1) {
|
||||
if (addedCompetitors == null) {
|
||||
addedCompetitors = new ArrayList<CompetitorDTO>();
|
||||
addedCompetitors = new ArrayList<CompetitorWithBoatDTO>();
|
||||
}
|
||||
addedCompetitors.add(competitor);
|
||||
compactCompetitorMap.put(competitor, competitor);
|
||||
} else {
|
||||
CompetitorDTO compactReplacementCompetitor = new PreviousCompetitorDTOImpl(indexInPrevious);
|
||||
CompetitorWithBoatDTO compactReplacementCompetitor = new PreviousCompetitorDTOImpl(indexInPrevious);
|
||||
compactCompetitorMap.put(competitor, compactReplacementCompetitor);
|
||||
}
|
||||
}
|
||||
@@ -547,12 +547,12 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
|
||||
suppressedCompetitorsUnchanged = true;
|
||||
setSuppressedCompetitors(null);
|
||||
} else {
|
||||
List<CompetitorDTO> compactSuppressedCompetitors = new ArrayList<CompetitorDTO>();
|
||||
for (CompetitorDTO suppressedCompetitor : getSuppressedCompetitors()) {
|
||||
List<CompetitorWithBoatDTO> compactSuppressedCompetitors = new ArrayList<CompetitorWithBoatDTO>();
|
||||
for (CompetitorWithBoatDTO suppressedCompetitor : getSuppressedCompetitors()) {
|
||||
final int indexOfSuppressedCompetitorInPreviousSuppressed = Util.indexOf(previousVersion.getSuppressedCompetitors(), suppressedCompetitor);
|
||||
if (indexOfSuppressedCompetitorInPreviousSuppressed == -1) {
|
||||
// not found in previous version's suppressed competitors; maybe it just transitioned from non-suppressed to suppressed
|
||||
final CompetitorDTO compactedFromPreviousCompetitors = compactCompetitorMap.get(suppressedCompetitor);
|
||||
final CompetitorWithBoatDTO compactedFromPreviousCompetitors = compactCompetitorMap.get(suppressedCompetitor);
|
||||
if (compactedFromPreviousCompetitors != null) {
|
||||
compactSuppressedCompetitors.add(compactedFromPreviousCompetitors);
|
||||
} else {
|
||||
@@ -569,24 +569,24 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
|
||||
competitorDisplayNamesUnchanged = true;
|
||||
competitorDisplayNames = null;
|
||||
} else {
|
||||
Map<CompetitorDTO, String> compactCompetitorDisplayNames = new HashMap<CompetitorDTO, String>();
|
||||
for (Map.Entry<CompetitorDTO, String> e : competitorDisplayNames.entrySet()) {
|
||||
Map<CompetitorWithBoatDTO, String> compactCompetitorDisplayNames = new HashMap<CompetitorWithBoatDTO, String>();
|
||||
for (Map.Entry<CompetitorWithBoatDTO, String> e : competitorDisplayNames.entrySet()) {
|
||||
compactCompetitorDisplayNames.put(compactCompetitorMap.get(e.getKey()), e.getValue());
|
||||
}
|
||||
competitorDisplayNames = compactCompetitorDisplayNames;
|
||||
}
|
||||
raceColumnNamesForWhichCompetitorOrderingPerRaceUnchanged = new HashSet<String>();
|
||||
final HashMap<String, List<CompetitorDTO>> competitorOrderingPerRaceColumnName = new HashMap<String, List<CompetitorDTO>>(getCompetitorOrderingPerRaceColumnName());
|
||||
final HashMap<String, List<CompetitorWithBoatDTO>> competitorOrderingPerRaceColumnName = new HashMap<String, List<CompetitorWithBoatDTO>>(getCompetitorOrderingPerRaceColumnName());
|
||||
for (RaceColumnDTO raceColumn : this.getRaceList()) {
|
||||
List<CompetitorDTO> competitorsFromBestToWorstForRaceColumn = getCompetitorsFromBestToWorst(raceColumn.getName());
|
||||
List<CompetitorDTO> previousCompetitorsFromBestToWorstForRaceColumn = previousVersion.getCompetitorsFromBestToWorst(raceColumn.getName());
|
||||
List<CompetitorWithBoatDTO> competitorsFromBestToWorstForRaceColumn = getCompetitorsFromBestToWorst(raceColumn.getName());
|
||||
List<CompetitorWithBoatDTO> previousCompetitorsFromBestToWorstForRaceColumn = previousVersion.getCompetitorsFromBestToWorst(raceColumn.getName());
|
||||
if (Util.equalsWithNull(competitorsFromBestToWorstForRaceColumn, previousCompetitorsFromBestToWorstForRaceColumn)) {
|
||||
raceColumnNamesForWhichCompetitorOrderingPerRaceUnchanged.add(raceColumn.getName());
|
||||
competitorOrderingPerRaceColumnName.remove(raceColumn.getName());
|
||||
} else {
|
||||
// try at least partial compaction
|
||||
List<CompetitorDTO> compactedCompetitorsFromBestToWorstForRaceColumn = new ArrayList<CompetitorDTO>();
|
||||
for (CompetitorDTO competitor : competitorsFromBestToWorstForRaceColumn) {
|
||||
List<CompetitorWithBoatDTO> compactedCompetitorsFromBestToWorstForRaceColumn = new ArrayList<CompetitorWithBoatDTO>();
|
||||
for (CompetitorWithBoatDTO competitor : competitorsFromBestToWorstForRaceColumn) {
|
||||
compactedCompetitorsFromBestToWorstForRaceColumn.add(compactCompetitorMap.get(competitor));
|
||||
}
|
||||
competitorOrderingPerRaceColumnName.put(raceColumn.getName(), compactedCompetitorsFromBestToWorstForRaceColumn);
|
||||
@@ -594,8 +594,8 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
|
||||
}
|
||||
setCompetitorOrderingPerRace(competitorOrderingPerRaceColumnName);
|
||||
// now clone the rows map to enable stripping the LeaderboardEntryDTOs inside
|
||||
HashMap<CompetitorDTO, LeaderboardRowDTO> newRows = new HashMap<CompetitorDTO, LeaderboardRowDTO>();
|
||||
for (Map.Entry<CompetitorDTO, LeaderboardRowDTO> competitorAndRow : rows.entrySet()) {
|
||||
HashMap<CompetitorWithBoatDTO, LeaderboardRowDTO> newRows = new HashMap<CompetitorWithBoatDTO, LeaderboardRowDTO>();
|
||||
for (Map.Entry<CompetitorWithBoatDTO, LeaderboardRowDTO> competitorAndRow : rows.entrySet()) {
|
||||
LeaderboardRowDTO previousRowDTO = previousVersion.rows.get(competitorAndRow.getKey());
|
||||
if (Util.equalsWithNull(competitorAndRow.getValue(), previousRowDTO)
|
||||
// can only compress for competitors that existed in the previous version
|
||||
@@ -605,7 +605,7 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
|
||||
} else {
|
||||
LeaderboardRowDTO newRowDTO = new LeaderboardRowDTO();
|
||||
cloner.clone(competitorAndRow.getValue(), newRowDTO);
|
||||
CompetitorDTO compactCompetitor = compactCompetitorMap.get(competitorAndRow.getKey());
|
||||
CompetitorWithBoatDTO compactCompetitor = compactCompetitorMap.get(competitorAndRow.getKey());
|
||||
newRowDTO.competitor = compactCompetitor;
|
||||
newRows.put(compactCompetitor, newRowDTO);
|
||||
HashMap<String, LeaderboardEntryDTO> newFieldsByRaceColumnName = new HashMap<String, LeaderboardEntryDTO>();
|
||||
@@ -700,7 +700,7 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
|
||||
* @param competitor
|
||||
* a competitor that already exists in <code>previousVersion.competitors</code>
|
||||
*/
|
||||
private void entireRowUnchanged(LeaderboardDTO previousVersion, CompetitorDTO competitor) {
|
||||
private void entireRowUnchanged(LeaderboardDTO previousVersion, CompetitorWithBoatDTO competitor) {
|
||||
assert previousVersion.competitors.contains(competitor);
|
||||
if (rowsUnchanged == null) {
|
||||
rowsUnchanged = new UnchangedWithCompetitorsInBitSet<Void>(previousVersion, rows.size());
|
||||
|
||||
+18
-18
@@ -33,14 +33,14 @@ public class LeaderboardDTO extends AbstractLeaderboardDTO implements Serializab
|
||||
/**
|
||||
* The competitor list, ordered ascending by total rank, suppressed competitors removed
|
||||
*/
|
||||
public List<CompetitorDTO> competitors;
|
||||
public List<CompetitorWithBoatDTO> competitors;
|
||||
|
||||
/**
|
||||
* A list with set semantics; no duplicates are allowed.
|
||||
*/
|
||||
private List<CompetitorDTO> suppressedCompetitors;
|
||||
private List<CompetitorWithBoatDTO> suppressedCompetitors;
|
||||
|
||||
private Map<String, List<CompetitorDTO>> competitorOrderingPerRaceColumnName;
|
||||
private Map<String, List<CompetitorWithBoatDTO>> competitorOrderingPerRaceColumnName;
|
||||
|
||||
/**
|
||||
* The validity time point for which this leaderboard DTO was requested (not to be confused with
|
||||
@@ -81,8 +81,8 @@ public class LeaderboardDTO extends AbstractLeaderboardDTO implements Serializab
|
||||
}
|
||||
|
||||
private void initCollections() {
|
||||
competitorOrderingPerRaceColumnName = new HashMap<String, List<CompetitorDTO>>();
|
||||
this.suppressedCompetitors = new ArrayList<CompetitorDTO>();
|
||||
competitorOrderingPerRaceColumnName = new HashMap<String, List<CompetitorWithBoatDTO>>();
|
||||
this.suppressedCompetitors = new ArrayList<CompetitorWithBoatDTO>();
|
||||
}
|
||||
|
||||
protected LeaderboardDTO(String id) {
|
||||
@@ -94,18 +94,18 @@ public class LeaderboardDTO extends AbstractLeaderboardDTO implements Serializab
|
||||
return id;
|
||||
}
|
||||
|
||||
public Iterable<CompetitorDTO> getSuppressedCompetitors() {
|
||||
public Iterable<CompetitorWithBoatDTO> getSuppressedCompetitors() {
|
||||
return suppressedCompetitors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param suppressedCompetitors must not contain any duplicates ("set" semantics)
|
||||
*/
|
||||
public void setSuppressedCompetitors(List<CompetitorDTO> suppressedCompetitors) {
|
||||
public void setSuppressedCompetitors(List<CompetitorWithBoatDTO> suppressedCompetitors) {
|
||||
this.suppressedCompetitors = suppressedCompetitors;
|
||||
}
|
||||
|
||||
public void setSuppressed(CompetitorDTO competitor, boolean suppressed) {
|
||||
public void setSuppressed(CompetitorWithBoatDTO competitor, boolean suppressed) {
|
||||
if (suppressed && !suppressedCompetitors.contains(competitor)) {
|
||||
suppressedCompetitors.add(competitor);
|
||||
} else {
|
||||
@@ -117,7 +117,7 @@ public class LeaderboardDTO extends AbstractLeaderboardDTO implements Serializab
|
||||
return higherScoresIsBetter;
|
||||
}
|
||||
|
||||
public BoatDTO getBoatOfCompetitor(String raceColumnName, CompetitorDTO competitor) {
|
||||
public BoatDTO getBoatOfCompetitor(String raceColumnName, CompetitorWithBoatDTO competitor) {
|
||||
BoatDTO result = null;
|
||||
if (rows != null) {
|
||||
LeaderboardRowDTO leaderboardRow = rows.get(competitor);
|
||||
@@ -135,7 +135,7 @@ public class LeaderboardDTO extends AbstractLeaderboardDTO implements Serializab
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setBoatOfCompetitor(CompetitorDTO competitor, BoatDTO boat) {
|
||||
public void setBoatOfCompetitor(CompetitorWithBoatDTO competitor, BoatDTO boat) {
|
||||
if (rows != null && this.canBoatsOfCompetitorsChangePerRace == false) {
|
||||
LeaderboardRowDTO leaderboardRowDTO = rows.get(competitor);
|
||||
if (leaderboardRowDTO != null) {
|
||||
@@ -144,7 +144,7 @@ public class LeaderboardDTO extends AbstractLeaderboardDTO implements Serializab
|
||||
}
|
||||
}
|
||||
|
||||
public void setBoatOfCompetitorForRace(String raceColumnName, CompetitorDTO competitor, BoatDTO boat) {
|
||||
public void setBoatOfCompetitorForRace(String raceColumnName, CompetitorWithBoatDTO competitor, BoatDTO boat) {
|
||||
if (rows != null && this.canBoatsOfCompetitorsChangePerRace == true) {
|
||||
LeaderboardRowDTO leaderboardRow = rows.get(competitor);
|
||||
if (leaderboardRow != null) {
|
||||
@@ -156,31 +156,31 @@ public class LeaderboardDTO extends AbstractLeaderboardDTO implements Serializab
|
||||
}
|
||||
}
|
||||
|
||||
public void setCompetitorsFromBestToWorst(String raceColumnName, List<CompetitorDTO> orderedCompetitors) {
|
||||
public void setCompetitorsFromBestToWorst(String raceColumnName, List<CompetitorWithBoatDTO> orderedCompetitors) {
|
||||
competitorOrderingPerRaceColumnName.put(raceColumnName, orderedCompetitors);
|
||||
}
|
||||
|
||||
public void setCompetitorsFromBestToWorst(RaceColumnDTO raceColumn, List<CompetitorDTO> newOrdering) {
|
||||
public void setCompetitorsFromBestToWorst(RaceColumnDTO raceColumn, List<CompetitorWithBoatDTO> newOrdering) {
|
||||
setCompetitorsFromBestToWorst(raceColumn.getName(), newOrdering);
|
||||
}
|
||||
|
||||
public void setCompetitorOrderingPerRace(Map<String, List<CompetitorDTO>> competitorOrderingPerRaceColumnName) {
|
||||
public void setCompetitorOrderingPerRace(Map<String, List<CompetitorWithBoatDTO>> competitorOrderingPerRaceColumnName) {
|
||||
this.competitorOrderingPerRaceColumnName = competitorOrderingPerRaceColumnName;
|
||||
}
|
||||
|
||||
public Map<String, List<CompetitorDTO>> getCompetitorOrderingPerRaceColumnName() {
|
||||
public Map<String, List<CompetitorWithBoatDTO>> getCompetitorOrderingPerRaceColumnName() {
|
||||
return competitorOrderingPerRaceColumnName;
|
||||
}
|
||||
|
||||
public List<CompetitorDTO> getCompetitorsFromBestToWorst(String raceColumnName) {
|
||||
public List<CompetitorWithBoatDTO> getCompetitorsFromBestToWorst(String raceColumnName) {
|
||||
return competitorOrderingPerRaceColumnName.get(raceColumnName);
|
||||
}
|
||||
|
||||
public List<CompetitorDTO> getCompetitorsFromBestToWorst(RaceColumnDTO raceColumn) {
|
||||
public List<CompetitorWithBoatDTO> getCompetitorsFromBestToWorst(RaceColumnDTO raceColumn) {
|
||||
return competitorOrderingPerRaceColumnName.get(raceColumn.getName());
|
||||
}
|
||||
|
||||
public int getTotalRank(CompetitorDTO competitor) {
|
||||
public int getTotalRank(CompetitorWithBoatDTO competitor) {
|
||||
return competitors.indexOf(competitor) + 1;
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ import com.sap.sse.common.Duration;
|
||||
*/
|
||||
public class LeaderboardRowDTO implements Serializable {
|
||||
private static final long serialVersionUID = -5421934148931661900L;
|
||||
public CompetitorDTO competitor;
|
||||
public CompetitorWithBoatDTO competitor;
|
||||
public BoatDTO boat;
|
||||
public Map<String, LeaderboardEntryDTO> fieldsByRaceColumnName;
|
||||
public Double carriedPoints;
|
||||
|
||||
+6
-6
@@ -9,28 +9,28 @@ import com.sap.sse.common.Util.Pair;
|
||||
public class PairingListDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 102220422437194196L;
|
||||
private List<List<List<Pair<CompetitorWithoutBoatDTO, BoatDTO>>>> pairingList;
|
||||
private List<List<List<Pair<CompetitorDTO, BoatDTO>>>> pairingList;
|
||||
private List<String> raceColumnNames;
|
||||
|
||||
public PairingListDTO() { }
|
||||
|
||||
public PairingListDTO(List<List<List<Pair<CompetitorWithoutBoatDTO, BoatDTO>>>> result) {
|
||||
public PairingListDTO(List<List<List<Pair<CompetitorDTO, BoatDTO>>>> result) {
|
||||
this(result, null);
|
||||
}
|
||||
|
||||
public PairingListDTO(List<List<List<Pair<CompetitorWithoutBoatDTO, BoatDTO>>>> result, List<String> raceColumnNames) {
|
||||
public PairingListDTO(List<List<List<Pair<CompetitorDTO, BoatDTO>>>> result, List<String> raceColumnNames) {
|
||||
this.pairingList = result;
|
||||
this.raceColumnNames = raceColumnNames;
|
||||
}
|
||||
|
||||
public List<List<List<Pair<CompetitorWithoutBoatDTO, BoatDTO>>>> getPairingList() {
|
||||
public List<List<List<Pair<CompetitorDTO, BoatDTO>>>> getPairingList() {
|
||||
return pairingList;
|
||||
}
|
||||
|
||||
public List<BoatDTO> getBoats() {
|
||||
List<BoatDTO> boats = new ArrayList<>();
|
||||
for (List<Pair<CompetitorWithoutBoatDTO, BoatDTO>> fleet : this.pairingList.get(0)) {
|
||||
for (Pair<CompetitorWithoutBoatDTO, BoatDTO> competitorAndBoatPair : fleet) {
|
||||
for (List<Pair<CompetitorDTO, BoatDTO>> fleet : this.pairingList.get(0)) {
|
||||
for (Pair<CompetitorDTO, BoatDTO> competitorAndBoatPair : fleet) {
|
||||
if (!boats.contains(competitorAndBoatPair.getB())) {
|
||||
boats.add(competitorAndBoatPair.getB());
|
||||
}
|
||||
|
||||
+22
-22
@@ -9,7 +9,7 @@ import com.sap.sse.common.Duration;
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public class PreviousCompetitorDTOImpl implements CompetitorDTO {
|
||||
public class PreviousCompetitorDTOImpl implements CompetitorWithBoatDTO {
|
||||
private static final long serialVersionUID = 8820028699103040805L;
|
||||
private int indexInPreviousCompetitorList;
|
||||
|
||||
@@ -49,125 +49,125 @@ public class PreviousCompetitorDTOImpl implements CompetitorDTO {
|
||||
@Override
|
||||
public String getTwoLetterIsoCountryCode() {
|
||||
throw new RuntimeException("Internal error. Objects of type "+PreviousCompetitorDTOImpl.class.getName()+
|
||||
" need to be replaced by an object of "+CompetitorDTOImpl.class.getName()+" after deserialization");
|
||||
" need to be replaced by an object of "+CompetitorWithBoatDTOImpl.class.getName()+" after deserialization");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getThreeLetterIocCountryCode() {
|
||||
throw new RuntimeException("Internal error. Objects of type "+PreviousCompetitorDTOImpl.class.getName()+
|
||||
" need to be replaced by an object of "+CompetitorDTOImpl.class.getName()+" after deserialization");
|
||||
" need to be replaced by an object of "+CompetitorWithBoatDTOImpl.class.getName()+" after deserialization");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCountryName() {
|
||||
throw new RuntimeException("Internal error. Objects of type "+PreviousCompetitorDTOImpl.class.getName()+
|
||||
" need to be replaced by an object of "+CompetitorDTOImpl.class.getName()+" after deserialization");
|
||||
" need to be replaced by an object of "+CompetitorWithBoatDTOImpl.class.getName()+" after deserialization");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortName() {
|
||||
throw new RuntimeException("Internal error. Objects of type "+PreviousCompetitorDTOImpl.class.getName()+
|
||||
" need to be replaced by an object of "+CompetitorDTOImpl.class.getName()+" after deserialization");
|
||||
" need to be replaced by an object of "+CompetitorWithBoatDTOImpl.class.getName()+" after deserialization");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShortInfo() {
|
||||
throw new RuntimeException("Internal error. Objects of type "+PreviousCompetitorDTOImpl.class.getName()+
|
||||
" need to be replaced by an object of "+CompetitorDTOImpl.class.getName()+" after deserialization");
|
||||
" need to be replaced by an object of "+CompetitorWithBoatDTOImpl.class.getName()+" after deserialization");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSailID() {
|
||||
throw new RuntimeException("Internal error. Objects of type "+PreviousCompetitorDTOImpl.class.getName()+
|
||||
" need to be replaced by an object of "+CompetitorDTOImpl.class.getName()+" after deserialization");
|
||||
" need to be replaced by an object of "+CompetitorWithBoatDTOImpl.class.getName()+" after deserialization");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoatDTO getBoat() {
|
||||
throw new RuntimeException("Internal error. Objects of type "+PreviousCompetitorDTOImpl.class.getName()+
|
||||
" need to be replaced by an object of "+CompetitorDTOImpl.class.getName()+" after deserialization");
|
||||
" need to be replaced by an object of "+CompetitorWithBoatDTOImpl.class.getName()+" after deserialization");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBoat(BoatDTO boat) {
|
||||
throw new RuntimeException("Internal error. Objects of type "+PreviousCompetitorDTOImpl.class.getName()+
|
||||
" need to be replaced by an object of "+CompetitorDTOImpl.class.getName()+" after deserialization");
|
||||
" need to be replaced by an object of "+CompetitorWithBoatDTOImpl.class.getName()+" after deserialization");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getColor() {
|
||||
throw new RuntimeException("Internal error. Objects of type "+PreviousCompetitorDTOImpl.class.getName()+
|
||||
" need to be replaced by an object of "+CompetitorDTOImpl.class.getName()+" after deserialization");
|
||||
" need to be replaced by an object of "+CompetitorWithBoatDTOImpl.class.getName()+" after deserialization");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdAsString() {
|
||||
throw new RuntimeException("Internal error. Objects of type "+PreviousCompetitorDTOImpl.class.getName()+
|
||||
" need to be replaced by an object of "+CompetitorDTOImpl.class.getName()+" after deserialization");
|
||||
" need to be replaced by an object of "+CompetitorWithBoatDTOImpl.class.getName()+" after deserialization");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoatClassDTO getBoatClass() {
|
||||
throw new RuntimeException("Internal error. Objects of type "+PreviousCompetitorDTOImpl.class.getName()+
|
||||
" need to be replaced by an object of "+CompetitorDTOImpl.class.getName()+" after deserialization");
|
||||
" need to be replaced by an object of "+CompetitorWithBoatDTOImpl.class.getName()+" after deserialization");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
throw new RuntimeException("Internal error. Objects of type "+PreviousCompetitorDTOImpl.class.getName()+
|
||||
" need to be replaced by an object of "+CompetitorDTOImpl.class.getName()+" after deserialization");
|
||||
" need to be replaced by an object of "+CompetitorWithBoatDTOImpl.class.getName()+" after deserialization");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEmail() {
|
||||
throw new RuntimeException("Internal error. Objects of type "+PreviousCompetitorDTOImpl.class.getName()+
|
||||
" need to be replaced by an object of "+CompetitorDTOImpl.class.getName()+" after deserialization");
|
||||
" need to be replaced by an object of "+CompetitorWithBoatDTOImpl.class.getName()+" after deserialization");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSearchTag() {
|
||||
throw new RuntimeException("Internal error. Objects of type "+PreviousCompetitorDTOImpl.class.getName()+
|
||||
" need to be replaced by an object of "+CompetitorDTOImpl.class.getName()+" after deserialization");
|
||||
" need to be replaced by an object of "+CompetitorWithBoatDTOImpl.class.getName()+" after deserialization");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addToSearchTag(String searchTag) {
|
||||
throw new RuntimeException("Internal error. Objects of type "+PreviousCompetitorDTOImpl.class.getName()+
|
||||
" need to be replaced by an object of "+CompetitorDTOImpl.class.getName()+" after deserialization");
|
||||
" need to be replaced by an object of "+CompetitorWithBoatDTOImpl.class.getName()+" after deserialization");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getImageURL() {
|
||||
throw new RuntimeException("Internal error. Objects of type "+PreviousCompetitorDTOImpl.class.getName()+
|
||||
" need to be replaced by an object of "+CompetitorDTOImpl.class.getName()+" after deserialization");
|
||||
" need to be replaced by an object of "+CompetitorWithBoatDTOImpl.class.getName()+" after deserialization");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFlagImageURL() {
|
||||
throw new RuntimeException("Internal error. Objects of type "+PreviousCompetitorDTOImpl.class.getName()+
|
||||
" need to be replaced by an object of "+CompetitorDTOImpl.class.getName()+" after deserialization");
|
||||
" need to be replaced by an object of "+CompetitorWithBoatDTOImpl.class.getName()+" after deserialization");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEmail() {
|
||||
throw new RuntimeException("Internal error. Objects of type "+PreviousCompetitorDTOImpl.class.getName()+
|
||||
" need to be replaced by an object of "+CompetitorDTOImpl.class.getName()+" after deserialization");
|
||||
" need to be replaced by an object of "+CompetitorWithBoatDTOImpl.class.getName()+" after deserialization");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double getTimeOnTimeFactor() {
|
||||
throw new RuntimeException("Internal error. Objects of type "+PreviousCompetitorDTOImpl.class.getName()+
|
||||
" need to be replaced by an object of "+CompetitorDTOImpl.class.getName()+" after deserialization");
|
||||
" need to be replaced by an object of "+CompetitorWithBoatDTOImpl.class.getName()+" after deserialization");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Duration getTimeOnDistanceAllowancePerNauticalMile() {
|
||||
throw new RuntimeException("Internal error. Objects of type "+PreviousCompetitorDTOImpl.class.getName()+
|
||||
" need to be replaced by an object of "+CompetitorDTOImpl.class.getName()+" after deserialization");
|
||||
" need to be replaced by an object of "+CompetitorWithBoatDTOImpl.class.getName()+" after deserialization");
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompetitorDTO getCompetitorFromPrevious(LeaderboardDTO previousVersion) {
|
||||
public CompetitorWithBoatDTO getCompetitorFromPrevious(LeaderboardDTO previousVersion) {
|
||||
return previousVersion.competitors.get(indexInPreviousCompetitorList);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -21,7 +21,7 @@ public class PreviousSuppressedCompetitorDTOImpl extends PreviousCompetitorDTOIm
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompetitorDTO getCompetitorFromPrevious(LeaderboardDTO previousVersion) {
|
||||
public CompetitorWithBoatDTO getCompetitorFromPrevious(LeaderboardDTO previousVersion) {
|
||||
return Util.get(previousVersion.getSuppressedCompetitors(), getIndexInPreviousCompetitorList());
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -23,7 +23,7 @@ public class TrackedRaceStatisticsDTO implements Serializable {
|
||||
|
||||
public Integer totalLegsCount;
|
||||
public Integer currentLegNo;
|
||||
public CompetitorDTO leaderOrWinner;
|
||||
public CompetitorWithBoatDTO leaderOrWinner;
|
||||
/**
|
||||
* Default constructor for GWT-Serialization
|
||||
*/
|
||||
|
||||
+6
-6
@@ -7,8 +7,8 @@ import java.util.Map;
|
||||
import com.sap.sailing.domain.base.impl.DynamicBoat;
|
||||
import com.sap.sailing.domain.base.impl.DynamicTeam;
|
||||
import com.sap.sailing.domain.common.dto.BoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithoutBoatDTO;
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.Duration;
|
||||
|
||||
@@ -19,7 +19,7 @@ import com.sap.sse.common.Duration;
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public interface CompetitorStore extends CompetitorFactory, BoatFactory {
|
||||
public interface CompetitorAndBoatStore extends CompetitorFactory, BoatFactory {
|
||||
public interface CompetitorUpdateListener {
|
||||
void competitorUpdated(Competitor competitor);
|
||||
void competitorCreated(Competitor competitor);
|
||||
@@ -100,13 +100,13 @@ public interface CompetitorStore extends CompetitorFactory, BoatFactory {
|
||||
|
||||
void addNewCompetitorsWithBoat(Iterable<CompetitorWithBoat> competitorsWithBoat);
|
||||
|
||||
CompetitorWithoutBoatDTO convertToCompetitorDTO(Competitor competitor);
|
||||
CompetitorDTO convertToCompetitorDTO(Competitor competitor);
|
||||
|
||||
CompetitorDTO convertToCompetitorWithBoatDTO(Competitor c, Boat b);
|
||||
CompetitorWithBoatDTO convertToCompetitorWithBoatDTO(Competitor c, Boat b);
|
||||
|
||||
CompetitorDTO convertToCompetitorWithOptionalBoatDTO(Competitor c);
|
||||
CompetitorWithBoatDTO convertToCompetitorWithOptionalBoatDTO(Competitor c);
|
||||
|
||||
Map<CompetitorDTO, BoatDTO> convertToCompetitorAndBoatDTOs(Map<Competitor, Boat> competitorsAndBoats);
|
||||
Map<CompetitorWithBoatDTO, BoatDTO> convertToCompetitorAndBoatDTOs(Map<Competitor, Boat> competitorsAndBoats);
|
||||
|
||||
/**
|
||||
* Listeners added here are notified whenever {@link #updateCompetitor(String, String, Color, String, Nationality)} is called
|
||||
+2
-2
@@ -82,9 +82,9 @@ public interface SharedDomainFactory extends CompetitorFactory, BoatFactory {
|
||||
BoatClass getOrCreateBoatClass(String name);
|
||||
|
||||
/**
|
||||
* Gets the {@link CompetitorStore} of this {@link SharedDomainFactory}.
|
||||
* Gets the {@link CompetitorAndBoatStore} of this {@link SharedDomainFactory}.
|
||||
*/
|
||||
CompetitorStore getCompetitorStore();
|
||||
CompetitorAndBoatStore getCompetitorStore();
|
||||
|
||||
/**
|
||||
* If a {@link CourseArea} with the given id already exists, it is returned. Otherwise a new {@link CourseArea}
|
||||
|
||||
+5
-5
@@ -19,7 +19,7 @@ import com.sap.sailing.domain.abstractlog.race.analyzing.impl.RaceLogResolver;
|
||||
import com.sap.sailing.domain.base.Boat;
|
||||
import com.sap.sailing.domain.base.BoatClass;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.CompetitorStore;
|
||||
import com.sap.sailing.domain.base.CompetitorAndBoatStore;
|
||||
import com.sap.sailing.domain.base.CompetitorWithBoat;
|
||||
import com.sap.sailing.domain.base.ControlPoint;
|
||||
import com.sap.sailing.domain.base.ControlPointWithTwoMarks;
|
||||
@@ -66,7 +66,7 @@ public class SharedDomainFactoryImpl implements SharedDomainFactory {
|
||||
|
||||
private final Map<String, BoatClass> boatClassCache;
|
||||
|
||||
protected final CompetitorStore competitorAndBoatStore;
|
||||
protected final CompetitorAndBoatStore competitorAndBoatStore;
|
||||
|
||||
private final Map<Serializable, CourseArea> courseAreaCache;
|
||||
|
||||
@@ -116,10 +116,10 @@ public class SharedDomainFactoryImpl implements SharedDomainFactory {
|
||||
* Uses a transient competitor store
|
||||
*/
|
||||
public SharedDomainFactoryImpl(RaceLogResolver raceLogResolver) {
|
||||
this(new TransientCompetitorStoreImpl(), raceLogResolver);
|
||||
this(new TransientCompetitorAndBoatStoreImpl(), raceLogResolver);
|
||||
}
|
||||
|
||||
public SharedDomainFactoryImpl(CompetitorStore competitorStore, RaceLogResolver raceLogResolver) {
|
||||
public SharedDomainFactoryImpl(CompetitorAndBoatStore competitorStore, RaceLogResolver raceLogResolver) {
|
||||
this.raceLogResolver = raceLogResolver;
|
||||
waypointCacheReferenceQueue = new ReferenceQueue<Waypoint>();
|
||||
nationalityCache = new HashMap<String, Nationality>();
|
||||
@@ -333,7 +333,7 @@ public class SharedDomainFactoryImpl implements SharedDomainFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompetitorStore getCompetitorStore() {
|
||||
public CompetitorAndBoatStore getCompetitorStore() {
|
||||
return competitorAndBoatStore;
|
||||
}
|
||||
|
||||
|
||||
+23
-23
@@ -19,23 +19,23 @@ import java.util.logging.Logger;
|
||||
import com.sap.sailing.domain.base.Boat;
|
||||
import com.sap.sailing.domain.base.BoatClass;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.CompetitorStore;
|
||||
import com.sap.sailing.domain.base.CompetitorAndBoatStore;
|
||||
import com.sap.sailing.domain.base.CompetitorWithBoat;
|
||||
import com.sap.sailing.domain.base.Nationality;
|
||||
import com.sap.sailing.domain.common.dto.BoatClassDTO;
|
||||
import com.sap.sailing.domain.common.dto.BoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTOImpl;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTOImpl;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithoutBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithoutBoatDTOImpl;
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.CountryCode;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.concurrent.LockUtil;
|
||||
import com.sap.sse.concurrent.NamedReentrantReadWriteLock;
|
||||
|
||||
public class TransientCompetitorStoreImpl implements CompetitorStore, Serializable {
|
||||
private static final Logger logger = Logger.getLogger(TransientCompetitorStoreImpl.class.getName());
|
||||
public class TransientCompetitorAndBoatStoreImpl implements CompetitorAndBoatStore, Serializable {
|
||||
private static final Logger logger = Logger.getLogger(TransientCompetitorAndBoatStoreImpl.class.getName());
|
||||
private static final long serialVersionUID = -4198298775476586931L;
|
||||
|
||||
private final Map<Serializable, Competitor> competitorCache;
|
||||
@@ -52,7 +52,7 @@ public class TransientCompetitorStoreImpl implements CompetitorStore, Serializab
|
||||
*/
|
||||
private final Set<Competitor> competitorsToUpdateDuringGetOrCreate;
|
||||
|
||||
private transient WeakHashMap<Competitor, CompetitorWithoutBoatDTO> weakCompetitorDTOCache;
|
||||
private transient WeakHashMap<Competitor, CompetitorDTO> weakCompetitorDTOCache;
|
||||
|
||||
private final Set<Boat> boatsToUpdateDuringGetOrCreate;
|
||||
|
||||
@@ -60,26 +60,26 @@ public class TransientCompetitorStoreImpl implements CompetitorStore, Serializab
|
||||
|
||||
private final NamedReentrantReadWriteLock lock;
|
||||
|
||||
public TransientCompetitorStoreImpl() {
|
||||
public TransientCompetitorAndBoatStoreImpl() {
|
||||
lock = new NamedReentrantReadWriteLock("CompetitorStore", /* fair */ false);
|
||||
competitorCache = new HashMap<Serializable, Competitor>();
|
||||
competitorsByIdAsString = new HashMap<String, Competitor>();
|
||||
competitorsToUpdateDuringGetOrCreate = new HashSet<Competitor>();
|
||||
weakCompetitorDTOCache = new WeakHashMap<Competitor, CompetitorWithoutBoatDTO>();
|
||||
competitorUpdateListeners = Collections.synchronizedSet(new HashSet<CompetitorStore.CompetitorUpdateListener>());
|
||||
weakCompetitorDTOCache = new WeakHashMap<Competitor, CompetitorDTO>();
|
||||
competitorUpdateListeners = Collections.synchronizedSet(new HashSet<CompetitorAndBoatStore.CompetitorUpdateListener>());
|
||||
boatCache = new HashMap<Serializable, Boat>();
|
||||
boatsByIdAsString = new HashMap<String, Boat>();
|
||||
boatsToUpdateDuringGetOrCreate = new HashSet<Boat>();
|
||||
weakBoatDTOCache = new WeakHashMap<Boat, BoatDTO>();
|
||||
boatUpdateListeners = Collections.synchronizedSet(new HashSet<CompetitorStore.BoatUpdateListener>());
|
||||
boatUpdateListeners = Collections.synchronizedSet(new HashSet<CompetitorAndBoatStore.BoatUpdateListener>());
|
||||
}
|
||||
|
||||
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
|
||||
ois.defaultReadObject();
|
||||
weakCompetitorDTOCache = new WeakHashMap<Competitor, CompetitorWithoutBoatDTO>();
|
||||
competitorUpdateListeners = Collections.synchronizedSet(new HashSet<CompetitorStore.CompetitorUpdateListener>());
|
||||
weakCompetitorDTOCache = new WeakHashMap<Competitor, CompetitorDTO>();
|
||||
competitorUpdateListeners = Collections.synchronizedSet(new HashSet<CompetitorAndBoatStore.CompetitorUpdateListener>());
|
||||
weakBoatDTOCache = new WeakHashMap<Boat, BoatDTO>();
|
||||
boatUpdateListeners = Collections.synchronizedSet(new HashSet<CompetitorStore.BoatUpdateListener>());
|
||||
boatUpdateListeners = Collections.synchronizedSet(new HashSet<CompetitorAndBoatStore.BoatUpdateListener>());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -357,11 +357,11 @@ public class TransientCompetitorStoreImpl implements CompetitorStore, Serializab
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompetitorWithoutBoatDTO convertToCompetitorDTO(Competitor c) {
|
||||
public CompetitorDTO convertToCompetitorDTO(Competitor c) {
|
||||
LockUtil.lockForRead(lock);
|
||||
boolean needToUnlockReadLock = true;
|
||||
try {
|
||||
CompetitorWithoutBoatDTO competitorDTO = weakCompetitorDTOCache.get(c);
|
||||
CompetitorDTO competitorDTO = weakCompetitorDTOCache.get(c);
|
||||
if (competitorDTO == null) {
|
||||
LockUtil.unlockAfterRead(lock);
|
||||
needToUnlockReadLock = false;
|
||||
@@ -370,7 +370,7 @@ public class TransientCompetitorStoreImpl implements CompetitorStore, Serializab
|
||||
if (competitorDTO == null) {
|
||||
final Nationality nationality = c.getTeam().getNationality();
|
||||
CountryCode countryCode = nationality == null ? null : nationality.getCountryCode();
|
||||
competitorDTO = new CompetitorWithoutBoatDTOImpl(c.getName(), c.getShortName(), c.getColor(), c.getEmail(), countryCode == null ? ""
|
||||
competitorDTO = new CompetitorDTOImpl(c.getName(), c.getShortName(), c.getColor(), c.getEmail(), countryCode == null ? ""
|
||||
: countryCode.getTwoLetterISOCode(), countryCode == null ? ""
|
||||
: countryCode.getThreeLetterIOCCode(), countryCode == null ? "" : countryCode.getName(),
|
||||
c.getId().toString(),
|
||||
@@ -718,18 +718,18 @@ public class TransientCompetitorStoreImpl implements CompetitorStore, Serializab
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompetitorDTO convertToCompetitorWithBoatDTO(Competitor competitor, Boat boat) {
|
||||
CompetitorWithoutBoatDTO c = convertToCompetitorDTO(competitor);
|
||||
public CompetitorWithBoatDTO convertToCompetitorWithBoatDTO(Competitor competitor, Boat boat) {
|
||||
CompetitorDTO c = convertToCompetitorDTO(competitor);
|
||||
BoatDTO boatDTO = null;
|
||||
if (boat != null) {
|
||||
boatDTO = convertToBoatDTO(boat);
|
||||
}
|
||||
CompetitorDTO competitorDTO = new CompetitorDTOImpl(c, boatDTO);
|
||||
CompetitorWithBoatDTO competitorDTO = new CompetitorWithBoatDTOImpl(c, boatDTO);
|
||||
return competitorDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompetitorDTO convertToCompetitorWithOptionalBoatDTO(Competitor competitor) {
|
||||
public CompetitorWithBoatDTO convertToCompetitorWithOptionalBoatDTO(Competitor competitor) {
|
||||
if (isValidCompetitorWithBoat(competitor)) {
|
||||
return convertToCompetitorWithBoatDTO(competitor, ((CompetitorWithBoat) competitor).getBoat());
|
||||
} else {
|
||||
@@ -738,10 +738,10 @@ public class TransientCompetitorStoreImpl implements CompetitorStore, Serializab
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<CompetitorDTO, BoatDTO> convertToCompetitorAndBoatDTOs(Map<Competitor, Boat> competitorsAndBoats) {
|
||||
Map<CompetitorDTO, BoatDTO> result = new HashMap<>();
|
||||
public Map<CompetitorWithBoatDTO, BoatDTO> convertToCompetitorAndBoatDTOs(Map<Competitor, Boat> competitorsAndBoats) {
|
||||
Map<CompetitorWithBoatDTO, BoatDTO> result = new HashMap<>();
|
||||
for (Entry<Competitor, Boat> entry: competitorsAndBoats.entrySet()) {
|
||||
CompetitorDTO competitorDTO = convertToCompetitorWithOptionalBoatDTO(entry.getKey());
|
||||
CompetitorWithBoatDTO competitorDTO = convertToCompetitorWithOptionalBoatDTO(entry.getKey());
|
||||
BoatDTO boatDTO = convertToBoatDTO(entry.getValue());
|
||||
result.put(competitorDTO, boatDTO);
|
||||
}
|
||||
+3
-3
@@ -15,7 +15,7 @@ import java.util.logging.Logger;
|
||||
import com.sap.sailing.domain.base.Boat;
|
||||
import com.sap.sailing.domain.base.BoatClass;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.CompetitorStore;
|
||||
import com.sap.sailing.domain.base.CompetitorAndBoatStore;
|
||||
import com.sap.sailing.domain.base.CompetitorWithBoat;
|
||||
import com.sap.sailing.domain.base.ControlPoint;
|
||||
import com.sap.sailing.domain.base.Nationality;
|
||||
@@ -120,7 +120,7 @@ public class DomainFactoryImpl implements DomainFactory {
|
||||
|
||||
@Override
|
||||
public Pair<Competitor, Boat> createCompetitorWithID(com.sap.sailing.domain.swisstimingadapter.Competitor competitor, BoatClass boatClass) {
|
||||
CompetitorStore competitorAndBoatStore = baseDomainFactory.getCompetitorStore();
|
||||
CompetitorAndBoatStore competitorAndBoatStore = baseDomainFactory.getCompetitorStore();
|
||||
CompetitorWithBoat domainCompetitor = competitorAndBoatStore.getExistingCompetitorWithBoatByIdAsString(competitor.getID());
|
||||
if (domainCompetitor == null || competitorAndBoatStore.isCompetitorToUpdateDuringGetOrCreate(domainCompetitor)) {
|
||||
List<DynamicPerson> teamMembers = new ArrayList<DynamicPerson>();
|
||||
@@ -139,7 +139,7 @@ public class DomainFactoryImpl implements DomainFactory {
|
||||
|
||||
@Override
|
||||
public Pair<Competitor, Boat> createCompetitorWithoutID(com.sap.sailing.domain.swisstimingadapter.Competitor competitor, String raceId, BoatClass boatClass) {
|
||||
CompetitorStore competitorAndBoatStore = baseDomainFactory.getCompetitorStore();
|
||||
CompetitorAndBoatStore competitorAndBoatStore = baseDomainFactory.getCompetitorStore();
|
||||
List<DynamicPerson> teamMembers = new ArrayList<DynamicPerson>();
|
||||
for (String teamMemberName : competitor.getName().split("[-+&]")) {
|
||||
teamMembers.add(new PersonImpl(teamMemberName.trim(), getOrCreateNationality(competitor.getThreeLetterIOCCode()),
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ import java.util.logging.Logger;
|
||||
import com.sap.sailing.domain.abstractlog.race.analyzing.impl.RaceLogResolver;
|
||||
import com.sap.sailing.domain.base.BoatClass;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.CompetitorStore;
|
||||
import com.sap.sailing.domain.base.CompetitorAndBoatStore;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.base.RaceDefinition;
|
||||
import com.sap.sailing.domain.base.Regatta;
|
||||
@@ -471,7 +471,7 @@ public class SwissTimingRaceTrackerImpl extends AbstractRaceTrackerImpl
|
||||
this.notifyAll();
|
||||
}
|
||||
// temp
|
||||
CompetitorStore competitorStore = domainFactory.getBaseDomainFactory().getCompetitorStore();
|
||||
CompetitorAndBoatStore competitorStore = domainFactory.getBaseDomainFactory().getCompetitorStore();
|
||||
for (com.sap.sailing.domain.swisstimingadapter.Competitor c : startList.getCompetitors()) {
|
||||
Competitor existingCompetitor = competitorStore.getExistingCompetitorByIdAsString(c.getID());
|
||||
if (existingCompetitor != null) {
|
||||
|
||||
+44
-44
@@ -26,8 +26,8 @@ import org.junit.Test;
|
||||
import com.sap.sailing.domain.common.BoatClassMasterdata;
|
||||
import com.sap.sailing.domain.common.dto.BoatClassDTO;
|
||||
import com.sap.sailing.domain.common.dto.BoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTOImpl;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTOImpl;
|
||||
import com.sap.sailing.domain.common.dto.FleetDTO;
|
||||
import com.sap.sailing.domain.common.dto.IncrementalLeaderboardDTO;
|
||||
import com.sap.sailing.domain.common.dto.LeaderboardDTO;
|
||||
@@ -71,8 +71,8 @@ public class LeaderboardDTODiffingTest {
|
||||
cloner.clone(previousVersion, newVersion);
|
||||
}
|
||||
|
||||
private CompetitorDTO getPreviousCompetitorByName(String name) {
|
||||
for (CompetitorDTO competitor : previousVersion.competitors) {
|
||||
private CompetitorWithBoatDTO getPreviousCompetitorByName(String name) {
|
||||
for (CompetitorWithBoatDTO competitor : previousVersion.competitors) {
|
||||
if (competitor.getName().equals(name)) {
|
||||
return competitor;
|
||||
}
|
||||
@@ -83,9 +83,9 @@ public class LeaderboardDTODiffingTest {
|
||||
@Test
|
||||
public void testEmptyLegDetailsGetFilled() throws FileNotFoundException, IOException, ClassNotFoundException {
|
||||
// remove legDetails for R9 for all competitors from previousVersion; remember which ones did contain data
|
||||
Set<CompetitorDTO> hadLegDetailsInR9 = new HashSet<>();
|
||||
Map<CompetitorDTO, LeaderboardRowDTO> newRows = new HashMap<>();
|
||||
for (CompetitorDTO competitor : previousVersion.rows.keySet()) {
|
||||
Set<CompetitorWithBoatDTO> hadLegDetailsInR9 = new HashSet<>();
|
||||
Map<CompetitorWithBoatDTO, LeaderboardRowDTO> newRows = new HashMap<>();
|
||||
for (CompetitorWithBoatDTO competitor : previousVersion.rows.keySet()) {
|
||||
LeaderboardRowDTO competitorRow = new LeaderboardRowDTO();
|
||||
cloner.clone(newVersion.rows.get(competitor), competitorRow);
|
||||
Map<String, LeaderboardEntryDTO> newFieldsByRaceColumnName = new HashMap<>();
|
||||
@@ -108,7 +108,7 @@ public class LeaderboardDTODiffingTest {
|
||||
newVersion.strip(previousVersion); // should contain the leg details now
|
||||
LeaderboardDTO applied = newVersion.getLeaderboardDTO(previousVersion);
|
||||
// now applied must contain the leg details
|
||||
for (CompetitorDTO competitor : hadLegDetailsInR9) {
|
||||
for (CompetitorWithBoatDTO competitor : hadLegDetailsInR9) {
|
||||
assertNotNull(applied.rows.get(competitor).fieldsByRaceColumnName.get("R9").legDetails);
|
||||
}
|
||||
}
|
||||
@@ -133,15 +133,15 @@ public class LeaderboardDTODiffingTest {
|
||||
|
||||
@Test
|
||||
public void testMajorStripping() {
|
||||
newVersion.rows = new HashMap<CompetitorDTO, LeaderboardRowDTO>(newVersion.rows);
|
||||
newVersion.rows = new HashMap<CompetitorWithBoatDTO, LeaderboardRowDTO>(newVersion.rows);
|
||||
List<RaceColumnDTO> raceListBeforeStripping = new ArrayList<RaceColumnDTO>(newVersion.getRaceList());
|
||||
CompetitorDTO wolfgang = getPreviousCompetitorByName("HUNGER +JESS");
|
||||
CompetitorWithBoatDTO wolfgang = getPreviousCompetitorByName("HUNGER +JESS");
|
||||
assertNotNull(wolfgang);
|
||||
LeaderboardRowDTO wolfgangsRow = new LeaderboardRowDTO();
|
||||
cloner.clone(newVersion.rows.get(wolfgang), wolfgangsRow);
|
||||
newVersion.rows.put(wolfgang, wolfgangsRow);
|
||||
wolfgangsRow.totalDistanceTraveledInMeters += 1;
|
||||
Map<CompetitorDTO, LeaderboardRowDTO> rowsBeforeStripping = newVersion.rows;
|
||||
Map<CompetitorWithBoatDTO, LeaderboardRowDTO> rowsBeforeStripping = newVersion.rows;
|
||||
newVersion.strip(previousVersion);
|
||||
assertAllRowsKeysAreIdenticalToAllLeaderboardRowDTOCompetitors(newVersion);
|
||||
assertNotNull(newVersion.rows);
|
||||
@@ -159,11 +159,11 @@ public class LeaderboardDTODiffingTest {
|
||||
|
||||
@Test
|
||||
public void testStrippingExceptOneColumnInOneRace() {
|
||||
HashMap<CompetitorDTO, LeaderboardRowDTO> newRows = new HashMap<CompetitorDTO, LeaderboardRowDTO>(newVersion.rows);
|
||||
HashMap<CompetitorWithBoatDTO, LeaderboardRowDTO> newRows = new HashMap<CompetitorWithBoatDTO, LeaderboardRowDTO>(newVersion.rows);
|
||||
double newDistance = 1234;
|
||||
String nameOfRaceColumnToChange = "R9";
|
||||
int indexOfLegToChange = 7; // ( zero based: ) 8th leg is the last leg
|
||||
for (Map.Entry<CompetitorDTO, LeaderboardRowDTO> e : newVersion.rows.entrySet()) {
|
||||
for (Map.Entry<CompetitorWithBoatDTO, LeaderboardRowDTO> e : newVersion.rows.entrySet()) {
|
||||
LeaderboardRowDTO newRow = new LeaderboardRowDTO();
|
||||
cloner.clone(e.getValue(), newRow);
|
||||
newRows.put(e.getKey(), newRow);
|
||||
@@ -183,19 +183,19 @@ public class LeaderboardDTODiffingTest {
|
||||
}
|
||||
}
|
||||
newVersion.rows = newRows;
|
||||
Map<CompetitorDTO, LeaderboardRowDTO> rowsBeforeStripping = newVersion.rows;
|
||||
Map<com.sap.sse.common.Util.Pair<CompetitorDTO, String>, List<LegEntryDTO>> previousLegDetailsBeforeStripping = new HashMap<>();
|
||||
for (Map.Entry<CompetitorDTO, LeaderboardRowDTO> e : rowsBeforeStripping.entrySet()) {
|
||||
Map<CompetitorWithBoatDTO, LeaderboardRowDTO> rowsBeforeStripping = newVersion.rows;
|
||||
Map<com.sap.sse.common.Util.Pair<CompetitorWithBoatDTO, String>, List<LegEntryDTO>> previousLegDetailsBeforeStripping = new HashMap<>();
|
||||
for (Map.Entry<CompetitorWithBoatDTO, LeaderboardRowDTO> e : rowsBeforeStripping.entrySet()) {
|
||||
for (Map.Entry<String, LeaderboardEntryDTO> e2 : e.getValue().fieldsByRaceColumnName.entrySet()) {
|
||||
if (e2.getValue().legDetails != null) {
|
||||
previousLegDetailsBeforeStripping.put(new com.sap.sse.common.Util.Pair<CompetitorDTO, String>(e.getKey(), e2.getKey()),
|
||||
previousLegDetailsBeforeStripping.put(new com.sap.sse.common.Util.Pair<CompetitorWithBoatDTO, 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<com.sap.sse.common.Util.Pair<CompetitorDTO, String>, List<LegEntryDTO>> e : previousLegDetailsBeforeStripping.entrySet()) {
|
||||
for (Map.Entry<com.sap.sse.common.Util.Pair<CompetitorWithBoatDTO, String>, List<LegEntryDTO>> e : previousLegDetailsBeforeStripping.entrySet()) {
|
||||
final LeaderboardRowDTO leaderboardRowDTO = rowsBeforeStripping.get(e.getKey().getA());
|
||||
if (leaderboardRowDTO != null) {
|
||||
List<LegEntryDTO> newLegDetails = leaderboardRowDTO.fieldsByRaceColumnName.get(e.getKey().getB()).legDetails;
|
||||
@@ -207,7 +207,7 @@ public class LeaderboardDTODiffingTest {
|
||||
assertEquals(previousVersion.rows.size()-17, newVersion.rows.size()); // all rows have changed except for 17 that have no leg details in leg 8
|
||||
// now assert that for all rows there is no leaderboard entry for all races but R9 and
|
||||
// for R9 there either are no leg details or all leg details for all legs other than L8 are null
|
||||
for (Map.Entry<CompetitorDTO, LeaderboardRowDTO> e : newVersion.rows.entrySet()) {
|
||||
for (Map.Entry<CompetitorWithBoatDTO, LeaderboardRowDTO> e : newVersion.rows.entrySet()) {
|
||||
if (e.getValue().fieldsByRaceColumnName != null) {
|
||||
assertTrue(e.getValue().fieldsByRaceColumnName.size() <= 1);
|
||||
for (Map.Entry<String, LeaderboardEntryDTO> e2 : e.getValue().fieldsByRaceColumnName.entrySet()) {
|
||||
@@ -235,19 +235,19 @@ public class LeaderboardDTODiffingTest {
|
||||
|
||||
@Test
|
||||
public void testCompetitorListChange() {
|
||||
newVersion.competitors = new ArrayList<CompetitorDTO>(newVersion.competitors); // clone competitor list so it's not identical to that of previous version
|
||||
newVersion.competitors = new ArrayList<CompetitorWithBoatDTO>(newVersion.competitors); // clone competitor list so it's not identical to that of previous version
|
||||
BoatDTO boat = new BoatDTO("123", "LSC", new BoatClassDTO("505", BoatClassMasterdata._5O5.getHullLength(), BoatClassMasterdata._5O5.getHullBeam()), "GER 1234");
|
||||
CompetitorDTO somebodyNew = new CompetitorDTOImpl("Someone New", "SN", Color.RED, "someone@nobody.de", "DE", "GER", "Germany", "912p09871203987",
|
||||
CompetitorWithBoatDTO somebodyNew = new CompetitorWithBoatDTOImpl("Someone New", "SN", Color.RED, "someone@nobody.de", "DE", "GER", "Germany", "912p09871203987",
|
||||
/* imageURL */ null, /* flagImageURL */ null,
|
||||
/* timeOnTimeFactor */ null,
|
||||
/* timeOnDistanceAllowancePerNauticalMile */ null,
|
||||
/* searchTag */ null,
|
||||
boat);
|
||||
newVersion.competitors.add(13, somebodyNew); // insert a competitor; this should mess up all others' indexes; check if this works
|
||||
CompetitorDTO wolfgang = getPreviousCompetitorByName("HUNGER +JESS");
|
||||
CompetitorWithBoatDTO wolfgang = getPreviousCompetitorByName("HUNGER +JESS");
|
||||
newVersion.competitors.remove(wolfgang);
|
||||
newVersion.rows.remove(wolfgang); // remove another competitor
|
||||
List<CompetitorDTO> newCompetitorsBeforeStripping = new ArrayList<CompetitorDTO>(newVersion.competitors);
|
||||
List<CompetitorWithBoatDTO> newCompetitorsBeforeStripping = new ArrayList<CompetitorWithBoatDTO>(newVersion.competitors);
|
||||
newVersion.strip(previousVersion);
|
||||
assertAllRowsKeysAreIdenticalToAllLeaderboardRowDTOCompetitors(newVersion);
|
||||
assertNull(newVersion.competitors); // but there should be an added competitor that we can't see through the public interface
|
||||
@@ -257,12 +257,12 @@ public class LeaderboardDTODiffingTest {
|
||||
|
||||
@Test
|
||||
public void testSuppressionChange() {
|
||||
final List<CompetitorDTO> newSuppressedCompetitors = new ArrayList<CompetitorDTO>();
|
||||
final List<CompetitorWithBoatDTO> newSuppressedCompetitors = new ArrayList<CompetitorWithBoatDTO>();
|
||||
Util.addAll(newVersion.getSuppressedCompetitors(), newSuppressedCompetitors);
|
||||
newVersion.setSuppressedCompetitors(newSuppressedCompetitors);
|
||||
newVersion.competitors = new ArrayList<CompetitorDTO>(newVersion.competitors); // clone competitor list so it's not identical to that of previous version
|
||||
newVersion.competitors = new ArrayList<CompetitorWithBoatDTO>(newVersion.competitors); // clone competitor list so it's not identical to that of previous version
|
||||
BoatDTO boat = new BoatDTO("123", "LSC", new BoatClassDTO("505", BoatClassMasterdata._5O5.getHullLength(), BoatClassMasterdata._5O5.getHullBeam()), "GER 1234");
|
||||
CompetitorDTO somebodyNew = new CompetitorDTOImpl("Someone New", "SN", Color.RED, "someone@nobody.de", "DE", "GER", "Germany", "912p09871203987",
|
||||
CompetitorWithBoatDTO somebodyNew = new CompetitorWithBoatDTOImpl("Someone New", "SN", Color.RED, "someone@nobody.de", "DE", "GER", "Germany", "912p09871203987",
|
||||
/* imageURL */ null, /* flagImageURL */ null,
|
||||
/* timeOnTimeFactor */ null,
|
||||
/* timeOnDistanceAllowancePerNauticalMile */ null,
|
||||
@@ -270,15 +270,15 @@ public class LeaderboardDTODiffingTest {
|
||||
boat);
|
||||
newVersion.setSuppressed(newVersion.competitors.get(13), true); // suppress an existing competitor; compaction should reduce this to a single number only
|
||||
newVersion.setSuppressed(somebodyNew, true); // check that mixed mode with existing and new competitors works as well
|
||||
List<CompetitorDTO> newSuppressedCompetitorsBeforeStripping = new ArrayList<CompetitorDTO>();
|
||||
List<CompetitorWithBoatDTO> newSuppressedCompetitorsBeforeStripping = new ArrayList<CompetitorWithBoatDTO>();
|
||||
Util.addAll(newVersion.getSuppressedCompetitors(), newSuppressedCompetitorsBeforeStripping);
|
||||
newVersion.strip(previousVersion);
|
||||
assertAllRowsKeysAreIdenticalToAllLeaderboardRowDTOCompetitors(newVersion);
|
||||
assertEquals(2, Util.size(newVersion.getSuppressedCompetitors()));
|
||||
assertTrue(Util.contains(newVersion.getSuppressedCompetitors(), somebodyNew));
|
||||
for (CompetitorDTO compactSuppressedCompetitor : newVersion.getSuppressedCompetitors()) {
|
||||
for (CompetitorWithBoatDTO compactSuppressedCompetitor : newVersion.getSuppressedCompetitors()) {
|
||||
if (compactSuppressedCompetitor != somebodyNew) {
|
||||
assertFalse(compactSuppressedCompetitor instanceof CompetitorDTOImpl); // assert that the existing competitor was compacted
|
||||
assertFalse(compactSuppressedCompetitor instanceof CompetitorWithBoatDTOImpl); // assert that the existing competitor was compacted
|
||||
}
|
||||
}
|
||||
LeaderboardDTO applied = newVersion.getLeaderboardDTO(previousVersion);
|
||||
@@ -287,27 +287,27 @@ public class LeaderboardDTODiffingTest {
|
||||
|
||||
@Test
|
||||
public void testDisplayNameChange() {
|
||||
newVersion.competitors = new ArrayList<CompetitorDTO>(newVersion.competitors); // clone competitor list so it's not identical to that of previous version
|
||||
newVersion.competitors = new ArrayList<CompetitorWithBoatDTO>(newVersion.competitors); // clone competitor list so it's not identical to that of previous version
|
||||
BoatDTO boat = new BoatDTO("123", "LSC", new BoatClassDTO("505", BoatClassMasterdata._5O5.getHullLength(), BoatClassMasterdata._5O5.getHullBeam()), "GER 1234");
|
||||
CompetitorDTO somebodyNew = new CompetitorDTOImpl("Someone New", "SN", Color.RED, "someone@nobody.de", "DE", "GER", "Germany", "912p09871203987",
|
||||
CompetitorWithBoatDTO somebodyNew = new CompetitorWithBoatDTOImpl("Someone New", "SN", Color.RED, "someone@nobody.de", "DE", "GER", "Germany", "912p09871203987",
|
||||
/* imageURL */ null, /* flagImageURL */ null,
|
||||
/* timeOnTimeFactor */ null,
|
||||
/* timeOnDistanceAllowancePerNauticalMile */ null,
|
||||
/* searchTag */ null,
|
||||
boat);
|
||||
newVersion.competitors.add(somebodyNew);
|
||||
newVersion.competitorDisplayNames = new HashMap<CompetitorDTO, String>(newVersion.competitorDisplayNames);
|
||||
newVersion.competitorDisplayNames = new HashMap<CompetitorWithBoatDTO, String>(newVersion.competitorDisplayNames);
|
||||
newVersion.competitorDisplayNames.put(newVersion.competitors.get(13), "Humba");
|
||||
newVersion.competitorDisplayNames.put(somebodyNew, "Trala");
|
||||
final HashMap<CompetitorDTO, String> newDisplayNamesBeforeStripping = new HashMap<CompetitorDTO, String>();
|
||||
final HashMap<CompetitorWithBoatDTO, String> newDisplayNamesBeforeStripping = new HashMap<CompetitorWithBoatDTO, String>();
|
||||
newDisplayNamesBeforeStripping.putAll(newVersion.competitorDisplayNames);
|
||||
newVersion.strip(previousVersion);
|
||||
assertAllRowsKeysAreIdenticalToAllLeaderboardRowDTOCompetitors(newVersion);
|
||||
assertEquals(2, newVersion.competitorDisplayNames.size());
|
||||
assertTrue(newVersion.competitorDisplayNames.keySet().contains(somebodyNew));
|
||||
for (CompetitorDTO compactSuppressedCompetitor : newVersion.competitorDisplayNames.keySet()) {
|
||||
for (CompetitorWithBoatDTO compactSuppressedCompetitor : newVersion.competitorDisplayNames.keySet()) {
|
||||
if (compactSuppressedCompetitor != somebodyNew) {
|
||||
assertFalse(compactSuppressedCompetitor instanceof CompetitorDTOImpl); // assert that the existing competitor was compacted
|
||||
assertFalse(compactSuppressedCompetitor instanceof CompetitorWithBoatDTOImpl); // assert that the existing competitor was compacted
|
||||
}
|
||||
}
|
||||
LeaderboardDTO applied = newVersion.getLeaderboardDTO(previousVersion);
|
||||
@@ -317,13 +317,13 @@ public class LeaderboardDTODiffingTest {
|
||||
@Test
|
||||
public void testCompetitorOrderingInRaceChange() {
|
||||
RaceColumnDTO r9 = newVersion.getRaceColumnByName("R9");
|
||||
Map<String, List<CompetitorDTO>> newCompetitorOrderingPerRace = new HashMap<String, List<CompetitorDTO>>(newVersion.getCompetitorOrderingPerRaceColumnName());
|
||||
Map<String, List<CompetitorWithBoatDTO>> newCompetitorOrderingPerRace = new HashMap<String, List<CompetitorWithBoatDTO>>(newVersion.getCompetitorOrderingPerRaceColumnName());
|
||||
newVersion.setCompetitorOrderingPerRace(newCompetitorOrderingPerRace);
|
||||
List<CompetitorDTO> newOrdering = new ArrayList<CompetitorDTO>(newVersion.getCompetitorsFromBestToWorst(r9));
|
||||
List<CompetitorWithBoatDTO> newOrdering = new ArrayList<CompetitorWithBoatDTO>(newVersion.getCompetitorsFromBestToWorst(r9));
|
||||
newVersion.setCompetitorsFromBestToWorst(r9, newOrdering);
|
||||
newVersion.competitors = new ArrayList<CompetitorDTO>(newVersion.competitors); // clone competitor list so it's not identical to that of previous version
|
||||
newVersion.competitors = new ArrayList<CompetitorWithBoatDTO>(newVersion.competitors); // clone competitor list so it's not identical to that of previous version
|
||||
BoatDTO boat = new BoatDTO("123", "LSC", new BoatClassDTO("505", BoatClassMasterdata._5O5.getHullLength(), BoatClassMasterdata._5O5.getHullBeam()), "GER 1234");
|
||||
CompetitorDTO somebodyNew = new CompetitorDTOImpl("Someone New", "SN", Color.RED, "someone@nobody.de", "DE", "GER", "Germany", "912p09871203987",
|
||||
CompetitorWithBoatDTO somebodyNew = new CompetitorWithBoatDTOImpl("Someone New", "SN", Color.RED, "someone@nobody.de", "DE", "GER", "Germany", "912p09871203987",
|
||||
/* imageURL */ null, /* flagImageURL */ null,
|
||||
/* timeOnTimeFactor */ null,
|
||||
/* timeOnDistanceAllowancePerNauticalMile */ null,
|
||||
@@ -331,18 +331,18 @@ public class LeaderboardDTODiffingTest {
|
||||
boat);
|
||||
newVersion.competitors.add(somebodyNew);
|
||||
newOrdering.add(somebodyNew);
|
||||
CompetitorDTO formerRank13 = newOrdering.remove(13);
|
||||
CompetitorWithBoatDTO formerRank13 = newOrdering.remove(13);
|
||||
newOrdering.add(12, formerRank13);
|
||||
List<CompetitorDTO> newOrderBeforeStripping = new ArrayList<CompetitorDTO>(newOrdering);
|
||||
List<CompetitorWithBoatDTO> newOrderBeforeStripping = new ArrayList<CompetitorWithBoatDTO>(newOrdering);
|
||||
newVersion.strip(previousVersion);
|
||||
assertAllRowsKeysAreIdenticalToAllLeaderboardRowDTOCompetitors(newVersion);
|
||||
for (int i=1; i<9; i++) {
|
||||
assertNull(newVersion.getCompetitorsFromBestToWorst("R"+i));
|
||||
}
|
||||
assertEquals(newVersion.getCompetitorsFromBestToWorst(r9).size()-1, newVersion.getCompetitorsFromBestToWorst(r9).indexOf(somebodyNew));
|
||||
for (CompetitorDTO compactSuppressedCompetitor : newVersion.getCompetitorsFromBestToWorst(r9)) {
|
||||
for (CompetitorWithBoatDTO compactSuppressedCompetitor : newVersion.getCompetitorsFromBestToWorst(r9)) {
|
||||
if (compactSuppressedCompetitor != somebodyNew) {
|
||||
assertFalse(compactSuppressedCompetitor instanceof CompetitorDTOImpl); // assert that the existing competitor was compacted
|
||||
assertFalse(compactSuppressedCompetitor instanceof CompetitorWithBoatDTOImpl); // assert that the existing competitor was compacted
|
||||
}
|
||||
}
|
||||
LeaderboardDTO applied = newVersion.getLeaderboardDTO(previousVersion);
|
||||
@@ -351,7 +351,7 @@ public class LeaderboardDTODiffingTest {
|
||||
|
||||
private void assertAllRowsKeysAreIdenticalToAllLeaderboardRowDTOCompetitors(LeaderboardDTO leaderboard) {
|
||||
if (leaderboard.rows != null) {
|
||||
for (Map.Entry<CompetitorDTO, LeaderboardRowDTO> e : leaderboard.rows.entrySet()) {
|
||||
for (Map.Entry<CompetitorWithBoatDTO, LeaderboardRowDTO> e : leaderboard.rows.entrySet()) {
|
||||
assertSame(e.getKey(), e.getValue().competitor);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -29,7 +29,7 @@ import com.sap.sailing.domain.abstractlog.race.analyzing.impl.RaceLogResolver;
|
||||
import com.sap.sailing.domain.base.Boat;
|
||||
import com.sap.sailing.domain.base.BoatClass;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.CompetitorStore;
|
||||
import com.sap.sailing.domain.base.CompetitorAndBoatStore;
|
||||
import com.sap.sailing.domain.base.CompetitorWithBoat;
|
||||
import com.sap.sailing.domain.base.ControlPoint;
|
||||
import com.sap.sailing.domain.base.Course;
|
||||
@@ -296,7 +296,7 @@ public class DomainFactoryImpl implements DomainFactory {
|
||||
private CompetitorWithBoat getOrCreateCompetitorWithBoat(final UUID competitorId,
|
||||
final String nationalityAsString, final String name, final String shortName, float timeOnTimeFactor,
|
||||
float timeOnDistanceAllowanceInSecondsPerNauticalMile, String searchTag, String competitorClassName, String sailId) {
|
||||
CompetitorStore competitorStore = baseDomainFactory.getCompetitorStore();
|
||||
CompetitorAndBoatStore competitorStore = baseDomainFactory.getCompetitorStore();
|
||||
CompetitorWithBoat domainCompetitor = competitorStore.getExistingCompetitorWithBoatById(competitorId);
|
||||
if (domainCompetitor == null || competitorStore.isCompetitorToUpdateDuringGetOrCreate(domainCompetitor)) {
|
||||
BoatClass boatClass = getOrCreateBoatClass(competitorClassName);
|
||||
@@ -321,7 +321,7 @@ public class DomainFactoryImpl implements DomainFactory {
|
||||
private Competitor getOrCreateCompetitor(final UUID competitorId, final String nationalityAsString,
|
||||
final String name, final String shortName, float timeOnTimeFactor,
|
||||
float timeOnDistanceAllowanceInSecondsPerNauticalMile, String searchTag) {
|
||||
CompetitorStore competitorStore = baseDomainFactory.getCompetitorStore();
|
||||
CompetitorAndBoatStore competitorStore = baseDomainFactory.getCompetitorStore();
|
||||
Competitor domainCompetitor = competitorStore.getExistingCompetitorById(competitorId);
|
||||
if (domainCompetitor == null || competitorStore.isCompetitorToUpdateDuringGetOrCreate(domainCompetitor)) {
|
||||
Nationality nationality;
|
||||
@@ -341,7 +341,7 @@ public class DomainFactoryImpl implements DomainFactory {
|
||||
}
|
||||
|
||||
public Boat getOrCreateBoat(Serializable boatId, String boatName, BoatClass boatClass, String sailId, Color boatColor) {
|
||||
CompetitorStore competitorStore = baseDomainFactory.getCompetitorStore();
|
||||
CompetitorAndBoatStore competitorStore = baseDomainFactory.getCompetitorStore();
|
||||
Boat domainBoat = competitorStore.getExistingBoatById(boatId);
|
||||
if (domainBoat == null) {
|
||||
domainBoat = baseDomainFactory.getCompetitorStore().getOrCreateBoat(boatId, boatName, boatClass, sailId, boatColor);
|
||||
@@ -708,7 +708,7 @@ public class DomainFactoryImpl implements DomainFactory {
|
||||
@Override
|
||||
public Map<Competitor, Boat> getOrCreateCompetitorsAndTheirBoats(DynamicTrackedRegatta trackedRegatta, LeaderboardGroupResolver leaderboardGroupResolver,
|
||||
IRace race, BoatClass defaultBoatClass) {
|
||||
final CompetitorStore competitorAndBoatStore = baseDomainFactory.getCompetitorStore();
|
||||
final CompetitorAndBoatStore competitorAndBoatStore = baseDomainFactory.getCompetitorStore();
|
||||
final Map<Competitor, Boat> competitorsAndBoats = new HashMap<>();
|
||||
Regatta regatta = trackedRegatta.getRegatta();
|
||||
LeaderboardGroup leaderboardGroup = leaderboardGroupResolver.resolveLeaderboardGroupByRegattaName(regatta.getName());
|
||||
|
||||
@@ -10,8 +10,8 @@ import com.sap.sailing.domain.common.Placemark;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.ScoringSchemeType;
|
||||
import com.sap.sailing.domain.common.dto.BoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithoutBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.FleetDTO;
|
||||
import com.sap.sailing.domain.common.dto.PlacemarkDTO;
|
||||
import com.sap.sailing.domain.common.dto.RaceDTO;
|
||||
@@ -59,13 +59,13 @@ public interface DomainFactory extends SharedDomainFactory {
|
||||
|
||||
ScoringScheme createScoringScheme(ScoringSchemeType scoringSchemeType);
|
||||
|
||||
CompetitorWithoutBoatDTO convertToCompetitorDTO(Competitor competitor);
|
||||
CompetitorDTO convertToCompetitorDTO(Competitor competitor);
|
||||
|
||||
CompetitorDTO convertToCompetitorWithOptionalBoatDTO(Competitor competitor);
|
||||
CompetitorWithBoatDTO convertToCompetitorWithOptionalBoatDTO(Competitor competitor);
|
||||
|
||||
CompetitorDTO convertToCompetitorDTO(Competitor competitor, Boat boat);
|
||||
CompetitorWithBoatDTO convertToCompetitorDTO(Competitor competitor, Boat boat);
|
||||
|
||||
Map<CompetitorDTO, BoatDTO> convertToCompetitorAndBoatDTOs(Map<Competitor, Boat> competitorsAndBoats);
|
||||
Map<CompetitorWithBoatDTO, BoatDTO> convertToCompetitorAndBoatDTOs(Map<Competitor, Boat> competitorsAndBoats);
|
||||
|
||||
BoatDTO convertToBoatDTO(Boat boat);
|
||||
|
||||
@@ -78,11 +78,11 @@ public interface DomainFactory extends SharedDomainFactory {
|
||||
|
||||
PlacemarkDTO convertToPlacemarkDTO(Placemark placemark);
|
||||
|
||||
List<CompetitorDTO> getCompetitorDTOList(Map<Competitor, Boat> competitors);
|
||||
List<CompetitorWithBoatDTO> getCompetitorDTOList(Map<Competitor, Boat> competitors);
|
||||
|
||||
List<CompetitorDTO> getCompetitorDTOList(Iterable<Competitor> competitors);
|
||||
List<CompetitorWithBoatDTO> getCompetitorDTOList(Iterable<Competitor> competitors);
|
||||
|
||||
List<CompetitorDTO> getCompetitorDTOList(List<Pair<Competitor, Boat>> competitors);
|
||||
List<CompetitorWithBoatDTO> getCompetitorDTOList(List<Pair<Competitor, Boat>> competitors);
|
||||
|
||||
TrackedRaceDTO createTrackedRaceDTO(TrackedRace trackedRace);
|
||||
|
||||
|
||||
+14
-14
@@ -12,7 +12,7 @@ import java.util.logging.Logger;
|
||||
import com.sap.sailing.domain.abstractlog.race.analyzing.impl.RaceLogResolver;
|
||||
import com.sap.sailing.domain.base.Boat;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.CompetitorStore;
|
||||
import com.sap.sailing.domain.base.CompetitorAndBoatStore;
|
||||
import com.sap.sailing.domain.base.DomainFactory;
|
||||
import com.sap.sailing.domain.base.Fleet;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
@@ -27,8 +27,8 @@ import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.ScoringSchemeType;
|
||||
import com.sap.sailing.domain.common.WindSourceType;
|
||||
import com.sap.sailing.domain.common.dto.BoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithoutBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.FleetDTO;
|
||||
import com.sap.sailing.domain.common.dto.PlacemarkDTO;
|
||||
import com.sap.sailing.domain.common.dto.PlacemarkOrderDTO;
|
||||
@@ -82,10 +82,10 @@ public class DomainFactoryImpl extends SharedDomainFactoryImpl implements Domain
|
||||
* Uses a transient competitor and boat store
|
||||
*/
|
||||
public DomainFactoryImpl(RaceLogResolver raceLogResolver) {
|
||||
super(new TransientCompetitorStoreImpl(), raceLogResolver);
|
||||
super(new TransientCompetitorAndBoatStoreImpl(), raceLogResolver);
|
||||
}
|
||||
|
||||
public DomainFactoryImpl(CompetitorStore competitorStore, RaceLogResolver raceLogResolver) {
|
||||
public DomainFactoryImpl(CompetitorAndBoatStore competitorStore, RaceLogResolver raceLogResolver) {
|
||||
super(competitorStore, raceLogResolver);
|
||||
}
|
||||
|
||||
@@ -147,22 +147,22 @@ public class DomainFactoryImpl extends SharedDomainFactoryImpl implements Domain
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompetitorDTO convertToCompetitorDTO(Competitor competitor, Boat boat) {
|
||||
public CompetitorWithBoatDTO convertToCompetitorDTO(Competitor competitor, Boat boat) {
|
||||
return competitorAndBoatStore.convertToCompetitorWithBoatDTO(competitor, boat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompetitorDTO convertToCompetitorWithOptionalBoatDTO(Competitor competitor) {
|
||||
public CompetitorWithBoatDTO convertToCompetitorWithOptionalBoatDTO(Competitor competitor) {
|
||||
return competitorAndBoatStore.convertToCompetitorWithOptionalBoatDTO(competitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompetitorWithoutBoatDTO convertToCompetitorDTO(Competitor competitor) {
|
||||
public CompetitorDTO convertToCompetitorDTO(Competitor competitor) {
|
||||
return competitorAndBoatStore.convertToCompetitorDTO(competitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<CompetitorDTO, BoatDTO> convertToCompetitorAndBoatDTOs(Map<Competitor, Boat> competitorsAndBoats) {
|
||||
public Map<CompetitorWithBoatDTO, BoatDTO> convertToCompetitorAndBoatDTOs(Map<Competitor, Boat> competitorsAndBoats) {
|
||||
return competitorAndBoatStore.convertToCompetitorAndBoatDTOs(competitorsAndBoats);
|
||||
}
|
||||
|
||||
@@ -369,8 +369,8 @@ public class DomainFactoryImpl extends SharedDomainFactoryImpl implements Domain
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CompetitorDTO> getCompetitorDTOList(Map<Competitor, Boat> competitors) {
|
||||
List<CompetitorDTO> result = new ArrayList<CompetitorDTO>();
|
||||
public List<CompetitorWithBoatDTO> getCompetitorDTOList(Map<Competitor, Boat> competitors) {
|
||||
List<CompetitorWithBoatDTO> result = new ArrayList<CompetitorWithBoatDTO>();
|
||||
for (Entry<Competitor, Boat> competitorAndBoatEntry : competitors.entrySet()) {
|
||||
result.add(convertToCompetitorDTO(competitorAndBoatEntry.getKey(), competitorAndBoatEntry.getValue()));
|
||||
}
|
||||
@@ -378,16 +378,16 @@ public class DomainFactoryImpl extends SharedDomainFactoryImpl implements Domain
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CompetitorDTO> getCompetitorDTOList(Iterable<Competitor> competitors) {
|
||||
List<CompetitorDTO> result = new ArrayList<CompetitorDTO>();
|
||||
public List<CompetitorWithBoatDTO> getCompetitorDTOList(Iterable<Competitor> competitors) {
|
||||
List<CompetitorWithBoatDTO> result = new ArrayList<CompetitorWithBoatDTO>();
|
||||
for (Competitor competitor : competitors) {
|
||||
result.add(convertToCompetitorWithOptionalBoatDTO(competitor));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<CompetitorDTO> getCompetitorDTOList(List<Pair<Competitor, Boat>> competitors) {
|
||||
List<CompetitorDTO> result = new ArrayList<CompetitorDTO>();
|
||||
public List<CompetitorWithBoatDTO> getCompetitorDTOList(List<Pair<Competitor, Boat>> competitors) {
|
||||
List<CompetitorWithBoatDTO> result = new ArrayList<CompetitorWithBoatDTO>();
|
||||
for (Pair<Competitor, Boat> competitorAndBoat : competitors) {
|
||||
result.add(convertToCompetitorDTO(competitorAndBoat.getA(), competitorAndBoat.getB()));
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,11 +3,11 @@ package com.sap.sailing.domain.base.impl;
|
||||
import java.io.Serializable;
|
||||
import java.net.URI;
|
||||
|
||||
import com.sap.sailing.domain.base.CompetitorStore;
|
||||
import com.sap.sailing.domain.base.CompetitorAndBoatStore;
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.Duration;
|
||||
|
||||
public interface DynamicCompetitorStore extends CompetitorStore {
|
||||
public interface DynamicCompetitorStore extends CompetitorAndBoatStore {
|
||||
@Override
|
||||
DynamicCompetitor getExistingCompetitorById(Serializable competitorId);
|
||||
|
||||
|
||||
+9
-9
@@ -47,7 +47,7 @@ import com.sap.sailing.domain.common.RegattaNameAndRaceName;
|
||||
import com.sap.sailing.domain.common.Speed;
|
||||
import com.sap.sailing.domain.common.SpeedWithBearing;
|
||||
import com.sap.sailing.domain.common.dto.BasicRaceDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.FleetDTO;
|
||||
import com.sap.sailing.domain.common.dto.LeaderboardDTO;
|
||||
import com.sap.sailing.domain.common.dto.LeaderboardEntryDTO;
|
||||
@@ -358,10 +358,10 @@ public abstract class AbstractLeaderboardWithCache implements Leaderboard {
|
||||
this.getScoringScheme() == null ? null : this.getScoringScheme().getType(), this
|
||||
.getScoringScheme().isHigherBetter(), new UUIDGenerator(), addOverallDetails);
|
||||
result.type = getLeaderboardType();
|
||||
result.competitors = new ArrayList<CompetitorDTO>();
|
||||
result.competitors = new ArrayList<CompetitorWithBoatDTO>();
|
||||
result.name = this.getName();
|
||||
result.displayName = this.getDisplayName();
|
||||
result.competitorDisplayNames = new HashMap<CompetitorDTO, String>();
|
||||
result.competitorDisplayNames = new HashMap<CompetitorWithBoatDTO, String>();
|
||||
boolean isLeaderboardThatHasRegattaLike = this instanceof LeaderboardThatHasRegattaLike;
|
||||
if (isLeaderboardThatHasRegattaLike) {
|
||||
LeaderboardThatHasRegattaLike regattaLikeLeaderboard = (LeaderboardThatHasRegattaLike) this;
|
||||
@@ -375,7 +375,7 @@ public abstract class AbstractLeaderboardWithCache implements Leaderboard {
|
||||
}
|
||||
// Now create the race columns and, as a future task, set their competitorsFromBestToWorst, then wait for all these
|
||||
// futures to finish:
|
||||
Map<RaceColumn, Future<List<CompetitorDTO>>> competitorsFromBestToWorstTasks = new HashMap<>();
|
||||
Map<RaceColumn, Future<List<CompetitorWithBoatDTO>>> competitorsFromBestToWorstTasks = new HashMap<>();
|
||||
for (final RaceColumn raceColumn : this.getRaceColumns()) {
|
||||
boolean isMetaLeaderboardColumn = raceColumn instanceof MetaLeaderboardColumn;
|
||||
RaceColumnDTO raceColumnDTO = result.createEmptyRaceColumn(raceColumn.getName(), raceColumn.isMedalRace(),
|
||||
@@ -402,12 +402,12 @@ public abstract class AbstractLeaderboardWithCache implements Leaderboard {
|
||||
raceColumn instanceof RaceColumnInSeries ? ((RaceColumnInSeries) raceColumn).getSeries().getName() : null,
|
||||
fleetDTO, raceColumn.isMedalRace(), raceIdentifier, race, isMetaLeaderboardColumn);
|
||||
}
|
||||
Future<List<CompetitorDTO>> task = executor.submit(
|
||||
Future<List<CompetitorWithBoatDTO>> task = executor.submit(
|
||||
() -> baseDomainFactory.getCompetitorDTOList(AbstractLeaderboardWithCache.this.getCompetitorsFromBestToWorst(raceColumn, timePoint)));
|
||||
competitorsFromBestToWorstTasks.put(raceColumn, task);
|
||||
}
|
||||
// wait for the competitor orderings to have been computed for all race columns before continuing; subsequent tasks may depend on these data
|
||||
for (Map.Entry<RaceColumn, Future<List<CompetitorDTO>>> raceColumnAndTaskToJoin : competitorsFromBestToWorstTasks.entrySet()) {
|
||||
for (Map.Entry<RaceColumn, Future<List<CompetitorWithBoatDTO>>> raceColumnAndTaskToJoin : competitorsFromBestToWorstTasks.entrySet()) {
|
||||
try {
|
||||
result.setCompetitorsFromBestToWorst(raceColumnAndTaskToJoin.getKey().getName(), raceColumnAndTaskToJoin.getValue().get());
|
||||
} catch (InterruptedException e) {
|
||||
@@ -425,7 +425,7 @@ public abstract class AbstractLeaderboardWithCache implements Leaderboard {
|
||||
}
|
||||
}
|
||||
result.setDelayToLiveInMillisForLatestRace(this.getDelayToLiveInMillis());
|
||||
result.rows = new HashMap<CompetitorDTO, LeaderboardRowDTO>();
|
||||
result.rows = new HashMap<CompetitorWithBoatDTO, LeaderboardRowDTO>();
|
||||
result.hasCarriedPoints = this.hasCarriedPoints();
|
||||
if (this.getResultDiscardingRule() instanceof ThresholdBasedResultDiscardingRule) {
|
||||
result.discardThresholds = ((ThresholdBasedResultDiscardingRule) this.getResultDiscardingRule())
|
||||
@@ -458,7 +458,7 @@ public abstract class AbstractLeaderboardWithCache implements Leaderboard {
|
||||
}
|
||||
}
|
||||
for (final Competitor competitor : this.getCompetitorsFromBestToWorst(timePoint)) {
|
||||
CompetitorDTO competitorDTO = baseDomainFactory.convertToCompetitorWithOptionalBoatDTO(competitor);
|
||||
CompetitorWithBoatDTO competitorDTO = baseDomainFactory.convertToCompetitorWithOptionalBoatDTO(competitor);
|
||||
LeaderboardRowDTO row = new LeaderboardRowDTO();
|
||||
row.competitor = competitorDTO;
|
||||
row.fieldsByRaceColumnName = new HashMap<String, LeaderboardEntryDTO>();
|
||||
@@ -513,7 +513,7 @@ public abstract class AbstractLeaderboardWithCache implements Leaderboard {
|
||||
// in case boats can't change set the also the boat on the row to simplify access
|
||||
if (result.canBoatsOfCompetitorsChangePerRace == false && !row.fieldsByRaceColumnName.isEmpty()) {
|
||||
// find a raceColumn where a boat is available
|
||||
for (LeaderboardEntryDTO leaderboardEntry: row.fieldsByRaceColumnName.values()) {
|
||||
for (LeaderboardEntryDTO leaderboardEntry : row.fieldsByRaceColumnName.values()) {
|
||||
if (leaderboardEntry.boat != null) {
|
||||
row.boat = leaderboardEntry.boat;
|
||||
break;
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.sap.sailing.domain.common.RankingMetrics;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.ScoringSchemeType;
|
||||
import com.sap.sailing.domain.common.abstractlog.TimePointSpecificationFoundInLogImpl;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.FleetDTO;
|
||||
import com.sap.sailing.domain.common.dto.RaceColumnDTO;
|
||||
import com.sap.sailing.domain.common.dto.RaceDTO;
|
||||
@@ -102,8 +102,8 @@ public class SlicingTest {
|
||||
columnNames.add(new Pair<>(columnNameOriginalRace, 0));
|
||||
sailingService.addRaceColumnsToSeries(regatta.getRegattaIdentifier(), seriesName, columnNames);
|
||||
sailingService.createRegattaLeaderboard(regatta.getRegattaIdentifier(), regattaName, new int[0]);
|
||||
final List<CompetitorDTO> competitors = sailingService.addCompetitors(Arrays.asList(competitor), null);
|
||||
final CompetitorDTO competitorDTO = competitors.iterator().next();
|
||||
final List<CompetitorWithBoatDTO> competitors = sailingService.addCompetitors(Arrays.asList(competitor), null);
|
||||
final CompetitorWithBoatDTO competitorDTO = competitors.iterator().next();
|
||||
sailingService.setCompetitorRegistrationsInRegattaLog(regattaName, new HashSet<>(competitors));
|
||||
DeviceIdentifierDTO deviceId = new DeviceIdentifierDTO("FILE", UUID.randomUUID().toString());
|
||||
final DeviceMappingDTO deviceMapping = new DeviceMappingDTO(deviceId, startOriginalRace.asDate(), endOriginalRace.asDate(), competitorDTO, null);
|
||||
|
||||
+3
-3
@@ -7,7 +7,7 @@ import com.google.gwt.user.client.ui.Label;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sailing.domain.common.RaceIdentifier;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.LeaderboardDTO;
|
||||
import com.sap.sailing.domain.common.dto.RaceColumnDTO;
|
||||
import com.sap.sailing.gwt.autoplay.client.app.AutoPlayClientFactory;
|
||||
@@ -70,7 +70,7 @@ public class RaceEndWithBoatsPresenterImpl extends AutoPlayPresenterConfigured<A
|
||||
timer = new com.sap.sse.gwt.client.player.Timer(PlayModes.Live,
|
||||
PlayStates.Paused,
|
||||
/* delayBetweenAutoAdvancesInMilliseconds */ LeaderboardEntryPoint.DEFAULT_REFRESH_INTERVAL_MILLIS);
|
||||
leaderboardPanel = new SingleRaceLeaderboardPanel(null,null,sailingService, new AsyncActionsExecutor(), leaderboardSettings,
|
||||
leaderboardPanel = new SingleRaceLeaderboardPanel(null, null, sailingService, new AsyncActionsExecutor(), leaderboardSettings,
|
||||
true, liveRace, competitorSelectionProvider, timer, null,
|
||||
getSlideCtx().getContextDefinition().getLeaderboardName(), errorReporter, StringMessages.INSTANCE,
|
||||
false, null, false, null, false, true, false, false, false, new SixtyInchLeaderBoardStyle(true),
|
||||
@@ -107,7 +107,7 @@ public class RaceEndWithBoatsPresenterImpl extends AutoPlayPresenterConfigured<A
|
||||
raceColumn = column;
|
||||
}
|
||||
}
|
||||
List<CompetitorDTO> sortedCompetitors = leaderboardPanel.getLeaderboard()
|
||||
List<CompetitorWithBoatDTO> sortedCompetitors = leaderboardPanel.getLeaderboard()
|
||||
.getCompetitorsFromBestToWorst(raceColumn);
|
||||
|
||||
if (sortedCompetitors.size() >= 3) {
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@ package com.sap.sailing.gwt.autoplay.client.places.screens.afterliveraceloop.boa
|
||||
|
||||
import com.google.gwt.user.client.ui.AcceptsOneWidget;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.SingleRaceLeaderboardPanel;
|
||||
import com.sap.sse.common.Duration;
|
||||
|
||||
@@ -13,11 +13,11 @@ public interface RaceEndWithBoatsView {
|
||||
|
||||
void setLeaderBoard(SingleRaceLeaderboardPanel leaderboardPanel);
|
||||
|
||||
void setFirst(CompetitorDTO c);
|
||||
void setFirst(CompetitorWithBoatDTO c);
|
||||
|
||||
void setSecond(CompetitorDTO c);
|
||||
void setSecond(CompetitorWithBoatDTO c);
|
||||
|
||||
void setThird(CompetitorDTO c);
|
||||
void setThird(CompetitorWithBoatDTO c);
|
||||
|
||||
void setStatistic(int competitorCount, Distance distance, Duration duration);
|
||||
}
|
||||
+4
-4
@@ -11,7 +11,7 @@ import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.ResizeComposite;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.autoplay.client.places.screens.preliveraceloop.leaderboard.PreLiveRaceLeaderBoardWithImageViewImpl.ImageProvider;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.SingleRaceLeaderboardPanel;
|
||||
@@ -75,19 +75,19 @@ public class RaceEndWithBoatsViewImpl extends ResizeComposite implements RaceEnd
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFirst(CompetitorDTO c) {
|
||||
public void setFirst(CompetitorWithBoatDTO c) {
|
||||
subline1.setText("1. " + c.getName());
|
||||
setImage(image1, provider.getImageUrl(c), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSecond(CompetitorDTO c) {
|
||||
public void setSecond(CompetitorWithBoatDTO c) {
|
||||
subline2.setText("2. " + c.getName());
|
||||
setImage(image2, provider.getImageUrl(c), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setThird(CompetitorDTO c) {
|
||||
public void setThird(CompetitorWithBoatDTO c) {
|
||||
subline3.setText("3. " + c.getName());
|
||||
setImage(image3, provider.getImageUrl(c), false);
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.sap.sailing.gwt.autoplay.client.places.screens.liveraceloop.raceboar
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.google.gwt.user.client.ui.AcceptsOneWidget;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.autoplay.client.app.AutoPlayClientFactory;
|
||||
import com.sap.sailing.gwt.autoplay.client.app.AutoPlayPresenterConfigured;
|
||||
|
||||
@@ -11,7 +11,7 @@ public class LiveRaceWithRaceboardPresenterImpl extends AutoPlayPresenterConfigu
|
||||
implements LiveRaceWithRaceboardView.Slide7Presenter {
|
||||
protected static final int SWITCH_COMPETITOR_DELAY = 2000;
|
||||
private LiveRaceWithRaceboardView view;
|
||||
ArrayList<CompetitorDTO> compList = new ArrayList<>();
|
||||
ArrayList<CompetitorWithBoatDTO> compList = new ArrayList<>();
|
||||
|
||||
public LiveRaceWithRaceboardPresenterImpl(LiveRaceWithRaceboardPlace place,
|
||||
AutoPlayClientFactory clientFactory, LiveRaceWithRaceboardView LifeRaceWithRacemapViewImpl) {
|
||||
|
||||
+4
-4
@@ -10,7 +10,7 @@ import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.ui.AcceptsOneWidget;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.LeaderboardRowDTO;
|
||||
import com.sap.sailing.gwt.autoplay.client.app.AutoPlayClientFactory;
|
||||
import com.sap.sailing.gwt.autoplay.client.app.AutoPlayPresenterConfigured;
|
||||
@@ -39,7 +39,7 @@ public class LiveRaceWithRacemapAndLeaderBoardPresenterImpl
|
||||
private Timer selectionTimer;
|
||||
private SingleRaceLeaderboardPanel leaderboardPanel;
|
||||
private int selected = -1;
|
||||
ArrayList<CompetitorDTO> compList = new ArrayList<>();
|
||||
ArrayList<CompetitorWithBoatDTO> compList = new ArrayList<>();
|
||||
private com.sap.sse.gwt.client.player.Timer timer;
|
||||
|
||||
public LiveRaceWithRacemapAndLeaderBoardPresenterImpl(LiveRaceWithRacemapAndLeaderBoardPlace place,
|
||||
@@ -72,7 +72,7 @@ public class LiveRaceWithRacemapAndLeaderBoardPresenterImpl
|
||||
if (selected > compList.size() - 1) {
|
||||
selected = 0;
|
||||
}
|
||||
CompetitorDTO marked = compList.get(selected);
|
||||
CompetitorWithBoatDTO marked = compList.get(selected);
|
||||
getPlace().getRaceMapSelectionProvider().setSelected(marked, true);
|
||||
onSelect(marked);
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
@@ -128,7 +128,7 @@ public class LiveRaceWithRacemapAndLeaderBoardPresenterImpl
|
||||
}
|
||||
}
|
||||
|
||||
private void onSelect(CompetitorDTO marked) {
|
||||
private void onSelect(CompetitorWithBoatDTO marked) {
|
||||
view.onCompetitorSelect(marked);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ package com.sap.sailing.gwt.autoplay.client.places.screens.liveraceloop.racemapw
|
||||
|
||||
import com.google.gwt.user.client.ui.AcceptsOneWidget;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.shared.racemap.RaceMap;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.SingleRaceLeaderboardPanel;
|
||||
|
||||
@@ -15,7 +15,7 @@ public interface LiveRaceWithRacemapAndLeaderBoardView {
|
||||
|
||||
void showErrorNoLive(LiveRaceWithRacemapAndLeaderBoardPresenterImpl slide7PresenterImpl, AcceptsOneWidget panel, Throwable error);
|
||||
|
||||
void onCompetitorSelect(CompetitorDTO marked);
|
||||
void onCompetitorSelect(CompetitorWithBoatDTO marked);
|
||||
|
||||
void scrollLeaderBoardToTop();
|
||||
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.ResizeComposite;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.client.shared.racemap.RaceMap;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.SingleRaceLeaderboardPanel;
|
||||
@@ -55,7 +55,7 @@ public class LiveRaceWithRacemapAndLeaderBoardViewImpl extends ResizeComposite i
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompetitorSelect(CompetitorDTO marked) {
|
||||
public void onCompetitorSelect(CompetitorWithBoatDTO marked) {
|
||||
rawRaceMap.addedToSelection(marked);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.ResizeComposite;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.autoplay.client.places.screens.preliveraceloop.leaderboard.PreLiveRaceLeaderBoardWithImageViewImpl.ImageProvider;
|
||||
|
||||
public class CompetitorViewImpl extends ResizeComposite {
|
||||
@@ -23,7 +23,7 @@ public class CompetitorViewImpl extends ResizeComposite {
|
||||
@UiField
|
||||
Label subline2;
|
||||
|
||||
public CompetitorViewImpl(ImageProvider provider, CompetitorDTO competitor) {
|
||||
public CompetitorViewImpl(ImageProvider provider, CompetitorWithBoatDTO competitor) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
if (competitor.getBoat() != null && competitor.getBoat().getName() != null) {
|
||||
subline1.setText(competitor.getBoat().getName());
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import java.util.List;
|
||||
|
||||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.ui.AcceptsOneWidget;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.autoplay.client.app.AutoPlayClientFactory;
|
||||
import com.sap.sailing.gwt.autoplay.client.app.AutoPlayPresenterConfigured;
|
||||
|
||||
@@ -30,7 +30,7 @@ public class PreRaceCompetitorsPresenterImpl extends AutoPlayPresenterConfigured
|
||||
@Override
|
||||
public void startConfigured(AcceptsOneWidget panel) {
|
||||
view.startingWith(this, panel);
|
||||
List<CompetitorDTO> data = null;
|
||||
List<CompetitorWithBoatDTO> data = null;
|
||||
view.setCompetitors(data);
|
||||
selectionScroll.scheduleRepeating(DELAY_NEXT);
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ package com.sap.sailing.gwt.autoplay.client.places.screens.preliveraceloop.compe
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.user.client.ui.AcceptsOneWidget;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
|
||||
public interface PreRaceCompetitorsView {
|
||||
void startingWith(PreRaceCompetitorsPresenter p, AcceptsOneWidget panel);
|
||||
@@ -13,5 +13,5 @@ public interface PreRaceCompetitorsView {
|
||||
|
||||
void move();
|
||||
|
||||
void setCompetitors(List<CompetitorDTO> data);
|
||||
void setCompetitors(List<CompetitorWithBoatDTO> data);
|
||||
}
|
||||
+4
-4
@@ -11,7 +11,7 @@ import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.LayoutPanel;
|
||||
import com.google.gwt.user.client.ui.ResizeComposite;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.autoplay.client.places.screens.preliveraceloop.leaderboard.PreLiveRaceLeaderBoardWithImageViewImpl.ImageProvider;
|
||||
|
||||
public class PreRaceCompetitorsViewImpl extends ResizeComposite implements PreRaceCompetitorsView {
|
||||
@@ -44,15 +44,15 @@ public class PreRaceCompetitorsViewImpl extends ResizeComposite implements PreRa
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompetitors(List<CompetitorDTO> competitors) {
|
||||
for (CompetitorDTO competitor : competitors) {
|
||||
public void setCompetitors(List<CompetitorWithBoatDTO> competitors) {
|
||||
for (CompetitorWithBoatDTO competitor : competitors) {
|
||||
Widget w = createCompetitorElement(competitor);
|
||||
competitorSlider.add(w);
|
||||
}
|
||||
competitorSlider.forceLayout();
|
||||
}
|
||||
|
||||
private Widget createCompetitorElement(CompetitorDTO competitor) {
|
||||
private Widget createCompetitorElement(CompetitorWithBoatDTO competitor) {
|
||||
FlowPanel competitorPanel = new FlowPanel();
|
||||
competitorPanel.add(new CompetitorViewImpl(provider, competitor));
|
||||
return new Label(competitor.getName());
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ package com.sap.sailing.gwt.autoplay.client.places.screens.preliveraceloop.leade
|
||||
|
||||
import com.google.gwt.user.client.ui.AcceptsOneWidget;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.SingleRaceLeaderboardPanel;
|
||||
|
||||
public interface PreLeaderboardWithImageView {
|
||||
@@ -12,7 +12,7 @@ public interface PreLeaderboardWithImageView {
|
||||
|
||||
void setLeaderBoard(SingleRaceLeaderboardPanel leaderboardPanel);
|
||||
|
||||
void onCompetitorSelect(CompetitorDTO marked);
|
||||
void onCompetitorSelect(CompetitorWithBoatDTO marked);
|
||||
|
||||
void scrollLeaderBoardToTop();
|
||||
|
||||
|
||||
+4
-4
@@ -8,7 +8,7 @@ import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.ui.AcceptsOneWidget;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.LeaderboardRowDTO;
|
||||
import com.sap.sailing.gwt.autoplay.client.app.AnimationPanel;
|
||||
import com.sap.sailing.gwt.autoplay.client.app.AutoPlayClientFactory;
|
||||
@@ -35,7 +35,7 @@ public class PreLiveRaceLeaderBoardWithImagePresenterImpl
|
||||
private SingleRaceLeaderboardPanel leaderboardPanel;
|
||||
private Timer selectionTimer;
|
||||
private RaceCompetitorSelectionModel competitorSelectionProvider;
|
||||
ArrayList<CompetitorDTO> compList = new ArrayList<>();
|
||||
ArrayList<CompetitorWithBoatDTO> compList = new ArrayList<>();
|
||||
private com.sap.sse.gwt.client.player.Timer timer;
|
||||
|
||||
public PreLiveRaceLeaderBoardWithImagePresenterImpl(AbstractPreRaceLeaderBoardWithImagePlace place,
|
||||
@@ -61,7 +61,7 @@ public class PreLiveRaceLeaderBoardWithImagePresenterImpl
|
||||
return;
|
||||
}
|
||||
if (selected >= 0) {
|
||||
CompetitorDTO lastSelected = compList.get(selected);
|
||||
CompetitorWithBoatDTO lastSelected = compList.get(selected);
|
||||
competitorSelectionProvider.setSelected(lastSelected, false);
|
||||
}
|
||||
selected++;
|
||||
@@ -69,7 +69,7 @@ public class PreLiveRaceLeaderBoardWithImagePresenterImpl
|
||||
if (selected > compList.size() - 1) {
|
||||
selected = 0;
|
||||
}
|
||||
CompetitorDTO newSelected = compList.get(selected);
|
||||
CompetitorWithBoatDTO newSelected = compList.get(selected);
|
||||
competitorSelectionProvider.setSelected(newSelected, true);
|
||||
view.onCompetitorSelect(newSelected);
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
+3
-3
@@ -9,7 +9,7 @@ import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.ResizeComposite;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.leaderboard.SingleRaceLeaderboardPanel;
|
||||
import com.sap.sse.gwt.client.panels.ResizableFlowPanel;
|
||||
@@ -43,7 +43,7 @@ public class PreLiveRaceLeaderBoardWithImageViewImpl extends ResizeComposite imp
|
||||
|
||||
public interface ImageProvider {
|
||||
|
||||
String getImageUrl(CompetitorDTO marked);
|
||||
String getImageUrl(CompetitorWithBoatDTO marked);
|
||||
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class PreLiveRaceLeaderBoardWithImageViewImpl extends ResizeComposite imp
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompetitorSelect(CompetitorDTO selected) {
|
||||
public void onCompetitorSelect(CompetitorWithBoatDTO selected) {
|
||||
image.setUrl(provider.getImageUrl(selected));
|
||||
if (selected.getBoat() != null && selected.getBoat().getName() != null) {
|
||||
subline1.setText(selected.getBoat().getName());
|
||||
|
||||
Regular → Executable
+10
-15
@@ -12,7 +12,7 @@ import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.dto.AbstractLeaderboardDTO;
|
||||
import com.sap.sailing.domain.common.dto.BoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.FleetDTO;
|
||||
import com.sap.sailing.domain.common.dto.RaceColumnDTO;
|
||||
import com.sap.sailing.gwt.home.communication.SailingDispatchSystem;
|
||||
@@ -184,10 +184,10 @@ public class AutoplayHelper {
|
||||
|
||||
StrippedLeaderboardDTO selectedLeaderboard = AutoplayHelper.getSelectedLeaderboard(event, leaderBoardName);
|
||||
|
||||
sailingService.getCompetitorsOfLeaderboard(leaderBoardName, new AsyncCallback<Iterable<CompetitorDTO>>() {
|
||||
sailingService.getCompetitorsOfLeaderboard(leaderBoardName, new AsyncCallback<Iterable<CompetitorWithBoatDTO>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Iterable<CompetitorDTO> competitors) {
|
||||
public void onSuccess(Iterable<CompetitorWithBoatDTO> competitors) {
|
||||
RaceTimesInfoProvider creationTimeProvider = new RaceTimesInfoProvider(sailingService,
|
||||
asyncActionsExecutor, errorReporter, new ArrayList<RegattaAndRaceIdentifier>(), 1000l);
|
||||
|
||||
@@ -198,21 +198,19 @@ public class AutoplayHelper {
|
||||
public void raceTimesInfosReceived(Map<RegattaAndRaceIdentifier, RaceTimesInfoDTO> raceTimesInfo,
|
||||
long clientTimeWhenRequestWasSent, Date serverTimeDuringRequest,
|
||||
long clientTimeWhenResponseWasReceived) {
|
||||
|
||||
// keep the creationTime updated upon liveChanges!
|
||||
creationTimer.adjustClientServerOffset(clientTimeWhenRequestWasSent, serverTimeDuringRequest,
|
||||
clientTimeWhenResponseWasReceived);
|
||||
creationTimer
|
||||
.setLivePlayDelayInMillis(raceTimesInfo.get(regattaAndRaceIdentifier).delayToLiveInMs);
|
||||
creationTimer.play();
|
||||
|
||||
if (regattaAndRaceIdentifier != null) {
|
||||
if(!mapAlreadyCreated){
|
||||
if (!mapAlreadyCreated) {
|
||||
mapAlreadyCreated = true;
|
||||
sailingService.getCompetitorBoats(regattaAndRaceIdentifier,
|
||||
new AsyncCallback<Map<CompetitorDTO, BoatDTO>>() {
|
||||
new AsyncCallback<Map<CompetitorWithBoatDTO, BoatDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(Map<CompetitorDTO, BoatDTO> result) {
|
||||
public void onSuccess(Map<CompetitorWithBoatDTO, BoatDTO> result) {
|
||||
createRaceMapIfNotExist(regattaAndRaceIdentifier, selectedLeaderboard,
|
||||
result, competitors, sailingService,
|
||||
AutoplayHelper.asyncActionsExecutor, errorReporter, creationTimer,
|
||||
@@ -269,8 +267,8 @@ public class AutoplayHelper {
|
||||
}
|
||||
|
||||
private static void createRaceMapIfNotExist(RegattaAndRaceIdentifier currentLiveRace,
|
||||
StrippedLeaderboardDTO selectedLeaderboard, Map<CompetitorDTO, BoatDTO> result,
|
||||
Iterable<CompetitorDTO> competitors, SailingServiceAsync sailingService,
|
||||
StrippedLeaderboardDTO selectedLeaderboard, Map<CompetitorWithBoatDTO, BoatDTO> result,
|
||||
Iterable<CompetitorWithBoatDTO> competitors, SailingServiceAsync sailingService,
|
||||
AsyncActionsExecutor asyncActionsExecutor, ErrorReporter errorReporter, Timer raceboardTimer,
|
||||
AsyncCallback<RVWrapper> callback, long clientTimeWhenResponseWasReceived, Date serverTimeDuringRequest,
|
||||
long clientTimeWhenRequestWasSent, Map<RegattaAndRaceIdentifier, RaceTimesInfoDTO> raceTimesInfos,
|
||||
@@ -281,17 +279,14 @@ public class AutoplayHelper {
|
||||
typesToConsiderOnZoom.add(ZoomTypes.BUOYS);
|
||||
typesToConsiderOnZoom.add(ZoomTypes.BOATS);
|
||||
RaceMapZoomSettings autoFollowRace = new RaceMapZoomSettings(typesToConsiderOnZoom, true);
|
||||
|
||||
RaceMapSettings settings = new RaceMapSettings(autoFollowRace, new RaceMapHelpLinesSettings(), false, 15,
|
||||
100000l, false, RaceMapSettings.DEFAULT_BUOY_ZONE_RADIUS, false, true, false, false, false, false,
|
||||
RaceMapSettings.getDefaultManeuvers(), false, false);
|
||||
|
||||
RaceMapLifecycle raceMapLifecycle = new RaceMapLifecycle(StringMessages.INSTANCE);
|
||||
|
||||
final CompetitorColorProvider colorProvider = new CompetitorColorProviderImpl(currentLiveRace, result);
|
||||
RaceCompetitorSelectionModel competitorSelectionProvider = new RaceCompetitorSelectionModel(
|
||||
/* hasMultiSelection */ true, colorProvider);
|
||||
for (Entry<CompetitorDTO, BoatDTO> entry : result.entrySet()) {
|
||||
/* hasMultiSelection */ true, colorProvider, result);
|
||||
for (Entry<CompetitorWithBoatDTO, BoatDTO> entry : result.entrySet()) {
|
||||
competitorSelectionProvider.setBoat(entry.getKey(), entry.getValue());
|
||||
}
|
||||
competitorSelectionProvider.setCompetitors(competitors);
|
||||
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
package com.sap.sailing.gwt.autoplay.client.utils;
|
||||
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.autoplay.client.places.screens.preliveraceloop.leaderboard.PreLiveRaceLeaderBoardWithImageViewImpl.ImageProvider;
|
||||
|
||||
public class CompetitorImageProvider implements ImageProvider {
|
||||
|
||||
@Override
|
||||
public String getImageUrl(CompetitorDTO marked) {
|
||||
public String getImageUrl(CompetitorWithBoatDTO marked) {
|
||||
if (marked.getImageURL() != null) {
|
||||
return marked.getImageURL();
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
package com.sap.sailing.gwt.autoplay.client.utils;
|
||||
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.autoplay.client.places.screens.preliveraceloop.leaderboard.PreLiveRaceLeaderBoardWithImageViewImpl.ImageProvider;
|
||||
|
||||
public class FlagImageProvider implements ImageProvider {
|
||||
|
||||
@Override
|
||||
public String getImageUrl(CompetitorDTO marked) {
|
||||
public String getImageUrl(CompetitorWithBoatDTO marked) {
|
||||
if (marked.getFlagImageURL() != null) {
|
||||
return marked.getFlagImageURL();
|
||||
}
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ import java.io.Serializable;
|
||||
import com.google.gwt.core.shared.GwtIncompatible;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.Nationality;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.NamedDTO;
|
||||
import com.sap.sse.common.CountryCode;
|
||||
import com.sap.sse.gwt.dispatch.shared.commands.DTO;
|
||||
@@ -35,7 +35,7 @@ public class SimpleCompetitorDTO extends NamedDTO implements DTO, Serializable,
|
||||
}
|
||||
|
||||
@GwtIncompatible
|
||||
public SimpleCompetitorDTO(CompetitorDTO competitor) {
|
||||
public SimpleCompetitorDTO(CompetitorWithBoatDTO competitor) {
|
||||
super(competitor.getName());
|
||||
this.shortInfo = competitor.getShortInfo();
|
||||
if (shortInfo == null) {
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ package com.sap.sailing.gwt.home.communication.event;
|
||||
|
||||
import com.google.gwt.core.shared.GwtIncompatible;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
|
||||
public class SimpleCompetitorWithIdDTO extends SimpleCompetitorDTO {
|
||||
|
||||
@@ -20,7 +20,7 @@ public class SimpleCompetitorWithIdDTO extends SimpleCompetitorDTO {
|
||||
}
|
||||
|
||||
@GwtIncompatible
|
||||
public SimpleCompetitorWithIdDTO(CompetitorDTO competitor) {
|
||||
public SimpleCompetitorWithIdDTO(CompetitorWithBoatDTO competitor) {
|
||||
super(competitor);
|
||||
this.idAsString = competitor.getIdAsString();
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import java.util.ArrayList;
|
||||
|
||||
import com.google.gwt.core.shared.GwtIncompatible;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.CompetitorStore;
|
||||
import com.sap.sailing.domain.base.CompetitorAndBoatStore;
|
||||
import com.sap.sailing.gwt.home.communication.SailingAction;
|
||||
import com.sap.sailing.gwt.home.communication.SailingDispatchContext;
|
||||
import com.sap.sailing.gwt.home.communication.event.SimpleCompetitorWithIdDTO;
|
||||
@@ -37,7 +37,7 @@ public class GetCompetitorsAction implements SailingAction<SortedSetResult<Simpl
|
||||
@Override
|
||||
@GwtIncompatible
|
||||
public SortedSetResult<SimpleCompetitorWithIdDTO> execute(SailingDispatchContext ctx) throws DispatchException {
|
||||
CompetitorStore competitorStore = ctx.getRacingEventService().getCompetitorStore();
|
||||
CompetitorAndBoatStore competitorStore = ctx.getRacingEventService().getCompetitorStore();
|
||||
SortedSetResult<SimpleCompetitorWithIdDTO> result = new SortedSetResult<>();
|
||||
for (String id : ids) {
|
||||
Competitor competitor = competitorStore.getExistingCompetitorByIdAsString(id);
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ import java.util.List;
|
||||
|
||||
import com.google.gwt.core.shared.GwtIncompatible;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.CompetitorStore;
|
||||
import com.sap.sailing.domain.base.CompetitorAndBoatStore;
|
||||
import com.sap.sailing.gwt.home.communication.SailingAction;
|
||||
import com.sap.sailing.gwt.home.communication.SailingDispatchContext;
|
||||
import com.sap.sailing.gwt.home.communication.event.SimpleCompetitorWithIdDTO;
|
||||
@@ -33,7 +33,7 @@ public class SaveFavoriteCompetitorsAction implements SailingAction<VoidResult>
|
||||
public VoidResult execute(SailingDispatchContext ctx) throws DispatchException {
|
||||
CompetitorNotificationPreferences prefs = new CompetitorNotificationPreferences(ctx.getRacingEventService());
|
||||
List<CompetitorNotificationPreference> competitorPreferences = new ArrayList<>();
|
||||
CompetitorStore competitorStore = ctx.getRacingEventService().getCompetitorStore();
|
||||
CompetitorAndBoatStore competitorStore = ctx.getRacingEventService().getCompetitorStore();
|
||||
for (SimpleCompetitorWithIdDTO competitorDTO : favorites.getSelectedCompetitors()) {
|
||||
Competitor competitor = competitorStore.getExistingCompetitorByIdAsString(competitorDTO.getIdAsString());
|
||||
competitorPreferences.add(new CompetitorNotificationPreference(competitorStore, competitor,
|
||||
|
||||
+3
-3
@@ -12,7 +12,7 @@ import com.google.gwt.user.client.ui.AcceptsOneWidget;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.sap.sailing.domain.common.DetailType;
|
||||
import com.sap.sailing.domain.common.RaceIdentifier;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.LeaderboardDTO;
|
||||
import com.sap.sailing.domain.common.dto.RaceColumnDTO;
|
||||
import com.sap.sailing.gwt.common.client.controls.tabbar.TabView;
|
||||
@@ -149,8 +149,8 @@ public class RegattaCompetitorAnalyticsTabView extends SharedLeaderboardRegattaT
|
||||
int selectedCompetitorsCount = Util.size(competitorSelectionProvider.getSelectedCompetitors());
|
||||
|
||||
if(selectedCompetitorsCount == 0 && competitorsCount > MAX_COMPETITORS_IN_CHART) {
|
||||
List<CompetitorDTO> selectedCompetitors = new ArrayList<CompetitorDTO>();
|
||||
Iterator<CompetitorDTO> allCompetitorsIt = competitorSelectionProvider.getAllCompetitors().iterator();
|
||||
List<CompetitorWithBoatDTO> selectedCompetitors = new ArrayList<CompetitorWithBoatDTO>();
|
||||
Iterator<CompetitorWithBoatDTO> allCompetitorsIt = competitorSelectionProvider.getAllCompetitors().iterator();
|
||||
int counter = 0;
|
||||
while(counter < MAX_COMPETITORS_IN_CHART) {
|
||||
selectedCompetitors.add(allCompetitorsIt.next());
|
||||
|
||||
+3
-3
@@ -5,7 +5,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.common.DetailType;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.settings.client.leaderboard.MultiCompetitorLeaderboardChartSettings;
|
||||
import com.sap.sailing.gwt.settings.client.leaderboard.MultiRaceLeaderboardSettings;
|
||||
import com.sap.sailing.gwt.ui.client.CompetitorSelectionChangeListener;
|
||||
@@ -121,8 +121,8 @@ public class EventSeriesAnalyticsDataManager {
|
||||
int selectedCompetitorsCount = Util.size(competitorSelectionProvider.getSelectedCompetitors());
|
||||
|
||||
if(selectedCompetitorsCount == 0 && competitorsCount > MAX_COMPETITORS_IN_CHART) {
|
||||
List<CompetitorDTO> selectedCompetitors = new ArrayList<CompetitorDTO>();
|
||||
Iterator<CompetitorDTO> allCompetitorsIt = competitorSelectionProvider.getAllCompetitors().iterator();
|
||||
List<CompetitorWithBoatDTO> selectedCompetitors = new ArrayList<CompetitorWithBoatDTO>();
|
||||
Iterator<CompetitorWithBoatDTO> allCompetitorsIt = competitorSelectionProvider.getAllCompetitors().iterator();
|
||||
int counter = 0;
|
||||
while(counter < MAX_COMPETITORS_IN_CHART) {
|
||||
selectedCompetitors.add(allCompetitorsIt.next());
|
||||
|
||||
+3
-3
@@ -12,7 +12,7 @@ import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.sap.sailing.domain.common.DetailType;
|
||||
import com.sap.sailing.domain.common.RaceIdentifier;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.LeaderboardDTO;
|
||||
import com.sap.sailing.domain.common.dto.RaceColumnDTO;
|
||||
import com.sap.sailing.gwt.common.client.controls.tabbar.TabView;
|
||||
@@ -134,8 +134,8 @@ public class EventSeriesCompetitorAnalyticsTabView extends SharedLeaderboardEven
|
||||
int selectedCompetitorsCount = Util.size(competitorSelectionProvider.getSelectedCompetitors());
|
||||
|
||||
if(selectedCompetitorsCount == 0 && competitorsCount > MAX_COMPETITORS_IN_CHART) {
|
||||
List<CompetitorDTO> selectedCompetitors = new ArrayList<CompetitorDTO>();
|
||||
Iterator<CompetitorDTO> allCompetitorsIt = competitorSelectionProvider.getAllCompetitors().iterator();
|
||||
List<CompetitorWithBoatDTO> selectedCompetitors = new ArrayList<CompetitorWithBoatDTO>();
|
||||
Iterator<CompetitorWithBoatDTO> allCompetitorsIt = competitorSelectionProvider.getAllCompetitors().iterator();
|
||||
int counter = 0;
|
||||
while(counter < MAX_COMPETITORS_IN_CHART) {
|
||||
selectedCompetitors.add(allCompetitorsIt.next());
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ import com.sap.sailing.domain.base.Fleet;
|
||||
import com.sap.sailing.domain.base.RaceColumn;
|
||||
import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.LeaderboardDTO;
|
||||
import com.sap.sailing.domain.common.dto.LeaderboardEntryDTO;
|
||||
import com.sap.sailing.domain.common.dto.LeaderboardRowDTO;
|
||||
@@ -97,7 +97,7 @@ public class LeaderboardContext {
|
||||
result.setLive(isLive);
|
||||
|
||||
int rank = 0;
|
||||
for (CompetitorDTO competitor : leaderboardDTO.competitors) {
|
||||
for (CompetitorWithBoatDTO competitor : leaderboardDTO.competitors) {
|
||||
rank++;
|
||||
LeaderboardRowDTO row = leaderboardDTO.rows.get(competitor);
|
||||
int raceCount = 0;
|
||||
|
||||
+7
-7
@@ -4,20 +4,20 @@ import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sse.gwt.client.async.AsyncAction;
|
||||
|
||||
public abstract class AbstractGetMapRelatedDataAction<T> implements AsyncAction<T> {
|
||||
private final SailingServiceAsync sailingService;
|
||||
private final RegattaAndRaceIdentifier raceIdentifier;
|
||||
private final Map<CompetitorDTO, Date> from;
|
||||
private final Map<CompetitorDTO, Date> to;
|
||||
private final Map<CompetitorWithBoatDTO, Date> from;
|
||||
private final Map<CompetitorWithBoatDTO, Date> to;
|
||||
private final boolean extrapolate;
|
||||
|
||||
public AbstractGetMapRelatedDataAction(SailingServiceAsync sailingService,
|
||||
RegattaAndRaceIdentifier raceIdentifier, Map<CompetitorDTO, Date> from,
|
||||
Map<CompetitorDTO, Date> to, boolean extrapolate) {
|
||||
RegattaAndRaceIdentifier raceIdentifier, Map<CompetitorWithBoatDTO, Date> from,
|
||||
Map<CompetitorWithBoatDTO, Date> to, boolean extrapolate) {
|
||||
this.sailingService = sailingService;
|
||||
this.raceIdentifier = raceIdentifier;
|
||||
this.from = from;
|
||||
@@ -33,11 +33,11 @@ public abstract class AbstractGetMapRelatedDataAction<T> implements AsyncAction<
|
||||
return raceIdentifier;
|
||||
}
|
||||
|
||||
protected Map<CompetitorDTO, Date> getFrom() {
|
||||
protected Map<CompetitorWithBoatDTO, Date> getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
protected Map<CompetitorDTO, Date> getTo() {
|
||||
protected Map<CompetitorWithBoatDTO, Date> getTo() {
|
||||
return to;
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -6,14 +6,14 @@ import java.util.Map;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.shared.CompactBoatPositionsDTO;
|
||||
|
||||
public class GetBoatPositionsAction extends AbstractGetMapRelatedDataAction<CompactBoatPositionsDTO> {
|
||||
public GetBoatPositionsAction(SailingServiceAsync sailingService,
|
||||
RegattaAndRaceIdentifier raceIdentifier, Map<CompetitorDTO, Date> from,
|
||||
Map<CompetitorDTO, Date> to, boolean extrapolate) {
|
||||
RegattaAndRaceIdentifier raceIdentifier, Map<CompetitorWithBoatDTO, Date> from,
|
||||
Map<CompetitorWithBoatDTO, Date> to, boolean extrapolate) {
|
||||
super(sailingService, raceIdentifier, from, to, extrapolate);
|
||||
}
|
||||
|
||||
@@ -21,11 +21,11 @@ public class GetBoatPositionsAction extends AbstractGetMapRelatedDataAction<Comp
|
||||
public void execute(final AsyncCallback<CompactBoatPositionsDTO> callback) {
|
||||
Map<String, Date> fromByCompetitorIdAsString = new HashMap<String, Date>();
|
||||
System.out.println(fromByCompetitorIdAsString);
|
||||
for (Map.Entry<CompetitorDTO, Date> fromEntry : getFrom().entrySet()) {
|
||||
for (Map.Entry<CompetitorWithBoatDTO, Date> fromEntry : getFrom().entrySet()) {
|
||||
fromByCompetitorIdAsString.put(fromEntry.getKey().getIdAsString(), fromEntry.getValue());
|
||||
}
|
||||
Map<String, Date> toByCompetitorIdAsString = new HashMap<String, Date>();
|
||||
for (Map.Entry<CompetitorDTO, Date> toEntry : getTo().entrySet()) {
|
||||
for (Map.Entry<CompetitorWithBoatDTO, Date> toEntry : getTo().entrySet()) {
|
||||
toByCompetitorIdAsString.put(toEntry.getKey().getIdAsString(), toEntry.getValue());
|
||||
}
|
||||
getSailingService().getBoatPositions(getRaceIdentifier(), fromByCompetitorIdAsString, toByCompetitorIdAsString,
|
||||
|
||||
+3
-3
@@ -6,7 +6,7 @@ import java.util.List;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.domain.common.DetailType;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.shared.CompetitorsRaceDataDTO;
|
||||
import com.sap.sse.gwt.client.async.AsyncAction;
|
||||
@@ -14,7 +14,7 @@ import com.sap.sse.gwt.client.async.AsyncAction;
|
||||
public class GetCompetitorsRaceDataAction implements AsyncAction<CompetitorsRaceDataDTO> {
|
||||
private final SailingServiceAsync sailingService;
|
||||
private final RegattaAndRaceIdentifier raceIdentifier;
|
||||
private final List<CompetitorDTO> competitors;
|
||||
private final List<CompetitorWithBoatDTO> competitors;
|
||||
private final Date fromDate;
|
||||
private final Date toDate;
|
||||
private final long stepSizeInMs;
|
||||
@@ -23,7 +23,7 @@ public class GetCompetitorsRaceDataAction implements AsyncAction<CompetitorsRace
|
||||
private final String leaderboardName;
|
||||
|
||||
public GetCompetitorsRaceDataAction(SailingServiceAsync sailingService, RegattaAndRaceIdentifier raceIdentifier,
|
||||
List<CompetitorDTO> competitors, Date fromDate, Date toDate, long stepSizeInMs, DetailType detailType,
|
||||
List<CompetitorWithBoatDTO> competitors, Date fromDate, Date toDate, long stepSizeInMs, DetailType detailType,
|
||||
String leaderboardGroupName, String leaderboardName) {
|
||||
this.sailingService = sailingService;
|
||||
this.raceIdentifier = raceIdentifier;
|
||||
|
||||
+3
-3
@@ -5,12 +5,12 @@ import java.util.List;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.domain.common.DetailType;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.gwt.client.async.AsyncAction;
|
||||
|
||||
public class GetLeaderboardDataEntriesAction implements AsyncAction<List<Util.Triple<String, List<CompetitorDTO>, List<Double>>>> {
|
||||
public class GetLeaderboardDataEntriesAction implements AsyncAction<List<Util.Triple<String, List<CompetitorWithBoatDTO>, List<Double>>>> {
|
||||
private final SailingServiceAsync sailingService;
|
||||
private final DetailType detailType;
|
||||
private final String leaderboardName;
|
||||
@@ -24,7 +24,7 @@ public class GetLeaderboardDataEntriesAction implements AsyncAction<List<Util.Tr
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(AsyncCallback<List<Util.Triple<String, List<CompetitorDTO>, List<Double>>>> callback) {
|
||||
public void execute(AsyncCallback<List<Util.Triple<String, List<CompetitorWithBoatDTO>, List<Double>>>> callback) {
|
||||
sailingService.getLeaderboardDataEntriesForAllRaceColumns(leaderboardName, date, detailType, callback);
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -7,22 +7,22 @@ import java.util.Map;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.domain.common.LegIdentifier;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.shared.CompactRaceMapDataDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.RaceMapDataDTO;
|
||||
|
||||
public class GetRaceMapDataAction extends AbstractGetMapRelatedDataAction<RaceMapDataDTO> {
|
||||
private final Map<String, CompetitorDTO> competitorsByIdAsString;
|
||||
private final Map<String, CompetitorWithBoatDTO> competitorsByIdAsString;
|
||||
private final Date date;
|
||||
private final LegIdentifier simulationLegIdentifier;
|
||||
private final byte[] md5OfIdsAsStringOfCompetitorParticipatingInRaceInAlphanumericOrderOfTheirID;
|
||||
private Date timeForEstimation;
|
||||
private boolean targetEstimationRequired;
|
||||
|
||||
public GetRaceMapDataAction(SailingServiceAsync sailingService, Map<String, CompetitorDTO> competitorsByIdAsString,
|
||||
RegattaAndRaceIdentifier raceIdentifier, Date date, Map<CompetitorDTO, Date> from,
|
||||
Map<CompetitorDTO, Date> to, boolean extrapolate, LegIdentifier simulationLegIdentifier,
|
||||
public GetRaceMapDataAction(SailingServiceAsync sailingService, Map<String, CompetitorWithBoatDTO> competitorsByIdAsString,
|
||||
RegattaAndRaceIdentifier raceIdentifier, Date date, Map<CompetitorWithBoatDTO, Date> from,
|
||||
Map<CompetitorWithBoatDTO, Date> to, boolean extrapolate, LegIdentifier simulationLegIdentifier,
|
||||
byte[] md5OfIdsAsStringOfCompetitorParticipatingInRaceInAlphanumericOrderOfTheirID,Date timeForEstimation, boolean targetEstimationRequired) {
|
||||
super(sailingService, raceIdentifier, from, to, extrapolate);
|
||||
this.competitorsByIdAsString = competitorsByIdAsString;
|
||||
@@ -36,11 +36,11 @@ public class GetRaceMapDataAction extends AbstractGetMapRelatedDataAction<RaceMa
|
||||
@Override
|
||||
public void execute(final AsyncCallback<RaceMapDataDTO> callback) {
|
||||
Map<String, Date> fromByCompetitorIdAsString = new HashMap<String, Date>();
|
||||
for (Map.Entry<CompetitorDTO, Date> fromEntry : getFrom().entrySet()) {
|
||||
for (Map.Entry<CompetitorWithBoatDTO, Date> fromEntry : getFrom().entrySet()) {
|
||||
fromByCompetitorIdAsString.put(fromEntry.getKey().getIdAsString(), fromEntry.getValue());
|
||||
}
|
||||
Map<String, Date> toByCompetitorIdAsString = new HashMap<String, Date>();
|
||||
for (Map.Entry<CompetitorDTO, Date> toEntry : getTo().entrySet()) {
|
||||
for (Map.Entry<CompetitorWithBoatDTO, Date> toEntry : getTo().entrySet()) {
|
||||
toByCompetitorIdAsString.put(toEntry.getKey().getIdAsString(), toEntry.getValue());
|
||||
}
|
||||
getSailingService().getRaceMapData(getRaceIdentifier(), date, fromByCompetitorIdAsString, toByCompetitorIdAsString,
|
||||
|
||||
+6
-6
@@ -6,13 +6,13 @@ import java.util.function.Consumer;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sse.gwt.client.ErrorReporter;
|
||||
import com.sap.sse.gwt.client.dialog.DataEntryDialog;
|
||||
|
||||
public abstract class AbstractCompetitorRegistrationDialog extends DataEntryDialog<Set<CompetitorDTO>> {
|
||||
public abstract class AbstractCompetitorRegistrationDialog extends DataEntryDialog<Set<CompetitorWithBoatDTO>> {
|
||||
protected final ErrorReporter errorReporter;
|
||||
protected final SailingServiceAsync sailingService;
|
||||
protected final StringMessages stringMessages;
|
||||
@@ -22,9 +22,9 @@ public abstract class AbstractCompetitorRegistrationDialog extends DataEntryDial
|
||||
|
||||
public AbstractCompetitorRegistrationDialog(SailingServiceAsync sailingService, StringMessages stringMessages,
|
||||
ErrorReporter errorReporter, boolean editable,
|
||||
com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback<Set<CompetitorDTO>> callback,
|
||||
com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback<Set<CompetitorWithBoatDTO>> callback,
|
||||
String leaderboardName, boolean canBoatsOfCompetitorsChangePerRace, String boatClass, String okButtonMessage,
|
||||
Validator<Set<CompetitorDTO>> validator) {
|
||||
Validator<Set<CompetitorWithBoatDTO>> validator) {
|
||||
super(stringMessages.registerCompetitors(), /* messsage */null, okButtonMessage, stringMessages.cancel(),
|
||||
validator, callback);
|
||||
this.errorReporter = errorReporter;
|
||||
@@ -42,11 +42,11 @@ public abstract class AbstractCompetitorRegistrationDialog extends DataEntryDial
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<CompetitorDTO> getResult() {
|
||||
protected Set<CompetitorWithBoatDTO> getResult() {
|
||||
return competitorRegistrationsPanel.getResult();
|
||||
}
|
||||
|
||||
protected abstract Consumer<AsyncCallback<Collection<CompetitorDTO>>> getRegisteredCompetitorsRetriever();
|
||||
protected abstract Consumer<AsyncCallback<Collection<CompetitorWithBoatDTO>>> getRegisteredCompetitorsRetriever();
|
||||
|
||||
protected abstract Widget[] getAdditionalWidgetsToInsertAboveCompetitorTables(StringMessages stringMessages);
|
||||
}
|
||||
+8
-8
@@ -4,9 +4,9 @@ import com.google.gwt.user.client.ui.FocusWidget;
|
||||
import com.google.gwt.user.client.ui.SuggestBox;
|
||||
import com.google.gwt.user.client.ui.TextBox;
|
||||
import com.sap.sailing.domain.common.dto.BoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTOImpl;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTOImpl;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithoutBoatDTO;
|
||||
import com.sap.sailing.gwt.common.client.suggestion.BoatClassMasterdataSuggestOracle;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
|
||||
@@ -31,7 +31,7 @@ public abstract class AbstractCompetitorWithBoatDialog extends CompetitorEditDia
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage(CompetitorDTO competitorToValidate) {
|
||||
public String getErrorMessage(CompetitorWithBoatDTO competitorToValidate) {
|
||||
String result = super.getErrorMessage(competitorToValidate);
|
||||
if (result == null) {
|
||||
BoatDTO boatToValidate = competitorToValidate.getBoat();
|
||||
@@ -58,8 +58,8 @@ public abstract class AbstractCompetitorWithBoatDialog extends CompetitorEditDia
|
||||
* The boat class is the default shown boat class for new boats. Set <code>null</code> if your boat is
|
||||
* already initialized or you don't want a default boat class.
|
||||
*/
|
||||
public AbstractCompetitorWithBoatDialog(String dialogTitle, StringMessages stringMessages, CompetitorDTO competitorToEdit,
|
||||
DialogCallback<CompetitorDTO> callback, String boatClass) {
|
||||
public AbstractCompetitorWithBoatDialog(String dialogTitle, StringMessages stringMessages, CompetitorWithBoatDTO competitorToEdit,
|
||||
DialogCallback<CompetitorWithBoatDTO> callback, String boatClass) {
|
||||
super(dialogTitle, stringMessages, competitorToEdit, new AbstractCompetitorWithBoatDialog.CompetitorWithBoatValidator(stringMessages), callback);
|
||||
|
||||
final BoatDTO boatToEdit = competitorToEdit.getBoat();
|
||||
@@ -86,10 +86,10 @@ public abstract class AbstractCompetitorWithBoatDialog extends CompetitorEditDia
|
||||
protected abstract BoatDTO getBoat();
|
||||
|
||||
@Override
|
||||
protected CompetitorDTO getResult() {
|
||||
CompetitorWithoutBoatDTO c = super.getResult();
|
||||
protected CompetitorWithBoatDTO getResult() {
|
||||
CompetitorDTO c = super.getResult();
|
||||
BoatDTO boat = getBoat();
|
||||
CompetitorDTO result = new CompetitorDTOImpl(c.getName(), c.getShortName(), c.getColor(), c.getEmail(),
|
||||
CompetitorWithBoatDTO result = new CompetitorWithBoatDTOImpl(c.getName(), c.getShortName(), c.getColor(), c.getEmail(),
|
||||
c.getTwoLetterIsoCountryCode(), c.getThreeLetterIocCountryCode(), c.getCountryName(),
|
||||
getCompetitorToEdit().getIdAsString(),
|
||||
c.getImageURL(), c.getFlagImageURL(),
|
||||
|
||||
+9
-9
@@ -14,7 +14,7 @@ import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.google.gwt.view.client.SingleSelectionModel;
|
||||
import com.sap.sailing.domain.common.dto.BoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.racelog.tracking.MappableToDevice;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
@@ -32,12 +32,12 @@ public class AbstractRegattaLogFixesAddMappingsDialog extends DataEntryDialog<Co
|
||||
private final StringMessages stringMessages;
|
||||
private final SimplePanel importWidgetHolder;
|
||||
protected final TrackFileImportDeviceIdentifierTableWrapper deviceIdTable;
|
||||
private final CompetitorTableWrapper<RefreshableSingleSelectionModel<CompetitorDTO>> competitorTable;
|
||||
private final CompetitorTableWrapper<RefreshableSingleSelectionModel<CompetitorWithBoatDTO>> competitorTable;
|
||||
private final MarkTableWrapper<RefreshableSingleSelectionModel<MarkDTO>> markTable;
|
||||
private final BoatTableWrapper<RefreshableSingleSelectionModel<BoatDTO>> boatTable;
|
||||
|
||||
private TrackFileImportDeviceIdentifierDTO deviceToSelect;
|
||||
private CompetitorDTO compToSelect;
|
||||
private CompetitorWithBoatDTO compToSelect;
|
||||
private MarkDTO markToSelect;
|
||||
private BoatDTO boatToSelect;
|
||||
private boolean inInstableTransitionState = false;
|
||||
@@ -108,9 +108,9 @@ public class AbstractRegattaLogFixesAddMappingsDialog extends DataEntryDialog<Co
|
||||
|
||||
private void getCompetitorRegistrations(SailingServiceAsync sailingService, final ErrorReporter errorReporter) {
|
||||
sailingService.getCompetitorRegistrationsForLeaderboard(leaderboardName,
|
||||
new AsyncCallback<Collection<CompetitorDTO>>() {
|
||||
new AsyncCallback<Collection<CompetitorWithBoatDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(Collection<CompetitorDTO> result) {
|
||||
public void onSuccess(Collection<CompetitorWithBoatDTO> result) {
|
||||
competitorTable.refreshCompetitorList(result);
|
||||
}
|
||||
|
||||
@@ -157,8 +157,8 @@ public class AbstractRegattaLogFixesAddMappingsDialog extends DataEntryDialog<Co
|
||||
if (!inInstableTransitionState) {
|
||||
deviceIdTable.setMappedObjectForSelectedDevice(mappedTo);
|
||||
|
||||
if (mappedTo instanceof CompetitorDTO) {
|
||||
compToSelect = (CompetitorDTO) mappedTo;
|
||||
if (mappedTo instanceof CompetitorWithBoatDTO) {
|
||||
compToSelect = (CompetitorWithBoatDTO) mappedTo;
|
||||
boatToSelect = null;
|
||||
markToSelect = null;
|
||||
} else if (mappedTo instanceof BoatDTO) {
|
||||
@@ -184,8 +184,8 @@ public class AbstractRegattaLogFixesAddMappingsDialog extends DataEntryDialog<Co
|
||||
|
||||
if (deviceId != null) {
|
||||
final MappableToDevice mappedTo = deviceIdTable.getMappedObjectForDeviceId(deviceId);
|
||||
if (mappedTo instanceof CompetitorDTO) {
|
||||
compToSelect = (CompetitorDTO) mappedTo;
|
||||
if (mappedTo instanceof CompetitorWithBoatDTO) {
|
||||
compToSelect = (CompetitorWithBoatDTO) mappedTo;
|
||||
} else if (mappedTo instanceof BoatDTO) {
|
||||
boatToSelect = (BoatDTO) mappedTo;
|
||||
} else if (mappedTo instanceof MarkDTO) {
|
||||
|
||||
+9
-9
@@ -13,7 +13,7 @@ import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.google.gwt.view.client.SingleSelectionModel;
|
||||
import com.sap.sailing.domain.common.dto.BoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.racelog.tracking.MappableToDevice;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
@@ -30,11 +30,11 @@ public abstract class AbstractRegattaLogSensorDataAddMappingsDialog extends Data
|
||||
private final SimplePanel importWidgetHolder;
|
||||
protected final TrackFileImportDeviceIdentifierTableWrapper deviceIdTable;
|
||||
private final BoatTableWrapper<RefreshableSingleSelectionModel<BoatDTO>> boatTable;
|
||||
private final CompetitorTableWrapper<RefreshableSingleSelectionModel<CompetitorDTO>> competitorTable;
|
||||
private final CompetitorTableWrapper<RefreshableSingleSelectionModel<CompetitorWithBoatDTO>> competitorTable;
|
||||
private final StringMessages stringMessages;
|
||||
|
||||
private TrackFileImportDeviceIdentifierDTO deviceToSelect;
|
||||
private CompetitorDTO compToSelect;
|
||||
private CompetitorWithBoatDTO compToSelect;
|
||||
private BoatDTO boatToSelect;
|
||||
private boolean inInstableTransitionState = false;
|
||||
|
||||
@@ -92,9 +92,9 @@ public abstract class AbstractRegattaLogSensorDataAddMappingsDialog extends Data
|
||||
|
||||
private void getCompetitorRegistrations(SailingServiceAsync sailingService, final ErrorReporter errorReporter) {
|
||||
sailingService.getCompetitorRegistrationsForLeaderboard(leaderboardName,
|
||||
new AsyncCallback<Collection<CompetitorDTO>>() {
|
||||
new AsyncCallback<Collection<CompetitorWithBoatDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(Collection<CompetitorDTO> result) {
|
||||
public void onSuccess(Collection<CompetitorWithBoatDTO> result) {
|
||||
competitorTable.refreshCompetitorList(result);
|
||||
}
|
||||
|
||||
@@ -174,8 +174,8 @@ public abstract class AbstractRegattaLogSensorDataAddMappingsDialog extends Data
|
||||
if (!inInstableTransitionState) {
|
||||
deviceIdTable.setMappedObjectForSelectedDevice(mappedTo);
|
||||
|
||||
if (mappedTo instanceof CompetitorDTO) {
|
||||
compToSelect = (CompetitorDTO) mappedTo;
|
||||
if (mappedTo instanceof CompetitorWithBoatDTO) {
|
||||
compToSelect = (CompetitorWithBoatDTO) mappedTo;
|
||||
boatToSelect = null;
|
||||
} else if (mappedTo instanceof BoatDTO) {
|
||||
compToSelect = null;
|
||||
@@ -194,8 +194,8 @@ public abstract class AbstractRegattaLogSensorDataAddMappingsDialog extends Data
|
||||
|
||||
if (deviceId != null) {
|
||||
final MappableToDevice mappedTo = deviceIdTable.getMappedObjectForDeviceId(deviceId);
|
||||
if (mappedTo instanceof CompetitorDTO) {
|
||||
compToSelect = (CompetitorDTO) mappedTo;
|
||||
if (mappedTo instanceof CompetitorWithBoatDTO) {
|
||||
compToSelect = (CompetitorWithBoatDTO) mappedTo;
|
||||
} else if (mappedTo instanceof BoatDTO) {
|
||||
boatToSelect = (BoatDTO) mappedTo;
|
||||
}
|
||||
|
||||
+3
-3
@@ -14,7 +14,7 @@ import com.google.gwt.user.cellview.client.TextColumn;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.sap.sailing.domain.common.dto.BoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.adminconsole.ColorColumn.ColorRetriever;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
@@ -180,14 +180,14 @@ public class CompactBoatTableWrapper<S extends RefreshableSelectionModel<BoatDTO
|
||||
}
|
||||
|
||||
public void refreshBoatListFromRace(String leaderboardName, String raceColumnName, String fleetName) {
|
||||
final AsyncCallback<Map<CompetitorDTO, BoatDTO>> myCallback = new AsyncCallback<Map<CompetitorDTO, BoatDTO>>() {
|
||||
final AsyncCallback<Map<CompetitorWithBoatDTO, BoatDTO>> myCallback = new AsyncCallback<Map<CompetitorWithBoatDTO, BoatDTO>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Remote Procedure Call refreshBoatListFromRace() - Failure: " + caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Map<CompetitorDTO, BoatDTO> result) {
|
||||
public void onSuccess(Map<CompetitorWithBoatDTO, BoatDTO> result) {
|
||||
filterBoats(result.values());
|
||||
}
|
||||
};
|
||||
|
||||
+32
-32
@@ -16,7 +16,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.ImageResourceRenderer;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.sap.sailing.domain.common.dto.BoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.FlagImageResolverImpl;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
@@ -36,57 +36,57 @@ import com.sap.sse.gwt.client.panels.LabeledAbstractFilterablePanel;
|
||||
*
|
||||
* @param <S>
|
||||
*/
|
||||
public class CompactCompetitorTableWrapper<S extends RefreshableSelectionModel<CompetitorDTO>> extends TableWrapper<CompetitorDTO, S> {
|
||||
private final LabeledAbstractFilterablePanel<CompetitorDTO> filterField;
|
||||
public class CompactCompetitorTableWrapper<S extends RefreshableSelectionModel<CompetitorWithBoatDTO>> extends TableWrapper<CompetitorWithBoatDTO, S> {
|
||||
private final LabeledAbstractFilterablePanel<CompetitorWithBoatDTO> filterField;
|
||||
|
||||
public CompactCompetitorTableWrapper(SailingServiceAsync sailingService, StringMessages stringMessages, ErrorReporter errorReporter,
|
||||
boolean multiSelection, boolean enablePager) {
|
||||
super(sailingService, stringMessages, errorReporter, multiSelection, enablePager,
|
||||
new EntityIdentityComparator<CompetitorDTO>() {
|
||||
new EntityIdentityComparator<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public boolean representSameEntity(CompetitorDTO dto1, CompetitorDTO dto2) {
|
||||
public boolean representSameEntity(CompetitorWithBoatDTO dto1, CompetitorWithBoatDTO dto2) {
|
||||
return dto1.getIdAsString().equals(dto2.getIdAsString());
|
||||
}
|
||||
@Override
|
||||
public int hashCode(CompetitorDTO t) {
|
||||
public int hashCode(CompetitorWithBoatDTO t) {
|
||||
return t.getIdAsString().hashCode();
|
||||
}
|
||||
});
|
||||
ListHandler<CompetitorDTO> competitorColumnListHandler = getColumnSortHandler();
|
||||
ListHandler<CompetitorWithBoatDTO> competitorColumnListHandler = getColumnSortHandler();
|
||||
|
||||
// competitors table
|
||||
TextColumn<CompetitorDTO> competitorNameColumn = new TextColumn<CompetitorDTO>() {
|
||||
TextColumn<CompetitorWithBoatDTO> competitorNameColumn = new TextColumn<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public String getValue(CompetitorDTO competitor) {
|
||||
public String getValue(CompetitorWithBoatDTO competitor) {
|
||||
return competitor.getName();
|
||||
}
|
||||
};
|
||||
competitorNameColumn.setSortable(true);
|
||||
competitorColumnListHandler.setComparator(competitorNameColumn, new Comparator<CompetitorDTO>() {
|
||||
competitorColumnListHandler.setComparator(competitorNameColumn, new Comparator<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public int compare(CompetitorDTO o1, CompetitorDTO o2) {
|
||||
public int compare(CompetitorWithBoatDTO o1, CompetitorWithBoatDTO o2) {
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
}
|
||||
});
|
||||
|
||||
TextColumn<CompetitorDTO> competitorShortNameColumn = new TextColumn<CompetitorDTO>() {
|
||||
TextColumn<CompetitorWithBoatDTO> competitorShortNameColumn = new TextColumn<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public String getValue(CompetitorDTO competitor) {
|
||||
public String getValue(CompetitorWithBoatDTO competitor) {
|
||||
return competitor.getShortName();
|
||||
}
|
||||
};
|
||||
competitorShortNameColumn.setSortable(true);
|
||||
competitorColumnListHandler.setComparator(competitorShortNameColumn, new Comparator<CompetitorDTO>() {
|
||||
competitorColumnListHandler.setComparator(competitorShortNameColumn, new Comparator<CompetitorWithBoatDTO>() {
|
||||
private final NaturalComparator comparator = new NaturalComparator(/* case sensitive */ false);
|
||||
@Override
|
||||
public int compare(CompetitorDTO o1, CompetitorDTO o2) {
|
||||
public int compare(CompetitorWithBoatDTO o1, CompetitorWithBoatDTO o2) {
|
||||
return comparator.compare(o1.getShortName(), o2.getShortName());
|
||||
}
|
||||
});
|
||||
|
||||
Column<CompetitorDTO, SafeHtml> flagImageColumn = new Column<CompetitorDTO, SafeHtml>(new SafeHtmlCell()) {
|
||||
Column<CompetitorWithBoatDTO, SafeHtml> flagImageColumn = new Column<CompetitorWithBoatDTO, SafeHtml>(new SafeHtmlCell()) {
|
||||
@Override
|
||||
public SafeHtml getValue(CompetitorDTO competitor) {
|
||||
public SafeHtml getValue(CompetitorWithBoatDTO competitor) {
|
||||
SafeHtmlBuilder sb = new SafeHtmlBuilder();
|
||||
ImageResourceRenderer renderer = new ImageResourceRenderer();
|
||||
final String twoLetterIsoCountryCode = competitor.getTwoLetterIsoCountryCode();
|
||||
@@ -110,32 +110,32 @@ public class CompactCompetitorTableWrapper<S extends RefreshableSelectionModel<C
|
||||
}
|
||||
};
|
||||
|
||||
TextColumn<CompetitorDTO> competitorSearchTagColumn = new TextColumn<CompetitorDTO>() {
|
||||
TextColumn<CompetitorWithBoatDTO> competitorSearchTagColumn = new TextColumn<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public String getValue(CompetitorDTO competitor) {
|
||||
public String getValue(CompetitorWithBoatDTO competitor) {
|
||||
return competitor.getSearchTag();
|
||||
}
|
||||
};
|
||||
competitorSearchTagColumn.setSortable(true);
|
||||
competitorColumnListHandler.setComparator(competitorSearchTagColumn, new Comparator<CompetitorDTO>() {
|
||||
competitorColumnListHandler.setComparator(competitorSearchTagColumn, new Comparator<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public int compare(CompetitorDTO o1, CompetitorDTO o2) {
|
||||
public int compare(CompetitorWithBoatDTO o1, CompetitorWithBoatDTO o2) {
|
||||
return new NaturalComparator(false).compare(o1.getSearchTag(), o2.getSearchTag());
|
||||
}
|
||||
});
|
||||
|
||||
TextColumn<CompetitorDTO> isBoatLinkedColumn = new TextColumn<CompetitorDTO>() {
|
||||
TextColumn<CompetitorWithBoatDTO> isBoatLinkedColumn = new TextColumn<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public String getValue(CompetitorDTO competitor) {
|
||||
public String getValue(CompetitorWithBoatDTO competitor) {
|
||||
boolean hasBoat = competitor.getBoat() != null;
|
||||
return hasBoat ? stringMessages.yes() : stringMessages.no();
|
||||
}
|
||||
};
|
||||
|
||||
filterField = new LabeledAbstractFilterablePanel<CompetitorDTO>(new Label(stringMessages.filterCompetitors()),
|
||||
new ArrayList<CompetitorDTO>(), table, dataProvider) {
|
||||
filterField = new LabeledAbstractFilterablePanel<CompetitorWithBoatDTO>(new Label(stringMessages.filterCompetitors()),
|
||||
new ArrayList<CompetitorWithBoatDTO>(), table, dataProvider) {
|
||||
@Override
|
||||
public Iterable<String> getSearchableStrings(CompetitorDTO t) {
|
||||
public Iterable<String> getSearchableStrings(CompetitorWithBoatDTO t) {
|
||||
List<String> string = new ArrayList<String>();
|
||||
string.add(t.getName());
|
||||
string.add(t.getShortName());
|
||||
@@ -155,34 +155,34 @@ public class CompactCompetitorTableWrapper<S extends RefreshableSelectionModel<C
|
||||
table.ensureDebugId("CompactCompetitorsTable");
|
||||
}
|
||||
|
||||
public Iterable<CompetitorDTO> getAllCompetitors() {
|
||||
public Iterable<CompetitorWithBoatDTO> getAllCompetitors() {
|
||||
return filterField.getAll();
|
||||
}
|
||||
|
||||
public LabeledAbstractFilterablePanel<CompetitorDTO> getFilterField() {
|
||||
public LabeledAbstractFilterablePanel<CompetitorWithBoatDTO> getFilterField() {
|
||||
return filterField;
|
||||
}
|
||||
|
||||
public void refreshCompetitorList(Iterable<CompetitorDTO> competitors) {
|
||||
public void refreshCompetitorList(Iterable<CompetitorWithBoatDTO> competitors) {
|
||||
getFilteredCompetitors(competitors);
|
||||
}
|
||||
|
||||
public void refreshCompetitorListFromRace(String leaderboardName, String raceColumnName, String fleetName) {
|
||||
final AsyncCallback<Map<CompetitorDTO, BoatDTO>> myCallback = new AsyncCallback<Map<CompetitorDTO, BoatDTO>>() {
|
||||
final AsyncCallback<Map<CompetitorWithBoatDTO, BoatDTO>> myCallback = new AsyncCallback<Map<CompetitorWithBoatDTO, BoatDTO>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Remote Procedure Call getCompetitors() - Failure: " + caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Map<CompetitorDTO, BoatDTO> result) {
|
||||
public void onSuccess(Map<CompetitorWithBoatDTO, BoatDTO> result) {
|
||||
refreshCompetitorList(result.keySet());
|
||||
}
|
||||
};
|
||||
sailingService.getCompetitorsAndBoatsOfRace(leaderboardName, raceColumnName, fleetName, myCallback);
|
||||
}
|
||||
|
||||
private void getFilteredCompetitors(Iterable<CompetitorDTO> result) {
|
||||
private void getFilteredCompetitors(Iterable<CompetitorWithBoatDTO> result) {
|
||||
filterField.updateAll(result);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -17,7 +17,7 @@ import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
|
||||
import com.google.gwt.user.cellview.client.TextColumn;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.sap.sailing.domain.common.CompetitorDescriptor;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.FlagImageResolverImpl;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
@@ -86,7 +86,7 @@ public class CompetitorDescriptorTableWrapper<S extends RefreshableSelectionMode
|
||||
*/
|
||||
public static interface CompetitorsToImportToExistingLinking {
|
||||
void unlinkCompetitor(CompetitorDescriptor competitor);
|
||||
CompetitorDTO getExistingCompetitorToUseInsteadOf(CompetitorDescriptor competitor);
|
||||
CompetitorWithBoatDTO getExistingCompetitorToUseInsteadOf(CompetitorDescriptor competitor);
|
||||
}
|
||||
|
||||
public CompetitorDescriptorTableWrapper(CompetitorImportMatcher competitorImportMatcherParam,
|
||||
@@ -224,7 +224,7 @@ public class CompetitorDescriptorTableWrapper<S extends RefreshableSelectionMode
|
||||
ImagesBarColumn<CompetitorDescriptor, CompetitorImportTableActionIcons> unlinkColumn, CompetitorsToImportToExistingLinking unlinkCallback) {
|
||||
ListHandler<CompetitorDescriptor> competitorColumnListHandler = getColumnSortHandler();
|
||||
final NaturalComparator caseInsensitiveNaturalComparator = new NaturalComparator(/* case sensitive */ false);
|
||||
final Comparator<CompetitorDTO> nullFirstComparator = Comparator.nullsFirst(/* real comparator */ null);
|
||||
final Comparator<CompetitorWithBoatDTO> nullFirstComparator = Comparator.nullsFirst(/* real comparator */ null);
|
||||
competitorColumnListHandler.setComparator(competitorNameColumn, (cd1, cd2)->caseInsensitiveNaturalComparator.compare(cd1.getName(), cd2.getName()));
|
||||
competitorColumnListHandler.setComparator(boatClassNameColumn, (cd1, cd2)->caseInsensitiveNaturalComparator.compare(cd1.getBoatClassName(), cd2.getBoatClassName()));
|
||||
competitorColumnListHandler.setComparator(sailIdColumn, (cd1, cd2)->caseInsensitiveNaturalComparator.compare(cd1.getSailNumber(), cd2.getSailNumber()));
|
||||
|
||||
+16
-16
@@ -12,8 +12,8 @@ import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.ListBox;
|
||||
import com.google.gwt.user.client.ui.TextBox;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTOImpl;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTOImpl;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.CountryCode;
|
||||
@@ -26,15 +26,15 @@ import com.sap.sse.gwt.client.dialog.DataEntryDialog;
|
||||
|
||||
/**
|
||||
* The competitors produced by this dialog will have a <code>null</code>
|
||||
* {@link CompetitorDTO#getTwoLetterIsoCountryCode() twoLetterIsoCountryCode} and a <code>null</code>
|
||||
* {@link CompetitorDTO#getCountryName() countryName} because all of these can be derived from a valid
|
||||
* {@link CompetitorDTO#getThreeLetterIocCountryCode() threeLetterIocCountryCode}.
|
||||
* {@link CompetitorWithBoatDTO#getTwoLetterIsoCountryCode() twoLetterIsoCountryCode} and a <code>null</code>
|
||||
* {@link CompetitorWithBoatDTO#getCountryName() countryName} because all of these can be derived from a valid
|
||||
* {@link CompetitorWithBoatDTO#getThreeLetterIocCountryCode() threeLetterIocCountryCode}.
|
||||
*
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public class CompetitorEditDialog extends DataEntryDialog<CompetitorDTO> {
|
||||
private final CompetitorDTO competitorToEdit;
|
||||
public class CompetitorEditDialog extends DataEntryDialog<CompetitorWithBoatDTO> {
|
||||
private final CompetitorWithBoatDTO competitorToEdit;
|
||||
private final TextBox name;
|
||||
private final TextBox shortName;
|
||||
private final TextBox displayColorTextBox;
|
||||
@@ -48,7 +48,7 @@ public class CompetitorEditDialog extends DataEntryDialog<CompetitorDTO> {
|
||||
private final DoubleBox timeOnTimeFactor;
|
||||
private final DoubleBox timeOnDistanceAllowanceInSecondsPerNauticalMile;
|
||||
|
||||
protected static class CompetitorWithoutBoatValidator implements Validator<CompetitorDTO> {
|
||||
protected static class CompetitorWithoutBoatValidator implements Validator<CompetitorWithBoatDTO> {
|
||||
protected final StringMessages stringMessages;
|
||||
|
||||
public CompetitorWithoutBoatValidator(StringMessages stringMessages) {
|
||||
@@ -56,7 +56,7 @@ public class CompetitorEditDialog extends DataEntryDialog<CompetitorDTO> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage(CompetitorDTO valueToValidate) {
|
||||
public String getErrorMessage(CompetitorWithBoatDTO valueToValidate) {
|
||||
String result = null;
|
||||
if (valueToValidate.getName() == null || valueToValidate.getName().isEmpty()) {
|
||||
result = stringMessages.pleaseEnterAName();
|
||||
@@ -70,8 +70,8 @@ public class CompetitorEditDialog extends DataEntryDialog<CompetitorDTO> {
|
||||
}
|
||||
}
|
||||
|
||||
public static CompetitorEditDialog create(StringMessages stringMessages, CompetitorDTO competitorToEdit,
|
||||
DialogCallback<CompetitorDTO> callback) {
|
||||
public static CompetitorEditDialog create(StringMessages stringMessages, CompetitorWithBoatDTO competitorToEdit,
|
||||
DialogCallback<CompetitorWithBoatDTO> callback) {
|
||||
return new CompetitorEditDialog(stringMessages.editCompetitor(), stringMessages, competitorToEdit,
|
||||
new CompetitorEditDialog.CompetitorWithoutBoatValidator(stringMessages), callback);
|
||||
}
|
||||
@@ -82,8 +82,8 @@ public class CompetitorEditDialog extends DataEntryDialog<CompetitorDTO> {
|
||||
* @param competitorToEdit
|
||||
* The 'competitorToEdit' parameter contains the competitor which should be changed or initialized.
|
||||
*/
|
||||
protected CompetitorEditDialog(String dialogTitle, StringMessages stringMessages, CompetitorDTO competitorToEdit,
|
||||
Validator<CompetitorDTO> validator, DialogCallback<CompetitorDTO> callback) {
|
||||
protected CompetitorEditDialog(String dialogTitle, StringMessages stringMessages, CompetitorWithBoatDTO competitorToEdit,
|
||||
Validator<CompetitorWithBoatDTO> validator, DialogCallback<CompetitorWithBoatDTO> callback) {
|
||||
super(dialogTitle, null, stringMessages.ok(), stringMessages.cancel(),
|
||||
validator, /* animationEnabled */true, callback);
|
||||
this.ensureDebugId("CompetitorEditDialog");
|
||||
@@ -174,7 +174,7 @@ public class CompetitorEditDialog extends DataEntryDialog<CompetitorDTO> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CompetitorDTO getResult() {
|
||||
protected CompetitorWithBoatDTO getResult() {
|
||||
Color color;
|
||||
if (displayColorTextBox.getText() == null || displayColorTextBox.getText().isEmpty()) {
|
||||
color = null;
|
||||
@@ -185,7 +185,7 @@ public class CompetitorEditDialog extends DataEntryDialog<CompetitorDTO> {
|
||||
color = new InvalidColor(iae);
|
||||
}
|
||||
}
|
||||
CompetitorDTO result = new CompetitorDTOImpl(name.getText(),
|
||||
CompetitorWithBoatDTO result = new CompetitorWithBoatDTOImpl(name.getText(),
|
||||
shortName.getText().trim().isEmpty() ? null : shortName.getText(), color,
|
||||
email.getText().trim().isEmpty() ? null : email.getText(),
|
||||
/* twoLetterIsoCountryCode */ null,
|
||||
@@ -224,7 +224,7 @@ public class CompetitorEditDialog extends DataEntryDialog<CompetitorDTO> {
|
||||
return result;
|
||||
}
|
||||
|
||||
protected CompetitorDTO getCompetitorToEdit() {
|
||||
protected CompetitorWithBoatDTO getCompetitorToEdit() {
|
||||
return competitorToEdit;
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -4,7 +4,7 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.sap.sailing.domain.common.CompetitorDescriptor;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sse.common.Util;
|
||||
|
||||
/**
|
||||
@@ -16,18 +16,18 @@ import com.sap.sse.common.Util;
|
||||
*/
|
||||
public class CompetitorImportMatcher {
|
||||
//FIXME: Not sure about the amount of data. May be need to implement some cache for that.
|
||||
private final Iterable<CompetitorDTO> existingCompetitorDTOs;
|
||||
private final Iterable<CompetitorWithBoatDTO> existingCompetitorDTOs;
|
||||
|
||||
public CompetitorImportMatcher(Iterable<CompetitorDTO> existingCompetitors) {
|
||||
public CompetitorImportMatcher(Iterable<CompetitorWithBoatDTO> existingCompetitors) {
|
||||
this.existingCompetitorDTOs = existingCompetitors;
|
||||
}
|
||||
|
||||
public Set<CompetitorDTO> getMatchesCompetitors(CompetitorDescriptor competitorDescriptor) {
|
||||
Set<CompetitorDTO> matchesCompetitor = new HashSet<>();
|
||||
public Set<CompetitorWithBoatDTO> getMatchesCompetitors(CompetitorDescriptor competitorDescriptor) {
|
||||
Set<CompetitorWithBoatDTO> matchesCompetitor = new HashSet<>();
|
||||
if (competitorDescriptor == null) {
|
||||
return matchesCompetitor;
|
||||
}
|
||||
for (CompetitorDTO existingCompetitor : existingCompetitorDTOs) {
|
||||
for (CompetitorWithBoatDTO existingCompetitor : existingCompetitorDTOs) {
|
||||
if (isEqual(competitorDescriptor, existingCompetitor)) {
|
||||
matchesCompetitor.add(existingCompetitor);
|
||||
}
|
||||
@@ -35,7 +35,7 @@ public class CompetitorImportMatcher {
|
||||
return matchesCompetitor;
|
||||
}
|
||||
|
||||
private boolean isEqual(CompetitorDescriptor competitorDescriptor, CompetitorDTO existingCompetitor) {
|
||||
private boolean isEqual(CompetitorDescriptor competitorDescriptor, CompetitorWithBoatDTO existingCompetitor) {
|
||||
return Util.equalsWithNull(competitorDescriptor.getName(), existingCompetitor.getName(), /* ignoreCase */ true)
|
||||
&& Util.equalsWithNull(removeSpaces(competitorDescriptor.getSailNumber()), removeSpaces(existingCompetitor.getSailID()), /* ignoreCase */ true)
|
||||
&& compareCountryCode(competitorDescriptor, existingCompetitor);
|
||||
@@ -45,7 +45,7 @@ public class CompetitorImportMatcher {
|
||||
return s==null?null:s.replace(" ", "").replace("\t", "");
|
||||
}
|
||||
|
||||
private boolean compareCountryCode(CompetitorDescriptor competitorDescriptor, CompetitorDTO existingCompetitor) {
|
||||
private boolean compareCountryCode(CompetitorDescriptor competitorDescriptor, CompetitorWithBoatDTO existingCompetitor) {
|
||||
return Util.equalsWithNull(competitorDescriptor.getCountryCode() == null ? null : competitorDescriptor.getCountryCode().getThreeLetterIOCCode(),
|
||||
existingCompetitor.getThreeLetterIocCountryCode(), /* ignoreCase */ true);
|
||||
}
|
||||
|
||||
+8
-8
@@ -14,9 +14,9 @@ import com.google.gwt.user.client.ui.FocusWidget;
|
||||
import com.google.gwt.user.client.ui.ListBox;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.domain.base.CompetitorStore;
|
||||
import com.sap.sailing.domain.base.CompetitorAndBoatStore;
|
||||
import com.sap.sailing.domain.common.CompetitorDescriptor;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.ParallelExecutionCallback;
|
||||
import com.sap.sailing.gwt.ui.client.ParallelExecutionHolder;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
@@ -188,7 +188,7 @@ public class CompetitorImportProviderSelectionDialog extends DataEntryDialog<Com
|
||||
@SuppressWarnings("unchecked")
|
||||
final Iterable<CompetitorDescriptor>[] competitorDescriptors = (Iterable<CompetitorDescriptor>[]) new Iterable<?>[1];
|
||||
@SuppressWarnings("unchecked")
|
||||
final Iterable<CompetitorDTO>[] competitors = (Iterable<CompetitorDTO>[]) new Iterable<?>[1];
|
||||
final Iterable<CompetitorWithBoatDTO>[] competitors = (Iterable<CompetitorWithBoatDTO>[]) new Iterable<?>[1];
|
||||
final ParallelExecutionCallback<List<CompetitorDescriptor>> getCompetitorDescriptorsCallback =
|
||||
new ParallelExecutionCallback<List<CompetitorDescriptor>>() {
|
||||
@Override
|
||||
@@ -197,10 +197,10 @@ public class CompetitorImportProviderSelectionDialog extends DataEntryDialog<Com
|
||||
super.onSuccess(myCompetitorDescriptors);
|
||||
}
|
||||
};
|
||||
final ParallelExecutionCallback<Iterable<CompetitorDTO>> getCompetitorsCallback =
|
||||
new ParallelExecutionCallback<Iterable<CompetitorDTO>>() {
|
||||
final ParallelExecutionCallback<Iterable<CompetitorWithBoatDTO>> getCompetitorsCallback =
|
||||
new ParallelExecutionCallback<Iterable<CompetitorWithBoatDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(Iterable<CompetitorDTO> myCompetitors) {
|
||||
public void onSuccess(Iterable<CompetitorWithBoatDTO> myCompetitors) {
|
||||
competitors[0] = myCompetitors;
|
||||
super.onSuccess(myCompetitors);
|
||||
}
|
||||
@@ -234,13 +234,13 @@ public class CompetitorImportProviderSelectionDialog extends DataEntryDialog<Com
|
||||
* @param competitorDescriptors
|
||||
* imported competitor descriptors {@link CompetitorDescriptor}
|
||||
* @param competitors
|
||||
* existing competitors from {@link CompetitorStore}
|
||||
* existing competitors from {@link CompetitorAndBoatStore}
|
||||
* @author Alexander Tatarinovich
|
||||
*
|
||||
*/
|
||||
public interface MatchImportedCompetitorsDialogFactory {
|
||||
MatchImportedCompetitorsDialog createMatchImportedCompetitorsDialog(
|
||||
Iterable<CompetitorDescriptor> competitorDescriptors, Iterable<CompetitorDTO> competitors);
|
||||
Iterable<CompetitorDescriptor> competitorDescriptors, Iterable<CompetitorWithBoatDTO> competitors);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+5
-5
@@ -5,7 +5,7 @@ import java.util.Set;
|
||||
import com.google.gwt.i18n.client.LocaleInfo;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
@@ -25,7 +25,7 @@ public class CompetitorInvitationHelper {
|
||||
this.errorReporter = errorReporter;
|
||||
}
|
||||
|
||||
public void inviteCompetitors(Set<CompetitorDTO> competitors, String leaderboardName) {
|
||||
public void inviteCompetitors(Set<CompetitorWithBoatDTO> competitors, String leaderboardName) {
|
||||
if (competitors.size() == 0){
|
||||
Window.alert(stringMessages.selectAtLeastOneCompetitorForInvitation());
|
||||
} else {
|
||||
@@ -39,8 +39,8 @@ public class CompetitorInvitationHelper {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isEmailProvidedForAll(Iterable<CompetitorDTO> allCompetitors) {
|
||||
for (CompetitorDTO competitor : allCompetitors) {
|
||||
private boolean isEmailProvidedForAll(Iterable<CompetitorWithBoatDTO> allCompetitors) {
|
||||
for (CompetitorWithBoatDTO competitor : allCompetitors) {
|
||||
if (!competitor.hasEmail()) {
|
||||
return false;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class CompetitorInvitationHelper {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void openChooseEventDialogAndSendMails(final Set<CompetitorDTO> competitors, final String leaderboardName) {
|
||||
private void openChooseEventDialogAndSendMails(final Set<CompetitorWithBoatDTO> competitors, final String leaderboardName) {
|
||||
new SelectEventAndHostnameDialog(sailingService, stringMessages, errorReporter, leaderboardName, new DialogCallback<Pair<EventDTO, String>>() {
|
||||
|
||||
@Override
|
||||
|
||||
+10
-10
@@ -12,8 +12,8 @@ import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.view.client.SelectionChangeEvent;
|
||||
import com.google.gwt.view.client.SelectionChangeEvent.Handler;
|
||||
import com.sap.sailing.domain.common.CompetitorDescriptor;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTOImpl;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTOImpl;
|
||||
import com.sap.sailing.gwt.ui.adminconsole.CompetitorImportProviderSelectionDialog.MatchImportedCompetitorsDialogFactory;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
@@ -30,8 +30,8 @@ import com.sap.sse.gwt.client.controls.busyindicator.SimpleBusyIndicator;
|
||||
*
|
||||
*/
|
||||
public class CompetitorPanel extends SimplePanel implements BusyDisplay {
|
||||
private final CompetitorTableWrapper<RefreshableMultiSelectionModel<CompetitorDTO>> competitorTable;
|
||||
private final RefreshableMultiSelectionModel<CompetitorDTO> refreshableCompetitorSelectionModel;
|
||||
private final CompetitorTableWrapper<RefreshableMultiSelectionModel<CompetitorWithBoatDTO>> competitorTable;
|
||||
private final RefreshableMultiSelectionModel<CompetitorWithBoatDTO> refreshableCompetitorSelectionModel;
|
||||
private final String leaderboardName;
|
||||
|
||||
private final BusyIndicator busyIndicator;
|
||||
@@ -47,7 +47,7 @@ public class CompetitorPanel extends SimplePanel implements BusyDisplay {
|
||||
this.leaderboardName = leaderboardName;
|
||||
this.competitorTable = new CompetitorTableWrapper<>(sailingService, stringMessages, errorReporter, /* multiSelection */ true, /* enablePager */ true,
|
||||
/* filterCompetitorWithBoat */ false, /* filterCompetitorsWithoutBoat */ false);
|
||||
this.refreshableCompetitorSelectionModel = (RefreshableMultiSelectionModel<CompetitorDTO>) competitorTable.getSelectionModel();
|
||||
this.refreshableCompetitorSelectionModel = (RefreshableMultiSelectionModel<CompetitorWithBoatDTO>) competitorTable.getSelectionModel();
|
||||
|
||||
busyIndicator = new SimpleBusyIndicator(false, 0.8f);
|
||||
|
||||
@@ -90,7 +90,7 @@ public class CompetitorPanel extends SimplePanel implements BusyDisplay {
|
||||
selectAllButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
for (CompetitorDTO c : competitorTable.getDataProvider().getList()) {
|
||||
for (CompetitorWithBoatDTO c : competitorTable.getDataProvider().getList()) {
|
||||
refreshableCompetitorSelectionModel.setSelected(c, true);
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,7 @@ public class CompetitorPanel extends SimplePanel implements BusyDisplay {
|
||||
inviteCompetitorsButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Set<CompetitorDTO> competitors = refreshableCompetitorSelectionModel.getSelectedSet();
|
||||
Set<CompetitorWithBoatDTO> competitors = refreshableCompetitorSelectionModel.getSelectedSet();
|
||||
CompetitorInvitationHelper helper = new CompetitorInvitationHelper(sailingService, stringMessages, errorReporter);
|
||||
helper.inviteCompetitors(competitors, leaderboardName);
|
||||
}
|
||||
@@ -160,11 +160,11 @@ public class CompetitorPanel extends SimplePanel implements BusyDisplay {
|
||||
@Override
|
||||
public MatchImportedCompetitorsDialog createMatchImportedCompetitorsDialog(
|
||||
final Iterable<CompetitorDescriptor> competitorDescriptors,
|
||||
final Iterable<CompetitorDTO> competitors) {
|
||||
final Iterable<CompetitorWithBoatDTO> competitors) {
|
||||
ImportCompetitorCallback importCompetitorCallback = new ImportCompetitorCallback(sailingService,
|
||||
errorReporter, stringMessages) {
|
||||
@Override
|
||||
public void registerCompetitors(Set<CompetitorDTO> competitorDTOs) {
|
||||
public void registerCompetitors(Set<CompetitorWithBoatDTO> competitorDTOs) {
|
||||
super.registerCompetitors(competitorDTOs);
|
||||
refreshCompetitorList();
|
||||
}
|
||||
@@ -176,7 +176,7 @@ public class CompetitorPanel extends SimplePanel implements BusyDisplay {
|
||||
}
|
||||
|
||||
private void openAddCompetitorDialog() {
|
||||
CompetitorDTOImpl competitorDTO = new CompetitorDTOImpl();
|
||||
CompetitorWithBoatDTOImpl competitorDTO = new CompetitorWithBoatDTOImpl();
|
||||
competitorDTO.setBoat(null);
|
||||
competitorTable.openEditCompetitorWithoutBoatDialog(competitorDTO);
|
||||
}
|
||||
|
||||
+22
-22
@@ -20,8 +20,8 @@ import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.domain.common.CompetitorDescriptor;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTOImpl;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTOImpl;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithToolTipDTO;
|
||||
import com.sap.sailing.gwt.ui.adminconsole.CompetitorImportProviderSelectionDialog.MatchImportedCompetitorsDialogFactory;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
@@ -37,14 +37,14 @@ import com.sap.sse.gwt.client.controls.busyindicator.SimpleBusyIndicator;
|
||||
* Shows two competitor tables next to each other; the table on the left is that of the "registered" competitors, the table
|
||||
* on the right is the "pool" of all competitors with those already "registered" removed. Between the tables are buttons
|
||||
* to move competitors left and right, thereby assigning them to the "registered" set or moving them back to the pool.
|
||||
* The {@link #getResult result} consists of all {@link CompetitorDTO competitors} in the table of "registered" competitors.<p>
|
||||
* The {@link #getResult result} consists of all {@link CompetitorWithBoatDTO competitors} in the table of "registered" competitors.<p>
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
public class CompetitorRegistrationsPanel extends FlowPanel implements BusyDisplay {
|
||||
private final CompetitorTableWrapper<RefreshableMultiSelectionModel<CompetitorDTO>> allCompetitorsTable;
|
||||
private final CompetitorTableWrapper<RefreshableMultiSelectionModel<CompetitorDTO>> registeredCompetitorsTable;
|
||||
private final CompetitorTableWrapper<RefreshableMultiSelectionModel<CompetitorWithBoatDTO>> allCompetitorsTable;
|
||||
private final CompetitorTableWrapper<RefreshableMultiSelectionModel<CompetitorWithBoatDTO>> registeredCompetitorsTable;
|
||||
private final ErrorReporter errorReporter;
|
||||
private Button registerBtn;
|
||||
private Button unregisterBtn;
|
||||
@@ -55,7 +55,7 @@ public class CompetitorRegistrationsPanel extends FlowPanel implements BusyDispl
|
||||
private final BusyIndicator busyIndicator;
|
||||
private final ImportCompetitorCallback importCompetitorCallback;
|
||||
private final Runnable validator;
|
||||
private final Consumer<AsyncCallback<Collection<CompetitorDTO>>> registeredCompetitorsRetriever;
|
||||
private final Consumer<AsyncCallback<Collection<CompetitorWithBoatDTO>>> registeredCompetitorsRetriever;
|
||||
private final boolean restrictPoolToLeaderboard;
|
||||
|
||||
/**
|
||||
@@ -78,7 +78,7 @@ public class CompetitorRegistrationsPanel extends FlowPanel implements BusyDispl
|
||||
protected CompetitorRegistrationsPanel(final SailingServiceAsync sailingService,
|
||||
final StringMessages stringMessages, final ErrorReporter errorReporter, boolean editable,
|
||||
String leaderboardName, boolean canBoatsOfCompetitorsChangePerRace, String boatClass, Runnable validator,
|
||||
Consumer<AsyncCallback<Collection<CompetitorDTO>>> registeredCompetitorsRetriever,
|
||||
Consumer<AsyncCallback<Collection<CompetitorWithBoatDTO>>> registeredCompetitorsRetriever,
|
||||
boolean restrictPoolToLeaderboard, Widget... additionalWidgetsBeforeTables) {
|
||||
this.errorReporter = errorReporter;
|
||||
this.restrictPoolToLeaderboard = restrictPoolToLeaderboard;
|
||||
@@ -92,7 +92,7 @@ public class CompetitorRegistrationsPanel extends FlowPanel implements BusyDispl
|
||||
addCompetitorButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
CompetitorDTOImpl competitorDTO = new CompetitorDTOImpl();
|
||||
CompetitorWithBoatDTOImpl competitorDTO = new CompetitorWithBoatDTOImpl();
|
||||
competitorDTO.setBoat(null);
|
||||
registeredCompetitorsTable.openEditCompetitorWithoutBoatDialog(competitorDTO);
|
||||
}
|
||||
@@ -101,7 +101,7 @@ public class CompetitorRegistrationsPanel extends FlowPanel implements BusyDispl
|
||||
addCompetitorWithBoatButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
CompetitorDTOImpl competitorDTO = new CompetitorDTOImpl();
|
||||
CompetitorWithBoatDTOImpl competitorDTO = new CompetitorWithBoatDTOImpl();
|
||||
registeredCompetitorsTable.openEditCompetitorWithBoatDialog(competitorDTO, boatClass);
|
||||
}
|
||||
});
|
||||
@@ -110,7 +110,7 @@ public class CompetitorRegistrationsPanel extends FlowPanel implements BusyDispl
|
||||
inviteCompetitorsButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Set<CompetitorDTO> competitors = registeredCompetitorsTable.getSelectionModel().getSelectedSet();
|
||||
Set<CompetitorWithBoatDTO> competitors = registeredCompetitorsTable.getSelectionModel().getSelectedSet();
|
||||
CompetitorInvitationHelper helper = new CompetitorInvitationHelper(sailingService, stringMessages,
|
||||
errorReporter);
|
||||
helper.inviteCompetitors(competitors, leaderboardName);
|
||||
@@ -210,7 +210,7 @@ public class CompetitorRegistrationsPanel extends FlowPanel implements BusyDispl
|
||||
@Override
|
||||
public MatchImportedCompetitorsDialog createMatchImportedCompetitorsDialog(
|
||||
final Iterable<CompetitorDescriptor> competitorDescriptors,
|
||||
final Iterable<CompetitorDTO> competitors) {
|
||||
final Iterable<CompetitorWithBoatDTO> competitors) {
|
||||
return new MatchImportedCompetitorsDialog(competitorDescriptors, competitors, stringMessages,
|
||||
sailingService, errorReporter, importCompetitorCallback);
|
||||
}
|
||||
@@ -222,19 +222,19 @@ public class CompetitorRegistrationsPanel extends FlowPanel implements BusyDispl
|
||||
busyIndicator.setBusy(isBusy);
|
||||
}
|
||||
|
||||
protected void move(CompetitorTableWrapper<?> from, CompetitorTableWrapper<?> to, Iterable<CompetitorDTO> toMove) {
|
||||
protected void move(CompetitorTableWrapper<?> from, CompetitorTableWrapper<?> to, Iterable<CompetitorWithBoatDTO> toMove) {
|
||||
from.getFilterField().removeAll(toMove);
|
||||
to.getFilterField().addAll(toMove);
|
||||
}
|
||||
|
||||
protected void addImportedCompetitorsToRegisteredCompetitorsTableAndRemoveFromAllCompetitorsTable(Iterable<CompetitorDTO> competitorsImported) {
|
||||
protected void addImportedCompetitorsToRegisteredCompetitorsTableAndRemoveFromAllCompetitorsTable(Iterable<CompetitorWithBoatDTO> competitorsImported) {
|
||||
allCompetitorsTable.getFilterField().removeAll(competitorsImported);
|
||||
registeredCompetitorsTable.getFilterField().addAll(competitorsImported);
|
||||
validateAndUpdate();
|
||||
}
|
||||
|
||||
private void moveSelected(CompetitorTableWrapper<RefreshableMultiSelectionModel<CompetitorDTO>> from,
|
||||
CompetitorTableWrapper<RefreshableMultiSelectionModel<CompetitorDTO>> to) {
|
||||
private void moveSelected(CompetitorTableWrapper<RefreshableMultiSelectionModel<CompetitorWithBoatDTO>> from,
|
||||
CompetitorTableWrapper<RefreshableMultiSelectionModel<CompetitorWithBoatDTO>> to) {
|
||||
move(from, to, from.getSelectionModel().getSelectedSet());
|
||||
validateAndUpdate();
|
||||
}
|
||||
@@ -250,12 +250,12 @@ public class CompetitorRegistrationsPanel extends FlowPanel implements BusyDispl
|
||||
}
|
||||
|
||||
private void setRegisterableCompetitorsAndRegisteredCompetitors() {
|
||||
allCompetitorsTable.refreshCompetitorList(this.restrictPoolToLeaderboard ? leaderboardName : null, new Callback<Iterable<CompetitorDTO>, Throwable>() {
|
||||
allCompetitorsTable.refreshCompetitorList(this.restrictPoolToLeaderboard ? leaderboardName : null, new Callback<Iterable<CompetitorWithBoatDTO>, Throwable>() {
|
||||
@Override
|
||||
public void onSuccess(Iterable<CompetitorDTO> result) {
|
||||
registeredCompetitorsRetriever.accept(new AsyncCallback<Collection<CompetitorDTO>>() {
|
||||
public void onSuccess(Iterable<CompetitorWithBoatDTO> result) {
|
||||
registeredCompetitorsRetriever.accept(new AsyncCallback<Collection<CompetitorWithBoatDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(Collection<CompetitorDTO> registeredCompetitors) {
|
||||
public void onSuccess(Collection<CompetitorWithBoatDTO> registeredCompetitors) {
|
||||
moveFromPoolToRegistered(registeredCompetitors);
|
||||
validateAndUpdate();
|
||||
}
|
||||
@@ -304,8 +304,8 @@ public class CompetitorRegistrationsPanel extends FlowPanel implements BusyDispl
|
||||
validateAndUpdate();
|
||||
}
|
||||
|
||||
public Set<CompetitorDTO> getResult() {
|
||||
final Set<CompetitorDTO> registeredCompetitors = new HashSet<>();
|
||||
public Set<CompetitorWithBoatDTO> getResult() {
|
||||
final Set<CompetitorWithBoatDTO> registeredCompetitors = new HashSet<>();
|
||||
Util.addAll(registeredCompetitorsTable.getAllCompetitors(), registeredCompetitors);
|
||||
return registeredCompetitors;
|
||||
}
|
||||
@@ -318,7 +318,7 @@ public class CompetitorRegistrationsPanel extends FlowPanel implements BusyDispl
|
||||
allCompetitorsTable.grayOutCompetitors(competitors);
|
||||
}
|
||||
|
||||
public void moveFromPoolToRegistered(Collection<CompetitorDTO> registeredCompetitors) {
|
||||
public void moveFromPoolToRegistered(Collection<CompetitorWithBoatDTO> registeredCompetitors) {
|
||||
move(allCompetitorsTable, registeredCompetitorsTable, registeredCompetitors);
|
||||
}
|
||||
|
||||
|
||||
+78
-78
@@ -21,7 +21,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.view.client.CellPreviewEvent;
|
||||
import com.sap.sailing.domain.common.dto.BoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithToolTipDTO;
|
||||
import com.sap.sailing.gwt.ui.adminconsole.ColorColumn.ColorRetriever;
|
||||
import com.sap.sailing.gwt.ui.client.FlagImageResolverImpl;
|
||||
@@ -48,8 +48,8 @@ import com.sap.sse.gwt.client.panels.LabeledAbstractFilterablePanel;
|
||||
*
|
||||
* @param <S>
|
||||
*/
|
||||
public class CompetitorTableWrapper<S extends RefreshableSelectionModel<CompetitorDTO>> extends TableWrapper<CompetitorDTO, S> {
|
||||
private final LabeledAbstractFilterablePanel<CompetitorDTO> filterField;
|
||||
public class CompetitorTableWrapper<S extends RefreshableSelectionModel<CompetitorWithBoatDTO>> extends TableWrapper<CompetitorWithBoatDTO, S> {
|
||||
private final LabeledAbstractFilterablePanel<CompetitorWithBoatDTO> filterField;
|
||||
private final boolean filterCompetitorsWithBoat;
|
||||
private final boolean filterCompetitorsWithoutBoat;
|
||||
|
||||
@@ -65,61 +65,61 @@ public class CompetitorTableWrapper<S extends RefreshableSelectionModel<Competit
|
||||
public CompetitorTableWrapper(SailingServiceAsync sailingService, StringMessages stringMessages, ErrorReporter errorReporter,
|
||||
boolean multiSelection, boolean enablePager, boolean filterCompetitorsWithBoat, boolean filterCompetitorsWithoutBoat) {
|
||||
super(sailingService, stringMessages, errorReporter, multiSelection, enablePager,
|
||||
new EntityIdentityComparator<CompetitorDTO>() {
|
||||
new EntityIdentityComparator<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public boolean representSameEntity(CompetitorDTO dto1, CompetitorDTO dto2) {
|
||||
public boolean representSameEntity(CompetitorWithBoatDTO dto1, CompetitorWithBoatDTO dto2) {
|
||||
return dto1.getIdAsString().equals(dto2.getIdAsString());
|
||||
}
|
||||
@Override
|
||||
public int hashCode(CompetitorDTO t) {
|
||||
public int hashCode(CompetitorWithBoatDTO t) {
|
||||
return t.getIdAsString().hashCode();
|
||||
}
|
||||
});
|
||||
this.filterCompetitorsWithBoat = filterCompetitorsWithBoat;
|
||||
this.filterCompetitorsWithoutBoat = filterCompetitorsWithoutBoat;
|
||||
ListHandler<CompetitorDTO> competitorColumnListHandler = getColumnSortHandler();
|
||||
ListHandler<CompetitorWithBoatDTO> competitorColumnListHandler = getColumnSortHandler();
|
||||
|
||||
// competitors table
|
||||
TextColumn<CompetitorDTO> competitorNameColumn = new TextColumn<CompetitorDTO>() {
|
||||
TextColumn<CompetitorWithBoatDTO> competitorNameColumn = new TextColumn<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public String getValue(CompetitorDTO competitor) {
|
||||
public String getValue(CompetitorWithBoatDTO competitor) {
|
||||
return competitor.getName();
|
||||
}
|
||||
};
|
||||
competitorNameColumn.setSortable(true);
|
||||
competitorColumnListHandler.setComparator(competitorNameColumn, new Comparator<CompetitorDTO>() {
|
||||
competitorColumnListHandler.setComparator(competitorNameColumn, new Comparator<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public int compare(CompetitorDTO o1, CompetitorDTO o2) {
|
||||
public int compare(CompetitorWithBoatDTO o1, CompetitorWithBoatDTO o2) {
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
}
|
||||
});
|
||||
|
||||
TextColumn<CompetitorDTO> competitorShortNameColumn = new TextColumn<CompetitorDTO>() {
|
||||
TextColumn<CompetitorWithBoatDTO> competitorShortNameColumn = new TextColumn<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public String getValue(CompetitorDTO competitor) {
|
||||
public String getValue(CompetitorWithBoatDTO competitor) {
|
||||
return competitor.getShortName();
|
||||
}
|
||||
};
|
||||
competitorShortNameColumn.setSortable(true);
|
||||
competitorColumnListHandler.setComparator(competitorShortNameColumn, new Comparator<CompetitorDTO>() {
|
||||
competitorColumnListHandler.setComparator(competitorShortNameColumn, new Comparator<CompetitorWithBoatDTO>() {
|
||||
private final NaturalComparator comparator = new NaturalComparator(/* case sensitive */ false);
|
||||
@Override
|
||||
public int compare(CompetitorDTO o1, CompetitorDTO o2) {
|
||||
public int compare(CompetitorWithBoatDTO o1, CompetitorWithBoatDTO o2) {
|
||||
return comparator.compare(o1.getShortName(), o2.getShortName());
|
||||
}
|
||||
});
|
||||
|
||||
TextColumn<CompetitorDTO> boatClassColumn = new TextColumn<CompetitorDTO>() {
|
||||
TextColumn<CompetitorWithBoatDTO> boatClassColumn = new TextColumn<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public String getValue(CompetitorDTO competitor) {
|
||||
public String getValue(CompetitorWithBoatDTO competitor) {
|
||||
return competitor.getBoatClass() != null ? competitor.getBoatClass().getName() : "";
|
||||
}
|
||||
};
|
||||
boatClassColumn.setSortable(true);
|
||||
competitorColumnListHandler.setComparator(boatClassColumn, new Comparator<CompetitorDTO>() {
|
||||
competitorColumnListHandler.setComparator(boatClassColumn, new Comparator<CompetitorWithBoatDTO>() {
|
||||
private final NaturalComparator comparator = new NaturalComparator(/* caseSensitive */ false);
|
||||
@Override
|
||||
public int compare(CompetitorDTO o1, CompetitorDTO o2) {
|
||||
public int compare(CompetitorWithBoatDTO o1, CompetitorWithBoatDTO o2) {
|
||||
BoatDTO boat1 = o1.getBoat();
|
||||
BoatDTO boat2 = o2.getBoat();
|
||||
if (boat1 == null && boat2 == null) {
|
||||
@@ -133,9 +133,9 @@ public class CompetitorTableWrapper<S extends RefreshableSelectionModel<Competit
|
||||
}
|
||||
});
|
||||
|
||||
Column<CompetitorDTO, SafeHtml> flagImageColumn = new Column<CompetitorDTO, SafeHtml>(new SafeHtmlCell()) {
|
||||
Column<CompetitorWithBoatDTO, SafeHtml> flagImageColumn = new Column<CompetitorWithBoatDTO, SafeHtml>(new SafeHtmlCell()) {
|
||||
@Override
|
||||
public SafeHtml getValue(CompetitorDTO competitor) {
|
||||
public SafeHtml getValue(CompetitorWithBoatDTO competitor) {
|
||||
SafeHtmlBuilder sb = new SafeHtmlBuilder();
|
||||
final String twoLetterIsoCountryCode = competitor.getTwoLetterIsoCountryCode();
|
||||
final String flagImageURL = competitor.getFlagImageURL();
|
||||
@@ -158,9 +158,9 @@ public class CompetitorTableWrapper<S extends RefreshableSelectionModel<Competit
|
||||
}
|
||||
};
|
||||
|
||||
TextColumn<CompetitorDTO> sailIdColumn = new TextColumn<CompetitorDTO>() {
|
||||
TextColumn<CompetitorWithBoatDTO> sailIdColumn = new TextColumn<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public String getValue(CompetitorDTO competitor) {
|
||||
public String getValue(CompetitorWithBoatDTO competitor) {
|
||||
if (competitor.getBoat() != null) {
|
||||
return competitor.getBoat().getSailId();
|
||||
}
|
||||
@@ -169,10 +169,10 @@ public class CompetitorTableWrapper<S extends RefreshableSelectionModel<Competit
|
||||
};
|
||||
|
||||
sailIdColumn.setSortable(true);
|
||||
competitorColumnListHandler.setComparator(sailIdColumn, new Comparator<CompetitorDTO>() {
|
||||
competitorColumnListHandler.setComparator(sailIdColumn, new Comparator<CompetitorWithBoatDTO>() {
|
||||
private final NaturalComparator comparator = new NaturalComparator(/* case sensitive */ false);
|
||||
@Override
|
||||
public int compare(CompetitorDTO o1, CompetitorDTO o2) {
|
||||
public int compare(CompetitorWithBoatDTO o1, CompetitorWithBoatDTO o2) {
|
||||
BoatDTO boat1 = o1.getBoat();
|
||||
BoatDTO boat2 = o2.getBoat();
|
||||
if (boat1 == null && boat2 == null) {
|
||||
@@ -186,16 +186,16 @@ public class CompetitorTableWrapper<S extends RefreshableSelectionModel<Competit
|
||||
}
|
||||
});
|
||||
|
||||
Column<CompetitorDTO, SafeHtml> displayColorColumn = new ColorColumn<>(new ColorRetriever<CompetitorDTO>() {
|
||||
Column<CompetitorWithBoatDTO, SafeHtml> displayColorColumn = new ColorColumn<>(new ColorRetriever<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public Color getColor(CompetitorDTO t) {
|
||||
public Color getColor(CompetitorWithBoatDTO t) {
|
||||
return t.getColor();
|
||||
}
|
||||
});
|
||||
|
||||
Column<CompetitorDTO, SafeHtml> imageColumn = new Column<CompetitorDTO, SafeHtml>(new SafeHtmlCell()) {
|
||||
Column<CompetitorWithBoatDTO, SafeHtml> imageColumn = new Column<CompetitorWithBoatDTO, SafeHtml>(new SafeHtmlCell()) {
|
||||
@Override
|
||||
public SafeHtml getValue(CompetitorDTO competitor) {
|
||||
public SafeHtml getValue(CompetitorWithBoatDTO competitor) {
|
||||
SafeHtmlBuilder sb = new SafeHtmlBuilder();
|
||||
if (competitor.getImageURL() != null && !competitor.getImageURL().isEmpty()) {
|
||||
sb.appendHtmlConstant("<img src=\"" + competitor.getImageURL() + "\" height=\"40px\" title=\""
|
||||
@@ -205,80 +205,80 @@ public class CompetitorTableWrapper<S extends RefreshableSelectionModel<Competit
|
||||
}
|
||||
};
|
||||
imageColumn.setSortable(true);
|
||||
competitorColumnListHandler.setComparator(imageColumn, new Comparator<CompetitorDTO>() {
|
||||
competitorColumnListHandler.setComparator(imageColumn, new Comparator<CompetitorWithBoatDTO>() {
|
||||
private final NaturalComparator comparator = new NaturalComparator(/* case sensitive */ false);
|
||||
@Override
|
||||
public int compare(CompetitorDTO o1, CompetitorDTO o2) {
|
||||
public int compare(CompetitorWithBoatDTO o1, CompetitorWithBoatDTO o2) {
|
||||
return comparator.compare(o1.getImageURL(), o2.getImageURL());
|
||||
}
|
||||
});
|
||||
|
||||
TextColumn<CompetitorDTO> competitorIdColumn = new TextColumn<CompetitorDTO>() {
|
||||
TextColumn<CompetitorWithBoatDTO> competitorIdColumn = new TextColumn<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public String getValue(CompetitorDTO competitor) {
|
||||
public String getValue(CompetitorWithBoatDTO competitor) {
|
||||
return competitor.getIdAsString();
|
||||
}
|
||||
};
|
||||
competitorIdColumn.setSortable(true);
|
||||
competitorColumnListHandler.setComparator(competitorIdColumn, new Comparator<CompetitorDTO>() {
|
||||
competitorColumnListHandler.setComparator(competitorIdColumn, new Comparator<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public int compare(CompetitorDTO o1, CompetitorDTO o2) {
|
||||
public int compare(CompetitorWithBoatDTO o1, CompetitorWithBoatDTO o2) {
|
||||
return new NaturalComparator(false).compare(o1.getIdAsString(), o2.getIdAsString());
|
||||
}
|
||||
});
|
||||
|
||||
TextColumn<CompetitorDTO> competitorEMailColumn = new TextColumn<CompetitorDTO>() {
|
||||
TextColumn<CompetitorWithBoatDTO> competitorEMailColumn = new TextColumn<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public String getValue(CompetitorDTO competitor) {
|
||||
public String getValue(CompetitorWithBoatDTO competitor) {
|
||||
return competitor.getEmail();
|
||||
}
|
||||
};
|
||||
competitorEMailColumn.setSortable(true);
|
||||
competitorColumnListHandler.setComparator(competitorEMailColumn, new Comparator<CompetitorDTO>() {
|
||||
competitorColumnListHandler.setComparator(competitorEMailColumn, new Comparator<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public int compare(CompetitorDTO o1, CompetitorDTO o2) {
|
||||
public int compare(CompetitorWithBoatDTO o1, CompetitorWithBoatDTO o2) {
|
||||
return new NaturalComparator(false).compare(o1.getEmail(), o2.getEmail());
|
||||
}
|
||||
});
|
||||
|
||||
TextColumn<CompetitorDTO> competitorSearchTagColumn = new TextColumn<CompetitorDTO>() {
|
||||
TextColumn<CompetitorWithBoatDTO> competitorSearchTagColumn = new TextColumn<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public String getValue(CompetitorDTO competitor) {
|
||||
public String getValue(CompetitorWithBoatDTO competitor) {
|
||||
return competitor.getSearchTag();
|
||||
}
|
||||
};
|
||||
competitorSearchTagColumn.setSortable(true);
|
||||
competitorColumnListHandler.setComparator(competitorSearchTagColumn, new Comparator<CompetitorDTO>() {
|
||||
competitorColumnListHandler.setComparator(competitorSearchTagColumn, new Comparator<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public int compare(CompetitorDTO o1, CompetitorDTO o2) {
|
||||
public int compare(CompetitorWithBoatDTO o1, CompetitorWithBoatDTO o2) {
|
||||
return new NaturalComparator(false).compare(o1.getSearchTag(), o2.getSearchTag());
|
||||
}
|
||||
});
|
||||
|
||||
TextColumn<CompetitorDTO> timeOnTimeFactorColumn = new TextColumn<CompetitorDTO>() {
|
||||
TextColumn<CompetitorWithBoatDTO> timeOnTimeFactorColumn = new TextColumn<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public String getValue(CompetitorDTO competitor) {
|
||||
public String getValue(CompetitorWithBoatDTO competitor) {
|
||||
return competitor.getTimeOnTimeFactor()==null?"":(""+competitor.getTimeOnTimeFactor());
|
||||
}
|
||||
};
|
||||
timeOnTimeFactorColumn.setSortable(true);
|
||||
competitorColumnListHandler.setComparator(timeOnTimeFactorColumn, new Comparator<CompetitorDTO>() {
|
||||
competitorColumnListHandler.setComparator(timeOnTimeFactorColumn, new Comparator<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public int compare(CompetitorDTO o1, CompetitorDTO o2) {
|
||||
public int compare(CompetitorWithBoatDTO o1, CompetitorWithBoatDTO o2) {
|
||||
return o1.getTimeOnTimeFactor()==null?o2.getTimeOnTimeFactor()==null?0:-1:o2.getTimeOnTimeFactor()==null?1:
|
||||
o1.getTimeOnTimeFactor().compareTo(o2.getTimeOnTimeFactor());
|
||||
}
|
||||
});
|
||||
TextColumn<CompetitorDTO> timeOnDistanceAllowancePerNauticalMileColumn = new TextColumn<CompetitorDTO>() {
|
||||
TextColumn<CompetitorWithBoatDTO> timeOnDistanceAllowancePerNauticalMileColumn = new TextColumn<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public String getValue(CompetitorDTO competitor) {
|
||||
public String getValue(CompetitorWithBoatDTO competitor) {
|
||||
return competitor.getTimeOnDistanceAllowancePerNauticalMile()==null?"":(""+competitor.getTimeOnDistanceAllowancePerNauticalMile());
|
||||
}
|
||||
};
|
||||
timeOnTimeFactorColumn.setSortable(true);
|
||||
competitorColumnListHandler.setComparator(timeOnDistanceAllowancePerNauticalMileColumn, new Comparator<CompetitorDTO>() {
|
||||
competitorColumnListHandler.setComparator(timeOnDistanceAllowancePerNauticalMileColumn, new Comparator<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public int compare(CompetitorDTO o1, CompetitorDTO o2) {
|
||||
public int compare(CompetitorWithBoatDTO o1, CompetitorWithBoatDTO o2) {
|
||||
return o1.getTimeOnDistanceAllowancePerNauticalMile() == null ? o2
|
||||
.getTimeOnDistanceAllowancePerNauticalMile() == null ? 0 : -1 : o2
|
||||
.getTimeOnDistanceAllowancePerNauticalMile() == null ? 1 : o1
|
||||
@@ -288,10 +288,10 @@ public class CompetitorTableWrapper<S extends RefreshableSelectionModel<Competit
|
||||
});
|
||||
|
||||
|
||||
filterField = new LabeledAbstractFilterablePanel<CompetitorDTO>(new Label(stringMessages.filterCompetitors()),
|
||||
new ArrayList<CompetitorDTO>(), table, dataProvider) {
|
||||
filterField = new LabeledAbstractFilterablePanel<CompetitorWithBoatDTO>(new Label(stringMessages.filterCompetitors()),
|
||||
new ArrayList<CompetitorWithBoatDTO>(), table, dataProvider) {
|
||||
@Override
|
||||
public Iterable<String> getSearchableStrings(CompetitorDTO t) {
|
||||
public Iterable<String> getSearchableStrings(CompetitorWithBoatDTO t) {
|
||||
List<String> string = new ArrayList<String>();
|
||||
string.add(t.getName());
|
||||
string.add(t.getShortName());
|
||||
@@ -309,11 +309,11 @@ public class CompetitorTableWrapper<S extends RefreshableSelectionModel<Competit
|
||||
registerSelectionModelOnNewDataProvider(filterField.getAllListDataProvider());
|
||||
|
||||
//CompetitorTableEditFeatures
|
||||
ImagesBarColumn<CompetitorDTO, CompetitorConfigImagesBarCell> competitorActionColumn = new ImagesBarColumn<CompetitorDTO, CompetitorConfigImagesBarCell>(
|
||||
ImagesBarColumn<CompetitorWithBoatDTO, CompetitorConfigImagesBarCell> competitorActionColumn = new ImagesBarColumn<CompetitorWithBoatDTO, CompetitorConfigImagesBarCell>(
|
||||
new CompetitorConfigImagesBarCell(stringMessages));
|
||||
competitorActionColumn.setFieldUpdater(new FieldUpdater<CompetitorDTO, String>() {
|
||||
competitorActionColumn.setFieldUpdater(new FieldUpdater<CompetitorWithBoatDTO, String>() {
|
||||
@Override
|
||||
public void update(int index, final CompetitorDTO competitor, String value) {
|
||||
public void update(int index, final CompetitorWithBoatDTO competitor, String value) {
|
||||
if (CompetitorConfigImagesBarCell.ACTION_EDIT.equals(value)) {
|
||||
if (competitor.getBoat() != null) {
|
||||
String boatClass = null;
|
||||
@@ -348,15 +348,15 @@ public class CompetitorTableWrapper<S extends RefreshableSelectionModel<Competit
|
||||
table.ensureDebugId("CompetitorsTable");
|
||||
}
|
||||
|
||||
public Iterable<CompetitorDTO> getAllCompetitors() {
|
||||
public Iterable<CompetitorWithBoatDTO> getAllCompetitors() {
|
||||
return filterField.getAll();
|
||||
}
|
||||
|
||||
public LabeledAbstractFilterablePanel<CompetitorDTO> getFilterField() {
|
||||
public LabeledAbstractFilterablePanel<CompetitorWithBoatDTO> getFilterField() {
|
||||
return filterField;
|
||||
}
|
||||
|
||||
public void refreshCompetitorList(Iterable<CompetitorDTO> competitors) {
|
||||
public void refreshCompetitorList(Iterable<CompetitorWithBoatDTO> competitors) {
|
||||
getFilteredCompetitors(competitors);
|
||||
}
|
||||
|
||||
@@ -367,9 +367,9 @@ public class CompetitorTableWrapper<S extends RefreshableSelectionModel<Competit
|
||||
/**
|
||||
* @param leaderboardName If null, all existing competitors are loaded
|
||||
*/
|
||||
public void refreshCompetitorList(String leaderboardName, final Callback<Iterable<CompetitorDTO>,
|
||||
public void refreshCompetitorList(String leaderboardName, final Callback<Iterable<CompetitorWithBoatDTO>,
|
||||
Throwable> callback) {
|
||||
final AsyncCallback<Iterable<CompetitorDTO>> myCallback = new AsyncCallback<Iterable<CompetitorDTO>>() {
|
||||
final AsyncCallback<Iterable<CompetitorWithBoatDTO>> myCallback = new AsyncCallback<Iterable<CompetitorWithBoatDTO>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Remote Procedure Call getCompetitors() - Failure: " + caught.getMessage());
|
||||
@@ -379,7 +379,7 @@ public class CompetitorTableWrapper<S extends RefreshableSelectionModel<Competit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Iterable<CompetitorDTO> result) {
|
||||
public void onSuccess(Iterable<CompetitorWithBoatDTO> result) {
|
||||
getFilteredCompetitors(result);
|
||||
refreshCompetitorList(result);
|
||||
if (callback != null) {
|
||||
@@ -394,23 +394,23 @@ public class CompetitorTableWrapper<S extends RefreshableSelectionModel<Competit
|
||||
}
|
||||
}
|
||||
|
||||
private void getFilteredCompetitors(Iterable<CompetitorDTO> result) {
|
||||
private void getFilteredCompetitors(Iterable<CompetitorWithBoatDTO> result) {
|
||||
filterField.updateAll(result);
|
||||
}
|
||||
|
||||
void openEditCompetitorWithBoatDialog(final CompetitorDTO originalCompetitor, String boatClass) {
|
||||
void openEditCompetitorWithBoatDialog(final CompetitorWithBoatDTO originalCompetitor, String boatClass) {
|
||||
final CompetitorWithBoatEditDialog dialog = new CompetitorWithBoatEditDialog(stringMessages,
|
||||
originalCompetitor, new DialogCallback<CompetitorDTO>() {
|
||||
originalCompetitor, new DialogCallback<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public void ok(final CompetitorDTO competitor) {
|
||||
sailingService.addOrUpdateCompetitorWithBoat(competitor, new AsyncCallback<CompetitorDTO>() {
|
||||
public void ok(final CompetitorWithBoatDTO competitor) {
|
||||
sailingService.addOrUpdateCompetitorWithBoat(competitor, new AsyncCallback<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Error trying to update competitor with boat: " + caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(CompetitorDTO updatedCompetitor) {
|
||||
public void onSuccess(CompetitorWithBoatDTO updatedCompetitor) {
|
||||
//only reload selected competitors reloading with refreshCompetitorList(leaderboardName)
|
||||
//would not work in case the list is not based on a leaderboard e.g. AbstractCompetitorRegistrationDialog
|
||||
int editedCompetitorIndex = getFilterField().indexOf(originalCompetitor);
|
||||
@@ -433,18 +433,18 @@ public class CompetitorTableWrapper<S extends RefreshableSelectionModel<Competit
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
void openEditCompetitorWithoutBoatDialog(final CompetitorDTO originalCompetitor) {
|
||||
final CompetitorEditDialog dialog = CompetitorEditDialog.create(stringMessages, originalCompetitor, new DialogCallback<CompetitorDTO>() {
|
||||
void openEditCompetitorWithoutBoatDialog(final CompetitorWithBoatDTO originalCompetitor) {
|
||||
final CompetitorEditDialog dialog = CompetitorEditDialog.create(stringMessages, originalCompetitor, new DialogCallback<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public void ok(final CompetitorDTO competitor) {
|
||||
sailingService.addOrUpdateCompetitorWithoutBoat(competitor, new AsyncCallback<CompetitorDTO>() {
|
||||
public void ok(final CompetitorWithBoatDTO competitor) {
|
||||
sailingService.addOrUpdateCompetitorWithoutBoat(competitor, new AsyncCallback<CompetitorWithBoatDTO>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError("Error trying to update competitor: " + caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(CompetitorDTO updatedCompetitor) {
|
||||
public void onSuccess(CompetitorWithBoatDTO updatedCompetitor) {
|
||||
//only reload selected competitors reloading with refreshCompetitorList(leaderboardName)
|
||||
//would not work in case the list is not based on a leaderboard e.g. AbstractCompetitorRegistrationDialog
|
||||
int editedCompetitorIndex = getFilterField().indexOf(originalCompetitor);
|
||||
@@ -467,8 +467,8 @@ public class CompetitorTableWrapper<S extends RefreshableSelectionModel<Competit
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
protected void allowUpdate(final Iterable<CompetitorDTO> competitors) {
|
||||
List<CompetitorDTO> serializableSingletonList = new ArrayList<CompetitorDTO>();
|
||||
protected void allowUpdate(final Iterable<CompetitorWithBoatDTO> competitors) {
|
||||
List<CompetitorWithBoatDTO> serializableSingletonList = new ArrayList<CompetitorWithBoatDTO>();
|
||||
Util.addAll(competitors, serializableSingletonList);
|
||||
sailingService.allowCompetitorResetToDefaults(serializableSingletonList, new AsyncCallback<Void>() {
|
||||
@Override
|
||||
@@ -488,14 +488,14 @@ public class CompetitorTableWrapper<S extends RefreshableSelectionModel<Competit
|
||||
* This method makes rows grayed out with a tool tip
|
||||
*/
|
||||
public void grayOutCompetitors(final List<CompetitorWithToolTipDTO> competitors) {
|
||||
table.addCellPreviewHandler((CellPreviewEvent<CompetitorDTO> event) -> {
|
||||
table.addCellPreviewHandler((CellPreviewEvent<CompetitorWithBoatDTO> event) -> {
|
||||
for (CompetitorWithToolTipDTO competitor : competitors) {
|
||||
if (competitor.getCompetitor().equals(event.getValue())) {
|
||||
table.getRowElement(event.getIndex()).setTitle(competitor.getToolTipMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
table.setRowStyles((CompetitorDTO row, int rowIndex) -> {
|
||||
table.setRowStyles((CompetitorWithBoatDTO row, int rowIndex) -> {
|
||||
for (CompetitorWithToolTipDTO competitor : competitors) {
|
||||
if (competitor.getCompetitor().equals(row)) {
|
||||
return tableRes.cellTableStyle().cellTableDisabledRow();
|
||||
|
||||
+23
-23
@@ -18,7 +18,7 @@ import com.google.gwt.user.client.ui.Widget;
|
||||
import com.google.gwt.view.client.ListDataProvider;
|
||||
import com.google.gwt.view.client.SelectionChangeEvent;
|
||||
import com.sap.sailing.domain.common.dto.BoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sse.gwt.client.ErrorReporter;
|
||||
@@ -32,27 +32,27 @@ import com.sap.sse.gwt.client.dialog.DataEntryDialog;
|
||||
* @author Frank Mittag
|
||||
*
|
||||
*/
|
||||
public class CompetitorToBoatMappingsDialog extends DataEntryDialog<Map<CompetitorDTO, BoatDTO>> {
|
||||
private final CompactCompetitorTableWrapper<RefreshableSingleSelectionModel<CompetitorDTO>> competitorTable;
|
||||
public class CompetitorToBoatMappingsDialog extends DataEntryDialog<Map<CompetitorWithBoatDTO, BoatDTO>> {
|
||||
private final CompactCompetitorTableWrapper<RefreshableSingleSelectionModel<CompetitorWithBoatDTO>> competitorTable;
|
||||
private final CompactBoatTableWrapper<RefreshableSingleSelectionModel<BoatDTO>> boatTable;
|
||||
|
||||
private final RefreshableSelectionModel<BoatDTO> refreshableBoatSelectionModel;
|
||||
private final RefreshableSelectionModel<CompetitorDTO> refreshableCompetitorSelectionModel;
|
||||
private final RefreshableSelectionModel<CompetitorWithBoatDTO> refreshableCompetitorSelectionModel;
|
||||
|
||||
private final StringMessages stringMessages;
|
||||
private final SelectionChangeEvent.Handler boatListHandler;
|
||||
private HandlerRegistration boatListHandlerRegistration;
|
||||
|
||||
private final Map<CompetitorDTO, BoatDTO> competitorToBoatMappings;
|
||||
private final Map<CompetitorWithBoatDTO, BoatDTO> competitorToBoatMappings;
|
||||
|
||||
protected static class CompetitorToBoatMappingValidator implements Validator<Map<CompetitorDTO, BoatDTO>> {
|
||||
protected static class CompetitorToBoatMappingValidator implements Validator<Map<CompetitorWithBoatDTO, BoatDTO>> {
|
||||
public CompetitorToBoatMappingValidator() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage(Map<CompetitorDTO, BoatDTO> valueToValidate) {
|
||||
public String getErrorMessage(Map<CompetitorWithBoatDTO, BoatDTO> valueToValidate) {
|
||||
String errorMessage = null;
|
||||
for (Map.Entry<CompetitorDTO, BoatDTO> competitorAndBoatEntry: valueToValidate.entrySet()) {
|
||||
for (Map.Entry<CompetitorWithBoatDTO, BoatDTO> competitorAndBoatEntry: valueToValidate.entrySet()) {
|
||||
if (competitorAndBoatEntry.getValue() == null) {
|
||||
errorMessage = "It's required that all competitors have an assigned boat.";
|
||||
break;
|
||||
@@ -64,7 +64,7 @@ public class CompetitorToBoatMappingsDialog extends DataEntryDialog<Map<Competit
|
||||
}
|
||||
|
||||
public CompetitorToBoatMappingsDialog(final SailingServiceAsync sailingService, final StringMessages stringMessages,
|
||||
final ErrorReporter errorReporter, Map<CompetitorDTO, BoatDTO> competitorsAndBoats, DialogCallback<Map<CompetitorDTO, BoatDTO>> callback) {
|
||||
final ErrorReporter errorReporter, Map<CompetitorWithBoatDTO, BoatDTO> competitorsAndBoats, DialogCallback<Map<CompetitorWithBoatDTO, BoatDTO>> callback) {
|
||||
super(stringMessages.actionEditCompetitorToBoatAssignments(), null, stringMessages.ok(), stringMessages.cancel(), new CompetitorToBoatMappingValidator(), callback);
|
||||
|
||||
this.stringMessages = stringMessages;
|
||||
@@ -73,10 +73,10 @@ public class CompetitorToBoatMappingsDialog extends DataEntryDialog<Map<Competit
|
||||
this.competitorTable = new CompactCompetitorTableWrapper<>(sailingService, stringMessages, errorReporter, /* multiSelection */ false, /* enablePager */ true);
|
||||
this.boatTable = new CompactBoatTableWrapper<>(sailingService, stringMessages, errorReporter, /* multiSelection */ false, /* enablePager */ true);
|
||||
|
||||
ImagesBarColumn<CompetitorDTO, CompactCompetitorConfigImagesBarCell> competitorActionColumn = new ImagesBarColumn<>(new CompactCompetitorConfigImagesBarCell(stringMessages));
|
||||
competitorActionColumn.setFieldUpdater(new FieldUpdater<CompetitorDTO, String>() {
|
||||
ImagesBarColumn<CompetitorWithBoatDTO, CompactCompetitorConfigImagesBarCell> competitorActionColumn = new ImagesBarColumn<>(new CompactCompetitorConfigImagesBarCell(stringMessages));
|
||||
competitorActionColumn.setFieldUpdater(new FieldUpdater<CompetitorWithBoatDTO, String>() {
|
||||
@Override
|
||||
public void update(int index, CompetitorDTO competitor, String value) {
|
||||
public void update(int index, CompetitorWithBoatDTO competitor, String value) {
|
||||
if (CompactCompetitorConfigImagesBarCell.ACTION_UNLINK.equals(value)) {
|
||||
unlinkBoatFromCompetitor(competitor);
|
||||
validateAndUpdate();
|
||||
@@ -92,7 +92,7 @@ public class CompetitorToBoatMappingsDialog extends DataEntryDialog<Map<Competit
|
||||
@Override
|
||||
public void onSelectionChange(SelectionChangeEvent event) {
|
||||
Set<BoatDTO> selectedBoats = refreshableBoatSelectionModel.getSelectedSet();
|
||||
CompetitorDTO selectedCompetitor = getSelectedCompetitor();
|
||||
CompetitorWithBoatDTO selectedCompetitor = getSelectedCompetitor();
|
||||
// if no competitor is selected, ignore the boat selection change
|
||||
if (selectedCompetitor != null) {
|
||||
if (selectedBoats.isEmpty()) {
|
||||
@@ -121,11 +121,11 @@ public class CompetitorToBoatMappingsDialog extends DataEntryDialog<Map<Competit
|
||||
validateAndUpdate();
|
||||
}
|
||||
|
||||
private boolean hasLinkedBoat(CompetitorDTO selectedCompetitor) {
|
||||
private boolean hasLinkedBoat(CompetitorWithBoatDTO selectedCompetitor) {
|
||||
return selectedCompetitor.getBoat() != null;
|
||||
}
|
||||
|
||||
private boolean isLinkedToBoat(CompetitorDTO selectedCompetitor, BoatDTO selectedBoat){
|
||||
private boolean isLinkedToBoat(CompetitorWithBoatDTO selectedCompetitor, BoatDTO selectedBoat){
|
||||
return selectedBoat.equals(selectedCompetitor.getBoat());
|
||||
}
|
||||
|
||||
@@ -156,8 +156,8 @@ public class CompetitorToBoatMappingsDialog extends DataEntryDialog<Map<Competit
|
||||
});
|
||||
|
||||
// Attention: We use the boatDTO property of the CompetitorDTO to make the CompetitorTable aware of linked boats
|
||||
for (Map.Entry<CompetitorDTO, BoatDTO> competitorAndBoatEntry: competitorToBoatMappings.entrySet()) {
|
||||
CompetitorDTO c = competitorAndBoatEntry.getKey();
|
||||
for (Map.Entry<CompetitorWithBoatDTO, BoatDTO> competitorAndBoatEntry: competitorToBoatMappings.entrySet()) {
|
||||
CompetitorWithBoatDTO c = competitorAndBoatEntry.getKey();
|
||||
if (competitorAndBoatEntry.getValue() != null) {
|
||||
c.setBoat(competitorAndBoatEntry.getValue());
|
||||
}
|
||||
@@ -167,7 +167,7 @@ public class CompetitorToBoatMappingsDialog extends DataEntryDialog<Map<Competit
|
||||
boatTable.refreshBoatList();
|
||||
}
|
||||
|
||||
private void linkBoatToSelectedCompetitor(CompetitorDTO selectedCompetitor, BoatDTO selectedBoat) {
|
||||
private void linkBoatToSelectedCompetitor(CompetitorWithBoatDTO selectedCompetitor, BoatDTO selectedBoat) {
|
||||
competitorToBoatMappings.remove(selectedCompetitor);
|
||||
selectedCompetitor.setBoat(selectedBoat);
|
||||
competitorToBoatMappings.put(selectedCompetitor, selectedBoat);
|
||||
@@ -176,7 +176,7 @@ public class CompetitorToBoatMappingsDialog extends DataEntryDialog<Map<Competit
|
||||
competitorTable.getTable().redraw();
|
||||
}
|
||||
|
||||
private void unlinkBoatFromCompetitor(CompetitorDTO selectedCompetitor) {
|
||||
private void unlinkBoatFromCompetitor(CompetitorWithBoatDTO selectedCompetitor) {
|
||||
competitorToBoatMappings.remove(selectedCompetitor);
|
||||
selectedCompetitor.setBoat(null);
|
||||
competitorToBoatMappings.put(selectedCompetitor, null);
|
||||
@@ -188,7 +188,7 @@ public class CompetitorToBoatMappingsDialog extends DataEntryDialog<Map<Competit
|
||||
}
|
||||
|
||||
private void competitorSelectionChanged() {
|
||||
CompetitorDTO selectedCompetitor = getSelectedCompetitor();
|
||||
CompetitorWithBoatDTO selectedCompetitor = getSelectedCompetitor();
|
||||
if (selectedCompetitor != null) {
|
||||
selectBoatForCompetitor(selectedCompetitor);
|
||||
} else {
|
||||
@@ -200,7 +200,7 @@ public class CompetitorToBoatMappingsDialog extends DataEntryDialog<Map<Competit
|
||||
boatTable.selectBoat(boat);
|
||||
}
|
||||
|
||||
private void selectBoatForCompetitor(CompetitorDTO selectedCompetitor) {
|
||||
private void selectBoatForCompetitor(CompetitorWithBoatDTO selectedCompetitor) {
|
||||
removeBoatListHandlerTemporarily();
|
||||
// BoatDTO boat = competitorToBoatMappings.get(selectedCompetitor);
|
||||
if (selectedCompetitor.getBoat() != null) {
|
||||
@@ -238,7 +238,7 @@ public class CompetitorToBoatMappingsDialog extends DataEntryDialog<Map<Competit
|
||||
});
|
||||
}
|
||||
|
||||
private CompetitorDTO getSelectedCompetitor() {
|
||||
private CompetitorWithBoatDTO getSelectedCompetitor() {
|
||||
if (competitorTable.getSelectionModel().getSelectedSet().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -273,7 +273,7 @@ public class CompetitorToBoatMappingsDialog extends DataEntryDialog<Map<Competit
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<CompetitorDTO, BoatDTO> getResult() {
|
||||
protected Map<CompetitorWithBoatDTO, BoatDTO> getResult() {
|
||||
return competitorToBoatMappings;
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -9,7 +9,7 @@ import com.google.gwt.user.client.ui.SimplePanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.view.client.SelectionChangeEvent;
|
||||
import com.sap.sailing.domain.common.dto.BoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sse.gwt.client.ErrorReporter;
|
||||
@@ -24,7 +24,7 @@ import com.sap.sse.gwt.client.celltable.RefreshableSingleSelectionModel;
|
||||
*
|
||||
*/
|
||||
public class CompetitorToBoatMappingsViewPanel extends SimplePanel {
|
||||
private final CompactCompetitorTableWrapper<RefreshableSingleSelectionModel<CompetitorDTO>> competitorTable;
|
||||
private final CompactCompetitorTableWrapper<RefreshableSingleSelectionModel<CompetitorWithBoatDTO>> competitorTable;
|
||||
private final CompactBoatTableWrapper<RefreshableSingleSelectionModel<BoatDTO>> boatTable;
|
||||
private final String leaderboardName;
|
||||
private final String raceColumnName;
|
||||
@@ -32,7 +32,7 @@ public class CompetitorToBoatMappingsViewPanel extends SimplePanel {
|
||||
private final SailingServiceAsync sailingService;
|
||||
private final ErrorReporter errorReporter;
|
||||
|
||||
private final RefreshableSelectionModel<CompetitorDTO> refreshableCompetitorSelectionModel;
|
||||
private final RefreshableSelectionModel<CompetitorWithBoatDTO> refreshableCompetitorSelectionModel;
|
||||
|
||||
public CompetitorToBoatMappingsViewPanel(final SailingServiceAsync sailingService, final StringMessages stringMessages,
|
||||
final ErrorReporter errorReporter, final String leaderboardName, final String raceColumnName, final String fleetName) {
|
||||
@@ -86,7 +86,7 @@ public class CompetitorToBoatMappingsViewPanel extends SimplePanel {
|
||||
}
|
||||
|
||||
private void competitorSelectionChanged() {
|
||||
CompetitorDTO selectedCompetitor = getSelectedCompetitor();
|
||||
CompetitorWithBoatDTO selectedCompetitor = getSelectedCompetitor();
|
||||
if (selectedCompetitor != null) {
|
||||
selectBoatForCompetitor(selectedCompetitor);
|
||||
} else {
|
||||
@@ -98,7 +98,7 @@ public class CompetitorToBoatMappingsViewPanel extends SimplePanel {
|
||||
boatTable.selectBoat(boat);
|
||||
}
|
||||
|
||||
private void selectBoatForCompetitor(CompetitorDTO selectedCompetitor) {
|
||||
private void selectBoatForCompetitor(CompetitorWithBoatDTO selectedCompetitor) {
|
||||
sailingService.getBoatLinkedToCompetitorForRace(leaderboardName,
|
||||
raceColumnName, fleetName, selectedCompetitor.getIdAsString(), new MarkedAsyncCallback<BoatDTO>(
|
||||
new AsyncCallback<BoatDTO>() {
|
||||
@@ -122,7 +122,7 @@ public class CompetitorToBoatMappingsViewPanel extends SimplePanel {
|
||||
}));
|
||||
}
|
||||
|
||||
private CompetitorDTO getSelectedCompetitor() {
|
||||
private CompetitorWithBoatDTO getSelectedCompetitor() {
|
||||
if (competitorTable.getSelectionModel().getSelectedSet().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+3
-3
@@ -14,7 +14,7 @@ import com.google.gwt.view.client.SelectionChangeEvent;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sailing.domain.common.dto.BoatClassDTO;
|
||||
import com.sap.sailing.domain.common.dto.BoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sse.gwt.client.ErrorReporter;
|
||||
@@ -42,8 +42,8 @@ public class CompetitorWithBoatCreateDialog extends AbstractCompetitorWithBoatDi
|
||||
* The boat class is the default shown boat class for new boats. Set <code>null</code> if your boat is
|
||||
* already initialized or you don't want a default boat class.
|
||||
*/
|
||||
public CompetitorWithBoatCreateDialog(SailingServiceAsync sailingService, StringMessages stringMessages, ErrorReporter errorReporter, CompetitorDTO competitorToEdit,
|
||||
DialogCallback<CompetitorDTO> callback, String boatClass) {
|
||||
public CompetitorWithBoatCreateDialog(SailingServiceAsync sailingService, StringMessages stringMessages, ErrorReporter errorReporter, CompetitorWithBoatDTO competitorToEdit,
|
||||
DialogCallback<CompetitorWithBoatDTO> callback, String boatClass) {
|
||||
super("Add competitor with boat", stringMessages, competitorToEdit, callback, boatClass);
|
||||
this.ensureDebugId("CompetitorWithBoatCreateDialog");
|
||||
|
||||
|
||||
+3
-3
@@ -7,7 +7,7 @@ import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.domain.common.Distance;
|
||||
import com.sap.sailing.domain.common.dto.BoatClassDTO;
|
||||
import com.sap.sailing.domain.common.dto.BoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.impl.RGBColor;
|
||||
@@ -26,8 +26,8 @@ public class CompetitorWithBoatEditDialog extends AbstractCompetitorWithBoatDial
|
||||
* The boat class is the default shown boat class for new boats. Set <code>null</code> if your boat is
|
||||
* already initialized or you don't want a default boat class.
|
||||
*/
|
||||
public CompetitorWithBoatEditDialog(StringMessages stringMessages, CompetitorDTO competitorToEdit,
|
||||
DialogCallback<CompetitorDTO> callback, String boatClass) {
|
||||
public CompetitorWithBoatEditDialog(StringMessages stringMessages, CompetitorWithBoatDTO competitorToEdit,
|
||||
DialogCallback<CompetitorWithBoatDTO> callback, String boatClass) {
|
||||
super("Edit competitor with boat", stringMessages, competitorToEdit, callback, boatClass);
|
||||
this.ensureDebugId("CompetitorWithBoatEditDialog");
|
||||
}
|
||||
|
||||
+6
-6
@@ -3,31 +3,31 @@ package com.sap.sailing.gwt.ui.adminconsole;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sse.gwt.client.ErrorReporter;
|
||||
import com.sap.sse.gwt.client.dialog.DataEntryDialog;
|
||||
|
||||
public class EditCompetitorsDialog extends DataEntryDialog<List<CompetitorDTO>> {
|
||||
public class EditCompetitorsDialog extends DataEntryDialog<List<CompetitorWithBoatDTO>> {
|
||||
private final SailingServiceAsync sailingService;
|
||||
private final StringMessages stringMessages;
|
||||
private final ErrorReporter errorReporter;
|
||||
private final String leaderboardName;
|
||||
|
||||
protected static class CompetitorsValidator implements Validator<List<CompetitorDTO>> {
|
||||
protected static class CompetitorsValidator implements Validator<List<CompetitorWithBoatDTO>> {
|
||||
public CompetitorsValidator() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage(List<CompetitorDTO> valueToValidate) {
|
||||
public String getErrorMessage(List<CompetitorWithBoatDTO> valueToValidate) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public EditCompetitorsDialog(final SailingServiceAsync sailingService, String leaderboardName, final StringMessages stringMessages,
|
||||
final ErrorReporter errorReporter, DialogCallback<List<CompetitorDTO>> callback) {
|
||||
final ErrorReporter errorReporter, DialogCallback<List<CompetitorWithBoatDTO>> callback) {
|
||||
super(stringMessages.actionEditCompetitors(), null, stringMessages.ok(), stringMessages.cancel(), new CompetitorsValidator(), callback);
|
||||
this.sailingService = sailingService;
|
||||
this.stringMessages = stringMessages;
|
||||
@@ -36,7 +36,7 @@ public class EditCompetitorsDialog extends DataEntryDialog<List<CompetitorDTO>>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<CompetitorDTO> getResult() {
|
||||
protected List<CompetitorWithBoatDTO> getResult() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Regular → Executable
+7
-7
@@ -10,7 +10,7 @@ import java.util.UUID;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.domain.common.RegattaNameAndRaceName;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.DeviceMappingDTO;
|
||||
@@ -128,7 +128,7 @@ public class ExpeditionAllInOneAfterImportHandler {
|
||||
this.stringMessages = stringMessages;
|
||||
}
|
||||
@Override
|
||||
public String getErrorMessage(Set<CompetitorDTO> valueToValidate) {
|
||||
public String getErrorMessage(Set<CompetitorWithBoatDTO> valueToValidate) {
|
||||
if (competitorRegistrationsPanel == null || competitorRegistrationsPanel.getSelectedRegisteredCompetitors().size() != 1) {
|
||||
return stringMessages.selectOneCompetitorToMapTheImportedData();
|
||||
}
|
||||
@@ -173,11 +173,11 @@ public class ExpeditionAllInOneAfterImportHandler {
|
||||
leaderboard.canBoatsOfCompetitorsChangePerRace).show();
|
||||
}
|
||||
|
||||
private void mapCompetitorsToGPSFixDeviceIds(final Set<CompetitorDTO> mappedCompetitors) {
|
||||
private void mapCompetitorsToGPSFixDeviceIds(final Set<CompetitorWithBoatDTO> mappedCompetitors) {
|
||||
if (gpsFixesDeviceIDs.size() == 1 && mappedCompetitors.size() == 1) {
|
||||
// If there is exactly one device and one Competitor, the mapping is automatically added without user interaction
|
||||
final TrackFileImportDeviceIdentifierDTO deviceIdentifierDTO = gpsFixesDeviceIDs.iterator().next();
|
||||
final CompetitorDTO competitor = mappedCompetitors.iterator().next();
|
||||
final CompetitorWithBoatDTO competitor = mappedCompetitors.iterator().next();
|
||||
saveCompetitorGPSMapping(mappedCompetitors, Collections.singleton(new DeviceMappingDTO(deviceIdentifierDTO, deviceIdentifierDTO.from, deviceIdentifierDTO.to, competitor, null)));
|
||||
} else {
|
||||
new RegattaLogFixesAddMappingsDialog(sailingService, errorReporter, stringMessages,
|
||||
@@ -192,17 +192,17 @@ public class ExpeditionAllInOneAfterImportHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private void saveCompetitorGPSMapping(final Set<CompetitorDTO> mappedCompetitors, final Collection<DeviceMappingDTO> mappings) {
|
||||
private void saveCompetitorGPSMapping(final Set<CompetitorWithBoatDTO> mappedCompetitors, final Collection<DeviceMappingDTO> mappings) {
|
||||
new AddDeviceMappingsToRegattaLog(leaderboard.getName(), mappings, () -> {
|
||||
mapCompetitorsToSensorFixDeviceIds(mappedCompetitors);
|
||||
});
|
||||
}
|
||||
|
||||
private final void mapCompetitorsToSensorFixDeviceIds(final Set<CompetitorDTO> mappedCompetitors) {
|
||||
private final void mapCompetitorsToSensorFixDeviceIds(final Set<CompetitorWithBoatDTO> mappedCompetitors) {
|
||||
if (sensorFixesDeviceIDs.size() == 1 && mappedCompetitors.size() == 1) {
|
||||
// If there is exactly one device and one Competitor, the mapping is automatically added without user interaction
|
||||
final TrackFileImportDeviceIdentifierDTO deviceIdentifierDTO = sensorFixesDeviceIDs.iterator().next();
|
||||
final CompetitorDTO competitor = mappedCompetitors.iterator().next();
|
||||
final CompetitorWithBoatDTO competitor = mappedCompetitors.iterator().next();
|
||||
saveCompetitorSensorFixMapping(Collections.singleton(new TypedDeviceMappingDTO(deviceIdentifierDTO, deviceIdentifierDTO.from, deviceIdentifierDTO.to, competitor, null, sensorImporterType)));
|
||||
} else if (sensorFixesDeviceIDs.size() > 0) {
|
||||
new RegattaLogSensorDataAddMappingsDialog(sailingService, errorReporter, stringMessages, leaderboard.getName(),
|
||||
|
||||
+15
-15
@@ -9,7 +9,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.domain.common.CompetitorDescriptor;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sse.common.Util;
|
||||
@@ -19,18 +19,18 @@ import com.sap.sse.gwt.client.async.MarkedAsyncCallback;
|
||||
import com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback;
|
||||
|
||||
/**
|
||||
* Callback is responsible for creation competitors for which no {@link CompetitorDTO} that represents an
|
||||
* Callback is responsible for creation competitors for which no {@link CompetitorWithBoatDTO} that represents an
|
||||
* already existing competitor has been provided, and save those newly created competitors to
|
||||
* the competitor store using {@link SailingServiceAsync#addCompetitors(Iterable, AsyncCallback)}. The combined
|
||||
* set of competitors as represented by the {@link CompetitorDTO}s provided as values representing the existing
|
||||
* competitors to use, plus those {@link CompetitorDTO}s returned from the service representing the newly
|
||||
* set of competitors as represented by the {@link CompetitorWithBoatDTO}s provided as values representing the existing
|
||||
* competitors to use, plus those {@link CompetitorWithBoatDTO}s returned from the service representing the newly
|
||||
* created competitors (those actually "imported") are then passed to {@link #registerCompetitors(Set)} which
|
||||
* in this class does nothing but may be overridden by subclasses.
|
||||
*
|
||||
* @author Alexander Tatarinovich
|
||||
*
|
||||
*/
|
||||
public class ImportCompetitorCallback implements DialogCallback<Pair<Map<CompetitorDescriptor, CompetitorDTO>, String>> {
|
||||
public class ImportCompetitorCallback implements DialogCallback<Pair<Map<CompetitorDescriptor, CompetitorWithBoatDTO>, String>> {
|
||||
protected final SailingServiceAsync sailingService;
|
||||
protected final ErrorReporter errorReporter;
|
||||
protected final StringMessages stringMessages;
|
||||
@@ -47,22 +47,22 @@ public class ImportCompetitorCallback implements DialogCallback<Pair<Map<Competi
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ok(final Pair<Map<CompetitorDescriptor, CompetitorDTO>, String> competitorsForRegisteringAndSearchTag) {
|
||||
final Set<CompetitorDTO> existingCompetitorsSelected = new HashSet<>();
|
||||
for (final CompetitorDTO existingCompetitor : competitorsForRegisteringAndSearchTag.getA().values()) {
|
||||
public void ok(final Pair<Map<CompetitorDescriptor, CompetitorWithBoatDTO>, String> competitorsForRegisteringAndSearchTag) {
|
||||
final Set<CompetitorWithBoatDTO> existingCompetitorsSelected = new HashSet<>();
|
||||
for (final CompetitorWithBoatDTO existingCompetitor : competitorsForRegisteringAndSearchTag.getA().values()) {
|
||||
if (existingCompetitor != null) {
|
||||
existingCompetitor.addToSearchTag(competitorsForRegisteringAndSearchTag.getB());
|
||||
existingCompetitorsSelected.add(existingCompetitor);
|
||||
}
|
||||
}
|
||||
sailingService.addOrUpdateCompetitors(new ArrayList<>(existingCompetitorsSelected), new MarkedAsyncCallback<>(
|
||||
new AsyncCallback<List<CompetitorDTO>>() {
|
||||
new AsyncCallback<List<CompetitorWithBoatDTO>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError(caught.getMessage());
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(List<CompetitorDTO> result) {
|
||||
public void onSuccess(List<CompetitorWithBoatDTO> result) {
|
||||
// TODO trigger an update of any client-side competitor display
|
||||
}
|
||||
}));
|
||||
@@ -81,16 +81,16 @@ public class ImportCompetitorCallback implements DialogCallback<Pair<Map<Competi
|
||||
* created with a new ID on the server
|
||||
*/
|
||||
private void registerCompetitorsAfterSaving(final List<CompetitorDescriptor> competitorsForSaving,
|
||||
final Iterable<CompetitorDTO> competitorsForRegistration, String searchTag) {
|
||||
sailingService.addCompetitors(competitorsForSaving, searchTag, new AsyncCallback<List<CompetitorDTO>>() {
|
||||
final Iterable<CompetitorWithBoatDTO> competitorsForRegistration, String searchTag) {
|
||||
sailingService.addCompetitors(competitorsForSaving, searchTag, new AsyncCallback<List<CompetitorWithBoatDTO>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
errorReporter.reportError(caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<CompetitorDTO> result) {
|
||||
final Set<CompetitorDTO> competitorsToAddWithNewOnesReplacedBySavedOnesWithId = new HashSet<>();
|
||||
public void onSuccess(List<CompetitorWithBoatDTO> result) {
|
||||
final Set<CompetitorWithBoatDTO> competitorsToAddWithNewOnesReplacedBySavedOnesWithId = new HashSet<>();
|
||||
Util.addAll(competitorsForRegistration, competitorsToAddWithNewOnesReplacedBySavedOnesWithId);
|
||||
// add those competitors returned by the server after saving to the competitor store where they received an ID:
|
||||
competitorsToAddWithNewOnesReplacedBySavedOnesWithId.addAll(result);
|
||||
@@ -99,7 +99,7 @@ public class ImportCompetitorCallback implements DialogCallback<Pair<Map<Competi
|
||||
});
|
||||
}
|
||||
|
||||
protected void registerCompetitors(Set<CompetitorDTO> competitorDTOs) {
|
||||
protected void registerCompetitors(Set<CompetitorWithBoatDTO> competitorDTOs) {
|
||||
// Don't register by default
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -11,7 +11,7 @@ import com.google.gwt.view.client.SelectionChangeEvent;
|
||||
import com.google.gwt.view.client.SelectionModel;
|
||||
import com.google.gwt.view.client.SingleSelectionModel;
|
||||
import com.sap.sailing.domain.common.dto.BoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.racelog.tracking.MappableToDevice;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
@@ -20,7 +20,7 @@ import com.sap.sse.gwt.client.ErrorReporter;
|
||||
import com.sap.sse.gwt.client.celltable.RefreshableSingleSelectionModel;
|
||||
|
||||
public class ItemToMapToDeviceSelectionPanel implements IsWidget {
|
||||
private final CompetitorTableWrapper<RefreshableSingleSelectionModel<CompetitorDTO>> competitorTable;
|
||||
private final CompetitorTableWrapper<RefreshableSingleSelectionModel<CompetitorWithBoatDTO>> competitorTable;
|
||||
private final BoatTableWrapper<RefreshableSingleSelectionModel<BoatDTO>> boatTable;
|
||||
private final MarkTableWrapper<RefreshableSingleSelectionModel<MarkDTO>> markTable;
|
||||
private MappableToDevice selected;
|
||||
@@ -28,7 +28,7 @@ public class ItemToMapToDeviceSelectionPanel implements IsWidget {
|
||||
private final ErrorReporter errorReporter;
|
||||
|
||||
static interface SelectionChangedHandler {
|
||||
void onSelectionChange(CompetitorDTO competitor);
|
||||
void onSelectionChange(CompetitorWithBoatDTO competitor);
|
||||
void onSelectionChange(BoatDTO boat);
|
||||
void onSelectionChange(MarkDTO mark);
|
||||
}
|
||||
@@ -46,7 +46,7 @@ public class ItemToMapToDeviceSelectionPanel implements IsWidget {
|
||||
@Override
|
||||
public void onSelectionChange(SelectionChangeEvent event) {
|
||||
if (competitorTable.getSelectionModel().getSelectedSet().size() == 1) {
|
||||
CompetitorDTO selectedCompetitor = competitorTable.getSelectionModel().getSelectedSet().iterator()
|
||||
CompetitorWithBoatDTO selectedCompetitor = competitorTable.getSelectionModel().getSelectedSet().iterator()
|
||||
.next();
|
||||
ItemToMapToDeviceSelectionPanel.this.selected = selectedCompetitor;
|
||||
deselectAll(boatTable.getSelectionModel(), boatTable.getDataProvider().getList());
|
||||
@@ -116,10 +116,10 @@ public class ItemToMapToDeviceSelectionPanel implements IsWidget {
|
||||
}
|
||||
}
|
||||
|
||||
public AsyncCallback<Collection<CompetitorDTO>> getSetCompetitorsCallback() {
|
||||
return new AsyncCallback<Collection<CompetitorDTO>>() {
|
||||
public AsyncCallback<Collection<CompetitorWithBoatDTO>> getSetCompetitorsCallback() {
|
||||
return new AsyncCallback<Collection<CompetitorWithBoatDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(Collection<CompetitorDTO> result) {
|
||||
public void onSuccess(Collection<CompetitorWithBoatDTO> result) {
|
||||
competitorTable.refreshCompetitorList(result);
|
||||
select(result, competitorTable.getSelectionModel());
|
||||
}
|
||||
|
||||
+3
-3
@@ -37,7 +37,7 @@ 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.dto.AbstractLeaderboardDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.FleetDTO;
|
||||
import com.sap.sailing.domain.common.dto.PairingListTemplateDTO;
|
||||
import com.sap.sailing.domain.common.dto.RaceColumnDTO;
|
||||
@@ -319,13 +319,13 @@ TrackedRaceChangedListener, LeaderboardsDisplayer {
|
||||
Window.open(leaderboardEditingUrl, "_blank", null);
|
||||
} else if (LeaderboardConfigImagesBarCell.ACTION_EDIT_COMPETITORS.equals(value)) {
|
||||
EditCompetitorsDialog editCompetitorsDialog = new EditCompetitorsDialog(sailingService, leaderboardDTO.name, stringMessages,
|
||||
errorReporter, new DialogCallback<List<CompetitorDTO>>() {
|
||||
errorReporter, new DialogCallback<List<CompetitorWithBoatDTO>>() {
|
||||
@Override
|
||||
public void cancel() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ok(final List<CompetitorDTO> result) {
|
||||
public void ok(final List<CompetitorWithBoatDTO> result) {
|
||||
}
|
||||
});
|
||||
editCompetitorsDialog.show();
|
||||
|
||||
+4
-4
@@ -2,17 +2,17 @@ package com.sap.sailing.gwt.ui.adminconsole;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
|
||||
public class LeaderboardDescriptorWithEliminations extends LeaderboardDescriptor {
|
||||
private final Set<CompetitorDTO> eliminatedCompetitors;
|
||||
private final Set<CompetitorWithBoatDTO> eliminatedCompetitors;
|
||||
|
||||
public LeaderboardDescriptorWithEliminations(LeaderboardDescriptor base, Set<CompetitorDTO> eliminatedCompetitors) {
|
||||
public LeaderboardDescriptorWithEliminations(LeaderboardDescriptor base, Set<CompetitorWithBoatDTO> eliminatedCompetitors) {
|
||||
super(base.getName(), base.getDisplayName(), base.getScoringScheme(), base.getDiscardThresholds(), base.getRegattaName(), base.getCourseAreaId());
|
||||
this.eliminatedCompetitors = eliminatedCompetitors;
|
||||
}
|
||||
|
||||
public Set<CompetitorDTO> getEliminatedCompetitors() {
|
||||
public Set<CompetitorWithBoatDTO> getEliminatedCompetitors() {
|
||||
return eliminatedCompetitors;
|
||||
}
|
||||
}
|
||||
+19
-19
@@ -15,7 +15,7 @@ import com.google.gwt.user.client.ui.Widget;
|
||||
import com.google.gwt.view.client.SelectionChangeEvent;
|
||||
import com.google.gwt.view.client.SelectionChangeEvent.Handler;
|
||||
import com.sap.sailing.domain.common.CompetitorDescriptor;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.adminconsole.CompetitorDescriptorTableWrapper.CompetitorsToImportToExistingLinking;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
@@ -34,14 +34,14 @@ import com.sap.sse.gwt.client.dialog.DataEntryDialog;
|
||||
* optionally defining mappings from the importable competitors to existing competitors where instead of creating a new
|
||||
* competitor by means of import the existing one shall be used. Then, the user can make a selection in the table with
|
||||
* the importable competitors, including those for which a mapping to an existing competitor was defined. Pressing OK
|
||||
* will produce a set of {@link CompetitorDTO}s where the ones coming from the set of already existing competitors have
|
||||
* a non-{@code null} {@link CompetitorDTO#getIdAsString() ID} whereas the ones to import have all <em>but</em> an
|
||||
* {@link CompetitorDTO#getIdAsString() ID}.
|
||||
* will produce a set of {@link CompetitorWithBoatDTO}s where the ones coming from the set of already existing competitors have
|
||||
* a non-{@code null} {@link CompetitorWithBoatDTO#getIdAsString() ID} whereas the ones to import have all <em>but</em> an
|
||||
* {@link CompetitorWithBoatDTO#getIdAsString() ID}.
|
||||
* <p>
|
||||
*
|
||||
* The result is a {@link Map} whose keys are all competitors selected for import and whose values are {@code null}
|
||||
* in case the competitor shall really be imported and hence be created anew, or a valid {@link CompetitorDTO} with
|
||||
* a valid {@link CompetitorDTO#getIdAsString() ID}, representing an already existing competitor that shall be used
|
||||
* in case the competitor shall really be imported and hence be created anew, or a valid {@link CompetitorWithBoatDTO} with
|
||||
* a valid {@link CompetitorWithBoatDTO#getIdAsString() ID}, representing an already existing competitor that shall be used
|
||||
* instead of the key competitor descriptor.<p>
|
||||
*
|
||||
* Use an {@link ImportCompetitorCallback} or subclass thereof as the {@link DialogCallback} passed to the constructor
|
||||
@@ -53,10 +53,10 @@ import com.sap.sse.gwt.client.dialog.DataEntryDialog;
|
||||
* @author Alexander Tatarinovich
|
||||
*
|
||||
*/
|
||||
public class MatchImportedCompetitorsDialog extends DataEntryDialog<Pair<Map<CompetitorDescriptor, CompetitorDTO>, String>> {
|
||||
public class MatchImportedCompetitorsDialog extends DataEntryDialog<Pair<Map<CompetitorDescriptor, CompetitorWithBoatDTO>, String>> {
|
||||
|
||||
private CompetitorDescriptorTableWrapper<RefreshableMultiSelectionModel<CompetitorDescriptor>> importedCompetitorsTable;
|
||||
private CompetitorTableWrapper<RefreshableSingleSelectionModel<CompetitorDTO>> existingCompetitorsTable;
|
||||
private CompetitorTableWrapper<RefreshableSingleSelectionModel<CompetitorWithBoatDTO>> existingCompetitorsTable;
|
||||
|
||||
private TextBox searchTagField;
|
||||
|
||||
@@ -67,12 +67,12 @@ public class MatchImportedCompetitorsDialog extends DataEntryDialog<Pair<Map<Com
|
||||
private final Iterable<CompetitorDescriptor> CompetitorDescriptors;
|
||||
private final CompetitorImportMatcher competitorImportMatcher;
|
||||
|
||||
private final Map<CompetitorDescriptor, CompetitorDTO> existingCompetitorsByImported = new HashMap<>();
|
||||
private final Map<CompetitorDescriptor, CompetitorWithBoatDTO> existingCompetitorsByImported = new HashMap<>();
|
||||
|
||||
public MatchImportedCompetitorsDialog(final Iterable<CompetitorDescriptor> CompetitorDescriptors,
|
||||
final Iterable<CompetitorDTO> existingCompetitor, StringMessages stringMessages,
|
||||
final Iterable<CompetitorWithBoatDTO> existingCompetitor, StringMessages stringMessages,
|
||||
SailingServiceAsync sailingService, ErrorReporter errorReporter,
|
||||
DialogCallback<Pair<Map<CompetitorDescriptor, CompetitorDTO>, String>> callback) {
|
||||
DialogCallback<Pair<Map<CompetitorDescriptor, CompetitorWithBoatDTO>, String>> callback) {
|
||||
super(stringMessages.importCompetitors(), stringMessages.chooseWhichCompetitorsShouldBeImported(),
|
||||
stringMessages.ok(), stringMessages.cancel(), /* validator */ null, callback);
|
||||
this.stringMessages = stringMessages;
|
||||
@@ -95,7 +95,7 @@ public class MatchImportedCompetitorsDialog extends DataEntryDialog<Pair<Map<Com
|
||||
final CompetitorsToImportToExistingLinking linker = new CompetitorsToImportToExistingLinking() {
|
||||
@Override
|
||||
public void unlinkCompetitor(CompetitorDescriptor competitor) {
|
||||
final CompetitorDTO existingCompetitor = existingCompetitorsByImported.remove(competitor);
|
||||
final CompetitorWithBoatDTO existingCompetitor = existingCompetitorsByImported.remove(competitor);
|
||||
if (existingCompetitor != null) {
|
||||
existingCompetitorsTable.getSelectionModel().setSelected(existingCompetitor, false);
|
||||
refreshInImportTable(competitor);
|
||||
@@ -103,7 +103,7 @@ public class MatchImportedCompetitorsDialog extends DataEntryDialog<Pair<Map<Com
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompetitorDTO getExistingCompetitorToUseInsteadOf(CompetitorDescriptor competitor) {
|
||||
public CompetitorWithBoatDTO getExistingCompetitorToUseInsteadOf(CompetitorDescriptor competitor) {
|
||||
return existingCompetitorsByImported.get(competitor);
|
||||
}
|
||||
};
|
||||
@@ -116,7 +116,7 @@ public class MatchImportedCompetitorsDialog extends DataEntryDialog<Pair<Map<Com
|
||||
importedCompetitorSelectionModel
|
||||
.addSelectionChangeHandler(getHandlerForImportedCompetitorsModel(importedCompetitorSelectionModel));
|
||||
|
||||
final RefreshableSingleSelectionModel<CompetitorDTO> existingCompetitorSelectionModel = existingCompetitorsTable
|
||||
final RefreshableSingleSelectionModel<CompetitorWithBoatDTO> existingCompetitorSelectionModel = existingCompetitorsTable
|
||||
.getSelectionModel();
|
||||
existingCompetitorSelectionModel.addSelectionChangeHandler(getHandlerForExistingCompetitorsModel(
|
||||
importedCompetitorSelectionModel, existingCompetitorSelectionModel));
|
||||
@@ -147,13 +147,13 @@ public class MatchImportedCompetitorsDialog extends DataEntryDialog<Pair<Map<Com
|
||||
|
||||
private Handler getHandlerForExistingCompetitorsModel(
|
||||
final RefreshableMultiSelectionModel<CompetitorDescriptor> importedCompetitorSelectionModel,
|
||||
final RefreshableSingleSelectionModel<CompetitorDTO> existingCompetitorSelectionModel) {
|
||||
final RefreshableSingleSelectionModel<CompetitorWithBoatDTO> existingCompetitorSelectionModel) {
|
||||
return new Handler() {
|
||||
@Override
|
||||
public void onSelectionChange(SelectionChangeEvent event) {
|
||||
Set<CompetitorDescriptor> competitorDescriptors = importedCompetitorSelectionModel.getSelectedSet();
|
||||
if (competitorDescriptors.size() == 1) {
|
||||
final CompetitorDTO selectedCompetitor = existingCompetitorSelectionModel.getSelectedObject();
|
||||
final CompetitorWithBoatDTO selectedCompetitor = existingCompetitorSelectionModel.getSelectedObject();
|
||||
final CompetitorDescriptor competitorFromImport = competitorDescriptors.iterator().next();
|
||||
final boolean changed;
|
||||
if (selectedCompetitor == null) {
|
||||
@@ -188,7 +188,7 @@ public class MatchImportedCompetitorsDialog extends DataEntryDialog<Pair<Map<Com
|
||||
try {
|
||||
existingCompetitorsTable.refreshCompetitorList(
|
||||
competitorImportMatcher.getMatchesCompetitors(selectedCompetitorDescriptor));
|
||||
CompetitorDTO competitor = existingCompetitorsByImported.get(selectedCompetitorDescriptor);
|
||||
CompetitorWithBoatDTO competitor = existingCompetitorsByImported.get(selectedCompetitorDescriptor);
|
||||
if (competitor != null && !existingCompetitorsTable.getSelectionModel().isSelected(competitor)) {
|
||||
existingCompetitorsTable.getSelectionModel().setSelected(competitor, true);
|
||||
}
|
||||
@@ -201,8 +201,8 @@ public class MatchImportedCompetitorsDialog extends DataEntryDialog<Pair<Map<Com
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Pair<Map<CompetitorDescriptor, CompetitorDTO>, String> getResult() {
|
||||
final Map<CompetitorDescriptor, CompetitorDTO> result = new HashMap<>();
|
||||
protected Pair<Map<CompetitorDescriptor, CompetitorWithBoatDTO>, String> getResult() {
|
||||
final Map<CompetitorDescriptor, CompetitorWithBoatDTO> result = new HashMap<>();
|
||||
for (CompetitorDescriptor competitorDescriptor : importedCompetitorsTable.getSelectionModel().getSelectedSet()) {
|
||||
result.put(competitorDescriptor, existingCompetitorsByImported.get(competitorDescriptor));
|
||||
}
|
||||
|
||||
+5
-5
@@ -20,7 +20,7 @@ import com.google.gwt.user.client.ui.ScrollPanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.domain.common.dto.BoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithoutBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.PairingListDTO;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sse.common.Color;
|
||||
@@ -107,7 +107,7 @@ public class PairingListPreviewDialog extends DataEntryDialog<Void> {
|
||||
String color = BACKGROUND_SHADE;
|
||||
pairingListGrid.getCellFormatter().getElement(0, 0).getStyle().setBackgroundColor(BACKGROUND_SHADE);
|
||||
pairingListGrid.getCellFormatter().getElement(0, 1).getStyle().setBackgroundColor(BACKGROUND_SHADE);
|
||||
for (List<List<Pair<CompetitorWithoutBoatDTO, BoatDTO>>> flight : pairingListDTO.getPairingList()) {
|
||||
for (List<List<Pair<CompetitorDTO, BoatDTO>>> flight : pairingListDTO.getPairingList()) {
|
||||
color = (color.equals("none") ? BACKGROUND_SHADE : "none");
|
||||
// setting up race
|
||||
int currentRaceInGridCells = (((flightIndexInGrid - 1) * groupCount) + 1);
|
||||
@@ -116,7 +116,7 @@ public class PairingListPreviewDialog extends DataEntryDialog<Void> {
|
||||
pairingListGrid.getCellFormatter().getElement(currentRaceInGridCells, 0).getStyle().setPadding(5, Unit.PX);
|
||||
pairingListGrid.getCellFormatter().getElement(currentRaceInGridCells, 0).getStyle()
|
||||
.setBackgroundColor(color);
|
||||
for (List<Pair<CompetitorWithoutBoatDTO, BoatDTO>> group : flight) {
|
||||
for (List<Pair<CompetitorDTO, BoatDTO>> group : flight) {
|
||||
// setting up fleet
|
||||
pairingListGrid.getCellFormatter().getElement(groupIndex, 0).getStyle().setPadding(3, Unit.PX);
|
||||
pairingListGrid.getCellFormatter().getElement(groupIndex, 0).getStyle().setBackgroundColor(color);
|
||||
@@ -127,14 +127,14 @@ public class PairingListPreviewDialog extends DataEntryDialog<Void> {
|
||||
pairingListGrid.getCellFormatter().getElement(groupIndex, 1).getStyle().setBackgroundColor(color);
|
||||
if (group.size() < boatCount) {
|
||||
List<BoatDTO> unusedBoats = new ArrayList<>(boats);
|
||||
for (Pair<CompetitorWithoutBoatDTO, BoatDTO> competitorAndBoatPair : group) {
|
||||
for (Pair<CompetitorDTO, BoatDTO> competitorAndBoatPair : group) {
|
||||
unusedBoats.remove(competitorAndBoatPair.getB());
|
||||
}
|
||||
for (BoatDTO unusedBoat : unusedBoats) {
|
||||
group.add(new Pair<>(null, unusedBoat));
|
||||
}
|
||||
}
|
||||
for (Pair<CompetitorWithoutBoatDTO, BoatDTO> competitorAndBoatPair : group) {
|
||||
for (Pair<CompetitorDTO, BoatDTO> competitorAndBoatPair : group) {
|
||||
int boatIndexInGrid = boats.indexOf(competitorAndBoatPair.getB()) + 2;
|
||||
if (competitorAndBoatPair.getA() == null) {
|
||||
pairingListGrid.setWidget(groupIndex, boatIndexInGrid, new Label(stringMessages.empty()));
|
||||
|
||||
+25
-25
@@ -17,7 +17,7 @@ import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.CheckBox;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithToolTipDTO;
|
||||
import com.sap.sailing.domain.common.dto.FleetDTO;
|
||||
import com.sap.sailing.gwt.ui.client.ParallelExecutionCallback;
|
||||
@@ -32,14 +32,14 @@ public class RaceLogCompetitorRegistrationDialog extends AbstractCompetitorRegis
|
||||
private String fleetName;
|
||||
private String raceColumnName;
|
||||
private CheckBox competitorRegistrationInRaceLogCheckBox;
|
||||
private final Map<String, Set<CompetitorDTO>> fleetNameWithCompetitors;
|
||||
private final Map<String, Set<CompetitorWithBoatDTO>> fleetNameWithCompetitors;
|
||||
private final ErrorReporter errorReporter;
|
||||
private final SailingServiceAsync sailingService;
|
||||
private final StringMessages stringMessages;
|
||||
|
||||
private static class Validator implements com.sap.sse.gwt.client.dialog.DataEntryDialog.Validator<Set<CompetitorDTO>> {
|
||||
private static class Validator implements com.sap.sse.gwt.client.dialog.DataEntryDialog.Validator<Set<CompetitorWithBoatDTO>> {
|
||||
private CheckBox competitorRegistrationInRaceLogCheckBox;
|
||||
private Map<String, Set<CompetitorDTO>> fleetsWithCompetitors;
|
||||
private Map<String, Set<CompetitorWithBoatDTO>> fleetsWithCompetitors;
|
||||
private final StringMessages stringMessages;
|
||||
|
||||
public Validator(StringMessages stringMessages) {
|
||||
@@ -47,13 +47,13 @@ public class RaceLogCompetitorRegistrationDialog extends AbstractCompetitorRegis
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage(Set<CompetitorDTO> valueToValidate) {
|
||||
public String getErrorMessage(Set<CompetitorWithBoatDTO> valueToValidate) {
|
||||
String result = null;
|
||||
if (getCompetitorRegistrationInRaceLogCheckBox() != null && !getCompetitorRegistrationInRaceLogCheckBox().getValue()) {
|
||||
result = stringMessages.competitorRegistrationsOnRaceDisabled();
|
||||
} else {
|
||||
Set<CompetitorDTO> difference = new HashSet<>();
|
||||
for (Set<CompetitorDTO> competitors : fleetsWithCompetitors.values()) {
|
||||
Set<CompetitorWithBoatDTO> difference = new HashSet<>();
|
||||
for (Set<CompetitorWithBoatDTO> competitors : fleetsWithCompetitors.values()) {
|
||||
difference.addAll(intersection(valueToValidate, competitors));
|
||||
}
|
||||
if (!difference.isEmpty()) {
|
||||
@@ -63,10 +63,10 @@ public class RaceLogCompetitorRegistrationDialog extends AbstractCompetitorRegis
|
||||
return result;
|
||||
}
|
||||
|
||||
private String createLineOfCompetitors(Set<CompetitorDTO> competitors) {
|
||||
private String createLineOfCompetitors(Set<CompetitorWithBoatDTO> competitors) {
|
||||
StringBuilder lineOfCompetitors = new StringBuilder();
|
||||
if (!competitors.isEmpty()) {
|
||||
for (CompetitorDTO competitor : competitors) {
|
||||
for (CompetitorWithBoatDTO competitor : competitors) {
|
||||
lineOfCompetitors.append(competitor.getName()).append(", ");
|
||||
}
|
||||
lineOfCompetitors.delete(lineOfCompetitors.length() - 2, lineOfCompetitors.length() - 1);
|
||||
@@ -74,8 +74,8 @@ public class RaceLogCompetitorRegistrationDialog extends AbstractCompetitorRegis
|
||||
return lineOfCompetitors.toString();
|
||||
}
|
||||
|
||||
private Set<CompetitorDTO> intersection(Set<CompetitorDTO> firstSet, Set<CompetitorDTO> secondSet) {
|
||||
Set<CompetitorDTO> result = new LinkedHashSet<>(firstSet);
|
||||
private Set<CompetitorWithBoatDTO> intersection(Set<CompetitorWithBoatDTO> firstSet, Set<CompetitorWithBoatDTO> secondSet) {
|
||||
Set<CompetitorWithBoatDTO> result = new LinkedHashSet<>(firstSet);
|
||||
result.retainAll(secondSet);
|
||||
return result;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ public class RaceLogCompetitorRegistrationDialog extends AbstractCompetitorRegis
|
||||
this.competitorRegistrationInRaceLogCheckBox = competitorRegistrationInRaceLogCheckBox;
|
||||
}
|
||||
|
||||
public void setFleetWithCompetitors(Map<String, Set<CompetitorDTO>> fleetNameWithCompetitors) {
|
||||
public void setFleetWithCompetitors(Map<String, Set<CompetitorWithBoatDTO>> fleetNameWithCompetitors) {
|
||||
this.fleetsWithCompetitors = fleetNameWithCompetitors;
|
||||
}
|
||||
}
|
||||
@@ -96,14 +96,14 @@ public class RaceLogCompetitorRegistrationDialog extends AbstractCompetitorRegis
|
||||
public RaceLogCompetitorRegistrationDialog(String boatClass, SailingServiceAsync sailingService,
|
||||
StringMessages stringMessages, ErrorReporter errorReporter, boolean editable, String leaderboardName, boolean canBoatsOfCompetitorsChangePerRace,
|
||||
String raceColumnName, String fleetName, List<FleetDTO> fleets,
|
||||
com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback<Set<CompetitorDTO>> callback) {
|
||||
com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback<Set<CompetitorWithBoatDTO>> callback) {
|
||||
this(sailingService, stringMessages, errorReporter, editable, callback, leaderboardName, canBoatsOfCompetitorsChangePerRace, boatClass,
|
||||
raceColumnName, fleetName, fleets, new Validator(stringMessages));
|
||||
}
|
||||
|
||||
public RaceLogCompetitorRegistrationDialog(SailingServiceAsync sailingService, StringMessages stringMessages,
|
||||
ErrorReporter errorReporter, boolean editable,
|
||||
com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback<Set<CompetitorDTO>> callback,
|
||||
com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback<Set<CompetitorWithBoatDTO>> callback,
|
||||
String leaderboardName, boolean canBoatsOfCompetitorsChangePerRace, String boatClass, String raceColumnName, String fleetName, List<FleetDTO> fleets, Validator validator) {
|
||||
super(sailingService, stringMessages, errorReporter, editable, callback, leaderboardName,
|
||||
canBoatsOfCompetitorsChangePerRace, boatClass,
|
||||
@@ -132,7 +132,7 @@ public class RaceLogCompetitorRegistrationDialog extends AbstractCompetitorRegis
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Consumer<AsyncCallback<Collection<CompetitorDTO>>> getRegisteredCompetitorsRetriever() {
|
||||
protected Consumer<AsyncCallback<Collection<CompetitorWithBoatDTO>>> getRegisteredCompetitorsRetriever() {
|
||||
return (callback)->getRegisteredCompetitors(callback);
|
||||
}
|
||||
|
||||
@@ -140,15 +140,15 @@ public class RaceLogCompetitorRegistrationDialog extends AbstractCompetitorRegis
|
||||
* For all {@code fleets} passed and not equal to {@link #fleetName} retrieves the competitor-per-race registrations
|
||||
* for the {@link #raceColumnName}.
|
||||
*/
|
||||
private Map<String, Set<CompetitorDTO>> findCompetitorsFromTheSameRaceColumn(final List<FleetDTO> fleets) {
|
||||
final Map<String, Set<CompetitorDTO>> result = new HashMap<>();
|
||||
final Map<String, ParallelExecutionCallback<Collection<CompetitorDTO>>> callbacksForFleetNames = new HashMap<>();
|
||||
private Map<String, Set<CompetitorWithBoatDTO>> findCompetitorsFromTheSameRaceColumn(final List<FleetDTO> fleets) {
|
||||
final Map<String, Set<CompetitorWithBoatDTO>> result = new HashMap<>();
|
||||
final Map<String, ParallelExecutionCallback<Collection<CompetitorWithBoatDTO>>> callbacksForFleetNames = new HashMap<>();
|
||||
for (FleetDTO fleetDTO : fleets) {
|
||||
final String curFleetName = fleetDTO.getName();
|
||||
if (!curFleetName.equals(fleetName)) {
|
||||
callbacksForFleetNames.put(curFleetName, new ParallelExecutionCallback<Collection<CompetitorDTO>>() {
|
||||
callbacksForFleetNames.put(curFleetName, new ParallelExecutionCallback<Collection<CompetitorWithBoatDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(Collection<CompetitorDTO> competitorRegistrationsForRace) {
|
||||
public void onSuccess(Collection<CompetitorWithBoatDTO> competitorRegistrationsForRace) {
|
||||
result.put(curFleetName, new HashSet<>(competitorRegistrationsForRace));
|
||||
super.onSuccess(competitorRegistrationsForRace);
|
||||
}
|
||||
@@ -168,7 +168,7 @@ public class RaceLogCompetitorRegistrationDialog extends AbstractCompetitorRegis
|
||||
errorReporter.reportError("Could not load already registered competitors: " + t.getMessage());
|
||||
}
|
||||
};
|
||||
for (final Entry<String, ParallelExecutionCallback<Collection<CompetitorDTO>>> fleetNameAndCallback : callbacksForFleetNames
|
||||
for (final Entry<String, ParallelExecutionCallback<Collection<CompetitorWithBoatDTO>>> fleetNameAndCallback : callbacksForFleetNames
|
||||
.entrySet()) {
|
||||
sailingService.getCompetitorRegistrationsForRace(leaderboardName, raceColumnName,
|
||||
fleetNameAndCallback.getKey(), fleetNameAndCallback.getValue());
|
||||
@@ -182,9 +182,9 @@ public class RaceLogCompetitorRegistrationDialog extends AbstractCompetitorRegis
|
||||
*/
|
||||
private void grayOutRows() {
|
||||
List<CompetitorWithToolTipDTO> competitors = new ArrayList<>();
|
||||
for (Map.Entry<String, Set<CompetitorDTO>> entry : fleetNameWithCompetitors.entrySet()) {
|
||||
for (Map.Entry<String, Set<CompetitorWithBoatDTO>> entry : fleetNameWithCompetitors.entrySet()) {
|
||||
if (!entry.getKey().equals(fleetName)) {
|
||||
for (CompetitorDTO competitor : entry.getValue()) {
|
||||
for (CompetitorWithBoatDTO competitor : entry.getValue()) {
|
||||
competitors.add(new CompetitorWithToolTipDTO(competitor, stringMessages
|
||||
.competitorToolTipMessage(competitor.getName(), fleetName, entry.getKey(), raceColumnName)));
|
||||
}
|
||||
@@ -194,7 +194,7 @@ public class RaceLogCompetitorRegistrationDialog extends AbstractCompetitorRegis
|
||||
competitorRegistrationsPanel.grayOutCompetitorsFromRegistered(competitors);
|
||||
}
|
||||
|
||||
private void getRegisteredCompetitors(AsyncCallback<Collection<CompetitorDTO>> callback) {
|
||||
private void getRegisteredCompetitors(AsyncCallback<Collection<CompetitorWithBoatDTO>> callback) {
|
||||
if (competitorRegistrationsPanel.showOnlyCompetitorsOfLog()) {
|
||||
sailingService.getCompetitorRegistrationsInRaceLog(leaderboardName, raceColumnName, fleetName, callback);
|
||||
} else {
|
||||
@@ -291,7 +291,7 @@ public class RaceLogCompetitorRegistrationDialog extends AbstractCompetitorRegis
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<CompetitorDTO> getResult() {
|
||||
protected Set<CompetitorWithBoatDTO> getResult() {
|
||||
if (getOrCreateCompetitorRegistrationInRaceLogCheckBox(stringMessages).getValue()) {
|
||||
return super.getResult();
|
||||
} else {
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ package com.sap.sailing.gwt.ui.adminconsole;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sse.gwt.client.ErrorReporter;
|
||||
@@ -17,7 +17,7 @@ public class RaceOrRegattaImportCompetitorCallback extends ImportCompetitorCallb
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerCompetitors(Set<CompetitorDTO> competitors) {
|
||||
protected void registerCompetitors(Set<CompetitorWithBoatDTO> competitors) {
|
||||
registrationsDialog.addImportedCompetitorsToRegisteredCompetitorsTableAndRemoveFromAllCompetitorsTable(competitors);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -6,7 +6,7 @@ import java.util.HashSet;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
@@ -25,7 +25,7 @@ public class RegattaLeaderboardWithEliminationsCreateDialog extends RegattaLeade
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Consumer<AsyncCallback<Collection<CompetitorDTO>>> getEliminatedCompetitorsRetriever() {
|
||||
protected Consumer<AsyncCallback<Collection<CompetitorWithBoatDTO>>> getEliminatedCompetitorsRetriever() {
|
||||
eliminatedCompetitors = new HashSet<>();
|
||||
return callback->callback.onSuccess(eliminatedCompetitors);
|
||||
}
|
||||
|
||||
+3
-3
@@ -16,7 +16,7 @@ import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.ListBox;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
@@ -39,7 +39,7 @@ public abstract class RegattaLeaderboardWithEliminationsDialog extends AbstractL
|
||||
* this field. For an existing leaderboard with eliminations it is initially filled from the
|
||||
* server's copy of that leaderboard. For new leaderboards it starts out empty.
|
||||
*/
|
||||
protected Collection<CompetitorDTO> eliminatedCompetitors;
|
||||
protected Collection<CompetitorWithBoatDTO> eliminatedCompetitors;
|
||||
|
||||
protected static class LeaderboardParameterValidator implements Validator<LeaderboardDescriptorWithEliminations> {
|
||||
protected final StringMessages stringMessages;
|
||||
@@ -139,7 +139,7 @@ public abstract class RegattaLeaderboardWithEliminationsDialog extends AbstractL
|
||||
* this hasn't happened before, and the result is cached locally. In the {@link #getResult()} implementation the
|
||||
* eliminations are then taken from the local state.
|
||||
*/
|
||||
protected abstract Consumer<AsyncCallback<Collection<CompetitorDTO>>> getEliminatedCompetitorsRetriever();
|
||||
protected abstract Consumer<AsyncCallback<Collection<CompetitorWithBoatDTO>>> getEliminatedCompetitorsRetriever();
|
||||
|
||||
/**
|
||||
* Based on the contents of {@link #regattaLeaderboardsListBox} obtains the leaderboard from
|
||||
|
||||
+4
-4
@@ -5,7 +5,7 @@ import java.util.HashSet;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
|
||||
@@ -47,20 +47,20 @@ public class RegattaLeaderboardWithEliminationsEditDialog extends RegattaLeaderb
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Consumer<AsyncCallback<Collection<CompetitorDTO>>> getEliminatedCompetitorsRetriever() {
|
||||
protected Consumer<AsyncCallback<Collection<CompetitorWithBoatDTO>>> getEliminatedCompetitorsRetriever() {
|
||||
eliminatedCompetitors = null;
|
||||
return callback->{
|
||||
if (eliminatedCompetitors != null) {
|
||||
callback.onSuccess(eliminatedCompetitors);
|
||||
} else {
|
||||
sailingService.getEliminatedCompetitors(nameTextBox.getValue(), new AsyncCallback<Collection<CompetitorDTO>>() {
|
||||
sailingService.getEliminatedCompetitors(nameTextBox.getValue(), new AsyncCallback<Collection<CompetitorWithBoatDTO>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
callback.onFailure(caught);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Collection<CompetitorDTO> result) {
|
||||
public void onSuccess(Collection<CompetitorWithBoatDTO> result) {
|
||||
eliminatedCompetitors = new HashSet<>(result);
|
||||
callback.onSuccess(eliminatedCompetitors);
|
||||
}
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ import com.google.gwt.user.client.ui.TextBox;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.domain.common.dto.BoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorWithBoatDTO;
|
||||
import com.sap.sailing.domain.common.racelog.tracking.DeviceMappingConstants;
|
||||
import com.sap.sailing.domain.common.racelog.tracking.MappableToDevice;
|
||||
import com.sap.sailing.domain.common.racelog.tracking.QRCodeURLCreationException;
|
||||
@@ -121,7 +121,7 @@ public class RegattaLogAddDeviceMappingDialog extends DataEntryDialogWithDateTim
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSelectionChange(CompetitorDTO competitor) {
|
||||
public void onSelectionChange(CompetitorWithBoatDTO competitor) {
|
||||
selectedItem = competitor;
|
||||
qrWidget.setMappedItem(DeviceMappingConstants.URL_COMPETITOR_ID_AS_STRING,
|
||||
competitor.getIdAsString());
|
||||
|
||||
Loaded 100 of 189 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user