Integrated images and video collections of 'Event' into the CreateEvent and UpdateEvent operations

This commit is contained in:
fmittag committed 2015-06-05 13:45:24 +02:00
1 parent 3c480c3836
commit 508dc7550a
15 files changed
+140 -33

No files matched your search

@@ -30,6 +30,7 @@ import com.sap.sailing.gwt.ui.shared.VenueDTO;
import com.sap.sse.gwt.client.IconResources;
import com.sap.sse.gwt.client.controls.listedit.StringConstantsListEditorComposite;
import com.sap.sse.gwt.client.controls.listedit.StringListInlineEditorComposite;
import com.sap.sse.gwt.client.media.ImageDTO;
public abstract class EventDialog extends DataEntryDialogWithBootstrap<EventDTO> {
protected StringMessages stringMessages;
@@ -194,6 +195,9 @@ public abstract class EventDialog extends DataEntryDialogWithBootstrap<EventDTO>
for (String sponsorImageURL : sponsorImageURLList.getValue()) {
result.addSponsorImageURL(sponsorImageURL);
}
for(ImageDTO image: imagesListComposite.getAllImages()) {
result.addImage(image);
}
result.venue = new VenueDTO(venueEntryField.getText(), courseAreas);
return result;
}
@@ -509,6 +509,7 @@ public class EventListComposite extends Composite implements EventsRefresher, Le
updatedEvent.isPublic, updatedEventLeaderboardGroupIds,
updatedEvent.getOfficialWebsiteURL(), updatedEvent.getLogoImageURL(),
updatedEvent.getImageURLs(), updatedEvent.getVideoURLs(), updatedEvent.getSponsorImageURLs(),
updatedEvent.getImages(), updatedEvent.getVideos(),
new AsyncCallback<EventDTO>() {
@Override
public void onFailure(Throwable t) {
@@ -580,8 +581,8 @@ public class EventListComposite extends Composite implements EventsRefresher, Le
}
sailingService.createEvent(newEvent.getName(), newEvent.getDescription(), newEvent.startDate, newEvent.endDate,
newEvent.venue.getName(), newEvent.isPublic, courseAreaNames, newEvent.getImageURLs(),
newEvent.getVideoURLs(), newEvent.getSponsorImageURLs(), newEvent.getLogoImageURL(),
newEvent.getOfficialWebsiteURL(), new AsyncCallback<EventDTO>() {
newEvent.getVideoURLs(), newEvent.getSponsorImageURLs(), newEvent.getImages(), newEvent.getVideos(),
newEvent.getLogoImageURL(), newEvent.getOfficialWebsiteURL(), new AsyncCallback<EventDTO>() {
@Override
public void onFailure(Throwable t) {
errorReporter.reportError("Error trying to create new event " + newEvent.getName() + ": " + t.getMessage());
@@ -9,6 +9,7 @@ import com.google.gwt.cell.client.SafeHtmlCell;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.safehtml.client.SafeHtmlTemplates;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.user.cellview.client.CellTable;
@@ -53,6 +54,13 @@ public class ImagesListComposite extends Composite {
}
}
interface AnchorTemplates extends SafeHtmlTemplates {
@SafeHtmlTemplates.Template("<a target=\"_blank\" href=\"{0}\">{1}</a>")
SafeHtml cell(String url, String displayName);
}
private static AnchorTemplates ANCHORTEMPLATE = GWT.create(AnchorTemplates.class);
private final AdminConsoleTableResources tableRes = GWT.create(AdminConsoleTableResources.class);
public ImagesListComposite(final StringMessages stringMessages) {
@@ -102,17 +110,19 @@ public class ImagesListComposite extends Composite {
imageListDataProvider.addDataDisplay(table);
table.setWidth("100%");
TextColumn<ImageDTO> shortImageNameColumn = new TextColumn<ImageDTO>() {
AnchorCell anchorCell = new AnchorCell();
Column<ImageDTO, SafeHtml> shortImageNameColumn = new Column<ImageDTO, SafeHtml>(anchorCell) {
@Override
public String getValue(ImageDTO image) {
String result = "";
public SafeHtml getValue(ImageDTO image) {
String linkName = "";
int index = image.getSourceRef().lastIndexOf("/");
if(index > 0) {
result = image.getSourceRef().substring(index+1, image.getSourceRef().length());
linkName = image.getSourceRef().substring(index+1, image.getSourceRef().length());
}
return result;
return ANCHORTEMPLATE.cell(image.getSourceRef(), linkName);
}
};
TextColumn<ImageDTO> titleColumn = new TextColumn<ImageDTO>() {
@Override
public String getValue(ImageDTO image) {
@@ -247,7 +247,7 @@ public class StructureImportManagementPanel extends FlowPanel implements Regatta
}
sailingService.createEvent(newEvent.getName(), newEvent.getDescription(), newEvent.startDate, newEvent.endDate,
newEvent.venue.getName(), newEvent.isPublic, courseAreaNames, newEvent.getImageURLs(),
newEvent.getVideoURLs(), newEvent.getSponsorImageURLs(), newEvent.getLogoImageURL(),
newEvent.getVideoURLs(), newEvent.getSponsorImageURLs(), newEvent.getImages(), newEvent.getVideos(), newEvent.getLogoImageURL(),
newEvent.getOfficialWebsiteURL(), new AsyncCallback<EventDTO>() {
@Override
public void onFailure(Throwable t) {
@@ -94,6 +94,8 @@ import com.sap.sse.common.Util.Pair;
import com.sap.sse.common.mail.MailException;
import com.sap.sse.common.search.KeywordQuery;
import com.sap.sse.gwt.client.filestorage.FileStorageManagementGwtService;
import com.sap.sse.gwt.client.media.ImageDTO;
import com.sap.sse.gwt.client.media.VideoDTO;
/**
* The client side stub for the RPC service. Usually, when a <code>null</code> date is passed to
@@ -295,11 +297,12 @@ public interface SailingService extends RemoteService, FileStorageManagementGwtS
EventDTO updateEvent(UUID eventId, String eventName, String eventDescription, Date startDate, Date endDate,
VenueDTO venue, boolean isPublic, Iterable<UUID> leaderboardGroupIds, String officialWebsiteURL,
String logoImageURL, Iterable<String> imageURLs, Iterable<String> videoURLs,
Iterable<String> sponsorImageURLs) throws Exception;
Iterable<String> sponsorImageURLs, 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, Iterable<String> imageURLs,
Iterable<String> videoURLs, Iterable<String> sponsorImageURLs, String logoImageURL, String officialWebsiteURL) throws Exception;
Iterable<String> videoURLs, Iterable<String> sponsorImageURLs, Iterable<ImageDTO> images, Iterable<VideoDTO> videos,
String logoImageURL, String officialWebsiteURL) throws Exception;
void removeEvent(UUID eventId);
@@ -83,6 +83,8 @@ import com.sap.sse.common.Util.Pair;
import com.sap.sse.common.search.KeywordQuery;
import com.sap.sse.gwt.client.BuildVersionRetriever;
import com.sap.sse.gwt.client.filestorage.FileStorageManagementGwtServiceAsync;
import com.sap.sse.gwt.client.media.ImageDTO;
import com.sap.sse.gwt.client.media.VideoDTO;
/**
* The async counterpart of {@link SailingService}
@@ -366,12 +368,12 @@ public interface SailingServiceAsync extends BuildVersionRetriever, FileStorageM
void createEvent(String eventName, String eventDescription, Date startDate, Date endDate, String venue, boolean isPublic,
List<String> courseAreaNames, Iterable<String> imageURLs, Iterable<String> videoURLs,
Iterable<String> sponsorImageURLs, String logoImageURL, String officialWebsiteURL, AsyncCallback<EventDTO> callback);
Iterable<String> sponsorImageURLs, Iterable<ImageDTO> images, Iterable<VideoDTO> videos, String logoImageURL, String officialWebsiteURL, AsyncCallback<EventDTO> callback);
void updateEvent(UUID eventId, String eventName, String eventDescription, Date startDate, Date endDate,
VenueDTO venue, boolean isPublic, Iterable<UUID> leaderboardGroupIds, String officialWebsiteURL,
String logoImageURL, Iterable<String> imageURLs, Iterable<String> videoURLs,
Iterable<String> sponsorImageURLs, AsyncCallback<EventDTO> callback);
Iterable<String> sponsorImageURLs, Iterable<ImageDTO> images, Iterable<VideoDTO> videos, AsyncCallback<EventDTO> callback);
void createCourseArea(UUID eventId, String courseAreaName, AsyncCallback<Void> callback);
@@ -432,7 +432,9 @@ import com.sap.sse.common.impl.MillisecondsTimePoint;
import com.sap.sse.common.impl.TimeRangeImpl;
import com.sap.sse.common.mail.MailException;
import com.sap.sse.common.media.ImageDescriptor;
import com.sap.sse.common.media.ImageDescriptorImpl;
import com.sap.sse.common.media.VideoDescriptor;
import com.sap.sse.common.media.VideoDescriptorImpl;
import com.sap.sse.common.search.KeywordQuery;
import com.sap.sse.common.search.Result;
import com.sap.sse.filestorage.FileStorageService;
@@ -3297,7 +3299,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
public EventDTO updateEvent(UUID eventId, String eventName, String eventDescription, Date startDate, Date endDate,
VenueDTO venue, boolean isPublic, Iterable<UUID> leaderboardGroupIds, String officialWebsiteURLString,
String logoImageURLString, Iterable<String> imageURLStrings, Iterable<String> videoURLStrings,
Iterable<String> sponsorImageURLStrings) throws MalformedURLException {
Iterable<String> sponsorImageURLStrings, 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;
@@ -3305,10 +3307,18 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
List<URL> imageURLs = createURLsFromStrings(imageURLStrings);
List<URL> videoURLs = createURLsFromStrings(videoURLStrings);
List<URL> sponsorimagieURLs = createURLsFromStrings(sponsorImageURLStrings);
List<ImageDescriptor> eventImages = new ArrayList<ImageDescriptor>();
for (ImageDTO image : images) {
eventImages.add(convertToImage(image));
}
List<VideoDescriptor> eventVideos = new ArrayList<VideoDescriptor>();
for (VideoDTO video : videos) {
eventVideos.add(convertToVideo(video));
}
getService().apply(
new UpdateEvent(eventId, eventName, eventDescription, startTimePoint, endTimePoint, venue.getName(),
isPublic, leaderboardGroupIds, logoImageURL, officialWebsiteURL, imageURLs, videoURLs,
sponsorimagieURLs));
sponsorimagieURLs, eventImages, eventVideos));
return getEventById(eventId, false);
}
@@ -3328,16 +3338,27 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
@Override
public EventDTO createEvent(String eventName, String eventDescription, Date startDate, Date endDate, String venue,
boolean isPublic, List<String> courseAreaNames, Iterable<String> imageURLs,
Iterable<String> videoURLs, Iterable<String> sponsorImageURLs, String logoImageURLAsString, String officialWebsiteURLAsString)
Iterable<String> videoURLs, Iterable<String> sponsorImageURLs, Iterable<ImageDTO> images, Iterable<VideoDTO> videos,
String logoImageURLAsString, String officialWebsiteURLAsString)
throws MalformedURLException {
UUID eventUuid = UUID.randomUUID();
TimePoint startTimePoint = startDate != null ? new MillisecondsTimePoint(startDate) : null;
TimePoint endTimePoint = endDate != null ? new MillisecondsTimePoint(endDate) : null;
List<ImageDescriptor> eventImages = new ArrayList<ImageDescriptor>();
for (ImageDTO image : images) {
eventImages.add(convertToImage(image));
}
List<VideoDescriptor> eventVideos = new ArrayList<VideoDescriptor>();
for (VideoDTO video : videos) {
eventVideos.add(convertToVideo(video));
}
getService().apply(
new CreateEvent(eventName, eventDescription, startTimePoint, endTimePoint, venue, isPublic, eventUuid,
createURLsFromStrings(imageURLs), createURLsFromStrings(videoURLs),
createURLsFromStrings(sponsorImageURLs),
logoImageURLAsString == null ? null : new URL(logoImageURLAsString), officialWebsiteURLAsString == null ? null : new URL(officialWebsiteURLAsString)));
eventImages, eventVideos,
logoImageURLAsString == null ? null : new URL(logoImageURLAsString),
officialWebsiteURLAsString == null ? null : new URL(officialWebsiteURLAsString)));
for (String courseAreaName : courseAreaNames) {
createCourseArea(eventUuid, courseAreaName);
}
@@ -3449,6 +3470,34 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
}
}
private ImageDescriptor convertToImage(ImageDTO image) throws MalformedURLException {
ImageDescriptor result = new ImageDescriptorImpl(new URL(image.getSourceRef()), new MillisecondsTimePoint(image.getCreatedAtDate()));
result.setCopyright(image.getCopyright());
result.setTitle(image.getTitle());
result.setSubtitle(image.getSubtitle());
result.setCopyright(image.getCopyright());
result.setSize(image.getWidthInPx(), image.getHeightInPx());
for (String tag : image.getTags()) {
result.addTag(tag);
}
return result;
}
private VideoDescriptor convertToVideo(VideoDTO video) throws MalformedURLException {
VideoDescriptor result = new VideoDescriptorImpl(new URL(video.getSourceRef()), video.getMimeType(), new MillisecondsTimePoint(video.getCreatedAtDate()));
result.setCopyright(video.getCopyright());
result.setTitle(video.getTitle());
result.setSubtitle(video.getSubtitle());
result.setCopyright(video.getCopyright());
result.setLengthInSeconds(video.getLengthInSeconds());
if(video.getThumbnailRef() != null && !video.getThumbnailRef().isEmpty())
result.setThumbnailURL(new URL(video.getThumbnailRef()));
for (String tag : video.getTags()) {
result.addTag(tag);
}
return result;
}
private ImageDTO convertToImageDTO(ImageDescriptor image) {
ImageDTO result = new ImageDTO(image.getURL().toString(), image.getCreatedAtDate() != null ? image.getCreatedAtDate().asDate() : null);
result.setCopyright(image.getCopyright());
@@ -4108,7 +4157,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
updateEvent(newEvent.id, newEvent.getName(), description, newEvent.startDate, newEvent.endDate, newEvent.venue,
newEvent.isPublic, eventLeaderboardGroupUUIDs, newEvent.getLogoImageURL(),
newEvent.getOfficialWebsiteURL(), newEvent.getImageURLs(), newEvent.getVideoURLs(),
newEvent.getSponsorImageURLs());
newEvent.getSponsorImageURLs(), newEvent.getImages(), newEvent.getVideos());
}
@Override
@@ -127,7 +127,9 @@ import com.sap.sse.common.TimePoint;
import com.sap.sse.common.Util;
import com.sap.sse.common.impl.MillisecondsDurationImpl;
import com.sap.sse.common.impl.MillisecondsTimePoint;
import com.sap.sse.common.media.ImageDescriptor;
import com.sap.sse.common.media.MimeType;
import com.sap.sse.common.media.VideoDescriptor;
import com.sap.sse.mongodb.MongoDBConfiguration;
import com.sap.sse.mongodb.MongoDBService;
@@ -1331,7 +1333,9 @@ public class MasterDataImportTest {
Iterable<URL> sponsorImageURLs = new HashSet<>();
Event event = sourceService.createEventWithoutReplication("Test Event", /* eventDescription */ null,
new MillisecondsTimePoint(0), new MillisecondsTimePoint(10), "testvenue", false, UUID.randomUUID(), imageURLs,
videoURLs, sponsorImageURLs, /* logoImageURL */ null, /* officialWebsiteURL */ null);
videoURLs, sponsorImageURLs,
/* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList(),
/* logoImageURL */ null, /* officialWebsiteURL */ null);
CourseArea defaultCourseArea = sourceService.addCourseArea(event.getId(), "ECHO", UUID.randomUUID());
Regatta regatta = sourceService.createRegatta(
@@ -1398,7 +1402,9 @@ public class MasterDataImportTest {
Iterable<URL> sponsorImageURLs = new HashSet<>();
Event event = sourceService.createEventWithoutReplication("Test Event", /* eventDescription */ null,
new MillisecondsTimePoint(0), new MillisecondsTimePoint(10), "testvenue", false, UUID.randomUUID(), imageURLs,
videoURLs, sponsorImageURLs, /* logoImageURL */ null, /* officialWebsiteURL */ null);
videoURLs, sponsorImageURLs,
/* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList(),
/* logoImageURL */ null, /* officialWebsiteURL */ null);
CourseArea defaultCourseArea = sourceService.addCourseArea(event.getId(), "ECHO", UUID.randomUUID());
List<String> raceColumnNames = new ArrayList<String>();
@@ -73,6 +73,8 @@ import com.sap.sse.common.Color;
import com.sap.sse.common.TimePoint;
import com.sap.sse.common.Util;
import com.sap.sse.common.impl.MillisecondsTimePoint;
import com.sap.sse.common.media.ImageDescriptor;
import com.sap.sse.common.media.VideoDescriptor;
import com.sap.sse.common.search.KeywordQuery;
import com.sap.sse.common.search.Result;
@@ -120,8 +122,9 @@ public class SearchServiceTest {
final TimePoint pfingstbuschEndDate = new MillisecondsTimePoint(cal.getTime());
pfingstbusch = server.apply(new CreateEvent("Pfingsbusch", /* eventDescription */ null, pfingstbuschStartDate, pfingstbuschEndDate, /* isPublic */
"Kiel", true, UUID.randomUUID(), Collections.<URL>emptySet(),
Collections.<URL>emptySet(),
/* sponsorImageURLs */ Collections.<URL>emptySet(), /* logoImageURLAsString */ null, /* officialWebsiteURLAsString */ null));
Collections.<URL>emptySet(), /* sponsorImageURLs */ Collections.<URL>emptySet(),
/* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList(),
/* logoImageURLAsString */ null, /* officialWebsiteURLAsString */ null));
kiel = pfingstbusch.getVenue();
final CourseAreaImpl kielAlpha = new CourseAreaImpl("Alpha", UUID.randomUUID());
kiel.addCourseArea(kielAlpha);
@@ -156,6 +159,7 @@ public class SearchServiceTest {
aalEvent = server.apply(new CreateEvent("Aalregatta", /* eventDescription */ null, aalStartDate, aalEndDate, /* isPublic */
"Flensburg", true, UUID.randomUUID(), Collections.<URL>emptySet(),
Collections.<URL>emptySet(), /* sponsorImageURLs */ Collections.<URL>emptySet(),
/* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList(),
/* logoimageURL */ null, /* officialWebsiteURLAsString */ null));
flensburg = aalEvent.getVenue();
final CourseAreaImpl flensburgStandard = new CourseAreaImpl("Standard", UUID.randomUUID());
@@ -74,6 +74,8 @@ import com.sap.sse.common.TimePoint;
import com.sap.sse.common.TypeBasedServiceFinderFactory;
import com.sap.sse.common.Util;
import com.sap.sse.common.Util.Triple;
import com.sap.sse.common.media.ImageDescriptor;
import com.sap.sse.common.media.VideoDescriptor;
import com.sap.sse.common.search.KeywordQuery;
import com.sap.sse.common.search.Result;
import com.sap.sse.common.search.Searchable;
@@ -369,7 +371,8 @@ public interface RacingEventService extends TrackedRegattaRegistry, RegattaFetch
*/
void updateEvent(UUID id, String eventName, String eventDescription, TimePoint startDate, TimePoint endDate,
String venueName, boolean isPublic, Iterable<UUID> leaderboardGroupIds, URL officialWebsiteURL,
URL logoImageURL, Iterable<URL> imageURLs, Iterable<URL> videoURLs, Iterable<URL> sponsorImageURLs);
URL logoImageURL, Iterable<URL> imageURLs, Iterable<URL> videoURLs, Iterable<URL> sponsorImageURLs,
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()},
@@ -464,7 +467,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, Iterable<URL> imageURLs, Iterable<URL> videoURLs, Iterable<URL> sponsorImageURLs, URL logoImageURL, URL officialWebsiteURL);
boolean isPublic, UUID id, Iterable<URL> imageURLs, Iterable<URL> videoURLs, Iterable<URL> sponsorImageURLs,
Iterable<ImageDescriptor> images, Iterable<VideoDescriptor> videos, URL logoImageURL, URL officialWebsiteURL);
void setRegattaForRace(Regatta regatta, String raceIdAsString);
@@ -208,6 +208,8 @@ import com.sap.sse.common.TimePoint;
import com.sap.sse.common.TypeBasedServiceFinderFactory;
import com.sap.sse.common.Util;
import com.sap.sse.common.impl.MillisecondsTimePoint;
import com.sap.sse.common.media.ImageDescriptor;
import com.sap.sse.common.media.VideoDescriptor;
import com.sap.sse.common.search.KeywordQuery;
import com.sap.sse.common.search.Result;
import com.sap.sse.common.search.ResultImpl;
@@ -2573,11 +2575,13 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
String venue, boolean isPublic, UUID id) {
Event result = createEventWithoutReplication(eventName, eventDescription, startDate, endDate, venue, isPublic,
id, /* imageURLs */Collections.<URL> emptyList(),
/* videoURLs */Collections.<URL> emptyList(), /* sponsorImageURLs */Collections.<URL> emptyList(), /* logoImageURL */
null, /* officialWebsiteURL */null);
/* videoURLs */Collections.<URL> emptyList(), /* sponsorImageURLs */Collections.<URL> emptyList(),
/* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList(),
/* logoImageURL */ null, /* officialWebsiteURL */null);
replicate(new CreateEvent(eventName, eventDescription, startDate, endDate, venue, isPublic, /* imageURLs */
id, Collections.<URL> emptyList(),
/* videoURLs */Collections.<URL> emptyList(), /* sponsorImageURLs */Collections.<URL> emptyList(),
/* images */Collections.<ImageDescriptor> emptyList(), /* videos */Collections.<VideoDescriptor> emptyList(),
/* logoimageURL */null, /* officialWebsiteURLAsString */null));
return result;
}
@@ -2590,7 +2594,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, Iterable<URL> imageURLs,
Iterable<URL> videoURLs, Iterable<URL> sponsorImageURLs, URL logoImageURL, URL officialWebsiteURL) {
Iterable<URL> videoURLs, Iterable<URL> sponsorImageURLs, Iterable<ImageDescriptor> images, Iterable<VideoDescriptor> videos,
URL logoImageURL, URL officialWebsiteURL) {
Event result = new EventImpl(eventName, startDate, endDate, venue, isPublic, id);
addEvent(result);
result.setDescription(eventDescription);
@@ -2599,6 +2604,8 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
result.setSponsorImageURLs(sponsorImageURLs);
result.setLogoImageURL(logoImageURL);
result.setOfficialWebsiteURL(officialWebsiteURL);
result.setImages(images);
result.setVideos(videos);
return result;
}
@@ -2614,7 +2621,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,
URL logoImageURL, Iterable<URL> imageURLs, Iterable<URL> videoURLs, Iterable<URL> sponsorImageURLs) {
URL logoImageURL, Iterable<URL> imageURLs, Iterable<URL> videoURLs, Iterable<URL> sponsorImageURLs,
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.");
@@ -2641,6 +2649,8 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
event.setImageURLs(imageURLs);
event.setVideoURLs(videoURLs);
event.setSponsorImageURLs(sponsorImageURLs);
event.setImages(images);
event.setVideos(videos);
// TODO consider use diffutils to compute diff between old and new leaderboard groups list and apply the patch
// to keep changes minimial
mongoObjectFactory.storeEvent(event);
@@ -7,6 +7,8 @@ import com.sap.sailing.domain.base.Event;
import com.sap.sailing.server.RacingEventService;
import com.sap.sailing.server.RacingEventServiceOperation;
import com.sap.sse.common.TimePoint;
import com.sap.sse.common.media.ImageDescriptor;
import com.sap.sse.common.media.VideoDescriptor;
/**
* Creates an {@link Event} in the server, with a new venue and an empty course area list.
@@ -26,11 +28,14 @@ public class CreateEvent extends AbstractEventOperation<Event> {
private final Iterable<URL> videoURLs;
private final Iterable<URL> imageURLs;
private final Iterable<URL> sponsorImageURLs;
private final Iterable<ImageDescriptor> images;
private final Iterable<VideoDescriptor> videos;
private final URL logoImageURL;
private final URL officialWebsiteURL;
public CreateEvent(String eventName, String eventDescription, TimePoint startDate, TimePoint endDate, String venue,
boolean isPublic, UUID id, Iterable<URL> imageURLs, Iterable<URL> videoURLs, Iterable<URL> sponsorImageURLs, URL logoImageURL, URL officialWebsiteURL) {
boolean isPublic, UUID id, Iterable<URL> imageURLs, Iterable<URL> videoURLs, Iterable<URL> sponsorImageURLs,
Iterable<ImageDescriptor> images, Iterable<VideoDescriptor> videos, URL logoImageURL, URL officialWebsiteURL) {
super(id);
this.eventName = eventName;
this.eventDescription = eventDescription;
@@ -41,6 +46,8 @@ public class CreateEvent extends AbstractEventOperation<Event> {
this.imageURLs = imageURLs;
this.videoURLs = videoURLs;
this.sponsorImageURLs = sponsorImageURLs;
this.images = images;
this.videos = videos;
this.logoImageURL = logoImageURL;
this.officialWebsiteURL = officialWebsiteURL;
}
@@ -64,7 +71,7 @@ public class CreateEvent extends AbstractEventOperation<Event> {
@Override
public Event internalApplyTo(RacingEventService toState) {
return toState.createEventWithoutReplication(getEventName(), eventDescription, startDate, endDate, venue, isPublic,
getId(), imageURLs, videoURLs, sponsorImageURLs, logoImageURL, officialWebsiteURL);
getId(), imageURLs, videoURLs, sponsorImageURLs, images, videos, logoImageURL, officialWebsiteURL);
}
}
@@ -6,6 +6,8 @@ import java.util.UUID;
import com.sap.sailing.server.RacingEventService;
import com.sap.sailing.server.RacingEventServiceOperation;
import com.sap.sse.common.TimePoint;
import com.sap.sse.common.media.ImageDescriptor;
import com.sap.sse.common.media.VideoDescriptor;
public class UpdateEvent extends AbstractEventOperation<Void> {
private static final long serialVersionUID = -8271559266421161532L;
@@ -21,10 +23,13 @@ public class UpdateEvent extends AbstractEventOperation<Void> {
private final Iterable<URL> imageURLs;
private final Iterable<URL> videoURLs;
private final Iterable<URL> sponsorImageURLs;
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 logoImageURL,
URL officialWebsiteURL, Iterable<URL> imageURLs, Iterable<URL> videoURLs, Iterable<URL> sponsorImageURLs) {
URL officialWebsiteURL, Iterable<URL> imageURLs, Iterable<URL> videoURLs, Iterable<URL> sponsorImageURLs,
Iterable<ImageDescriptor> images, Iterable<VideoDescriptor> videos) {
super(id);
this.eventName = eventName;
this.eventDescription = eventDescription;
@@ -38,6 +43,8 @@ public class UpdateEvent extends AbstractEventOperation<Void> {
this.imageURLs = imageURLs;
this.videoURLs = videoURLs;
this.sponsorImageURLs = sponsorImageURLs;
this.images = images;
this.videos = videos;
}
@Override
@@ -55,7 +62,7 @@ public class UpdateEvent extends AbstractEventOperation<Void> {
@Override
public Void internalApplyTo(RacingEventService toState) {
toState.updateEvent(getId(), eventName, eventDescription, startDate, endDate, venueName, isPublic,
leaderboardGroupIds, officialWebsiteURL, logoImageURL, imageURLs, videoURLs, sponsorImageURLs);
leaderboardGroupIds, officialWebsiteURL, logoImageURL, imageURLs, videoURLs, sponsorImageURLs, images, videos);
return null;
}
}
@@ -2,7 +2,7 @@ package com.sap.sse.common.media;
public interface ImageDescriptor extends MediaDescriptor {
void setSize(ImageSize size);
void setSize(int widthInPx, int heightInPx);
void setSize(Integer widthInPx, Integer heightInPx);
Integer getWidthInPx();
Integer getHeightInPx();
@@ -41,7 +41,7 @@ public class ImageDescriptorImpl extends AbstractMediaDescriptor implements Imag
}
@Override
public void setSize(int widthInPx, int heightInPx) {
public void setSize(Integer widthInPx, Integer heightInPx) {
this.widthInPx = widthInPx;
this.heightInPx = heightInPx;
}