mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-27 06:17:27 +00:00
Merge branch 'master' into design2015
This commit is contained in:
commit
edfa660635
43 files changed
+197
-195
No files matched your search
+1
-1
@@ -67,7 +67,7 @@ public enum BoatClassMasterdata {
|
||||
RC44 ("RC44", true, 13.35, 2.75, BoatHullType.MONOHULL, true),
|
||||
FLYING_DUTCHMAN ("Flying Dutchman", true, 6.10, 1.80, BoatHullType.MONOHULL, true),
|
||||
DYAS("Dyas", true, 7.15, 1.95, BoatHullType.MONOHULL, true),
|
||||
INTERNATIONAL_14("International 14", true, 4.27, 1.83, BoatHullType.MONOHULL, true, "I14"),
|
||||
INTERNATIONAL_14("International 14", true, 4.27, 1.83, BoatHullType.MONOHULL, true, "I14", "Int.14", "Int14"),
|
||||
OPEN_BIC("O'pen BIC", true, 2.75, 1.14, BoatHullType.MONOHULL, false, "OpenBIC"),
|
||||
|
||||
// multi-class "boat classes"; to be replaced at some later point in time by something like a RegattaClass
|
||||
|
||||
+8
@@ -1047,6 +1047,14 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
|
||||
logger.severe("Error parsing official website URL "+officialWebSiteURLAsString+" for event "+name+". Ignoring this URL.");
|
||||
}
|
||||
}
|
||||
String sailorsInfoWebSiteURLAsString = (String) eventDBObject.get(FieldNames.EVENT_SAILORS_INFO_WEBSITE_URL.name());
|
||||
if (sailorsInfoWebSiteURLAsString != null) {
|
||||
try {
|
||||
result.setSailorsInfoWebsiteURL(new URL(sailorsInfoWebSiteURLAsString));
|
||||
} catch (MalformedURLException e) {
|
||||
logger.severe("Error parsing sailors info website URL "+sailorsInfoWebSiteURLAsString+" for event "+name+". Ignoring this URL.");
|
||||
}
|
||||
}
|
||||
BasicDBList images = (BasicDBList) eventDBObject.get(FieldNames.EVENT_IMAGES.name());
|
||||
if (images != null) {
|
||||
for (Object imageObject : images) {
|
||||
|
||||
+1
@@ -22,6 +22,7 @@ public enum FieldNames {
|
||||
EVENT_IMAGES,
|
||||
EVENT_VIDEOS,
|
||||
EVENT_OFFICIAL_WEBSITE_URL,
|
||||
EVENT_SAILORS_INFO_WEBSITE_URL,
|
||||
EVENT_LOGO_IMAGE_URL,
|
||||
|
||||
REGATTA_NAME,
|
||||
|
||||
+1
@@ -536,6 +536,7 @@ public class MongoObjectFactoryImpl implements MongoObjectFactory {
|
||||
eventDBObject.put(FieldNames.EVENT_ID.name(), event.getId());
|
||||
eventDBObject.put(FieldNames.EVENT_LOGO_IMAGE_URL.name(), event.getLogoImageURL() != null ? event.getLogoImageURL().toString() : null);
|
||||
eventDBObject.put(FieldNames.EVENT_OFFICIAL_WEBSITE_URL.name(), event.getOfficialWebsiteURL() != null ? event.getOfficialWebsiteURL().toString() : null);
|
||||
eventDBObject.put(FieldNames.EVENT_SAILORS_INFO_WEBSITE_URL.name(), event.getSailorsInfoWebsiteURL() != null ? event.getSailorsInfoWebsiteURL().toString() : null);
|
||||
storeTimePoint(event.getStartDate(), eventDBObject, FieldNames.EVENT_START_DATE);
|
||||
storeTimePoint(event.getEndDate(), eventDBObject, FieldNames.EVENT_END_DATE);
|
||||
eventDBObject.put(FieldNames.EVENT_IS_PUBLIC.name(), event.isPublic());
|
||||
|
||||
+16
-1
@@ -4,12 +4,15 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -18,6 +21,7 @@ import com.sap.sailing.domain.abstractlog.impl.LogEventAuthorImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEventFactory;
|
||||
import com.sap.sailing.domain.abstractlog.race.analyzing.impl.RaceLogResolver;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogFlagEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogStartProcedureChangedEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.RaceState;
|
||||
@@ -125,7 +129,18 @@ public class RaceStateTest {
|
||||
verify(listener).onStatusChanged(state);
|
||||
verifyNoMoreInteractions(listener);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* See bug 3086: make sure that race log change events cause an update of the RacingProcedure
|
||||
*/
|
||||
@Test
|
||||
public void testSetIndividualRecall() {
|
||||
assertFalse(state.getRacingProcedure().isIndividualRecallDisplayed());
|
||||
raceLog.add(new RaceLogFlagEventImpl(MillisecondsTimePoint.now(), author, MillisecondsTimePoint.now(), UUID
|
||||
.randomUUID(), null, /* pass */0, Flags.XRAY, Flags.NONE, /* pIsDisplayed */true));
|
||||
assertTrue(state.getRacingProcedure().isIndividualRecallDisplayed());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAdvancePass() {
|
||||
state.addChangedListener(listener);
|
||||
|
||||
+6
@@ -3,6 +3,12 @@ package com.sap.sailing.domain.abstractlog.race.impl;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogChangedListener;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
|
||||
/**
|
||||
* Forwards events received by this visitor to the listener passed to the constructor.
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
public class RaceLogChangedVisitor extends AbstractRaceLogChangedVisitor {
|
||||
private final RaceLogChangedListener listener;
|
||||
|
||||
|
||||
+10
-1
@@ -14,7 +14,10 @@ import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
|
||||
/**
|
||||
* A listener that unregisters itself from the race log's listeners if its notification target is no longer strongly
|
||||
* referenced.
|
||||
* referenced. Note that the visitor is <em>not</em> automatically registered by the constructor although the
|
||||
* {@link RaceLog} object is passed in.
|
||||
* {@link RaceLog#addListener(com.sap.sailing.domain.abstractlog.race.RaceLogEventVisitor) registration} of this visitor
|
||||
* as a listener on the {@link RaceLog} has to happen explicitly by the client.
|
||||
*
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
@@ -45,6 +48,12 @@ public class WeakRaceLogChangedVisitor extends AbstractRaceLogChangedVisitor {
|
||||
private final WeakReference<RaceLogChangedListener> listenerRef;
|
||||
private final RaceLog removeFromThisRaceLogWhenListenerNoLongerStronglyReferenced;
|
||||
|
||||
/**
|
||||
* Remembers from which {@link RaceLog} to {@link RaceLog#removeListener(Object) remove} this visitor as a listener
|
||||
* when the <code>listener</code> is no longer strongly referenced. This constructor does <em>not</em> register this
|
||||
* visitor as a listener on the {@link RaceLog}. This has to happen explicitly by the caller after this constructor
|
||||
* has returned.
|
||||
*/
|
||||
public WeakRaceLogChangedVisitor(RaceLog removeFromThisRaceLogWhenListenerNoLongerStronglyReferenced, RaceLogChangedListener listener) {
|
||||
this.removeFromThisRaceLogWhenListenerNoLongerStronglyReferenced = removeFromThisRaceLogWhenListenerNoLongerStronglyReferenced;
|
||||
listenerRef = new WeakReference<RaceLogChangedListener>(listener, queue);
|
||||
|
||||
+2
-3
@@ -91,6 +91,7 @@ public abstract class BaseRacingProcedure extends BaseRaceStateChangedListener i
|
||||
this.finishedTimeFinder = new FinishedTimeFinder(raceLog);
|
||||
this.startTimeFinder = new StartTimeFinder(raceLogResolver, raceLog);
|
||||
this.raceLogListener = new WeakRaceLogChangedVisitor(this.raceLog, this);
|
||||
this.raceLog.addListener(this.raceLogListener);
|
||||
this.cachedIsIndividualRecallDisplayed = false;
|
||||
}
|
||||
|
||||
@@ -223,7 +224,6 @@ public abstract class BaseRacingProcedure extends BaseRaceStateChangedListener i
|
||||
|
||||
protected void update() {
|
||||
boolean isRecallDisplayed = isRecallDisplayedAnalyzer.analyze();
|
||||
|
||||
if (cachedIsIndividualRecallDisplayed != isRecallDisplayed) {
|
||||
cachedIsIndividualRecallDisplayed = isRecallDisplayed;
|
||||
if (cachedIsIndividualRecallDisplayed) {
|
||||
@@ -233,8 +233,7 @@ public abstract class BaseRacingProcedure extends BaseRaceStateChangedListener i
|
||||
changedListeners.onIndividualRecallRemoved(this);
|
||||
unscheduleStateEvent(RaceStateEvents.INDIVIDUAL_RECALL_TIMEOUT);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// always call listeners for changed flag, as this does not only affect recall, but also
|
||||
// changes start procedure, for which some text elements need to be updated
|
||||
// ({@link BaseRaceInfoFragmen#renderFlagChangesCountdown}
|
||||
|
||||
+8
@@ -81,6 +81,14 @@ public interface EventBase extends Named, WithDescription, Renamable, WithID, Wi
|
||||
|
||||
void setOfficialWebsiteURL(URL officialWebsiteURL);
|
||||
|
||||
/**
|
||||
* @return the URL of an external web site containing sailor related information like protests, official results, etc.
|
||||
* or <code>null</code> if such a site does not exist or its URL is not known.
|
||||
*/
|
||||
URL getSailorsInfoWebsiteURL();
|
||||
|
||||
void setSailorsInfoWebsiteURL(URL sailorsInfoWebsiteURL);
|
||||
|
||||
Iterable<? extends LeaderboardGroupBase> getLeaderboardGroups();
|
||||
|
||||
/**
|
||||
|
||||
+11
@@ -36,6 +36,7 @@ public abstract class EventBaseImpl implements EventBase {
|
||||
private TimePoint startDate;
|
||||
private TimePoint endDate;
|
||||
private URL officialWebsiteURL;
|
||||
private URL sailorsInfoWebsiteURL;
|
||||
private ConcurrentLinkedQueue<ImageDescriptor> images;
|
||||
private ConcurrentLinkedQueue<VideoDescriptor> videos;
|
||||
|
||||
@@ -182,6 +183,16 @@ public abstract class EventBaseImpl implements EventBase {
|
||||
this.officialWebsiteURL = officialWebsiteURL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getSailorsInfoWebsiteURL() {
|
||||
return sailorsInfoWebsiteURL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSailorsInfoWebsiteURL(URL sailorsInfoWebsiteURL) {
|
||||
this.sailorsInfoWebsiteURL = sailorsInfoWebsiteURL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<ImageDescriptor> getImages() {
|
||||
return Collections.unmodifiableCollection(images);
|
||||
|
||||
+28
-33
@@ -105,13 +105,13 @@ public class TrackedRegattaImpl implements TrackedRegatta {
|
||||
@Override
|
||||
public void addTrackedRace(TrackedRace trackedRace) {
|
||||
final TrackedRace oldTrackedRace;
|
||||
LockUtil.lockForWrite(trackedRacesLock);
|
||||
lockTrackedRacesForWrite();
|
||||
try {
|
||||
logger.info("adding tracked race for "+trackedRace.getRace()+" to tracked regatta "+getRegatta().getName()+
|
||||
" with regatta hash code "+getRegatta().hashCode());
|
||||
oldTrackedRace = trackedRaces.put(trackedRace.getRace(), trackedRace);
|
||||
} finally {
|
||||
LockUtil.unlockAfterWrite(trackedRacesLock);
|
||||
unlockTrackedRacesAfterWrite();
|
||||
}
|
||||
if (oldTrackedRace != trackedRace) {
|
||||
for (RaceListener listener : raceListeners.keySet()) {
|
||||
@@ -159,43 +159,38 @@ public class TrackedRegattaImpl implements TrackedRegatta {
|
||||
@Override
|
||||
public TrackedRace getTrackedRace(RaceDefinition race) {
|
||||
boolean interrupted = false;
|
||||
lockTrackedRacesForRead();
|
||||
try {
|
||||
TrackedRace result = trackedRaces.get(race);
|
||||
if (!interrupted && result == null) {
|
||||
final Object mutex = new Object();
|
||||
final RaceListener listener = new RaceListener() {
|
||||
@Override
|
||||
public void raceRemoved(TrackedRace trackedRace) {}
|
||||
|
||||
@Override
|
||||
public void raceAdded(TrackedRace trackedRace) {
|
||||
synchronized (mutex) {
|
||||
mutex.notifyAll();
|
||||
}
|
||||
}
|
||||
};
|
||||
addRaceListener(listener);
|
||||
try {
|
||||
TrackedRace result = getExistingTrackedRace(race);
|
||||
if (!interrupted && result == null) {
|
||||
final Object mutex = new Object();
|
||||
final RaceListener listener = new RaceListener() {
|
||||
@Override
|
||||
public void raceRemoved(TrackedRace trackedRace) {}
|
||||
|
||||
@Override
|
||||
public void raceAdded(TrackedRace trackedRace) {
|
||||
synchronized (mutex) {
|
||||
result = trackedRaces.get(race);
|
||||
while (!interrupted && result == null) {
|
||||
try {
|
||||
mutex.wait();
|
||||
result = trackedRaces.get(race);
|
||||
} catch (InterruptedException e) {
|
||||
interrupted = true;
|
||||
}
|
||||
mutex.notifyAll();
|
||||
}
|
||||
}
|
||||
};
|
||||
addRaceListener(listener);
|
||||
try {
|
||||
synchronized (mutex) {
|
||||
result = getExistingTrackedRace(race);
|
||||
while (!interrupted && result == null) {
|
||||
try {
|
||||
mutex.wait();
|
||||
result = getExistingTrackedRace(race);
|
||||
} catch (InterruptedException e) {
|
||||
interrupted = true;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
removeRaceListener(listener);
|
||||
}
|
||||
} finally {
|
||||
removeRaceListener(listener);
|
||||
}
|
||||
return result;
|
||||
} finally {
|
||||
unlockTrackedRacesAfterRead();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ public class TabletAndDesktopEventView extends Composite implements EventMultire
|
||||
|
||||
initBreadCrumbs();
|
||||
|
||||
String sailorsInfoURL = currentPresenter.getCtx().getEventDTO().getSailorsInfoURL();
|
||||
String sailorsInfoURL = currentPresenter.getCtx().getEventDTO().getSailorsInfoWebsiteURL();
|
||||
if(sailorsInfoURL != null && ! sailorsInfoURL.isEmpty()) {
|
||||
Label label = new Label();
|
||||
label.getElement().setInnerHTML(i18n.sailorInfoLongText().replace("\n", "<br />"));
|
||||
|
||||
+2
@@ -31,6 +31,8 @@ public class EventCreateDialog extends EventDialog {
|
||||
endDateBox.setFormat("dd/mm/yyyy hh:ii");
|
||||
officialWebsiteURLEntryField = createTextBox(null);
|
||||
officialWebsiteURLEntryField.setVisibleLength(50);
|
||||
sailorsInfoWebsiteURLEntryField = createTextBox(null);
|
||||
sailorsInfoWebsiteURLEntryField.setVisibleLength(50);
|
||||
isPublicCheckBox = createCheckbox("");
|
||||
isPublicCheckBox.setValue(false);
|
||||
imagesListComposite.fillImages(Collections.<ImageDTO>emptyList());
|
||||
|
||||
+5
-1
@@ -38,6 +38,7 @@ public class EventDetailsComposite extends Composite {
|
||||
private final Label endDate;
|
||||
private final Label isPublic;
|
||||
private final Anchor officialWebsiteURL;
|
||||
private final Anchor sailorsInfoWebsiteURL;
|
||||
private final Anchor eventOverviewURL;
|
||||
private final SimpleStringListComposite courseAreaNamesList;
|
||||
private final SimpleStringListComposite imageURLList;
|
||||
@@ -55,7 +56,7 @@ public class EventDetailsComposite extends Composite {
|
||||
VerticalPanel vPanel = new VerticalPanel();
|
||||
mainPanel.add(vPanel);
|
||||
|
||||
int rows = 15;
|
||||
int rows = 16;
|
||||
Grid grid = new Grid(rows, 2);
|
||||
vPanel.add(grid);
|
||||
|
||||
@@ -68,6 +69,7 @@ public class EventDetailsComposite extends Composite {
|
||||
endDate = createLabelAndValueWidget(grid, currentRow++, stringMessages.endDate(), "EndDateLabel");
|
||||
isPublic = createLabelAndValueWidget(grid, currentRow++, stringMessages.isPublic(), "IsPublicLabel");
|
||||
officialWebsiteURL = createAnchorAndValueWidget(grid, currentRow++, stringMessages.eventOfficialWebsiteURL(), "OfficialWebsiteURLLabel");
|
||||
sailorsInfoWebsiteURL = createAnchorAndValueWidget(grid, currentRow++, stringMessages.eventSailorsInfoWebsiteURL(), "SailorsInfoWebsiteURLLabel");
|
||||
eventOverviewURL = createAnchorAndValueWidget(grid, currentRow++, stringMessages.eventOverviewURL(), "EventOverviewURLLabel");
|
||||
courseAreaNamesList = createLableAndValueListWidget(grid, currentRow++, stringMessages.courseAreas(), "CourseAreaValueList");
|
||||
imageURLList = createLableAndValueListWidget(grid, currentRow++, stringMessages.images(), "ImageURLValueList");
|
||||
@@ -128,6 +130,8 @@ public class EventDetailsComposite extends Composite {
|
||||
isPublic.setText(String.valueOf(event.isPublic));
|
||||
officialWebsiteURL.setText(event.getOfficialWebsiteURL());
|
||||
officialWebsiteURL.setHref(event.getOfficialWebsiteURL());
|
||||
sailorsInfoWebsiteURL.setText(event.getSailorsInfoWebsiteURL());
|
||||
sailorsInfoWebsiteURL.setHref(event.getSailorsInfoWebsiteURL());
|
||||
Map<String, String> regattaOverviewURLParameters = new HashMap<String, String>();
|
||||
regattaOverviewURLParameters.put("event", event.id.toString());
|
||||
String regattaOverviewLink = EntryPointLinkFactory.createRegattaOverviewLink(regattaOverviewURLParameters);
|
||||
|
||||
+5
-1
@@ -42,6 +42,7 @@ public abstract class EventDialog extends DataEntryDialogWithBootstrap<EventDTO>
|
||||
protected CheckBox isPublicCheckBox;
|
||||
protected UUID id;
|
||||
protected TextBox officialWebsiteURLEntryField;
|
||||
protected TextBox sailorsInfoWebsiteURLEntryField;
|
||||
protected StringListInlineEditorComposite courseAreaNameList;
|
||||
protected StringConstantsListEditorComposite leaderboardGroupList;
|
||||
protected List<LeaderboardGroupDTO> availableLeaderboardGroups;
|
||||
@@ -157,6 +158,7 @@ public abstract class EventDialog extends DataEntryDialogWithBootstrap<EventDTO>
|
||||
result.setName(nameEntryField.getText());
|
||||
result.setDescription(descriptionEntryField.getText());
|
||||
result.setOfficialWebsiteURL(officialWebsiteURLEntryField.getText().trim().isEmpty() ? null : officialWebsiteURLEntryField.getText().trim());
|
||||
result.setSailorsInfoWebsiteURL(sailorsInfoWebsiteURLEntryField.getText().trim().isEmpty() ? null : sailorsInfoWebsiteURLEntryField.getText().trim());
|
||||
result.startDate = startDateBox.getValue();
|
||||
result.endDate = endDateBox.getValue();
|
||||
result.isPublic = isPublicCheckBox.getValue();
|
||||
@@ -187,7 +189,7 @@ public abstract class EventDialog extends DataEntryDialogWithBootstrap<EventDTO>
|
||||
panel.add(additionalWidget);
|
||||
}
|
||||
|
||||
Grid formGrid = new Grid(7, 2);
|
||||
Grid formGrid = new Grid(8, 2);
|
||||
panel.add(formGrid);
|
||||
|
||||
formGrid.setWidget(0, 0, new Label(stringMessages.name() + ":"));
|
||||
@@ -204,6 +206,8 @@ public abstract class EventDialog extends DataEntryDialogWithBootstrap<EventDTO>
|
||||
formGrid.setWidget(5, 1, isPublicCheckBox);
|
||||
formGrid.setWidget(6, 0, new Label(stringMessages.eventOfficialWebsiteURL() + ":"));
|
||||
formGrid.setWidget(6, 1, officialWebsiteURLEntryField);
|
||||
formGrid.setWidget(7, 0, new Label(stringMessages.eventSailorsInfoWebsiteURL() + ":"));
|
||||
formGrid.setWidget(7, 1, sailorsInfoWebsiteURLEntryField);
|
||||
|
||||
TabLayoutPanel tabPanel = new TabLayoutPanel(30, Unit.PX);
|
||||
tabPanel.setHeight("250px");
|
||||
|
||||
+2
@@ -36,6 +36,8 @@ public class EventEditDialog extends EventDialog {
|
||||
}
|
||||
officialWebsiteURLEntryField = createTextBox(event.getOfficialWebsiteURL());
|
||||
officialWebsiteURLEntryField.setVisibleLength(50);
|
||||
sailorsInfoWebsiteURLEntryField = createTextBox(event.getSailorsInfoWebsiteURL());
|
||||
sailorsInfoWebsiteURLEntryField.setVisibleLength(50);
|
||||
courseAreaNameList.setValue(courseAreaNames);
|
||||
List<String> leaderboardGroupNames = new ArrayList<>();
|
||||
for(LeaderboardGroupDTO leaderboardGroupDTO: event.getLeaderboardGroups()) {
|
||||
|
||||
+3
-2
@@ -491,7 +491,8 @@ public class EventListComposite extends Composite implements EventsRefresher, Le
|
||||
sailingService.updateEvent(oldEvent.id, oldEvent.getName(), updatedEvent.getDescription(),
|
||||
updatedEvent.startDate, updatedEvent.endDate, updatedEvent.venue,
|
||||
updatedEvent.isPublic, updatedEventLeaderboardGroupIds,
|
||||
updatedEvent.getOfficialWebsiteURL(), updatedEvent.getImages(), updatedEvent.getVideos(),
|
||||
updatedEvent.getOfficialWebsiteURL(), updatedEvent.getSailorsInfoWebsiteURL(),
|
||||
updatedEvent.getImages(), updatedEvent.getVideos(),
|
||||
new AsyncCallback<EventDTO>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
@@ -562,7 +563,7 @@ public class EventListComposite extends Composite implements EventsRefresher, Le
|
||||
courseAreaNames.add(courseAreaDTO.getName());
|
||||
}
|
||||
sailingService.createEvent(newEvent.getName(), newEvent.getDescription(), newEvent.startDate, newEvent.endDate,
|
||||
newEvent.venue.getName(), newEvent.isPublic, courseAreaNames, newEvent.getOfficialWebsiteURL(),
|
||||
newEvent.venue.getName(), newEvent.isPublic, courseAreaNames, newEvent.getOfficialWebsiteURL(), newEvent.getSailorsInfoWebsiteURL(),
|
||||
newEvent.getImages(), newEvent.getVideos(), new AsyncCallback<EventDTO>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
|
||||
-107
@@ -1,107 +0,0 @@
|
||||
package com.sap.sailing.gwt.ui.adminconsole;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.gwt.user.client.ui.CheckBox;
|
||||
import com.google.gwt.user.client.ui.Grid;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.TextArea;
|
||||
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.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.BetterDateTimeBox;
|
||||
import com.sap.sailing.gwt.ui.shared.CourseAreaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.VenueDTO;
|
||||
import com.sap.sse.gwt.client.controls.listedit.StringListInlineEditorComposite;
|
||||
import com.sap.sse.gwt.client.dialog.DataEntryDialog;
|
||||
|
||||
|
||||
public class RegattaImportDialog extends DataEntryDialog<String>{
|
||||
protected StringMessages stringMessages;
|
||||
protected TextBox nameEntryField;
|
||||
protected TextArea descriptionEntryField;
|
||||
protected TextBox venueEntryField;
|
||||
protected BetterDateTimeBox startDateBox;
|
||||
protected BetterDateTimeBox endDateBox;
|
||||
protected CheckBox isPublicCheckBox;
|
||||
protected UUID id;
|
||||
protected TextBox officialWebsiteURLEntryField;
|
||||
protected StringListInlineEditorComposite courseAreaNameList;
|
||||
protected StringListInlineEditorComposite imageURLList;
|
||||
protected StringListInlineEditorComposite videoURLList;
|
||||
protected StringListInlineEditorComposite sponsorImageURLList;
|
||||
|
||||
public RegattaImportDialog(StringMessages stringMessages, String message,
|
||||
com.sap.sse.gwt.client.dialog.DataEntryDialog.Validator<String> validator,
|
||||
com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback<String> callback) {
|
||||
super("Regattas"/*title*/, null/*message*/, stringMessages.ok(), stringMessages.cancel(), validator, false/*animationEnables; raus?*/, callback);
|
||||
this.stringMessages = stringMessages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Widget getAdditionalWidget() {
|
||||
final VerticalPanel panel = new VerticalPanel();
|
||||
Widget additionalWidget = super.getAdditionalWidget();
|
||||
if (additionalWidget != null) {
|
||||
panel.add(additionalWidget);
|
||||
}
|
||||
|
||||
Grid formGrid = new Grid(7, 2);
|
||||
panel.add(formGrid);
|
||||
|
||||
formGrid.setWidget(0, 0, new Label(stringMessages.name() + ":"));
|
||||
formGrid.setWidget(0, 1, nameEntryField);
|
||||
formGrid.setWidget(1, 0, new Label(stringMessages.description() + ":"));
|
||||
formGrid.setWidget(1, 1, descriptionEntryField);
|
||||
formGrid.setWidget(2, 0, new Label(stringMessages.venue() + ":"));
|
||||
formGrid.setWidget(2, 1, venueEntryField);
|
||||
formGrid.setWidget(3, 0, new Label(stringMessages.startDate() + ":"));
|
||||
formGrid.setWidget(3, 1, startDateBox);
|
||||
formGrid.setWidget(4, 0, new Label(stringMessages.endDate() + ":"));
|
||||
formGrid.setWidget(4, 1, endDateBox);
|
||||
formGrid.setWidget(5, 0, new Label(stringMessages.isPublic() + ":"));
|
||||
formGrid.setWidget(5, 1, isPublicCheckBox);
|
||||
formGrid.setWidget(6, 0, new Label(stringMessages.eventOfficialWebsiteURL() + ":"));
|
||||
formGrid.setWidget(6, 1, officialWebsiteURLEntryField);
|
||||
|
||||
panel.add(createHeadlineLabel(stringMessages.courseAreas()));
|
||||
panel.add(courseAreaNameList);
|
||||
panel.add(createHeadlineLabel(stringMessages.imageURLs()));
|
||||
panel.add(imageURLList);
|
||||
panel.add(createHeadlineLabel(stringMessages.videoURLs()));
|
||||
panel.add(videoURLList);
|
||||
panel.add(createHeadlineLabel(stringMessages.sponsorImageURLs()));
|
||||
panel.add(sponsorImageURLList);
|
||||
return panel;
|
||||
}
|
||||
|
||||
protected String getResult() {
|
||||
EventDTO result = new EventDTO();
|
||||
result.setName(nameEntryField.getText());
|
||||
result.setDescription(descriptionEntryField.getText());
|
||||
result.setOfficialWebsiteURL(officialWebsiteURLEntryField.getText().trim().isEmpty() ? null : officialWebsiteURLEntryField.getText().trim());
|
||||
result.startDate = startDateBox.getValue();
|
||||
result.endDate = endDateBox.getValue();
|
||||
result.isPublic = isPublicCheckBox.getValue();
|
||||
result.id = id;
|
||||
|
||||
List<CourseAreaDTO> courseAreas = new ArrayList<CourseAreaDTO>();
|
||||
for (String courseAreaName : courseAreaNameList.getValue()) {
|
||||
CourseAreaDTO courseAreaDTO = new CourseAreaDTO();
|
||||
courseAreaDTO.setName(courseAreaName);
|
||||
courseAreas.add(courseAreaDTO);
|
||||
}
|
||||
result.venue = new VenueDTO(venueEntryField.getText(), courseAreas);
|
||||
return "OK";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
nameEntryField.setFocus(true);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -257,7 +257,7 @@ public class StructureImportManagementPanel extends SimplePanel implements Regat
|
||||
courseAreaNames.add(courseAreaDTO.getName());
|
||||
}
|
||||
sailingService.createEvent(newEvent.getName(), newEvent.getDescription(), newEvent.startDate, newEvent.endDate,
|
||||
newEvent.venue.getName(), newEvent.isPublic, courseAreaNames, newEvent.getOfficialWebsiteURL(),
|
||||
newEvent.venue.getName(), newEvent.isPublic, courseAreaNames, newEvent.getOfficialWebsiteURL(), newEvent.getSailorsInfoWebsiteURL(),
|
||||
newEvent.getImages(), newEvent.getVideos(),
|
||||
new AsyncCallback<EventDTO>() {
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -295,11 +295,11 @@ public interface SailingService extends RemoteService, FileStorageManagementGwtS
|
||||
void updateRacesDelayToLive(List<RegattaAndRaceIdentifier> regattaAndRaceIdentifiers, long delayToLiveInMs);
|
||||
|
||||
EventDTO updateEvent(UUID eventId, String eventName, String eventDescription, Date startDate, Date endDate,
|
||||
VenueDTO venue, boolean isPublic, Iterable<UUID> leaderboardGroupIds, String officialWebsiteURL,
|
||||
VenueDTO venue, boolean isPublic, Iterable<UUID> leaderboardGroupIds, String officialWebsiteURL, String sailorsInfoWebsiteURL,
|
||||
Iterable<ImageDTO> images, Iterable<VideoDTO> videos) throws Exception;
|
||||
|
||||
EventDTO createEvent(String eventName, String eventDescription, Date startDate, Date endDate, String venue,
|
||||
boolean isPublic, List<String> courseAreaNames, String officialWebsiteURL, Iterable<ImageDTO> images, Iterable<VideoDTO> videos) throws Exception;
|
||||
boolean isPublic, List<String> courseAreaNames, String officialWebsiteURL, String sailorsInfoWebsiteURL, Iterable<ImageDTO> images, Iterable<VideoDTO> videos) throws Exception;
|
||||
|
||||
void removeEvent(UUID eventId);
|
||||
|
||||
|
||||
+2
-2
@@ -367,11 +367,11 @@ public interface SailingServiceAsync extends BuildVersionRetriever, FileStorageM
|
||||
void removeEvents(Collection<UUID> eventIds, AsyncCallback<Void> asyncCallback);
|
||||
|
||||
void createEvent(String eventName, String eventDescription, Date startDate, Date endDate, String venue, boolean isPublic,
|
||||
List<String> courseAreaNames, String officialWebsiteURL, Iterable<ImageDTO> images, Iterable<VideoDTO> videos,
|
||||
List<String> courseAreaNames, String officialWebsiteURL, String sailorsInfoWebsiteURL, Iterable<ImageDTO> images, Iterable<VideoDTO> videos,
|
||||
AsyncCallback<EventDTO> callback);
|
||||
|
||||
void updateEvent(UUID eventId, String eventName, String eventDescription, Date startDate, Date endDate,
|
||||
VenueDTO venue, boolean isPublic, Iterable<UUID> leaderboardGroupIds, String officialWebsiteURL,
|
||||
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);
|
||||
|
||||
+1
@@ -1093,6 +1093,7 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages, c
|
||||
String advancePassId();
|
||||
String pleaseSelectAScoringResult();
|
||||
String eventOfficialWebsiteURL();
|
||||
String eventSailorsInfoWebsiteURL();
|
||||
String eventOverviewURL();
|
||||
String eventLogoImageURL();
|
||||
String showPingMarkMappings();
|
||||
|
||||
+1
@@ -1067,6 +1067,7 @@ invalidSelection=The current selection isn''t valid.
|
||||
advancePassId=Advance Pass ID
|
||||
pleaseSelectAScoringResult=Please select a scoring result...
|
||||
eventOfficialWebsiteURL=Official Website URL
|
||||
eventSailorsInfoWebsiteURL=Sailors Info Website URL
|
||||
eventOverviewURL=Event Overview URL
|
||||
eventLogoImageURL=Logo Image URL
|
||||
showPingMarkMappings=Show Mappings for pinged Marks
|
||||
|
||||
+4
-3
@@ -1060,9 +1060,10 @@ sponsorImageURLs=Sponsorenlogo-URLs
|
||||
invalidSelection=Die aktuelle Selektion ist nicht gültig.
|
||||
advancePassId=Pass ID erhöhen
|
||||
pleaseSelectAScoringResult=Bitte ein Ergebnis auswählen...
|
||||
eventOfficialWebsiteURL=URL der offiziellen Veranstaltungs-Website
|
||||
eventOverviewURL=URL der Eventübersicht
|
||||
eventLogoImageURL=URL des Veranstaltungs-Logos
|
||||
eventOfficialWebsiteURL=URL der offiziellen Veranstaltungswebseite
|
||||
eventSailorsInfoWebsiteURL=URL zur Webseite mit Seglerinfos
|
||||
eventOverviewURL=URL der Veranstaltungsübersicht
|
||||
eventLogoImageURL=URL des Veranstaltungslogos
|
||||
showPingMarkMappings=Mappings für gepingte Marks zeigen
|
||||
errorFetchingWindStreamletData=Fehler beim Empfang der Streamlet-Winddaten: {0}
|
||||
showWindStreamletOverlay=Wind als Streamlets überlagern
|
||||
|
||||
+1
@@ -1019,6 +1019,7 @@ videoURLs=Video URLs
|
||||
sponsorImageURLs=Sponsor Image URLs
|
||||
pleaseSelectAScoringResult=Please select a scoring result...
|
||||
eventOfficialWebsiteURL=Official Website URL
|
||||
eventSailorsInfoWebsiteURL=Sailors Info Website URL
|
||||
eventOverviewURL=Event Overview URL
|
||||
eventLogoImageURL=Logo Image URL
|
||||
showPingMarkMappings=Show Mappings for pinged Marks
|
||||
|
||||
+1
@@ -8,6 +8,7 @@ pleaseSelectARace=Please select a race
|
||||
columnMoveUp=Up
|
||||
enterCarryValueFor=Enter carried points for competitor {0}
|
||||
eventOfficialWebsiteURL=Official Website URL
|
||||
eventSailorsInfoWebsiteURL=Sailors Info Website URL
|
||||
polarSheetOutlierDetectionMinimumPercTooltip=The percentage of neighborhood datapoints / overall datapoints\nneeds to be at less than the given value for the point to be considered an outlier.
|
||||
errorTryingToCreateNewEvent=Error trying to create new event {0}: {1}
|
||||
xyDiagram=x-y-Diagram
|
||||
|
||||
+8
-5
@@ -3300,22 +3300,24 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
|
||||
@Override
|
||||
public EventDTO updateEvent(UUID eventId, String eventName, String eventDescription, Date startDate, Date endDate,
|
||||
VenueDTO venue, boolean isPublic, Iterable<UUID> leaderboardGroupIds, String officialWebsiteURLString,
|
||||
VenueDTO venue, boolean isPublic, Iterable<UUID> leaderboardGroupIds, String officialWebsiteURLString, String sailorsInfoWebsiteURLString,
|
||||
Iterable<ImageDTO> images, Iterable<VideoDTO> videos) throws MalformedURLException {
|
||||
TimePoint startTimePoint = startDate != null ? new MillisecondsTimePoint(startDate) : null;
|
||||
TimePoint endTimePoint = endDate != null ? new MillisecondsTimePoint(endDate) : null;
|
||||
URL officialWebsiteURL = officialWebsiteURLString != null ? new URL(officialWebsiteURLString) : null;
|
||||
URL sailorsInfoWebsiteURL = sailorsInfoWebsiteURLString != null ? new URL(sailorsInfoWebsiteURLString) : null;
|
||||
List<ImageDescriptor> eventImages = convertToImages(images);
|
||||
List<VideoDescriptor> eventVideos = convertToVideos(videos);
|
||||
getService().apply(
|
||||
new UpdateEvent(eventId, eventName, eventDescription, startTimePoint, endTimePoint, venue.getName(),
|
||||
isPublic, leaderboardGroupIds, officialWebsiteURL, eventImages, eventVideos));
|
||||
isPublic, leaderboardGroupIds, officialWebsiteURL, sailorsInfoWebsiteURL, eventImages, eventVideos));
|
||||
return getEventById(eventId, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventDTO createEvent(String eventName, String eventDescription, Date startDate, Date endDate, String venue,
|
||||
boolean isPublic, List<String> courseAreaNames, String officialWebsiteURLAsString, Iterable<ImageDTO> images, Iterable<VideoDTO> videos)
|
||||
boolean isPublic, List<String> courseAreaNames, String officialWebsiteURLAsString, String sailorsInfoWebsiteURLAsString,
|
||||
Iterable<ImageDTO> images, Iterable<VideoDTO> videos)
|
||||
throws MalformedURLException {
|
||||
UUID eventUuid = UUID.randomUUID();
|
||||
TimePoint startTimePoint = startDate != null ? new MillisecondsTimePoint(startDate) : null;
|
||||
@@ -3324,7 +3326,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
List<VideoDescriptor> eventVideos = convertToVideos(videos);
|
||||
getService().apply(
|
||||
new CreateEvent(eventName, eventDescription, startTimePoint, endTimePoint, venue, isPublic, eventUuid,
|
||||
officialWebsiteURLAsString == null ? null : new URL(officialWebsiteURLAsString), eventImages, eventVideos));
|
||||
officialWebsiteURLAsString == null ? null : new URL(officialWebsiteURLAsString), new URL(sailorsInfoWebsiteURLAsString), eventImages, eventVideos));
|
||||
for (String courseAreaName : courseAreaNames) {
|
||||
createCourseArea(eventUuid, courseAreaName);
|
||||
}
|
||||
@@ -3403,6 +3405,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
eventDTO.id = (UUID) event.getId();
|
||||
eventDTO.setDescription(event.getDescription());
|
||||
eventDTO.setOfficialWebsiteURL(event.getOfficialWebsiteURL() != null ? event.getOfficialWebsiteURL().toString() : null);
|
||||
eventDTO.setSailorsInfoWebsiteURL(event.getSailorsInfoWebsiteURL() != null ? event.getSailorsInfoWebsiteURL().toString() : null);
|
||||
for(ImageDescriptor image: event.getImages()) {
|
||||
eventDTO.addImage(convertToImageDTO(image));
|
||||
}
|
||||
@@ -4143,7 +4146,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
eventLeaderboardGroupUUIDs.add(lg.getId());
|
||||
}
|
||||
updateEvent(newEvent.id, newEvent.getName(), description, newEvent.startDate, newEvent.endDate, newEvent.venue,
|
||||
newEvent.isPublic, eventLeaderboardGroupUUIDs, newEvent.getOfficialWebsiteURL(),
|
||||
newEvent.isPublic, eventLeaderboardGroupUUIDs, newEvent.getOfficialWebsiteURL(), newEvent.getSailorsInfoWebsiteURL(),
|
||||
newEvent.getImages(), newEvent.getVideos());
|
||||
}
|
||||
|
||||
|
||||
+9
@@ -26,6 +26,7 @@ public class EventBaseDTO extends NamedDTO implements IsSerializable {
|
||||
private String description;
|
||||
private List<? extends LeaderboardGroupBaseDTO> leaderboardGroups;
|
||||
private String officialWebsiteURL;
|
||||
private String sailorsInfoWebsiteURL;
|
||||
private List<ImageDTO> images = new ArrayList<>();
|
||||
private List<VideoDTO> videos = new ArrayList<>();
|
||||
|
||||
@@ -98,6 +99,14 @@ public class EventBaseDTO extends NamedDTO implements IsSerializable {
|
||||
this.officialWebsiteURL = officialWebsiteURL;
|
||||
}
|
||||
|
||||
public String getSailorsInfoWebsiteURL() {
|
||||
return sailorsInfoWebsiteURL;
|
||||
}
|
||||
|
||||
public void setSailorsInfoWebsiteURL(String sailorsInfoWebsiteURL) {
|
||||
this.sailorsInfoWebsiteURL = sailorsInfoWebsiteURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* If not {@link #setBaseURL(String) set}, defaults to <code>http://sapsailing.com</code>. Meant to describe the
|
||||
* base URL that maps to the server instance at which this event can be found, such as
|
||||
|
||||
+9
-3
@@ -49,6 +49,7 @@ public class GetEventViewAction implements Action<EventViewDTO> {
|
||||
ImageDescriptor logoImage = event.findImageWithTag(MediaTagConstants.LOGO);
|
||||
dto.setLogoImage(logoImage != null ? HomeServiceUtil.convertToImageDTO(logoImage) : null);
|
||||
dto.setOfficialWebsiteURL(event.getOfficialWebsiteURL() == null ? null : event.getOfficialWebsiteURL().toString());
|
||||
dto.setSailorsInfoWebsiteURL(event.getSailorsInfoWebsiteURL() == null ? null : event.getSailorsInfoWebsiteURL().toString());
|
||||
|
||||
dto.setHasMedia(HomeServiceUtil.hasMedia(event));
|
||||
dto.setState(HomeServiceUtil.calculateEventState(event));
|
||||
@@ -101,9 +102,14 @@ public class GetEventViewAction implements Action<EventViewDTO> {
|
||||
dto.setType(dto.getRegattas().size() == 1 ? EventType.SINGLE_REGATTA: EventType.MULTI_REGATTA);
|
||||
}
|
||||
|
||||
// Special solution for Kieler Woche 2015
|
||||
if("a9d6c5d5-cac3-47f2-9b5c-506e441819a1".equals(event.getId().toString())) {
|
||||
dto.setSailorsInfoURL(Locale.GERMAN.equals(context.getClientLocale()) ? "http://sailorsinfo.kieler-woche.de/" : "http://sailorsinfo.kieler-woche.de/en");
|
||||
// Special solution for localization of SailorsInfo URL
|
||||
if(dto.getSailorsInfoWebsiteURL() != null && !Locale.GERMAN.equals(context.getClientLocale())) {
|
||||
String localizedURL = dto.getSailorsInfoWebsiteURL();
|
||||
if(!localizedURL.endsWith("/")) {
|
||||
localizedURL += "/";
|
||||
}
|
||||
localizedURL += "en";
|
||||
dto.setSailorsInfoWebsiteURL(localizedURL);
|
||||
}
|
||||
|
||||
return dto;
|
||||
|
||||
+5
-5
@@ -26,7 +26,7 @@ public class EventViewDTO extends EventMetadataDTO implements Result, HasLogo {
|
||||
private String seriesName;
|
||||
private ImageDTO logoImage;
|
||||
private String officialWebsiteURL;
|
||||
private String sailorsInfoURL;
|
||||
private String sailorsInfoWebsiteURL;
|
||||
|
||||
public EventViewDTO() {
|
||||
}
|
||||
@@ -108,12 +108,12 @@ public class EventViewDTO extends EventMetadataDTO implements Result, HasLogo {
|
||||
return officialWebsiteURL;
|
||||
}
|
||||
|
||||
public String getSailorsInfoURL() {
|
||||
return sailorsInfoURL;
|
||||
public String getSailorsInfoWebsiteURL() {
|
||||
return sailorsInfoWebsiteURL;
|
||||
}
|
||||
|
||||
public void setSailorsInfoURL(String sailorsInfoURL) {
|
||||
this.sailorsInfoURL = sailorsInfoURL;
|
||||
public void setSailorsInfoWebsiteURL(String sailorsInfoWebsiteURL) {
|
||||
this.sailorsInfoWebsiteURL = sailorsInfoWebsiteURL;
|
||||
}
|
||||
|
||||
public String getLocationAndVenueAndCountry() {
|
||||
|
||||
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
+5
-1
@@ -131,6 +131,8 @@ public class TestStoringAndLoadingEventsAndRegattas extends AbstractMongoDBTest
|
||||
final String eventDescription = "Event Description";
|
||||
final String venueName = "Venue Name";
|
||||
final String[] courseAreaNames = new String[] { "Alpha", "Bravo", "Charlie", "Delta", "Echo", "Foxtrott" };
|
||||
final URL officialWebsiteURL = new URL("http://official.website.com");
|
||||
final URL sailorsInfoWebsiteURL = new URL("http://sailorsinfo.website.com");
|
||||
final Venue venue = new VenueImpl(venueName);
|
||||
|
||||
for (String courseAreaName : courseAreaNames) {
|
||||
@@ -144,7 +146,8 @@ public class TestStoringAndLoadingEventsAndRegattas extends AbstractMongoDBTest
|
||||
event.addLeaderboardGroup(lg1);
|
||||
event.addLeaderboardGroup(lg2);
|
||||
event.setDescription(eventDescription);
|
||||
event.setOfficialWebsiteURL(new URL("http://official.website.com"));
|
||||
event.setOfficialWebsiteURL(officialWebsiteURL);
|
||||
event.setSailorsInfoWebsiteURL(sailorsInfoWebsiteURL);
|
||||
mof.storeEvent(event);
|
||||
|
||||
DomainObjectFactory dof = PersistenceFactory.INSTANCE.getDomainObjectFactory(getMongoService(), DomainFactory.INSTANCE);
|
||||
@@ -169,6 +172,7 @@ public class TestStoringAndLoadingEventsAndRegattas extends AbstractMongoDBTest
|
||||
assertEquals(eventName, loadedEvent.getName());
|
||||
assertEquals(eventDescription, loadedEvent.getDescription());
|
||||
assertEquals(event.getOfficialWebsiteURL(), loadedEvent.getOfficialWebsiteURL());
|
||||
assertEquals(event.getSailorsInfoWebsiteURL(), loadedEvent.getSailorsInfoWebsiteURL());
|
||||
assertEquals(2, Util.size(loadedEvent.getLeaderboardGroups()));
|
||||
Iterator<LeaderboardGroup> lgIter = loadedEvent.getLeaderboardGroups().iterator();
|
||||
assertSame(lg1, lgIter.next());
|
||||
|
||||
+2
@@ -29,6 +29,7 @@ public class EventBaseJsonSerializer implements JsonSerializer<EventBase> {
|
||||
public static final String FIELD_IMAGE_HEIGHT = "imageHeight";
|
||||
public static final String FIELD_VIDEO_URL = "videoURL";
|
||||
public static final String FIELD_OFFICIAL_WEBSITE_URL = "officialWebsiteURL";
|
||||
public static final String FIELD_SAILORS_INFO_WEBSITE_URL = "sailorsInfoWebsiteURL";
|
||||
public static final String FIELDS_LEADERBOARD_GROUPS = "leaderboardGroups";
|
||||
|
||||
public static final String FIELD_SOURCE_URL = "sourceURL";
|
||||
@@ -63,6 +64,7 @@ public class EventBaseJsonSerializer implements JsonSerializer<EventBase> {
|
||||
result.put(FIELD_NAME, event.getName());
|
||||
result.put(FIELD_DESCRIPTION, event.getDescription());
|
||||
result.put(FIELD_OFFICIAL_WEBSITE_URL, event.getOfficialWebsiteURL() != null ? event.getOfficialWebsiteURL().toString() : null);
|
||||
result.put(FIELD_SAILORS_INFO_WEBSITE_URL, event.getSailorsInfoWebsiteURL() != null ? event.getSailorsInfoWebsiteURL().toString() : null);
|
||||
result.put(FIELD_START_DATE, event.getStartDate() != null ? event.getStartDate().asMillis() : null);
|
||||
result.put(FIELD_END_DATE, event.getStartDate() != null ? event.getEndDate().asMillis() : null);
|
||||
result.put(FIELD_VENUE, venueSerializer.serialize(event.getVenue()));
|
||||
|
||||
+3
-1
@@ -651,7 +651,9 @@ public class RegattasResource extends AbstractSailingServerResource {
|
||||
return Response.status(Status.INTERNAL_SERVER_ERROR).entity("Could not parse the 'to' time.")
|
||||
.type(MediaType.TEXT_PLAIN).build();
|
||||
}
|
||||
|
||||
// Crop request interval to startOfTracking / [endOfTracking|timePointOfLastEvent]
|
||||
from = Util.getLatestOfTimePoints(from, trackedRace.getStartOfTracking());
|
||||
to = Util.getEarliestOfTimePoints(to, Util.getEarliestOfTimePoints(trackedRace.getEndOfTracking(), trackedRace.getTimePointOfNewestEvent()));
|
||||
TrackedRaceJsonSerializer serializer = new TrackedRaceJsonSerializer(
|
||||
new DefaultWindTrackJsonSerializer());
|
||||
serializer.setWindSource(windSource);
|
||||
|
||||
+4
-4
@@ -1329,8 +1329,8 @@ public class MasterDataImportTest {
|
||||
|
||||
Event event = sourceService.createEventWithoutReplication("Test Event", /* eventDescription */ null,
|
||||
new MillisecondsTimePoint(0), new MillisecondsTimePoint(10), "testvenue", false, UUID.randomUUID(),
|
||||
/* officialWebsiteURL */ null, /* images */Collections.<ImageDescriptor> emptyList(),
|
||||
/* videos */Collections.<VideoDescriptor> emptyList());
|
||||
/* officialWebsiteURL */ null, /* sailorsInfoWebsiteURL */ null,
|
||||
/* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList());
|
||||
CourseArea defaultCourseArea = sourceService.addCourseArea(event.getId(), "ECHO", UUID.randomUUID());
|
||||
|
||||
Regatta regatta = sourceService.createRegatta(
|
||||
@@ -1394,8 +1394,8 @@ public class MasterDataImportTest {
|
||||
|
||||
Event event = sourceService.createEventWithoutReplication("Test Event", /* eventDescription */ null,
|
||||
new MillisecondsTimePoint(0), new MillisecondsTimePoint(10), "testvenue", false, UUID.randomUUID(),
|
||||
/* officialWebsiteURL */ null, /* images */Collections.<ImageDescriptor> emptyList(),
|
||||
/* videos */Collections.<VideoDescriptor> emptyList());
|
||||
/* officialWebsiteURL */ null, /* sailorsInfoWebsiteURL */ null,
|
||||
/* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList());
|
||||
CourseArea defaultCourseArea = sourceService.addCourseArea(event.getId(), "ECHO", UUID.randomUUID());
|
||||
|
||||
List<String> raceColumnNames = new ArrayList<String>();
|
||||
|
||||
+3
-2
@@ -120,7 +120,8 @@ public class SearchServiceTest {
|
||||
cal.set(2014, 5, 8, 16, 00);
|
||||
final TimePoint pfingstbuschEndDate = new MillisecondsTimePoint(cal.getTime());
|
||||
pfingstbusch = server.apply(new CreateEvent("Pfingsbusch", /* eventDescription */ null, pfingstbuschStartDate, pfingstbuschEndDate, /* isPublic */
|
||||
"Kiel", true, UUID.randomUUID(), /* officialWebsiteURLAsString */ null, /* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList()));
|
||||
"Kiel", true, UUID.randomUUID(), /* officialWebsiteURLAsString */ null, /* sailorsInfoWebsiteURLAsString */ null,
|
||||
/* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList()));
|
||||
kiel = pfingstbusch.getVenue();
|
||||
final CourseAreaImpl kielAlpha = new CourseAreaImpl("Alpha", UUID.randomUUID());
|
||||
kiel.addCourseArea(kielAlpha);
|
||||
@@ -153,7 +154,7 @@ public class SearchServiceTest {
|
||||
cal.set(2014, 5, 8, 18, 00);
|
||||
final TimePoint aalEndDate = new MillisecondsTimePoint(cal.getTime());
|
||||
aalEvent = server.apply(new CreateEvent("Aalregatta", /* eventDescription */ null, aalStartDate, aalEndDate, /* isPublic */
|
||||
"Flensburg", true, UUID.randomUUID(), /* officialWebsiteURLAsString */ null,
|
||||
"Flensburg", true, UUID.randomUUID(), /* officialWebsiteURLAsString */ null, /*sailorsInfoWebsiteURLAsString */ null,
|
||||
/* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList()));
|
||||
flensburg = aalEvent.getVenue();
|
||||
final CourseAreaImpl flensburgStandard = new CourseAreaImpl("Standard", UUID.randomUUID());
|
||||
|
||||
@@ -371,7 +371,7 @@ public interface RacingEventService extends TrackedRegattaRegistry, RegattaFetch
|
||||
* @return The new event
|
||||
*/
|
||||
void updateEvent(UUID id, String eventName, String eventDescription, TimePoint startDate, TimePoint endDate,
|
||||
String venueName, boolean isPublic, Iterable<UUID> leaderboardGroupIds, URL officialWebsiteURL,
|
||||
String venueName, boolean isPublic, Iterable<UUID> leaderboardGroupIds, URL officialWebsiteURL, URL sailorsInfoWebsiteURL,
|
||||
Iterable<ImageDescriptor> images, Iterable<VideoDescriptor> videos);
|
||||
|
||||
/**
|
||||
@@ -467,7 +467,7 @@ public interface RacingEventService extends TrackedRegattaRegistry, RegattaFetch
|
||||
ConcurrentHashMap<String, Regatta> getPersistentRegattasForRaceIDs();
|
||||
|
||||
Event createEventWithoutReplication(String eventName, String eventDescription, TimePoint startDate, TimePoint endDate, String venue,
|
||||
boolean isPublic, UUID id, URL officialWebsiteURL, Iterable<ImageDescriptor> images,
|
||||
boolean isPublic, UUID id, URL officialWebsiteURL, URL sailorsInfoWebsiteURL, Iterable<ImageDescriptor> images,
|
||||
Iterable<VideoDescriptor> videos);
|
||||
|
||||
void setRegattaForRace(Regatta regatta, String raceIdAsString);
|
||||
|
||||
+8
-6
@@ -2607,10 +2607,11 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
public Event addEvent(String eventName, String eventDescription, TimePoint startDate, TimePoint endDate,
|
||||
String venue, boolean isPublic, UUID id) {
|
||||
Event result = createEventWithoutReplication(eventName, eventDescription, startDate, endDate, venue, isPublic,
|
||||
id, /* officialWebsiteURL */null, /* images */Collections.<ImageDescriptor> emptyList(),
|
||||
/* videos */Collections.<VideoDescriptor> emptyList());
|
||||
id, /* officialWebsiteURL */null, /* sailorsInfoWebsiteURLAsString */null,
|
||||
/* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList());
|
||||
replicate(new CreateEvent(eventName, eventDescription, startDate, endDate, venue, isPublic, id,
|
||||
/* officialWebsiteURLAsString */null, /* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList()));
|
||||
/* officialWebsiteURLAsString */null, /* sailorsInfoWebsiteURLAsString */null,
|
||||
/* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList()));
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2621,8 +2622,8 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
|
||||
@Override
|
||||
public Event createEventWithoutReplication(String eventName, String eventDescription, TimePoint startDate,
|
||||
TimePoint endDate, String venue, boolean isPublic, UUID id, URL officialWebsiteURL, Iterable<ImageDescriptor> images,
|
||||
Iterable<VideoDescriptor> videos) {
|
||||
TimePoint endDate, String venue, boolean isPublic, UUID id, URL officialWebsiteURL, URL sailorsInfoWebsiteURL,
|
||||
Iterable<ImageDescriptor> images, Iterable<VideoDescriptor> videos) {
|
||||
Event result = new EventImpl(eventName, startDate, endDate, venue, isPublic, id);
|
||||
addEvent(result);
|
||||
result.setDescription(eventDescription);
|
||||
@@ -2643,7 +2644,7 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
|
||||
@Override
|
||||
public void updateEvent(UUID id, String eventName, String eventDescription, TimePoint startDate, TimePoint endDate,
|
||||
String venueName, boolean isPublic, Iterable<UUID> leaderboardGroupIds, URL officialWebsiteURL,
|
||||
String venueName, boolean isPublic, Iterable<UUID> leaderboardGroupIds, URL officialWebsiteURL, URL sailorsInfoWebsiteURL,
|
||||
Iterable<ImageDescriptor> images, Iterable<VideoDescriptor> videos) {
|
||||
final Event event = eventsById.get(id);
|
||||
if (event == null) {
|
||||
@@ -2667,6 +2668,7 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
}
|
||||
event.setLeaderboardGroups(leaderboardGroups);
|
||||
event.setOfficialWebsiteURL(officialWebsiteURL);
|
||||
event.setSailorsInfoWebsiteURL(sailorsInfoWebsiteURL);
|
||||
event.setImages(images);
|
||||
event.setVideos(videos);
|
||||
// TODO consider use diffutils to compute diff between old and new leaderboard groups list and apply the patch
|
||||
|
||||
+4
-2
@@ -28,9 +28,10 @@ public class CreateEvent extends AbstractEventOperation<Event> {
|
||||
private final Iterable<ImageDescriptor> images;
|
||||
private final Iterable<VideoDescriptor> videos;
|
||||
private final URL officialWebsiteURL;
|
||||
private final URL sailorsInfoWebsiteURL;
|
||||
|
||||
public CreateEvent(String eventName, String eventDescription, TimePoint startDate, TimePoint endDate, String venue,
|
||||
boolean isPublic, UUID id, URL officialWebsiteURL, Iterable<ImageDescriptor> images, Iterable<VideoDescriptor> videos) {
|
||||
boolean isPublic, UUID id, URL officialWebsiteURL, URL sailorsInfoWebsiteURL, Iterable<ImageDescriptor> images, Iterable<VideoDescriptor> videos) {
|
||||
super(id);
|
||||
this.eventName = eventName;
|
||||
this.eventDescription = eventDescription;
|
||||
@@ -39,6 +40,7 @@ public class CreateEvent extends AbstractEventOperation<Event> {
|
||||
this.venue = venue;
|
||||
this.isPublic = isPublic;
|
||||
this.officialWebsiteURL = officialWebsiteURL;
|
||||
this.sailorsInfoWebsiteURL = sailorsInfoWebsiteURL;
|
||||
this.images = images;
|
||||
this.videos = videos;
|
||||
}
|
||||
@@ -62,7 +64,7 @@ public class CreateEvent extends AbstractEventOperation<Event> {
|
||||
@Override
|
||||
public Event internalApplyTo(RacingEventService toState) {
|
||||
return toState.createEventWithoutReplication(getEventName(), eventDescription, startDate, endDate, venue, isPublic,
|
||||
getId(), officialWebsiteURL, images, videos);
|
||||
getId(), officialWebsiteURL, sailorsInfoWebsiteURL, images, videos);
|
||||
}
|
||||
|
||||
}
|
||||
+4
-2
@@ -19,11 +19,12 @@ public class UpdateEvent extends AbstractEventOperation<Void> {
|
||||
private final String eventName;
|
||||
private final String eventDescription;
|
||||
private final URL officialWebsiteURL;
|
||||
private final URL sailorsInfoWebsiteURL;
|
||||
private final Iterable<ImageDescriptor> images;
|
||||
private final Iterable<VideoDescriptor> videos;
|
||||
|
||||
public UpdateEvent(UUID id, String eventName, String eventDescription, TimePoint startDate, TimePoint endDate,
|
||||
String venueName, boolean isPublic, Iterable<UUID> leaderboardGroupIds, URL officialWebsiteURL,
|
||||
String venueName, boolean isPublic, Iterable<UUID> leaderboardGroupIds, URL officialWebsiteURL, URL sailorsInfoWebsiteURL,
|
||||
Iterable<ImageDescriptor> images, Iterable<VideoDescriptor> videos) {
|
||||
super(id);
|
||||
this.eventName = eventName;
|
||||
@@ -34,6 +35,7 @@ public class UpdateEvent extends AbstractEventOperation<Void> {
|
||||
this.isPublic = isPublic;
|
||||
this.leaderboardGroupIds = leaderboardGroupIds;
|
||||
this.officialWebsiteURL = officialWebsiteURL;
|
||||
this.sailorsInfoWebsiteURL = sailorsInfoWebsiteURL;
|
||||
this.images = images;
|
||||
this.videos = videos;
|
||||
}
|
||||
@@ -53,7 +55,7 @@ public class UpdateEvent extends AbstractEventOperation<Void> {
|
||||
@Override
|
||||
public Void internalApplyTo(RacingEventService toState) {
|
||||
toState.updateEvent(getId(), eventName, eventDescription, startDate, endDate, venueName, isPublic,
|
||||
leaderboardGroupIds, officialWebsiteURL, images, videos);
|
||||
leaderboardGroupIds, officialWebsiteURL, sailorsInfoWebsiteURL, images, videos);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user