added baseURL property to EventBase

Change-Id: I0fbd92b14331918986d817fc86a06912ae8f603d
This commit is contained in:
Axel Uhl committed 2016-07-15 13:56:07 +02:00
1 parent dea82a7c88
commit 97c25d6bcd
32 files changed
+165 -85

No files matched your search

@@ -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);
@@ -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);
@@ -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&regattaName="
+ 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() + "&regattaId="
String link = getBaseURL(event).toString() + "/gwt/Home.html#/regatta/" + tab + "/:eventId=" + event.getId() + "&regattaId="
+ leaderboard.getName();
return link;
}
@@ -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);
@@ -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;
}
}