mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-25 05:23:51 +00:00
Merge remote-tracking branch 'origin/master' into design2015
Conflicts: java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/home/client/place/event/partials/regattaHeader/RegattaHeader.gss
This commit is contained in:
commit
34df056315
25 files changed
+236
-115
No files matched your search
+5
@@ -33,6 +33,11 @@ public abstract class AbstractSpeedImpl implements Speed {
|
||||
public double getKilometersPerHour() {
|
||||
return getKnots() * Mile.METERS_PER_SEA_MILE / 1000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getStatuteMilesPerHour() {
|
||||
return getMetersPerSecond() * 2.2369;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Speed speed) {
|
||||
|
||||
+1
@@ -64,6 +64,7 @@ public enum BoatClassMasterdata {
|
||||
RS_X ("RS:X", true, 2.86, 0.93, BoatHullType.SURFERBOARD, false, "RS-X", "RSX", "RS:X"),
|
||||
RS_FEVA ("RS Feva", true, 3.64, 1.42, BoatHullType.MONOHULL, true, "RSFeva"),
|
||||
SONAR ("Sonar", true, 7.01, 2.39, BoatHullType.MONOHULL, true),
|
||||
SOLING ("Soling", true, 8.15, 1.91, BoatHullType.MONOHULL, true),
|
||||
STAR ("Star", true, 6.92, 1.74, BoatHullType.MONOHULL, false, "STR"),
|
||||
STREAMLINE ("Streamline", true, 7.15, 2.55, BoatHullType.MONOHULL, true),
|
||||
SWAN_45 ("Swan 45", true, 13.83, 3.91, BoatHullType.MONOHULL, true, "Swan", "Swan-45"),
|
||||
|
||||
@@ -4,4 +4,5 @@ public interface Mile {
|
||||
static double METERS_PER_SEA_MILE = 1852.3;
|
||||
static double METERS_PER_NAUTICAL_MILE = 1852;
|
||||
static double METERS_PER_GEOGRAPHICAL_MILE = 400080. / 216. /* = 40008000/360/60 */;
|
||||
static double METERS_PER_STATUTE_MILE = 1609.344;
|
||||
}
|
||||
@@ -56,6 +56,11 @@ public interface Speed extends Comparable<Speed>, Serializable {
|
||||
public String toString() {
|
||||
return "0kn";
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getStatuteMilesPerHour() {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
@Statistic(messageKey="", resultDecimals=2, resultUnit=Unit.Knots)
|
||||
@@ -66,6 +71,8 @@ public interface Speed extends Comparable<Speed>, Serializable {
|
||||
double getKilometersPerHour();
|
||||
|
||||
double getBeaufort();
|
||||
|
||||
double getStatuteMilesPerHour();
|
||||
|
||||
/**
|
||||
* Traveling at this speed starting at time <code>from</code> until time </code>to</code>, how far have we traveled?
|
||||
|
||||
+4
@@ -389,6 +389,10 @@ public class WindTrackImpl extends TrackImpl<Wind> implements WindTrack {
|
||||
public Speed projectTo(Position position, Bearing bearing) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public double getStatuteMilesPerHour() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
@@ -78,6 +78,7 @@ public class BoatClassImageResolver {
|
||||
boatClassIconsMap.put(BoatClassMasterdata.RS_X.getDisplayName(), imageResources.RSXIcon());
|
||||
boatClassIconsMap.put(BoatClassMasterdata.RS_FEVA.getDisplayName(), imageResources.RSFevaIcon());
|
||||
boatClassIconsMap.put(BoatClassMasterdata.SONAR.getDisplayName(), imageResources.SonarIcon());
|
||||
boatClassIconsMap.put(BoatClassMasterdata.SOLING.getDisplayName(), imageResources.SolingIcon());
|
||||
boatClassIconsMap.put(BoatClassMasterdata.STAR.getDisplayName(), imageResources.StarIcon());
|
||||
boatClassIconsMap.put(BoatClassMasterdata.STREAMLINE.getDisplayName(), imageResources.StreamlineIcon());
|
||||
boatClassIconsMap.put(BoatClassMasterdata.SWAN_45.getDisplayName(), imageResources.Swan45Icon());
|
||||
|
||||
+4
-1
@@ -150,7 +150,10 @@ public interface BoatClassImageResources extends ClientBundle {
|
||||
|
||||
@Source("com/sap/sailing/gwt/ui/client/images/boatclass/SONAR.png")
|
||||
ImageResource SonarIcon();
|
||||
|
||||
|
||||
@Source("com/sap/sailing/gwt/ui/client/images/boatclass/SOLING.png")
|
||||
ImageResource SolingIcon();
|
||||
|
||||
@Source("com/sap/sailing/gwt/ui/client/images/boatclass/STAR.png")
|
||||
ImageResource StarIcon();
|
||||
|
||||
|
||||
+7
-2
@@ -31,8 +31,10 @@
|
||||
vertical-align: middle;
|
||||
}
|
||||
.regattaheader_content {
|
||||
float: left;
|
||||
width: 60%;
|
||||
/* float: left; */
|
||||
display: inline-block;
|
||||
width: calc(100% - 4em);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
border-left: 1px solid #ccc;
|
||||
margin-left: 0.666666666666667em;
|
||||
@@ -43,9 +45,12 @@
|
||||
font-weight: 700;
|
||||
height: 1.363636363636364em;
|
||||
line-height: 1.363636363636364em;
|
||||
overflow: hidden;
|
||||
}
|
||||
.regattaheader_content_details {
|
||||
height: 1.333333333333333em;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.regattaheader_content_details_item {
|
||||
float: left;
|
||||
|
||||
+47
-45
@@ -482,9 +482,9 @@ public class EventListComposite extends Composite implements EventsRefresher, Le
|
||||
|
||||
private void updateEvent(final EventDTO oldEvent, final EventDTO updatedEvent) {
|
||||
Pair<List<CourseAreaDTO>, List<CourseAreaDTO>> courseAreasToAddAndRemove = getCourseAreasToAdd(oldEvent, updatedEvent);
|
||||
List<CourseAreaDTO> courseAreasToAdd = courseAreasToAddAndRemove.getA();
|
||||
List<CourseAreaDTO> courseAreasToRemove = courseAreasToAddAndRemove.getB();
|
||||
List<UUID> updatedEventLeaderboardGroupIds = new ArrayList<>();
|
||||
final List<CourseAreaDTO> courseAreasToAdd = courseAreasToAddAndRemove.getA();
|
||||
final List<CourseAreaDTO> courseAreasToRemove = courseAreasToAddAndRemove.getB();
|
||||
final List<UUID> updatedEventLeaderboardGroupIds = new ArrayList<>();
|
||||
for (LeaderboardGroupDTO leaderboardGroup : updatedEvent.getLeaderboardGroups()) {
|
||||
updatedEventLeaderboardGroupIds.add(leaderboardGroup.getId());
|
||||
}
|
||||
@@ -502,51 +502,53 @@ public class EventListComposite extends Composite implements EventsRefresher, Le
|
||||
@Override
|
||||
public void onSuccess(EventDTO result) {
|
||||
fillEvents();
|
||||
if (!oldEvent.getName().equals(updatedEvent.getName())) {
|
||||
sailingService.renameEvent(oldEvent.id, updatedEvent.getName(), new AsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
fillEvents();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to rename sailing event " + oldEvent.getName() + ": " + t.getMessage());
|
||||
}
|
||||
});
|
||||
final String[] namesOfCourseAreasToAdd = new String[courseAreasToAdd.size()];
|
||||
int i=0;
|
||||
for (CourseAreaDTO courseAreaToAdd : courseAreasToAdd) {
|
||||
namesOfCourseAreasToAdd[i++] = courseAreaToAdd.getName();
|
||||
}
|
||||
sailingService.createCourseAreas(oldEvent.id, namesOfCourseAreasToAdd, new AsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to add course area to sailing event " + oldEvent.getName()
|
||||
+ ": " + t.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
final UUID[] idsOfCourseAreasToRemove = new UUID[courseAreasToRemove.size()];
|
||||
int j=0;
|
||||
for (CourseAreaDTO courseAreaToRemove : courseAreasToRemove) {
|
||||
idsOfCourseAreasToRemove[j++] = courseAreaToRemove.id;
|
||||
}
|
||||
sailingService.removeCourseAreas(oldEvent.id, idsOfCourseAreasToRemove, new AsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to remove course area from sailing event " + oldEvent.getName()
|
||||
+ ": " + t.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
fillEvents();
|
||||
if (!oldEvent.getName().equals(updatedEvent.getName())) {
|
||||
sailingService.renameEvent(oldEvent.id, updatedEvent.getName(), new AsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to rename sailing event " + oldEvent.getName() + ": " + t.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
for (CourseAreaDTO courseArea : courseAreasToAdd) {
|
||||
sailingService.createCourseArea(oldEvent.id, courseArea.getName(), new AsyncCallback<Void>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to add course area to sailing event " + oldEvent.getName()
|
||||
+ ": " + t.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
fillEvents();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
for (CourseAreaDTO courseArea : courseAreasToRemove) {
|
||||
sailingService.removeCourseArea(oldEvent.id, courseArea.id, new AsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to remove course area from sailing event " + oldEvent.getName()
|
||||
+ ": " + t.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
fillEvents();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private Pair<List<CourseAreaDTO>, List<CourseAreaDTO>> getCourseAreasToAdd(final EventDTO oldEvent, final EventDTO updatedEvent) {
|
||||
|
||||
+2
-2
@@ -372,11 +372,11 @@ public interface SailingService extends RemoteService, FileStorageManagementGwtS
|
||||
PolarSheetGenerationResponse generatePolarSheetForRaces(List<RegattaAndRaceIdentifier> selectedRaces,
|
||||
PolarSheetGenerationSettings settings, String name) throws Exception;
|
||||
|
||||
void createCourseArea(UUID eventId, String courseAreaName);
|
||||
void createCourseAreas(UUID eventId, String[] courseAreaNames);
|
||||
|
||||
List<String> getBoatClassNamesWithPolarSheetsAvailable();
|
||||
|
||||
void removeCourseArea(UUID eventId, UUID courseAreaId);
|
||||
void removeCourseAreas(UUID eventId, UUID[] courseAreaIds);
|
||||
|
||||
List<Util.Pair<String, String>> getLeaderboardsNamesOfMetaLeaderboard(String metaLeaderboardName);
|
||||
|
||||
|
||||
+2
-2
@@ -375,9 +375,9 @@ public interface SailingServiceAsync extends ServerInfoRetriever, FileStorageMan
|
||||
VenueDTO venue, boolean isPublic, Iterable<UUID> leaderboardGroupIds, String officialWebsiteURL, String sailorsInfoWebsiteURL,
|
||||
Iterable<ImageDTO> images, Iterable<VideoDTO> videos, AsyncCallback<EventDTO> callback);
|
||||
|
||||
void createCourseArea(UUID eventId, String courseAreaName, AsyncCallback<Void> callback);
|
||||
void createCourseAreas(UUID eventId, String[] courseAreaNames, AsyncCallback<Void> callback);
|
||||
|
||||
void removeCourseArea(UUID eventId, UUID courseAreaId, AsyncCallback<Void> callback);
|
||||
void removeCourseAreas(UUID eventId, UUID[] idsOfCourseAreasToRemove, AsyncCallback<Void> callback);
|
||||
|
||||
void removeRegatta(RegattaIdentifier regattaIdentifier, AsyncCallback<Void> callback);
|
||||
|
||||
|
||||
+11
-9
@@ -364,7 +364,7 @@ import com.sap.sailing.server.RacingEventService;
|
||||
import com.sap.sailing.server.masterdata.MasterDataImporter;
|
||||
import com.sap.sailing.server.operationaltransformation.AddColumnToLeaderboard;
|
||||
import com.sap.sailing.server.operationaltransformation.AddColumnToSeries;
|
||||
import com.sap.sailing.server.operationaltransformation.AddCourseArea;
|
||||
import com.sap.sailing.server.operationaltransformation.AddCourseAreas;
|
||||
import com.sap.sailing.server.operationaltransformation.AddRemoteSailingServerReference;
|
||||
import com.sap.sailing.server.operationaltransformation.AddSpecificRegatta;
|
||||
import com.sap.sailing.server.operationaltransformation.AllowCompetitorResetToDefaults;
|
||||
@@ -380,7 +380,7 @@ import com.sap.sailing.server.operationaltransformation.MoveLeaderboardColumnDow
|
||||
import com.sap.sailing.server.operationaltransformation.MoveLeaderboardColumnUp;
|
||||
import com.sap.sailing.server.operationaltransformation.RemoveAndUntrackRace;
|
||||
import com.sap.sailing.server.operationaltransformation.RemoveColumnFromSeries;
|
||||
import com.sap.sailing.server.operationaltransformation.RemoveCourseArea;
|
||||
import com.sap.sailing.server.operationaltransformation.RemoveCourseAreas;
|
||||
import com.sap.sailing.server.operationaltransformation.RemoveEvent;
|
||||
import com.sap.sailing.server.operationaltransformation.RemoveLeaderboard;
|
||||
import com.sap.sailing.server.operationaltransformation.RemoveLeaderboardColumn;
|
||||
@@ -3311,20 +3311,22 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
getService().apply(
|
||||
new CreateEvent(eventName, eventDescription, startTimePoint, endTimePoint, venue, isPublic, eventUuid,
|
||||
officialWebsiteURL, sailorsInfoWebsiteURL, eventImages, eventVideos));
|
||||
for (String courseAreaName : courseAreaNames) {
|
||||
createCourseArea(eventUuid, courseAreaName);
|
||||
}
|
||||
createCourseAreas(eventUuid, courseAreaNames.toArray(new String[courseAreaNames.size()]));
|
||||
return getEventById(eventUuid, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createCourseArea(UUID eventId, String courseAreaName) {
|
||||
getService().apply(new AddCourseArea(eventId, courseAreaName, UUID.randomUUID()));
|
||||
public void createCourseAreas(UUID eventId, String[] courseAreaNames) {
|
||||
final UUID[] courseAreaIDs = new UUID[courseAreaNames.length];
|
||||
for (int i=0; i<courseAreaNames.length; i++) {
|
||||
courseAreaIDs[i] = UUID.randomUUID();
|
||||
}
|
||||
getService().apply(new AddCourseAreas(eventId, courseAreaNames, courseAreaIDs));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCourseArea(UUID eventId, UUID courseAreaId) {
|
||||
getService().apply(new RemoveCourseArea(eventId, courseAreaId));
|
||||
public void removeCourseAreas(UUID eventId, UUID[] courseAreaIds) {
|
||||
getService().apply(new RemoveCourseAreas(eventId, courseAreaIds));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
+3
-1
@@ -6,6 +6,7 @@ import org.json.simple.JSONObject;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.server.gateway.serialization.JsonSerializer;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public abstract class BaseRaceLogEventSerializer implements JsonSerializer<RaceLogEvent> {
|
||||
public static final String FIELD_CLASS = "@class";
|
||||
@@ -31,7 +32,8 @@ public abstract class BaseRaceLogEventSerializer implements JsonSerializer<RaceL
|
||||
result.put(FIELD_CLASS, getClassFieldValue());
|
||||
result.put(FIELD_ID, object.getId().toString());
|
||||
result.put(FIELD_CREATED_AT, object.getCreatedAt().asMillis());
|
||||
result.put(FIELD_TIMESTAMP, object.getLogicalTimePoint().asMillis());
|
||||
final TimePoint logicalTimePoint = object.getLogicalTimePoint();
|
||||
result.put(FIELD_TIMESTAMP, logicalTimePoint==null?null:logicalTimePoint.asMillis());
|
||||
result.put(FIELD_PASS_ID, object.getPassId());
|
||||
|
||||
JSONArray competitors = new JSONArray();
|
||||
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package com.sap.sailing.server.gateway.serialization.test.racelog;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.impl.LogEventAuthorImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEndOfTrackingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventRestoreFactory;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogStartOfTrackingEvent;
|
||||
import com.sap.sailing.server.gateway.serialization.JsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.BoatClassJsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.BoatJsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.CompetitorJsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.NationalityJsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.PersonJsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.TeamJsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.racelog.impl.RaceLogEndOfTrackingEventSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.racelog.impl.RaceLogStartOfTrackingEventSerializer;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
|
||||
public class TrackingTimesEventSerializerTest {
|
||||
private JsonSerializer<RaceLogEvent> createStartOfTrackingEventSerializer() {
|
||||
return new RaceLogStartOfTrackingEventSerializer(createCompetitorSerializer());
|
||||
}
|
||||
|
||||
private JsonSerializer<RaceLogEvent> createEndOfTrackingEventSerializer() {
|
||||
return new RaceLogEndOfTrackingEventSerializer(createCompetitorSerializer());
|
||||
}
|
||||
|
||||
private CompetitorJsonSerializer createCompetitorSerializer() {
|
||||
return new CompetitorJsonSerializer(new TeamJsonSerializer(
|
||||
new PersonJsonSerializer(new NationalityJsonSerializer())), new BoatJsonSerializer(
|
||||
new BoatClassJsonSerializer()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullStartOfTrackingTimeAttribute() {
|
||||
final RaceLogStartOfTrackingEvent event = RaceLogEventRestoreFactory.INSTANCE.createStartOfTrackingEvent(/* startOfTracking */null,
|
||||
new LogEventAuthorImpl("Axel", 0), UUID.randomUUID(), /* competitors */null, /* passId */1);
|
||||
JSONObject json = createStartOfTrackingEventSerializer().serialize(event);
|
||||
assertNull(json.get(RaceLogStartOfTrackingEventSerializer.FIELD_TIMESTAMP));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNullEndOfTrackingTimeAttribute() {
|
||||
final RaceLogEndOfTrackingEvent event = RaceLogEventRestoreFactory.INSTANCE.createEndOfTrackingEvent(/* endOfTracking */null,
|
||||
new LogEventAuthorImpl("Axel", 0), UUID.randomUUID(), /* competitors */null, /* passId */1);
|
||||
JSONObject json = createEndOfTrackingEventSerializer().serialize(event);
|
||||
assertNull(json.get(RaceLogEndOfTrackingEventSerializer.FIELD_TIMESTAMP));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonNullStartOfTrackingTimeAttribute() {
|
||||
final TimePoint now = MillisecondsTimePoint.now();
|
||||
final RaceLogStartOfTrackingEvent event = RaceLogEventRestoreFactory.INSTANCE.createStartOfTrackingEvent(/* startOfTracking */now,
|
||||
new LogEventAuthorImpl("Axel", 0), UUID.randomUUID(), /* competitors */null, /* passId */1);
|
||||
JSONObject json = createStartOfTrackingEventSerializer().serialize(event);
|
||||
assertEquals(now.asMillis(), json.get(RaceLogStartOfTrackingEventSerializer.FIELD_TIMESTAMP));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonNullEndOfTrackingTimeAttribute() {
|
||||
final TimePoint now = MillisecondsTimePoint.now();
|
||||
final RaceLogEndOfTrackingEvent event = RaceLogEventRestoreFactory.INSTANCE.createEndOfTrackingEvent(/* endOfTracking */now,
|
||||
new LogEventAuthorImpl("Axel", 0), UUID.randomUUID(), /* competitors */null, /* passId */1);
|
||||
JSONObject json = createEndOfTrackingEventSerializer().serialize(event);
|
||||
assertEquals(now.asMillis(), json.get(RaceLogEndOfTrackingEventSerializer.FIELD_TIMESTAMP));
|
||||
}
|
||||
}
|
||||
+4
@@ -71,6 +71,7 @@ public class WindStatusJsonServlet extends WindStatusServlet implements IgtimiWi
|
||||
windFix.put("windFromInDegrees", message.getWind().getFrom().getDegrees());
|
||||
windFix.put("windToInDegrees", message.getWind().getFrom().reverse().getDegrees());
|
||||
windFix.put("windSpeedInMetersPerSecond", message.getWind().getMetersPerSecond());
|
||||
windFix.put("windSpeedInStatuteMilesPerHour", message.getWind().getStatuteMilesPerHour());
|
||||
windFix.put("windSpeedInKilometersPerHour", message.getWind().getKilometersPerHour());
|
||||
windFix.put("windSpeedInKnots", message.getWind().getKnots());
|
||||
windFix.put("measurementTimePointAsMillis", message.getWind().getTimePoint().asMillis());
|
||||
@@ -95,6 +96,7 @@ public class WindStatusJsonServlet extends WindStatusServlet implements IgtimiWi
|
||||
put("windToInDegrees", 270.0);
|
||||
put("windSpeedInMetersPerSecond", 6.944444);
|
||||
put("windSpeedInKilometersPerHour", 25.0);
|
||||
put("windSpeedInStatuteMilesPerHour", 15.43);
|
||||
put("windSpeedInKnots", 13.498920086);
|
||||
put("measurementTimePointAsMillis", MillisecondsTimePoint.now().minus(Duration.ONE_SECOND.times(4)).asMillis());
|
||||
}});
|
||||
@@ -106,6 +108,7 @@ public class WindStatusJsonServlet extends WindStatusServlet implements IgtimiWi
|
||||
put("windToInDegrees", 280.0);
|
||||
put("windSpeedInMetersPerSecond", 6.944444);
|
||||
put("windSpeedInKilometersPerHour", 25.0);
|
||||
put("windSpeedInStatuteMilesPerHour", 15.43);
|
||||
put("windSpeedInKnots", 13.498920086);
|
||||
put("measurementTimePointAsMillis", MillisecondsTimePoint.now().minus(Duration.ONE_SECOND.times(5)).asMillis());
|
||||
}});
|
||||
@@ -117,6 +120,7 @@ public class WindStatusJsonServlet extends WindStatusServlet implements IgtimiWi
|
||||
put("windToInDegrees", 265.0);
|
||||
put("windSpeedInMetersPerSecond", 6.944444);
|
||||
put("windSpeedInKilometersPerHour", 25.0);
|
||||
put("windSpeedInStatuteMilesPerHour", 15.43);
|
||||
put("windSpeedInKnots", 13.498920086);
|
||||
put("measurementTimePointAsMillis", MillisecondsTimePoint.now().minus(Duration.ONE_SECOND.times(6)).asMillis());
|
||||
}});
|
||||
|
||||
+2
-2
@@ -50,8 +50,8 @@ public class WindStatusServlet extends SailingServerHttpServlet implements Igtim
|
||||
|
||||
protected static final String PARAM_RELOAD_WIND_RECEIVER="reloadWindReceiver";
|
||||
|
||||
protected final int NUMBER_OF_MESSAGES_TO_SHOW=20;
|
||||
protected final int NUMBER_OF_MESSAGES_PER_DEVICE_TO_SHOW=5;
|
||||
protected final int NUMBER_OF_MESSAGES_TO_SHOW=100;
|
||||
protected final int NUMBER_OF_MESSAGES_PER_DEVICE_TO_SHOW=10;
|
||||
|
||||
protected static final DecimalFormat decimalFormatter2Digits = new DecimalFormat("#.##");
|
||||
protected static final DecimalFormat decimalFormatter1Digit = new DecimalFormat("#.#");
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ public class EventReplicationTest extends AbstractServerReplicationTest {
|
||||
final TimePoint eventStartDate = new MillisecondsTimePoint(new Date());
|
||||
final TimePoint eventEndDate = new MillisecondsTimePoint(new Date());
|
||||
Event masterEvent = master.addEvent(eventName, /* eventDescription */ null, eventStartDate, eventEndDate, venueName, isPublic, UUID.randomUUID());
|
||||
CourseArea masterCourseArea = master.addCourseArea(masterEvent.getId(), courseArea, UUID.randomUUID());
|
||||
CourseArea masterCourseArea = master.addCourseAreas(masterEvent.getId(), new String[] {courseArea}, new UUID[] {UUID.randomUUID()})[0];
|
||||
|
||||
Thread.sleep(1000);
|
||||
Event replicatedEvent = replica.getEvent(masterEvent.getId());
|
||||
|
||||
+6
-6
@@ -69,8 +69,8 @@ public class RegattaReplicationTest extends AbstractServerReplicationTest {
|
||||
final TimePoint eventEndDate = new MillisecondsTimePoint(new Date());
|
||||
|
||||
Event event = master.addEvent("Event", /* eventDescription */ null, eventStartDate, eventEndDate, "Venue", true, UUID.randomUUID());
|
||||
master.addCourseArea(event.getId(), "Alpha", alphaCourseAreaId);
|
||||
master.addCourseArea(event.getId(), "TV", tvCourseAreaId);
|
||||
master.addCourseAreas(event.getId(), new String[] {"Alpha"}, new UUID[] {alphaCourseAreaId});
|
||||
master.addCourseAreas(event.getId(), new String[] {"TV"}, new UUID[] {tvCourseAreaId});
|
||||
|
||||
UUID currentCourseAreaId = null;
|
||||
Regatta masterRegatta = master.createRegatta(RegattaImpl.getDefaultName("Kiel Week 2012", "49er"), "49er",
|
||||
@@ -119,8 +119,8 @@ public class RegattaReplicationTest extends AbstractServerReplicationTest {
|
||||
final TimePoint eventStartDate = new MillisecondsTimePoint(new Date());
|
||||
final TimePoint eventEndDate = new MillisecondsTimePoint(new Date());
|
||||
Event event = master.addEvent("Event", /* eventDescription */ null, eventStartDate, eventEndDate, "Venue", /*isPublic*/true, UUID.randomUUID());
|
||||
master.addCourseArea(event.getId(), "TV", tvCourseAreaId);
|
||||
master.addCourseArea(event.getId(), "Golf", golfCourseAreaId);
|
||||
master.addCourseAreas(event.getId(), new String[] {"TV"}, new UUID[] {tvCourseAreaId});
|
||||
master.addCourseAreas(event.getId(), new String[] {"Golf"}, new UUID[] {golfCourseAreaId});
|
||||
final String regattaName = RegattaImpl.getDefaultName("Kiel Week 2012", "49er");
|
||||
Regatta masterRegatta = master.createRegatta(regattaName, "49er", /*startDate*/ null, /*endDate*/ null, UUID.randomUUID(), Collections.<Series>emptyList(),
|
||||
/* persistent */ true, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), tvCourseAreaId, /* useStartTimeInference */ true, OneDesignRankingMetric::new);
|
||||
@@ -144,7 +144,7 @@ public class RegattaReplicationTest extends AbstractServerReplicationTest {
|
||||
final TimePoint eventEndDate = new MillisecondsTimePoint(new Date());
|
||||
|
||||
Event event = master.addEvent("Event", /* eventDescription */ null, eventStartDate, eventEndDate, "Venue", true, UUID.randomUUID());
|
||||
master.addCourseArea(event.getId(), "Alpha", alphaCourseAreaId);
|
||||
master.addCourseAreas(event.getId(), new String[] {"Alpha"}, new UUID[] {alphaCourseAreaId});
|
||||
|
||||
UUID currentCourseAreaId = null;
|
||||
Regatta masterRegatta = master.createRegatta(RegattaImpl.getDefaultName("RR", "49er"), "49er", /*startDate*/ null, /*endDate*/ null, UUID.randomUUID(), Collections.<Series>emptyList(),
|
||||
@@ -302,7 +302,7 @@ public class RegattaReplicationTest extends AbstractServerReplicationTest {
|
||||
final TimePoint eventStartDate = new MillisecondsTimePoint(new Date());
|
||||
final TimePoint eventEndDate = new MillisecondsTimePoint(new Date());
|
||||
Event masterEvent = master.addEvent(eventName, /* eventDescription */ null, eventStartDate, eventEndDate, venueName, isPublic, UUID.randomUUID());
|
||||
CourseArea masterCourseArea = master.addCourseArea(masterEvent.getId(), courseArea, UUID.randomUUID());
|
||||
CourseArea masterCourseArea = master.addCourseAreas(masterEvent.getId(), new String[] {courseArea}, new UUID[] {UUID.randomUUID()})[0];
|
||||
|
||||
Regatta masterRegatta = master.createRegatta(RegattaImpl.getDefaultName(eventName, boatClassName), boatClassName, /*startDate*/ null, /*endDate*/ null, UUID.randomUUID(), series,
|
||||
/* persistent */ true, DomainFactory.INSTANCE.createScoringScheme(ScoringSchemeType.LOW_POINT), masterCourseArea.getId(), /* useStartTimeInference */ true, OneDesignRankingMetric::new);
|
||||
|
||||
+2
-2
@@ -1344,7 +1344,7 @@ public class MasterDataImportTest {
|
||||
new MillisecondsTimePoint(0), new MillisecondsTimePoint(10), "testvenue", false, UUID.randomUUID(),
|
||||
/* officialWebsiteURL */ null, /* sailorsInfoWebsiteURL */ null,
|
||||
/* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList());
|
||||
CourseArea defaultCourseArea = sourceService.addCourseArea(event.getId(), "ECHO", UUID.randomUUID());
|
||||
CourseArea defaultCourseArea = sourceService.addCourseAreas(event.getId(), new String[] {"ECHO"}, new UUID[] {UUID.randomUUID()})[0];
|
||||
|
||||
Regatta regatta = sourceService.createRegatta(
|
||||
RegattaImpl.getDefaultName(TEST_REGATTA_NAME, TEST_BOAT_CLASS_NAME), TEST_BOAT_CLASS_NAME, /*startDate*/ null, /*endDate*/ null,
|
||||
@@ -1409,7 +1409,7 @@ public class MasterDataImportTest {
|
||||
new MillisecondsTimePoint(0), new MillisecondsTimePoint(10), "testvenue", false, UUID.randomUUID(),
|
||||
/* officialWebsiteURL */ null, /* sailorsInfoWebsiteURL */ null,
|
||||
/* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList());
|
||||
CourseArea defaultCourseArea = sourceService.addCourseArea(event.getId(), "ECHO", UUID.randomUUID());
|
||||
CourseArea defaultCourseArea = sourceService.addCourseAreas(event.getId(), new String[] {"ECHO"}, new UUID[] {UUID.randomUUID()})[0];
|
||||
|
||||
List<String> raceColumnNames = new ArrayList<String>();
|
||||
String raceColumnName = "T1";
|
||||
|
||||
@@ -400,7 +400,7 @@ public interface RacingEventService extends TrackedRegattaRegistry, RegattaFetch
|
||||
void removeRemoteSailingServerReference(String name);
|
||||
|
||||
|
||||
CourseArea addCourseArea(UUID eventId, String courseAreaName, UUID courseAreaId);
|
||||
CourseArea[] addCourseAreas(UUID eventId, String[] courseAreaNames, UUID[] courseAreaIds);
|
||||
|
||||
com.sap.sailing.domain.base.DomainFactory getBaseDomainFactory();
|
||||
|
||||
@@ -473,9 +473,9 @@ public interface RacingEventService extends TrackedRegattaRegistry, RegattaFetch
|
||||
|
||||
void setRegattaForRace(Regatta regatta, String raceIdAsString);
|
||||
|
||||
CourseArea addCourseAreaWithoutReplication(UUID eventId, UUID courseAreaId, String courseAreaName);
|
||||
CourseArea[] addCourseAreasWithoutReplication(UUID eventId, UUID[] courseAreaIds, String[] courseAreaNames);
|
||||
|
||||
CourseArea removeCourseAreaWithoutReplication(UUID eventId, UUID courseAreaId);
|
||||
CourseArea[] removeCourseAreaWithoutReplication(UUID eventId, UUID[] courseAreaIds);
|
||||
|
||||
/**
|
||||
* Returns a mobile device's configuration.
|
||||
|
||||
+33
-25
@@ -171,7 +171,7 @@ import com.sap.sailing.server.gateway.deserialization.impl.LeaderboardGroupBaseJ
|
||||
import com.sap.sailing.server.gateway.deserialization.impl.LeaderboardSearchResultBaseJsonDeserializer;
|
||||
import com.sap.sailing.server.gateway.deserialization.impl.VenueJsonDeserializer;
|
||||
import com.sap.sailing.server.masterdata.DataImportLockWithProgress;
|
||||
import com.sap.sailing.server.operationaltransformation.AddCourseArea;
|
||||
import com.sap.sailing.server.operationaltransformation.AddCourseAreas;
|
||||
import com.sap.sailing.server.operationaltransformation.AddDefaultRegatta;
|
||||
import com.sap.sailing.server.operationaltransformation.AddMediaTrackOperation;
|
||||
import com.sap.sailing.server.operationaltransformation.AddRaceDefinition;
|
||||
@@ -2771,38 +2771,46 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
}
|
||||
|
||||
@Override
|
||||
public CourseArea addCourseArea(UUID eventId, String courseAreaName, UUID courseAreaId) {
|
||||
CourseArea courseArea = getBaseDomainFactory().getOrCreateCourseArea(courseAreaId, courseAreaName);
|
||||
addCourseAreaWithoutReplication(eventId, courseAreaId, courseAreaName);
|
||||
replicate(new AddCourseArea(eventId, courseAreaName, courseAreaId));
|
||||
return courseArea;
|
||||
public CourseArea[] addCourseAreas(UUID eventId, String[] courseAreaNames, UUID[] courseAreaIds) {
|
||||
final CourseArea[] courseAreas = addCourseAreasWithoutReplication(eventId, courseAreaIds, courseAreaNames);
|
||||
replicate(new AddCourseAreas(eventId, courseAreaNames, courseAreaIds));
|
||||
return courseAreas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CourseArea addCourseAreaWithoutReplication(UUID eventId, UUID courseAreaId, String courseAreaName) {
|
||||
final CourseArea courseArea = getBaseDomainFactory().getOrCreateCourseArea(courseAreaId, courseAreaName);
|
||||
public CourseArea[] addCourseAreasWithoutReplication(UUID eventId, UUID[] courseAreaIds, String[] courseAreaNames) {
|
||||
final CourseArea[] result = new CourseArea[courseAreaNames.length];
|
||||
for (int i=0; i<courseAreaIds.length; i++) {
|
||||
final CourseArea courseArea = getBaseDomainFactory().getOrCreateCourseArea(courseAreaIds[i], courseAreaNames[i]);
|
||||
final Event event = eventsById.get(eventId);
|
||||
if (event == null) {
|
||||
throw new IllegalArgumentException("No sailing event with ID " + eventId + " found.");
|
||||
}
|
||||
event.getVenue().addCourseArea(courseArea);
|
||||
mongoObjectFactory.storeEvent(event);
|
||||
result[i] = courseArea;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CourseArea[] removeCourseAreaWithoutReplication(UUID eventId, UUID[] courseAreaIds) {
|
||||
final Event event = eventsById.get(eventId);
|
||||
if (event == null) {
|
||||
throw new IllegalArgumentException("No sailing event with ID " + eventId + " found.");
|
||||
}
|
||||
event.getVenue().addCourseArea(courseArea);
|
||||
mongoObjectFactory.storeEvent(event);
|
||||
return courseArea;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CourseArea removeCourseAreaWithoutReplication(UUID eventId, UUID courseAreaId) {
|
||||
final CourseArea courseArea = getBaseDomainFactory().getExistingCourseAreaById(courseAreaId);
|
||||
if (courseArea == null) {
|
||||
throw new IllegalArgumentException("No course area with ID " + courseAreaId + " found.");
|
||||
final CourseArea[] courseAreasRemoved = new CourseArea[courseAreaIds.length];
|
||||
int i=0;
|
||||
for (final UUID courseAreaId : courseAreaIds) {
|
||||
final CourseArea courseArea = getBaseDomainFactory().getExistingCourseAreaById(courseAreaId);
|
||||
if (courseArea == null) {
|
||||
throw new IllegalArgumentException("No course area with ID " + courseAreaId + " found.");
|
||||
}
|
||||
courseAreasRemoved[i++] = courseArea;
|
||||
event.getVenue().removeCourseArea(courseArea);
|
||||
mongoObjectFactory.storeEvent(event);
|
||||
}
|
||||
final Event event = eventsById.get(eventId);
|
||||
if (event == null) {
|
||||
throw new IllegalArgumentException("No sailing event with ID " + eventId + " found.");
|
||||
}
|
||||
event.getVenue().removeCourseArea(courseArea);
|
||||
mongoObjectFactory.storeEvent(event);
|
||||
return courseArea;
|
||||
return courseAreasRemoved;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+8
-8
@@ -14,23 +14,23 @@ import com.sap.sailing.server.RacingEventServiceOperation;
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public class AddCourseArea extends AbstractRacingEventServiceOperation<CourseArea> {
|
||||
public class AddCourseAreas extends AbstractRacingEventServiceOperation<CourseArea[]> {
|
||||
|
||||
private static final long serialVersionUID = -3650109848260363949L;
|
||||
private final String courseAreaName;
|
||||
private final UUID courseAreaId;
|
||||
private final String[] courseAreaNames;
|
||||
private final UUID[] courseAreaIds;
|
||||
private final UUID eventId;
|
||||
|
||||
public AddCourseArea(UUID eventId, String courseAreaName, UUID courseAreaId) {
|
||||
public AddCourseAreas(UUID eventId, String[] courseAreaNames, UUID[] courseAreaIds) {
|
||||
super();
|
||||
this.eventId = eventId;
|
||||
this.courseAreaId = courseAreaId;
|
||||
this.courseAreaName = courseAreaName;
|
||||
this.courseAreaIds = courseAreaIds;
|
||||
this.courseAreaNames = courseAreaNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CourseArea internalApplyTo(RacingEventService toState) throws Exception {
|
||||
return toState.addCourseAreaWithoutReplication(eventId, courseAreaId, courseAreaName);
|
||||
public CourseArea[] internalApplyTo(RacingEventService toState) throws Exception {
|
||||
return toState.addCourseAreasWithoutReplication(eventId, courseAreaIds, courseAreaNames);
|
||||
}
|
||||
|
||||
@Override
|
||||
+1
-1
@@ -12,7 +12,7 @@ import com.sap.sse.common.media.VideoDescriptor;
|
||||
|
||||
/**
|
||||
* Creates an {@link Event} in the server, with a new venue and an empty course area list.
|
||||
* See the {@link AddCourseArea} operation for adding course areas to the event's venue.
|
||||
* See the {@link AddCourseAreas} operation for adding course areas to the event's venue.
|
||||
*
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
|
||||
+5
-5
@@ -13,20 +13,20 @@ import com.sap.sailing.server.RacingEventServiceOperation;
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public class RemoveCourseArea extends AbstractRacingEventServiceOperation<Void> {
|
||||
public class RemoveCourseAreas extends AbstractRacingEventServiceOperation<Void> {
|
||||
private static final long serialVersionUID = -3650109848260363949L;
|
||||
private final UUID courseAreaId;
|
||||
private final UUID[] courseAreaIds;
|
||||
private final UUID eventId;
|
||||
|
||||
public RemoveCourseArea(UUID eventId, UUID courseAreaId) {
|
||||
public RemoveCourseAreas(UUID eventId, UUID[] courseAreaIds) {
|
||||
super();
|
||||
this.eventId = eventId;
|
||||
this.courseAreaId = courseAreaId;
|
||||
this.courseAreaIds = courseAreaIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void internalApplyTo(RacingEventService toState) throws Exception {
|
||||
toState.removeCourseAreaWithoutReplication(eventId, courseAreaId);
|
||||
toState.removeCourseAreaWithoutReplication(eventId, courseAreaIds);
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user