mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-13 14:12:11 +00:00
null fixes regarding tracking connector info on Event and (de-)serialization
This commit is contained in:
1 parent
cbc0ec46e1
commit
aaace28830
3 files changed
+7
-6
No files matched your search
+1
@@ -31,6 +31,7 @@ public class StrippedEventImpl extends EventBaseImpl {
|
||||
boolean isPublic, UUID id, Iterable<LeaderboardGroupBase> leaderboardGroups, Set<TrackingConnectorInfo> trackingConnectorInfos) {
|
||||
super(name, startDate, endDate, venue, isPublic, id);
|
||||
this.leaderboardGroups = leaderboardGroups;
|
||||
assert trackingConnectorInfos != null;
|
||||
this.trackingConnectorInfos = trackingConnectorInfos;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -78,7 +78,7 @@ public class EventBaseJsonSerializer implements JsonSerializer<EventBase> {
|
||||
leaderboardGroups.add(leaderboardGroupBaseSerializer.serialize(lg));
|
||||
}
|
||||
JSONArray trackingConnectorInfos = new JSONArray();
|
||||
for(TrackingConnectorInfo trackingConnectorInfo : event.getTrackingConnectorInfos()) {
|
||||
for (TrackingConnectorInfo trackingConnectorInfo : event.getTrackingConnectorInfos()) {
|
||||
trackingConnectorInfos.add(trackingConnectorInfoSerializer.serialize(trackingConnectorInfo));
|
||||
}
|
||||
result.put(FIELD_TRACKING_CONNECTOR_INFOS, trackingConnectorInfos);
|
||||
@@ -88,12 +88,12 @@ public class EventBaseJsonSerializer implements JsonSerializer<EventBase> {
|
||||
addImageSize(image, imageSizes);
|
||||
}
|
||||
JSONArray jsonImages = new JSONArray();
|
||||
for(ImageDescriptor imageDescriptor: event.getImages()) {
|
||||
for (ImageDescriptor imageDescriptor: event.getImages()) {
|
||||
addImage(imageDescriptor, jsonImages);
|
||||
}
|
||||
result.put(FIELD_IMAGES, jsonImages);
|
||||
JSONArray jsonVideos = new JSONArray();
|
||||
for(VideoDescriptor videoDescriptor: event.getVideos()) {
|
||||
for (VideoDescriptor videoDescriptor: event.getVideos()) {
|
||||
addVideo(videoDescriptor, jsonVideos);
|
||||
}
|
||||
result.put(FIELD_VIDEOS, jsonVideos);
|
||||
@@ -150,7 +150,7 @@ public class EventBaseJsonSerializer implements JsonSerializer<EventBase> {
|
||||
* JSON object to <code>imageSizes</code>
|
||||
*/
|
||||
private void addImageSize(ImageDescriptor image, JSONArray imageSizes) {
|
||||
if(image.getHeightInPx() != null && image.getWidthInPx() != null) {
|
||||
if (image.getHeightInPx() != null && image.getWidthInPx() != null) {
|
||||
JSONObject imageSizeJson = new JSONObject();
|
||||
imageSizes.add(imageSizeJson);
|
||||
imageSizeJson.put(FIELD_IMAGE_URL, image.getURL().toString());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.sap.sailing.server.util;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.junit.Assert;
|
||||
@@ -22,7 +23,6 @@ public class EventUtilTest {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(year, month - 1, date);
|
||||
MillisecondsTimePoint startEnd = new MillisecondsTimePoint(calendar.getTime());
|
||||
return new StrippedEventImpl("Test", startEnd, startEnd, "Anywhere", true, UUID.randomUUID(), null, null);
|
||||
return new StrippedEventImpl("Test", startEnd, startEnd, "Anywhere", true, UUID.randomUUID(), null, Collections.emptySet());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user