mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-24 04:53:54 +00:00
added baseURL property to EventBase
Change-Id: I0fbd92b14331918986d817fc86a06912ae8f603d
This commit is contained in:
1 parent
dea82a7c88
commit
97c25d6bcd
32 files changed
+165
-85
No files matched your search
+8
@@ -1033,6 +1033,14 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
|
||||
logger.severe("Error parsing official website URL "+officialWebSiteURLAsString+" for event "+name+". Ignoring this URL.");
|
||||
}
|
||||
}
|
||||
String baseURLAsString = (String) eventDBObject.get(FieldNames.EVENT_BASE_URL.name());
|
||||
if (baseURLAsString != null) {
|
||||
try {
|
||||
result.setBaseURL(new URL(baseURLAsString));
|
||||
} catch (MalformedURLException e) {
|
||||
logger.severe("Error parsing base URL "+baseURLAsString+" 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_BASE_URL,
|
||||
EVENT_SAILORS_INFO_WEBSITE_URL,
|
||||
EVENT_SAILORS_INFO_WEBSITES,
|
||||
EVENT_LOGO_IMAGE_URL,
|
||||
|
||||
+1
@@ -550,6 +550,7 @@ public class MongoObjectFactoryImpl implements MongoObjectFactory {
|
||||
eventDBObject.put(FieldNames.EVENT_DESCRIPTION.name(), event.getDescription());
|
||||
eventDBObject.put(FieldNames.EVENT_ID.name(), event.getId());
|
||||
eventDBObject.put(FieldNames.EVENT_OFFICIAL_WEBSITE_URL.name(), event.getOfficialWebsiteURL() != null ? event.getOfficialWebsiteURL().toString() : null);
|
||||
eventDBObject.put(FieldNames.EVENT_BASE_URL.name(), event.getBaseURL() != null ? event.getBaseURL().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());
|
||||
|
||||
+10
@@ -49,6 +49,16 @@ public interface EventBase extends NamedWithID, WithDescription, Renamable, With
|
||||
|
||||
void setOfficialWebsiteURL(URL officialWebsiteURL);
|
||||
|
||||
/**
|
||||
* @return the URL under which the event's landing page in the {@code sapsailing.com} universe can be reached. This
|
||||
* could be something like {@code tw2015.sapsailing.com} or {@link 505worlds2012.sapsailing.com} or similar.
|
||||
* It shall be a URL to which relative paths to pages in the context of this event can be appended, such
|
||||
* as links to race boards, leaderboards or the regatta overview.
|
||||
*/
|
||||
URL getBaseURL();
|
||||
|
||||
void setBaseURL(URL baseURL);
|
||||
|
||||
/**
|
||||
* Returns a mapping of Locales to URLs where the URLs are meant as an external web site containing sailor related
|
||||
* information like protests, official results, etc.
|
||||
|
||||
+12
-1
@@ -38,6 +38,7 @@ public abstract class EventBaseImpl implements EventBase {
|
||||
private TimePoint startDate;
|
||||
private TimePoint endDate;
|
||||
private URL officialWebsiteURL;
|
||||
private URL baseURL;
|
||||
private CopyOnWriteHashMap<Locale, URL> sailorsInfoWebsiteURLs;
|
||||
private ConcurrentLinkedQueue<ImageDescriptor> images;
|
||||
private ConcurrentLinkedQueue<VideoDescriptor> videos;
|
||||
@@ -144,12 +145,22 @@ public abstract class EventBaseImpl implements EventBase {
|
||||
public URL getOfficialWebsiteURL() {
|
||||
return officialWebsiteURL;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setOfficialWebsiteURL(URL officialWebsiteURL) {
|
||||
this.officialWebsiteURL = officialWebsiteURL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getBaseURL() {
|
||||
return baseURL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBaseURL(URL baseURL) {
|
||||
this.baseURL = baseURL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Locale, URL> getSailorsInfoWebsiteURLs() {
|
||||
return Collections.unmodifiableMap(sailorsInfoWebsiteURLs);
|
||||
|
||||
+2
@@ -39,6 +39,8 @@ public class EventCreateDialog extends EventDialog {
|
||||
endDateBox.ensureDebugId("EndDateTimeBox");
|
||||
officialWebsiteURLEntryField = createTextBox(null);
|
||||
officialWebsiteURLEntryField.setVisibleLength(50);
|
||||
baseURLEntryField = createTextBox(null);
|
||||
baseURLEntryField.setVisibleLength(50);
|
||||
sailorsInfoWebsiteURLEntryFields = createTextBoxesForLocalesAndDefault(Collections.<String, String> emptyMap());
|
||||
isPublicCheckBox = createCheckbox("");
|
||||
isPublicCheckBox.setValue(false);
|
||||
|
||||
+21
-17
@@ -49,6 +49,7 @@ public abstract class EventDialog extends DataEntryDialogWithBootstrap<EventDTO>
|
||||
protected CheckBox isPublicCheckBox;
|
||||
protected UUID id;
|
||||
protected TextBox officialWebsiteURLEntryField;
|
||||
protected TextBox baseURLEntryField;
|
||||
protected Map<String, TextBox> sailorsInfoWebsiteURLEntryFields = new HashMap<>();
|
||||
protected CourseAreaListInlineEditorComposite courseAreaNameList;
|
||||
protected StringConstantsListEditorComposite leaderboardGroupList;
|
||||
@@ -176,6 +177,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.setBaseURL(baseURLEntryField.getText().trim().isEmpty() ? null : baseURLEntryField.getText().trim());
|
||||
for (Map.Entry<String, TextBox> sailorsInfoWebsiteUrlEntry : sailorsInfoWebsiteURLEntryFields.entrySet()) {
|
||||
TextBox sailorsInfoWebsiteURLEntryField = sailorsInfoWebsiteUrlEntry.getValue();
|
||||
String sailorsInfoWebsiteURL = sailorsInfoWebsiteURLEntryField.getText().trim();
|
||||
@@ -205,23 +207,25 @@ public abstract class EventDialog extends DataEntryDialogWithBootstrap<EventDTO>
|
||||
panel.add(additionalWidget);
|
||||
}
|
||||
Grid formGrid = new Grid(9 + GWTLocaleUtil.getLanguageCountWithDefault(), 2);
|
||||
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.timeZone() + ":"));
|
||||
formGrid.setWidget(3, 1, new Label(DateAndTimeFormatterUtil.getClientTimeZoneAsGMTString()));
|
||||
formGrid.setWidget(4, 0, new Label(stringMessages.startDate() + ":"));
|
||||
formGrid.setWidget(4, 1, startDateBox);
|
||||
formGrid.setWidget(5, 0, new Label(stringMessages.endDate() + ":"));
|
||||
formGrid.setWidget(5, 1, endDateBox);
|
||||
formGrid.setWidget(6, 0, new Label(stringMessages.isPublic() + ":"));
|
||||
formGrid.setWidget(6, 1, isPublicCheckBox);
|
||||
formGrid.setWidget(7, 0, new Label(stringMessages.eventOfficialWebsiteURL() + ":"));
|
||||
formGrid.setWidget(7, 1, officialWebsiteURLEntryField);
|
||||
int rowIndex = 8;
|
||||
int rowIndex = 0;
|
||||
formGrid.setWidget(rowIndex, 0, new Label(stringMessages.name() + ":"));
|
||||
formGrid.setWidget(rowIndex++, 1, nameEntryField);
|
||||
formGrid.setWidget(rowIndex, 0, new Label(stringMessages.description() + ":"));
|
||||
formGrid.setWidget(rowIndex++, 1, descriptionEntryField);
|
||||
formGrid.setWidget(rowIndex, 0, new Label(stringMessages.venue() + ":"));
|
||||
formGrid.setWidget(rowIndex++, 1, venueEntryField);
|
||||
formGrid.setWidget(rowIndex, 0, new Label(stringMessages.timeZone() + ":"));
|
||||
formGrid.setWidget(rowIndex++, 1, new Label(DateAndTimeFormatterUtil.getClientTimeZoneAsGMTString()));
|
||||
formGrid.setWidget(rowIndex, 0, new Label(stringMessages.startDate() + ":"));
|
||||
formGrid.setWidget(rowIndex++, 1, startDateBox);
|
||||
formGrid.setWidget(rowIndex, 0, new Label(stringMessages.endDate() + ":"));
|
||||
formGrid.setWidget(rowIndex++, 1, endDateBox);
|
||||
formGrid.setWidget(rowIndex, 0, new Label(stringMessages.isPublic() + ":"));
|
||||
formGrid.setWidget(rowIndex++, 1, isPublicCheckBox);
|
||||
formGrid.setWidget(rowIndex, 0, new Label(stringMessages.eventOfficialWebsiteURL() + ":"));
|
||||
formGrid.setWidget(rowIndex++, 1, officialWebsiteURLEntryField);
|
||||
formGrid.setWidget(rowIndex, 0, new Label(stringMessages.eventBaseURL() + ":"));
|
||||
formGrid.setWidget(rowIndex++, 1, baseURLEntryField);
|
||||
for (Map.Entry<String, TextBox> sailorsInfoWebsiteUrlEntry : sailorsInfoWebsiteURLEntryFields.entrySet()) {
|
||||
String suffix = " ["+ (sailorsInfoWebsiteUrlEntry.getKey() == null ? stringMessages.defaultLocale() + "*" : sailorsInfoWebsiteUrlEntry.getKey()) + "]";
|
||||
formGrid.setWidget(rowIndex, 0, new Label(stringMessages.eventSailorsInfoWebsiteURL() + suffix + ":"));
|
||||
|
||||
+2
@@ -30,6 +30,8 @@ public class EventEditDialog extends EventDialog {
|
||||
id = event.id;
|
||||
officialWebsiteURLEntryField = createTextBox(event.getOfficialWebsiteURL());
|
||||
officialWebsiteURLEntryField.setVisibleLength(50);
|
||||
baseURLEntryField = createTextBox(event.getOfficialWebsiteURL());
|
||||
baseURLEntryField.setVisibleLength(50);
|
||||
sailorsInfoWebsiteURLEntryFields = createTextBoxesForLocalesAndDefault(event.getSailorsInfoWebsiteURLs());
|
||||
courseAreaNameList.setValue(new ArrayList<>(event.venue.getCourseAreas()));
|
||||
List<String> leaderboardGroupNames = new ArrayList<>();
|
||||
|
||||
+5
-5
@@ -596,9 +596,9 @@ public class EventListComposite extends Composite implements EventsRefresher, Le
|
||||
updatedEvent.startDate, updatedEvent.endDate, updatedEvent.venue,
|
||||
updatedEvent.isPublic, updatedEventLeaderboardGroupIds,
|
||||
updatedEvent.getOfficialWebsiteURL(),
|
||||
updatedEvent.getSailorsInfoWebsiteURLs(),
|
||||
updatedEvent.getImages(), updatedEvent.getVideos(),
|
||||
new AsyncCallback<EventDTO>() {
|
||||
updatedEvent.getBaseURL(),
|
||||
updatedEvent.getSailorsInfoWebsiteURLs(), updatedEvent.getImages(),
|
||||
updatedEvent.getVideos(), new AsyncCallback<EventDTO>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to update sailing event" + oldEvent.getName() + ": " + t.getMessage());
|
||||
@@ -670,8 +670,8 @@ 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.getSailorsInfoWebsiteURLs(),
|
||||
newEvent.getImages(), newEvent.getVideos(), newEvent.getLeaderboardGroupIds(), new AsyncCallback<EventDTO>() {
|
||||
newEvent.venue.getName(), newEvent.isPublic, courseAreaNames, newEvent.getOfficialWebsiteURL(), newEvent.getBaseURL(),
|
||||
newEvent.getSailorsInfoWebsiteURLs(), newEvent.getImages(), newEvent.getVideos(), newEvent.getLeaderboardGroupIds(), new AsyncCallback<EventDTO>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to create new event " + newEvent.getName() + ": " + t.getMessage());
|
||||
|
||||
+3
-3
@@ -265,9 +265,9 @@ 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.getSailorsInfoWebsiteURLs(),
|
||||
newEvent.getImages(), newEvent.getVideos(),
|
||||
newEvent.getLeaderboardGroupIds(), new AsyncCallback<EventDTO>() {
|
||||
newEvent.venue.getName(), newEvent.isPublic, courseAreaNames, newEvent.getOfficialWebsiteURL(), newEvent.getBaseURL(),
|
||||
newEvent.getSailorsInfoWebsiteURLs(), newEvent.getImages(),
|
||||
newEvent.getVideos(), newEvent.getLeaderboardGroupIds(), new AsyncCallback<EventDTO>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
errorReporter.reportError(stringMessages.errorTryingToCreateNewEvent(newEvent.getName(), t.getMessage()));
|
||||
|
||||
+4
-4
@@ -314,13 +314,13 @@ public interface SailingService extends RemoteService, FileStorageManagementGwtS
|
||||
Pair<Integer, Integer> resolveImageDimensions(String imageUrlAsString) throws Exception;
|
||||
|
||||
EventDTO updateEvent(UUID eventId, String eventName, String eventDescription, Date startDate, Date endDate,
|
||||
VenueDTO venue, boolean isPublic, Iterable<UUID> leaderboardGroupIds, String officialWebsiteURL, Map<String, String> sailorsInfoWebsiteURLsByLocaleName,
|
||||
Iterable<ImageDTO> images, Iterable<VideoDTO> videos) throws Exception;
|
||||
VenueDTO venue, boolean isPublic, Iterable<UUID> leaderboardGroupIds, String officialWebsiteURL, String baseURLAsString,
|
||||
Map<String, String> sailorsInfoWebsiteURLsByLocaleName, 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,
|
||||
Map<String, String> sailorsInfoWebsiteURLsByLocaleName, Iterable<ImageDTO> images,
|
||||
Iterable<VideoDTO> videos, Iterable<UUID> leaderboardGroupIds) throws Exception;
|
||||
String baseURLAsString, Map<String, String> sailorsInfoWebsiteURLsByLocaleName,
|
||||
Iterable<ImageDTO> images, Iterable<VideoDTO> videos, Iterable<UUID> leaderboardGroupIds) throws Exception;
|
||||
|
||||
void removeEvent(UUID eventId);
|
||||
|
||||
|
||||
+5
-4
@@ -407,13 +407,14 @@ public interface SailingServiceAsync extends ServerInfoRetriever, FileStorageMan
|
||||
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, Map<String, String> sailorsInfoWebsiteURLsByLocaleName,
|
||||
Iterable<ImageDTO> images, Iterable<VideoDTO> videos, Iterable<UUID> leaderboardGroupIDs, AsyncCallback<EventDTO> callback);
|
||||
boolean isPublic, List<String> courseAreaNames, String officialWebsiteURL, String baseURL,
|
||||
Map<String, String> sailorsInfoWebsiteURLsByLocaleName, Iterable<ImageDTO> images,
|
||||
Iterable<VideoDTO> videos, Iterable<UUID> leaderboardGroupIDs, AsyncCallback<EventDTO> callback);
|
||||
|
||||
void updateEvent(UUID eventId, String eventName, String eventDescription, Date startDate, Date endDate,
|
||||
VenueDTO venue, boolean isPublic, Iterable<UUID> leaderboardGroupIds, String officialWebsiteURL,
|
||||
Map<String, String> sailorsInfoWebsiteURLsByLocaleName, Iterable<ImageDTO> images, Iterable<VideoDTO> videos,
|
||||
AsyncCallback<EventDTO> callback);
|
||||
String baseURL, Map<String, String> sailorsInfoWebsiteURLsByLocaleName, Iterable<ImageDTO> images,
|
||||
Iterable<VideoDTO> videos, AsyncCallback<EventDTO> callback);
|
||||
|
||||
void resolveImageDimensions(String imageUrlAsString, AsyncCallback<Pair<Integer, Integer>> callback);
|
||||
|
||||
|
||||
+1
@@ -1131,6 +1131,7 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages,
|
||||
String pleaseSelectAScoringResult();
|
||||
String timeZone();
|
||||
String eventOfficialWebsiteURL();
|
||||
String eventBaseURL();
|
||||
String eventSailorsInfoWebsiteURL();
|
||||
String eventOverviewURL();
|
||||
String eventLogoImageURL();
|
||||
|
||||
+1
@@ -1104,6 +1104,7 @@ advancePassId=Advance Pass ID
|
||||
pleaseSelectAScoringResult=Please select a scoring result...
|
||||
timeZone=Time zone
|
||||
eventOfficialWebsiteURL=Official Website URL
|
||||
eventBaseURL=Event''s Base URL (http://something.sapsailing.com)
|
||||
eventSailorsInfoWebsiteURL=Sailors Info Website URL
|
||||
eventOverviewURL=Event Overview URL
|
||||
eventLogoImageURL=Logo Image URL
|
||||
|
||||
+1
@@ -1094,6 +1094,7 @@ advancePassId=Pass ID erhöhen
|
||||
pleaseSelectAScoringResult=Bitte ein Ergebnis auswählen...
|
||||
timeZone=Zeitzone
|
||||
eventOfficialWebsiteURL=URL der offiziellen Veranstaltungswebseite
|
||||
eventBaseURL=Stamm-URL der Veranstaltung (http://something.sapsailing.com)
|
||||
eventSailorsInfoWebsiteURL=URL zur Webseite mit Seglerinfos
|
||||
eventOverviewURL=URL der Veranstaltungsübersicht
|
||||
eventLogoImageURL=URL des Veranstaltungslogos
|
||||
|
||||
+18
-13
@@ -3397,11 +3397,10 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
|
||||
@Override
|
||||
public List<EventDTO> getEvents() throws MalformedURLException {
|
||||
String requestBaseURL = getRequestBaseURL().toString();
|
||||
List<EventDTO> result = new ArrayList<EventDTO>();
|
||||
for (Event event : getService().getAllEvents()) {
|
||||
EventDTO eventDTO = convertToEventDTO(event, false);
|
||||
eventDTO.setBaseURL(requestBaseURL);
|
||||
eventDTO.setBaseURL(getEventBaseURLFromEventOrRequest(event));
|
||||
eventDTO.setIsOnRemoteServer(false);
|
||||
result.add(eventDTO);
|
||||
}
|
||||
@@ -3421,11 +3420,11 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
final com.sap.sse.common.Util.Pair<Iterable<EventBase>, Exception> eventsOrException = serverRefAndEventsOrException.getValue();
|
||||
final RemoteSailingServerReference serverRef = serverRefAndEventsOrException.getKey();
|
||||
final Iterable<EventBase> remoteEvents = eventsOrException.getA();
|
||||
String baseURL = getBaseURL(serverRef.getURL()).toString();
|
||||
String baseURLFromServerReference = getBaseURL(serverRef.getURL()).toString();
|
||||
if (remoteEvents != null) {
|
||||
for (EventBase remoteEvent : remoteEvents) {
|
||||
EventBaseDTO remoteEventDTO = convertToEventDTO(remoteEvent);
|
||||
remoteEventDTO.setBaseURL(baseURL);
|
||||
remoteEventDTO.setBaseURL(remoteEvent.getBaseURL() == null ? baseURLFromServerReference : remoteEvent.getBaseURL().toString());
|
||||
remoteEventDTO.setIsOnRemoteServer(true);
|
||||
result.add(remoteEventDTO);
|
||||
}
|
||||
@@ -3480,36 +3479,38 @@ 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, Map<String, String> sailorsInfoWebsiteURLsByLocaleName,
|
||||
Iterable<ImageDTO> images, Iterable<VideoDTO> videos) throws MalformedURLException {
|
||||
VenueDTO venue, boolean isPublic, Iterable<UUID> leaderboardGroupIds, String officialWebsiteURLString, String baseURLAsString,
|
||||
Map<String, String> sailorsInfoWebsiteURLsByLocaleName, 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 baseURL = baseURLAsString != null ? new URL(baseURLAsString) : null;
|
||||
Map<Locale, URL> sailorsInfoWebsiteURLs = convertToLocalesAndUrls(sailorsInfoWebsiteURLsByLocaleName);
|
||||
List<ImageDescriptor> eventImages = convertToImages(images);
|
||||
List<VideoDescriptor> eventVideos = convertToVideos(videos);
|
||||
getService().apply(
|
||||
new UpdateEvent(eventId, eventName, eventDescription, startTimePoint, endTimePoint, venue.getName(),
|
||||
isPublic, leaderboardGroupIds, officialWebsiteURL, sailorsInfoWebsiteURLs, eventImages, eventVideos));
|
||||
isPublic, leaderboardGroupIds, officialWebsiteURL, baseURL, sailorsInfoWebsiteURLs, 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, Map<String, String> sailorsInfoWebsiteURLsByLocaleName,
|
||||
Iterable<ImageDTO> images, Iterable<VideoDTO> videos, Iterable<UUID> leaderboardGroupIds)
|
||||
boolean isPublic, List<String> courseAreaNames, String officialWebsiteURLAsString, String baseURLAsString,
|
||||
Map<String, String> sailorsInfoWebsiteURLsByLocaleName, Iterable<ImageDTO> images, Iterable<VideoDTO> videos, Iterable<UUID> leaderboardGroupIds)
|
||||
throws MalformedURLException {
|
||||
UUID eventUuid = UUID.randomUUID();
|
||||
TimePoint startTimePoint = startDate != null ? new MillisecondsTimePoint(startDate) : null;
|
||||
TimePoint endTimePoint = endDate != null ? new MillisecondsTimePoint(endDate) : null;
|
||||
URL officialWebsiteURL = officialWebsiteURLAsString != null ? new URL(officialWebsiteURLAsString) : null;
|
||||
URL baseURL = baseURLAsString != null ? new URL(baseURLAsString) : null;
|
||||
Map<Locale, URL> sailorsInfoWebsiteURLs = convertToLocalesAndUrls(sailorsInfoWebsiteURLsByLocaleName);
|
||||
|
||||
List<ImageDescriptor> eventImages = convertToImages(images);
|
||||
List<VideoDescriptor> eventVideos = convertToVideos(videos);
|
||||
getService().apply(
|
||||
new CreateEvent(eventName, eventDescription, startTimePoint, endTimePoint, venue, isPublic, eventUuid,
|
||||
officialWebsiteURL, sailorsInfoWebsiteURLs, eventImages, eventVideos, leaderboardGroupIds));
|
||||
officialWebsiteURL, baseURL, sailorsInfoWebsiteURLs, eventImages, eventVideos, leaderboardGroupIds));
|
||||
createCourseAreas(eventUuid, courseAreaNames.toArray(new String[courseAreaNames.size()]));
|
||||
return getEventById(eventUuid, false);
|
||||
}
|
||||
@@ -3560,16 +3561,19 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
@Override
|
||||
public EventDTO getEventById(UUID id, boolean withStatisticalData) throws MalformedURLException {
|
||||
EventDTO result = null;
|
||||
String requestBaseURL = getRequestBaseURL().toString();
|
||||
Event event = getService().getEvent(id);
|
||||
if (event != null) {
|
||||
result = convertToEventDTO(event, withStatisticalData);
|
||||
result.setBaseURL(requestBaseURL);
|
||||
result.setBaseURL(getEventBaseURLFromEventOrRequest(event));
|
||||
result.setIsOnRemoteServer(false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private String getEventBaseURLFromEventOrRequest(Event event) throws MalformedURLException {
|
||||
return event.getBaseURL() == null ? getRequestBaseURL().toString() : event.getBaseURL().toString();
|
||||
}
|
||||
|
||||
private EventBaseDTO convertToEventDTO(EventBase event) {
|
||||
final EventBaseDTO eventDTO;
|
||||
if (event == null) {
|
||||
@@ -3602,6 +3606,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.setBaseURL(event.getBaseURL() != null ? event.getBaseURL().toString() : null);
|
||||
for(Map.Entry<Locale, URL> sailorsInfoWebsiteEntry : event.getSailorsInfoWebsiteURLs().entrySet()) {
|
||||
eventDTO.setSailorsInfoWebsiteURL(sailorsInfoWebsiteEntry.getKey() == null ? null : sailorsInfoWebsiteEntry
|
||||
.getKey().toLanguageTag(), sailorsInfoWebsiteEntry.getValue().toExternalForm());
|
||||
@@ -4363,7 +4368,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
}
|
||||
updateEvent(newEvent.id, newEvent.getName(), description, newEvent.startDate, newEvent.endDate, newEvent.venue,
|
||||
newEvent.isPublic, eventLeaderboardGroupUUIDs, newEvent.getOfficialWebsiteURL(),
|
||||
newEvent.getSailorsInfoWebsiteURLs(), newEvent.getImages(), newEvent.getVideos());
|
||||
newEvent.getBaseURL(), newEvent.getSailorsInfoWebsiteURLs(), newEvent.getImages(), newEvent.getVideos());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -100,7 +100,7 @@ public class EventBaseDTO extends NamedDTO implements IsSerializable {
|
||||
public void setOfficialWebsiteURL(String officialWebsiteURL) {
|
||||
this.officialWebsiteURL = officialWebsiteURL;
|
||||
}
|
||||
|
||||
|
||||
public Map<String, String> getSailorsInfoWebsiteURLs() {
|
||||
return sailorsInfoWebsiteURLs;
|
||||
}
|
||||
|
||||
+3
@@ -132,6 +132,7 @@ public class TestStoringAndLoadingEventsAndRegattas extends AbstractMongoDBTest
|
||||
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 baseURL = new URL("http://base.url.com");
|
||||
final URL sailorsInfoWebsiteURL = new URL("http://sailorsinfo.website.com");
|
||||
final URL sailorsInfoWebsiteURLDE = new URL("http://sailorsinfo-de.website.com");
|
||||
final Venue venue = new VenueImpl(venueName);
|
||||
@@ -148,6 +149,7 @@ public class TestStoringAndLoadingEventsAndRegattas extends AbstractMongoDBTest
|
||||
event.addLeaderboardGroup(lg2);
|
||||
event.setDescription(eventDescription);
|
||||
event.setOfficialWebsiteURL(officialWebsiteURL);
|
||||
event.setBaseURL(baseURL);
|
||||
event.setSailorsInfoWebsiteURL(null, sailorsInfoWebsiteURL);
|
||||
event.setSailorsInfoWebsiteURL(Locale.GERMAN, sailorsInfoWebsiteURLDE);
|
||||
mof.storeEvent(event);
|
||||
@@ -174,6 +176,7 @@ public class TestStoringAndLoadingEventsAndRegattas extends AbstractMongoDBTest
|
||||
assertEquals(eventName, loadedEvent.getName());
|
||||
assertEquals(eventDescription, loadedEvent.getDescription());
|
||||
assertEquals(event.getOfficialWebsiteURL(), loadedEvent.getOfficialWebsiteURL());
|
||||
assertEquals(event.getBaseURL(), loadedEvent.getBaseURL());
|
||||
assertEquals(sailorsInfoWebsiteURL, loadedEvent.getSailorsInfoWebsiteURL(null));
|
||||
assertEquals(sailorsInfoWebsiteURLDE, loadedEvent.getSailorsInfoWebsiteURL(Locale.GERMAN));
|
||||
assertEquals(2, loadedEvent.getSailorsInfoWebsiteURLs().size());
|
||||
|
||||
+8
@@ -39,6 +39,7 @@ public class EventBaseJsonDeserializer implements JsonDeserializer<EventBase> {
|
||||
String name = (String) eventJson.get(EventBaseJsonSerializer.FIELD_NAME);
|
||||
String description = (String) eventJson.get(EventBaseJsonSerializer.FIELD_DESCRIPTION);
|
||||
String officialWebsiteURLAsString = (String) eventJson.get(EventBaseJsonSerializer.FIELD_OFFICIAL_WEBSITE_URL);
|
||||
String baseURLAsString = (String) eventJson.get(EventBaseJsonSerializer.FIELD_BASE_URL);
|
||||
Number startDate = (Number) eventJson.get(EventBaseJsonSerializer.FIELD_START_DATE);
|
||||
Number endDate = (Number) eventJson.get(EventBaseJsonSerializer.FIELD_END_DATE);
|
||||
final Venue venue;
|
||||
@@ -65,6 +66,13 @@ public class EventBaseJsonDeserializer implements JsonDeserializer<EventBase> {
|
||||
throw new JsonDeserializationException("Error deserializing official website URL for event "+name, e);
|
||||
}
|
||||
}
|
||||
if (baseURLAsString != null) {
|
||||
try {
|
||||
result.setBaseURL(new URL(baseURLAsString));
|
||||
} catch (MalformedURLException e) {
|
||||
throw new JsonDeserializationException("Error deserializing base URL for event "+name, e);
|
||||
}
|
||||
}
|
||||
JSONArray imagesJson = (JSONArray) eventJson.get(EventBaseJsonSerializer.FIELD_IMAGES);
|
||||
if (imagesJson != null) {
|
||||
for (Object imageJson : imagesJson) {
|
||||
|
||||
+2
@@ -27,6 +27,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_BASE_URL = "baseURL";
|
||||
public static final String FIELD_SAILORS_INFO_WEBSITE_URLS = "sailorsInfoWebsiteURLs";
|
||||
public static final String FIELDS_LEADERBOARD_GROUPS = "leaderboardGroups";
|
||||
|
||||
@@ -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_BASE_URL, event.getBaseURL() != null ? event.getBaseURL().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
@@ -48,6 +48,7 @@ public class EventDataJsonSerializerTest {
|
||||
protected final TimePoint expectedEndDate = new MillisecondsTimePoint(new Date());
|
||||
protected final Venue expectedVenue = new VenueImpl("Expected Venue");
|
||||
protected final URL expectedOfficialWebsiteURL;
|
||||
protected final URL expectedBaseURL;
|
||||
protected final Map<Locale, URL> expectedSailorsInfoWebsiteURLs;
|
||||
protected final URL expectedLogoImageURL;
|
||||
protected final ImageDescriptor expectedLogoImageDescriptor;
|
||||
@@ -60,6 +61,7 @@ public class EventDataJsonSerializerTest {
|
||||
|
||||
public EventDataJsonSerializerTest() throws MalformedURLException {
|
||||
expectedOfficialWebsiteURL = new URL("http://official.website.com");
|
||||
expectedBaseURL = new URL("http://our.own.com");
|
||||
expectedLogoImageURL = new URL("http://official.logo.com/logo.png");
|
||||
expectedLogoImageDescriptor = new ImageDescriptorImpl(expectedLogoImageURL, MillisecondsTimePoint.now());
|
||||
expectedSailorsInfoWebsiteURLs = new HashMap<>();
|
||||
@@ -76,6 +78,7 @@ public class EventDataJsonSerializerTest {
|
||||
when(event.getName()).thenReturn(expectedName);
|
||||
when(event.getDescription()).thenReturn(expectedDescription);
|
||||
when(event.getOfficialWebsiteURL()).thenReturn(expectedOfficialWebsiteURL);
|
||||
when(event.getBaseURL()).thenReturn(expectedBaseURL);
|
||||
when(event.getSailorsInfoWebsiteURLs()).thenReturn(expectedSailorsInfoWebsiteURLs);
|
||||
when(event.getSailorsInfoWebsiteURL(null)).thenReturn(expectedSailorsInfoWebsiteURLs.get(null));
|
||||
when(event.getStartDate()).thenReturn(expectedStartDate);
|
||||
|
||||
+2
@@ -43,6 +43,7 @@ public class EventDataJsonSerializerWithNullValuesTest {
|
||||
protected final TimePoint expectedEndDate = new MillisecondsTimePoint(new Date());
|
||||
protected final Venue expectedVenue = new VenueImpl("Expected Venue");
|
||||
protected final URL expectedOfficialWebsiteURL = null;
|
||||
protected final URL expectedBaseURL = null;
|
||||
protected final LeaderboardGroup expectedLeaderbaordGroup = mock(LeaderboardGroup.class);
|
||||
|
||||
protected JsonSerializer<Venue> venueSerializer;
|
||||
@@ -59,6 +60,7 @@ public class EventDataJsonSerializerWithNullValuesTest {
|
||||
when(event.getName()).thenReturn(expectedName);
|
||||
when(event.getDescription()).thenReturn(expectedDescription);
|
||||
when(event.getOfficialWebsiteURL()).thenReturn(expectedOfficialWebsiteURL);
|
||||
when(event.getBaseURL()).thenReturn(expectedBaseURL);
|
||||
when(event.getStartDate()).thenReturn(expectedStartDate);
|
||||
when(event.getEndDate()).thenReturn(expectedEndDate);
|
||||
when(event.getVenue()).thenReturn(expectedVenue);
|
||||
|
||||
+4
@@ -46,6 +46,7 @@ public class EventWithNullStartAndEndDataJsonSerializerTest {
|
||||
protected final TimePoint expectedEndDate = null;
|
||||
protected final Venue expectedVenue = new VenueImpl("Expected Venue");
|
||||
protected final URL expectedOfficialWebsiteURL;
|
||||
protected final URL expectedBaseURL;
|
||||
protected final URL expectedLogoImageURL;
|
||||
protected final ImageDescriptor expectedLogoImageDescriptor;
|
||||
protected final LeaderboardGroupBase expectedLeaderboardGroup = mock(LeaderboardGroupBase.class);
|
||||
@@ -58,6 +59,7 @@ public class EventWithNullStartAndEndDataJsonSerializerTest {
|
||||
|
||||
public EventWithNullStartAndEndDataJsonSerializerTest() throws MalformedURLException {
|
||||
expectedOfficialWebsiteURL = new URL("http://official.website.com");
|
||||
expectedBaseURL = new URL("http://our.veryown.com");
|
||||
expectedLogoImageURL = new URL("http://official.logo.com/logo.png");
|
||||
expectedLogoImageDescriptor = new ImageDescriptorImpl(expectedLogoImageURL, MillisecondsTimePoint.now());
|
||||
}
|
||||
@@ -74,6 +76,7 @@ public class EventWithNullStartAndEndDataJsonSerializerTest {
|
||||
when(event.getName()).thenReturn(expectedName);
|
||||
when(event.getDescription()).thenReturn(expectedDescription);
|
||||
when(event.getOfficialWebsiteURL()).thenReturn(expectedOfficialWebsiteURL);
|
||||
when(event.getBaseURL()).thenReturn(expectedBaseURL);
|
||||
when(event.getStartDate()).thenReturn(expectedStartDate);
|
||||
when(event.getEndDate()).thenReturn(expectedEndDate);
|
||||
when(event.getVenue()).thenReturn(expectedVenue);
|
||||
@@ -104,6 +107,7 @@ public class EventWithNullStartAndEndDataJsonSerializerTest {
|
||||
assertEquals(expectedName, deserializedEvent.getName());
|
||||
assertEquals(expectedDescription, deserializedEvent.getDescription());
|
||||
assertEquals(expectedOfficialWebsiteURL, deserializedEvent.getOfficialWebsiteURL());
|
||||
assertEquals(expectedBaseURL, deserializedEvent.getBaseURL());
|
||||
assertEquals(1, Util.size(deserializedEvent.getImages()));
|
||||
assertEquals(expectedLogoImageURL, deserializedEvent.getImages().iterator().next().getURL());
|
||||
LeaderboardGroupBase deserializedLg = deserializedEvent.getLeaderboardGroups().iterator().next();
|
||||
|
||||
-2
@@ -52,8 +52,6 @@ public class SensorDataImportServlet extends AbstractFileUploadServlet {
|
||||
* Searches the requested importer in the importers provided by the OSGi registry and imports the priovided sensor
|
||||
* data file.
|
||||
*
|
||||
* @param files
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
private Iterable<TrackFileImportDeviceIdentifier> importFiles(Iterable<Pair<String, InputStream>> files)
|
||||
|
||||
+6
-6
@@ -1369,9 +1369,9 @@ public class MasterDataImportTest {
|
||||
|
||||
Event event = sourceService.createEventWithoutReplication("Test Event", /* eventDescription */null,
|
||||
new MillisecondsTimePoint(0), new MillisecondsTimePoint(10), "testvenue", false, UUID.randomUUID(),
|
||||
/* officialWebsiteURL */null, /* sailorsInfoWebsiteURL */null,
|
||||
/* images */Collections.<ImageDescriptor> emptyList(), /* videos */
|
||||
Collections.<VideoDescriptor> emptyList());
|
||||
/* officialWebsiteURL */null, /*baseURL*/null,
|
||||
/* sailorsInfoWebsiteURL */null, /* videos */
|
||||
/* images */Collections.<ImageDescriptor> emptyList(), Collections.<VideoDescriptor> emptyList());
|
||||
CourseArea defaultCourseArea = sourceService.addCourseAreas(event.getId(), new String[] { "ECHO" },
|
||||
new UUID[] { UUID.randomUUID() })[0];
|
||||
|
||||
@@ -1437,9 +1437,9 @@ public class MasterDataImportTest {
|
||||
|
||||
Event event = sourceService.createEventWithoutReplication("Test Event", /* eventDescription */null,
|
||||
new MillisecondsTimePoint(0), new MillisecondsTimePoint(10), "testvenue", false, UUID.randomUUID(),
|
||||
/* officialWebsiteURL */null, /* sailorsInfoWebsiteURL */null,
|
||||
/* images */Collections.<ImageDescriptor> emptyList(), /* videos */
|
||||
Collections.<VideoDescriptor> emptyList());
|
||||
/* officialWebsiteURL */null, /*baseURL*/null,
|
||||
/* sailorsInfoWebsiteURL */null, /* videos */
|
||||
/* images */Collections.<ImageDescriptor> emptyList(), Collections.<VideoDescriptor> emptyList());
|
||||
CourseArea defaultCourseArea = sourceService.addCourseAreas(event.getId(), new String[] { "ECHO" },
|
||||
new UUID[] { UUID.randomUUID() })[0];
|
||||
|
||||
|
||||
+3
-3
@@ -68,9 +68,9 @@ public class RemoveLeaderboardGroupTest {
|
||||
cal.set(2014, 5, 8, 16, 00);
|
||||
final TimePoint pfingstbuschEndDate = new MillisecondsTimePoint(cal.getTime());
|
||||
pfingstbusch = server.apply(new CreateEvent("Pfingstbusch", /* eventDescription */ null, pfingstbuschStartDate, pfingstbuschEndDate,
|
||||
"Kiel", /* isPublic */ true, UUID.randomUUID(), /* officialWebsiteURLAsString */ null, /* sailorsInfoWebsiteURLAsString */ null,
|
||||
/* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList(),
|
||||
/* leaderboardGroupIds */ Collections.<UUID> emptyList()));
|
||||
"Kiel", /* isPublic */ true, UUID.randomUUID(), /* officialWebsiteURLAsString */ null, /*baseURL*/null,
|
||||
/* sailorsInfoWebsiteURLAsString */ null, /* images */Collections.<ImageDescriptor> emptyList(),
|
||||
/* videos */Collections.<VideoDescriptor> emptyList(), /* leaderboardGroupIds */ Collections.<UUID> emptyList()));
|
||||
final LeaderboardGroup pfingstbuschLeaderboardGroup = server.apply(new CreateLeaderboardGroup("Pfingstbusch", "Pfingstbusch", /* displayName */ null,
|
||||
/* displayGroupsInReverseOrder */ false, /* leaderboard names */ Collections.emptyList(),
|
||||
new int[0], /* overallLeaderboardScoringSchemeType */ ScoringSchemeType.LOW_POINT));
|
||||
|
||||
+4
-4
@@ -126,8 +126,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,
|
||||
"Kiel", /* isPublic */ true, UUID.randomUUID(), /* officialWebsiteURLAsString */ null, /* sailorsInfoWebsiteURLAsString */ null,
|
||||
/* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList(), /* leaderboardGroupIds */ Collections.<UUID> emptyList()));
|
||||
"Kiel", /* isPublic */ true, UUID.randomUUID(), /* officialWebsiteURLAsString */ null, /*baseURL*/null,
|
||||
/* sailorsInfoWebsiteURLAsString */ null, /* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList(), /* leaderboardGroupIds */ Collections.<UUID> emptyList()));
|
||||
kiel = pfingstbusch.getVenue();
|
||||
final CourseAreaImpl kielAlpha = new CourseAreaImpl("Alpha", UUID.randomUUID());
|
||||
kiel.addCourseArea(kielAlpha);
|
||||
@@ -164,8 +164,8 @@ 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,
|
||||
"Flensburg", /* isPublic */ true, UUID.randomUUID(), /* officialWebsiteURLAsString */ null, /*sailorsInfoWebsiteURLAsString */ null,
|
||||
/* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList(), /* leaderboardGroupIds */ Collections.<UUID> emptyList()));
|
||||
"Flensburg", /* isPublic */ true, UUID.randomUUID(), /* officialWebsiteURLAsString */ null, /*baseURL*/null,
|
||||
/*sailorsInfoWebsiteURLAsString */ null, /* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList(), /* leaderboardGroupIds */ Collections.<UUID> emptyList()));
|
||||
flensburg = aalEvent.getVenue();
|
||||
final CourseAreaImpl flensburgStandard = new CourseAreaImpl("Standard", UUID.randomUUID());
|
||||
flensburg.addCourseArea(flensburgStandard);
|
||||
|
||||
@@ -369,11 +369,12 @@ public interface RacingEventService extends TrackedRegattaRegistry, RegattaFetch
|
||||
* The name of the venue of the event
|
||||
* @param isPublic
|
||||
* Indicates whether the event is public accessible via the publication URL or not
|
||||
* @param baseURL TODO
|
||||
* @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, Map<Locale, URL> sailorsInfoWebsiteURLs,
|
||||
Iterable<ImageDescriptor> images, Iterable<VideoDescriptor> videos);
|
||||
String venueName, boolean isPublic, Iterable<UUID> leaderboardGroupIds, URL officialWebsiteURL, URL baseURL,
|
||||
Map<Locale, URL> sailorsInfoWebsiteURLs, Iterable<ImageDescriptor> images, Iterable<VideoDescriptor> videos);
|
||||
|
||||
/**
|
||||
* Renames a sailing event. If a sailing event by the name <code>oldName</code> does not exist in {@link #getEvents()},
|
||||
@@ -468,8 +469,8 @@ 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, Map<Locale, URL> sailorsInfoWebsiteURLs, Iterable<ImageDescriptor> images,
|
||||
Iterable<VideoDescriptor> videos);
|
||||
boolean isPublic, UUID id, URL officialWebsiteURL, URL baseURL, Map<Locale, URL> sailorsInfoWebsiteURLs,
|
||||
Iterable<ImageDescriptor> images, Iterable<VideoDescriptor> videos);
|
||||
|
||||
void setRegattaForRace(Regatta regatta, String raceIdAsString);
|
||||
|
||||
|
||||
+11
-9
@@ -2672,12 +2672,12 @@ 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, /* sailorsInfoWebsiteURLAsString */null,
|
||||
/* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList());
|
||||
id, /* officialWebsiteURL */null, /* baseURL */null,
|
||||
/* sailorsInfoWebsiteURLAsString */null, /* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList());
|
||||
replicate(new CreateEvent(eventName, eventDescription, startDate, endDate, venue, isPublic, id,
|
||||
/* officialWebsiteURLAsString */null, /* sailorsInfoWebsiteURLAsString */null,
|
||||
/* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList(),
|
||||
/* leaderboardGroupIds */ Collections.<UUID> emptyList()));
|
||||
/* officialWebsiteURLAsString */null, /*baseURL*/null,
|
||||
/* sailorsInfoWebsiteURLAsString */null, /* images */Collections.<ImageDescriptor> emptyList(),
|
||||
/* videos */Collections.<VideoDescriptor> emptyList(), /* leaderboardGroupIds */ Collections.<UUID> emptyList()));
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2688,12 +2688,13 @@ 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, Map<Locale, URL> sailorsInfoWebsiteURLs,
|
||||
Iterable<ImageDescriptor> images, Iterable<VideoDescriptor> videos) {
|
||||
TimePoint endDate, String venue, boolean isPublic, UUID id, URL officialWebsiteURL, URL baseURL,
|
||||
Map<Locale, URL> sailorsInfoWebsiteURLs, Iterable<ImageDescriptor> images, Iterable<VideoDescriptor> videos) {
|
||||
Event result = new EventImpl(eventName, startDate, endDate, venue, isPublic, id);
|
||||
addEvent(result);
|
||||
result.setDescription(eventDescription);
|
||||
result.setOfficialWebsiteURL(officialWebsiteURL);
|
||||
result.setBaseURL(baseURL);
|
||||
result.setSailorsInfoWebsiteURLs(sailorsInfoWebsiteURLs);
|
||||
result.setImages(images);
|
||||
result.setVideos(videos);
|
||||
@@ -2711,8 +2712,8 @@ 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, Map<Locale, URL> sailorsInfoWebsiteURLs,
|
||||
Iterable<ImageDescriptor> images, Iterable<VideoDescriptor> videos) {
|
||||
String venueName, boolean isPublic, Iterable<UUID> leaderboardGroupIds, URL officialWebsiteURL, URL baseURL,
|
||||
Map<Locale, URL> sailorsInfoWebsiteURLs, Iterable<ImageDescriptor> images, Iterable<VideoDescriptor> videos) {
|
||||
final Event event = eventsById.get(id);
|
||||
if (event == null) {
|
||||
throw new IllegalArgumentException("Sailing event with ID " + id + " does not exist.");
|
||||
@@ -2735,6 +2736,7 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
|
||||
}
|
||||
event.setLeaderboardGroups(leaderboardGroups);
|
||||
event.setOfficialWebsiteURL(officialWebsiteURL);
|
||||
event.setBaseURL(baseURL);
|
||||
event.setSailorsInfoWebsiteURLs(sailorsInfoWebsiteURLs);
|
||||
event.setImages(images);
|
||||
event.setVideos(videos);
|
||||
|
||||
+8
-4
@@ -1,5 +1,6 @@
|
||||
package com.sap.sailing.server.notification.impl;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Locale;
|
||||
@@ -171,8 +172,7 @@ public class SailingNotificationServiceImpl implements Stoppable, SailingNotific
|
||||
private String createRaceBoardLink(TrackedRace trackedRace, Leaderboard leaderboard, Event event,
|
||||
LeaderboardGroup leaderboardGroup) {
|
||||
RegattaAndRaceIdentifier raceIdentifier = trackedRace.getRaceIdentifier();
|
||||
// TODO where to get the base URL?
|
||||
String link = "/gwt/RaceBoard.html?eventId=" + event.getId() + "&leaderboardName=" + leaderboard.getName()
|
||||
String link = getBaseURL(event).toString() + "/gwt/RaceBoard.html?eventId=" + event.getId() + "&leaderboardName=" + leaderboard.getName()
|
||||
+ "&leaderboardGroupName=" + leaderboardGroup.getName() + "&raceName="
|
||||
+ raceIdentifier.getRaceName() + "&showMapControls=true&viewShowNavigationPanel=true®attaName="
|
||||
+ raceIdentifier.getRegattaName();
|
||||
@@ -183,13 +183,17 @@ public class SailingNotificationServiceImpl implements Stoppable, SailingNotific
|
||||
return createHomeRegattaLink("races", leaderboard, event);
|
||||
}
|
||||
|
||||
private URL getBaseURL(final Event event) {
|
||||
// TODO where to get the base URL?
|
||||
return event.getBaseURL();
|
||||
}
|
||||
|
||||
private String createHomeLeaderboardLink(Leaderboard leaderboard, Event event) {
|
||||
return createHomeRegattaLink("leaderboard", leaderboard, event);
|
||||
}
|
||||
|
||||
private String createHomeRegattaLink(String tab, Leaderboard leaderboard, Event event) {
|
||||
// TODO where to get the base URL?
|
||||
String link = "/gwt/Home.html#/regatta/" + tab + "/:eventId=" + event.getId() + "®attaId="
|
||||
String link = getBaseURL(event).toString() + "/gwt/Home.html#/regatta/" + tab + "/:eventId=" + event.getId() + "®attaId="
|
||||
+ leaderboard.getName();
|
||||
return link;
|
||||
}
|
||||
|
||||
+5
-2
@@ -33,11 +33,13 @@ public class CreateEvent extends AbstractEventOperation<Event> {
|
||||
private final Iterable<ImageDescriptor> images;
|
||||
private final Iterable<VideoDescriptor> videos;
|
||||
private final URL officialWebsiteURL;
|
||||
private final URL baseURL;
|
||||
private final Map<Locale, URL> sailorsInfoWebsiteURLs;
|
||||
private final Iterable<UUID> leaderboardGroupIds;
|
||||
|
||||
public CreateEvent(String eventName, String eventDescription, TimePoint startDate, TimePoint endDate, String venue,
|
||||
boolean isPublic, UUID id, URL officialWebsiteURL, Map<Locale, URL> sailorsInfoWebsiteURLs, Iterable<ImageDescriptor> images, Iterable<VideoDescriptor> videos, Iterable<UUID> leaderboardGroupIds) {
|
||||
boolean isPublic, UUID id, URL officialWebsiteURL, URL baseURL, Map<Locale, URL> sailorsInfoWebsiteURLs,
|
||||
Iterable<ImageDescriptor> images, Iterable<VideoDescriptor> videos, Iterable<UUID> leaderboardGroupIds) {
|
||||
super(id);
|
||||
this.eventName = eventName;
|
||||
this.eventDescription = eventDescription;
|
||||
@@ -46,6 +48,7 @@ public class CreateEvent extends AbstractEventOperation<Event> {
|
||||
this.venue = venue;
|
||||
this.isPublic = isPublic;
|
||||
this.officialWebsiteURL = officialWebsiteURL;
|
||||
this.baseURL = baseURL;
|
||||
this.sailorsInfoWebsiteURLs = sailorsInfoWebsiteURLs;
|
||||
this.images = images;
|
||||
this.videos = videos;
|
||||
@@ -71,7 +74,7 @@ public class CreateEvent extends AbstractEventOperation<Event> {
|
||||
@Override
|
||||
public Event internalApplyTo(RacingEventService toState) {
|
||||
final Event result = toState.createEventWithoutReplication(getEventName(), eventDescription, startDate, endDate, venue, isPublic,
|
||||
getId(), officialWebsiteURL, sailorsInfoWebsiteURLs, images, videos);
|
||||
getId(), officialWebsiteURL, baseURL, sailorsInfoWebsiteURLs, images, videos);
|
||||
List<LeaderboardGroup> lgl = new ArrayList<>();
|
||||
for (final UUID lgid : leaderboardGroupIds) {
|
||||
final LeaderboardGroup lg = toState.getLeaderboardGroupByID(lgid);
|
||||
|
||||
+5
-3
@@ -21,13 +21,14 @@ public class UpdateEvent extends AbstractEventOperation<Void> {
|
||||
private final String eventName;
|
||||
private final String eventDescription;
|
||||
private final URL officialWebsiteURL;
|
||||
private final URL baseURL;
|
||||
private final Map<Locale, URL> sailorsInfoWebsiteURLs;
|
||||
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, Map<Locale, URL> sailorsInfoWebsiteURLs,
|
||||
Iterable<ImageDescriptor> images, Iterable<VideoDescriptor> videos) {
|
||||
String venueName, boolean isPublic, Iterable<UUID> leaderboardGroupIds, URL officialWebsiteURL, URL baseURL,
|
||||
Map<Locale, URL> sailorsInfoWebsiteURLs, Iterable<ImageDescriptor> images, Iterable<VideoDescriptor> videos) {
|
||||
super(id);
|
||||
this.eventName = eventName;
|
||||
this.eventDescription = eventDescription;
|
||||
@@ -37,6 +38,7 @@ public class UpdateEvent extends AbstractEventOperation<Void> {
|
||||
this.isPublic = isPublic;
|
||||
this.leaderboardGroupIds = leaderboardGroupIds;
|
||||
this.officialWebsiteURL = officialWebsiteURL;
|
||||
this.baseURL = baseURL;
|
||||
this.sailorsInfoWebsiteURLs = sailorsInfoWebsiteURLs;
|
||||
this.images = images;
|
||||
this.videos = videos;
|
||||
@@ -57,7 +59,7 @@ public class UpdateEvent extends AbstractEventOperation<Void> {
|
||||
@Override
|
||||
public Void internalApplyTo(RacingEventService toState) {
|
||||
toState.updateEvent(getId(), eventName, eventDescription, startDate, endDate, venueName, isPublic,
|
||||
leaderboardGroupIds, officialWebsiteURL, sailorsInfoWebsiteURLs, images, videos);
|
||||
leaderboardGroupIds, officialWebsiteURL, baseURL, sailorsInfoWebsiteURLs, images, videos);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user