mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-08 20:12:23 +00:00
Master data import now supports device config import
fixes bug3151
This commit is contained in:
1 parent
dfbffe65d5
commit
874e490dc0
13 files changed
+97
-27
No files matched your search
+9
-1
@@ -23,6 +23,8 @@ import com.sap.sailing.domain.base.Event;
|
||||
import com.sap.sailing.domain.base.Fleet;
|
||||
import com.sap.sailing.domain.base.RaceColumn;
|
||||
import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfiguration;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfigurationMatcher;
|
||||
import com.sap.sailing.domain.common.RaceIdentifier;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.RegattaIdentifier;
|
||||
@@ -62,10 +64,11 @@ public class TopLevelMasterData implements Serializable {
|
||||
private final Set<WindTrackMasterData> windTrackMasterData;
|
||||
private final Map<LeaderboardGroup, Set<Event>> eventForLeaderboardGroup;
|
||||
private final Map<DeviceIdentifier, Set<GPSFix>> raceLogTrackingFixes;
|
||||
private final Map<DeviceConfigurationMatcher, DeviceConfiguration> deviceConfigurations;
|
||||
|
||||
public TopLevelMasterData(final Set<LeaderboardGroup> groupsToExport, final Iterable<Event> allEvents,
|
||||
final Map<String, Regatta> regattaForRaceIdString, final Collection<MediaTrack> allMediaTracks,
|
||||
GPSFixStore gpsFixStore, boolean exportWind) {
|
||||
GPSFixStore gpsFixStore, boolean exportWind, Map<DeviceConfigurationMatcher, DeviceConfiguration> deviceConfigurations) {
|
||||
this.raceIdStringsForRegatta = convertToRaceIdStringsForRegattaMap(regattaForRaceIdString);
|
||||
this.leaderboardGroups = groupsToExport;
|
||||
this.raceLogTrackingFixes = getAllRelevantRaceLogTrackingFixes(gpsFixStore);
|
||||
@@ -74,6 +77,7 @@ public class TopLevelMasterData implements Serializable {
|
||||
} else {
|
||||
this.windTrackMasterData = new HashSet<WindTrackMasterData>();
|
||||
}
|
||||
this.deviceConfigurations = deviceConfigurations;
|
||||
this.eventForLeaderboardGroup = createEventMap(groupsToExport, allEvents);
|
||||
this.filteredMediaTracks = new HashSet<MediaTrack>();
|
||||
filterMediaTracks(allMediaTracks, this.filteredMediaTracks);
|
||||
@@ -344,4 +348,8 @@ public class TopLevelMasterData implements Serializable {
|
||||
public Map<DeviceIdentifier, Set<GPSFix>> getRaceLogTrackingFixes() {
|
||||
return raceLogTrackingFixes;
|
||||
}
|
||||
|
||||
public Map<DeviceConfigurationMatcher, DeviceConfiguration> getDeviceConfigurations() {
|
||||
return deviceConfigurations;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -407,7 +407,7 @@ public interface SailingService extends RemoteService, FileStorageManagementGwtS
|
||||
|
||||
List<String> getLeaderboardGroupNamesFromRemoteServer(String host);
|
||||
|
||||
UUID importMasterData(String host, String[] groupNames, boolean override, boolean compress, boolean exportWind);
|
||||
UUID importMasterData(String host, String[] groupNames, boolean override, boolean compress, boolean exportWind, boolean exportDeviceConfigurations);
|
||||
|
||||
DataImportProgress getImportOperationProgress(UUID id);
|
||||
|
||||
|
||||
+1
-1
@@ -518,7 +518,7 @@ public interface SailingServiceAsync extends BuildVersionRetriever, FileStorageM
|
||||
void getRegattaLog(String leaderboardName, AsyncCallback<RegattaLogDTO> callback);
|
||||
|
||||
void importMasterData(String host, String[] names, boolean override, boolean compress, boolean exportWind,
|
||||
AsyncCallback<UUID> asyncCallback);
|
||||
boolean exportDeviceConfigurations, AsyncCallback<UUID> asyncCallback);
|
||||
|
||||
void getImportOperationProgress(UUID id, AsyncCallback<DataImportProgress> asyncCallback);
|
||||
|
||||
|
||||
+2
@@ -1050,6 +1050,8 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages, c
|
||||
String ratio();
|
||||
String importWind();
|
||||
String importWindTooltip();
|
||||
String importDeviceConfigurations();
|
||||
String importDeviceConfigurationsTooltip();
|
||||
String authorName();
|
||||
String authorPriority();
|
||||
String removeDenotation();
|
||||
|
||||
+3
-1
@@ -1018,6 +1018,8 @@ showAddedScores=Show added scores for each entry in leaderboard
|
||||
ratio=ratio
|
||||
importWind=Import Wind
|
||||
importWindTooltip=Unchecking this option will drastically lower the amount of data transfered.
|
||||
importDeviceConfigurations=Import Device Configurations
|
||||
importDeviceConfigurationsTooltip=Checking this will import ALL device configurations on the remote server.
|
||||
authorName=Author name
|
||||
authorPriority=Author priority
|
||||
removeDenotation=Remove Denotation
|
||||
@@ -1319,4 +1321,4 @@ degreesToWind={0}° to wind
|
||||
miniLeeaderboardLegendText=Shows the points along with the number of races per competitor
|
||||
currentOfTotal={0,number}/{1,number}
|
||||
noFinishedRaces=There are no finished races yet
|
||||
racesOverview=Races overview
|
||||
racesOverview=Races overview
|
||||
+3
-1
@@ -1014,6 +1014,8 @@ showAddedScores=Addierte Punkte für jeden Eintrag im Leaderboard anzeigen
|
||||
ratio=Verhältnis
|
||||
importWind=Wind importieren
|
||||
importWindTooltip=Diese Option zu deselektieren führt zu einer wesentlich kleineren übertragenen Datenmenge.
|
||||
importDeviceConfigurations=Device Configurations importieren
|
||||
importDeviceConfigurationsTooltip=ALLE device configurations werden importiert.
|
||||
authorName=Benutzername
|
||||
authorPriority=Benutzer-Priorität
|
||||
removeDenotation=Markierung entfernen
|
||||
@@ -1309,4 +1311,4 @@ degreesToWind={0}° zum Wind
|
||||
miniLeeaderboardLegendText=Es werden die Punkte und die Anzahl Rennen je Team angezeigt
|
||||
currentOfTotal={0,number}/{1,number}
|
||||
noFinishedRaces=Es wurden noch keine Wettfahrten beendet.
|
||||
racesOverview=Wettfahrtübersicht
|
||||
racesOverview=Wettfahrtübersicht
|
||||
+3
-1
@@ -974,6 +974,8 @@ showAddedScores=Показать добавленные очки для кажд
|
||||
ratio=коэффициент
|
||||
importWind=Имопрт данных о ветре
|
||||
importWindTooltip=Снятие флажка с этой опции значительно снизит объем передаваемых данных.
|
||||
importDeviceConfigurations=Конфигурации Импорт устройств
|
||||
importDeviceConfigurationsTooltip=Все конфигурации устройства ввозятся.
|
||||
authorName=Имя автора
|
||||
authorPriority=Приоритет автора
|
||||
removeDenotation=Remove Denotation
|
||||
@@ -1256,4 +1258,4 @@ degreesToWind={0}° to wind
|
||||
miniLeeaderboardLegendText=Shows points along with the number of races per competitor
|
||||
currentOfTotal={0,number}/{1,number}
|
||||
noFinishedRaces=There are no finished races yet
|
||||
racesOverview=Races overview
|
||||
racesOverview=Races overview
|
||||
+8
-1
@@ -55,6 +55,7 @@ public class MasterDataImportPanel extends VerticalPanel {
|
||||
private final LeaderboardGroupsRefresher leaderboardGroupsRefresher;
|
||||
private CheckBox compressSwitch;
|
||||
private CheckBox exportWindSwitch;
|
||||
private CheckBox exportDeviceConfigsSwitch;
|
||||
private TextBox filterBox;
|
||||
|
||||
public MasterDataImportPanel(StringMessages stringMessages, SailingServiceAsync sailingService,
|
||||
@@ -131,8 +132,9 @@ public class MasterDataImportPanel extends VerticalPanel {
|
||||
boolean override = overrideSwitch.getValue();
|
||||
boolean compress = compressSwitch.getValue();
|
||||
boolean exportWind = exportWindSwitch.getValue();
|
||||
boolean exportDeviceConfigs = exportDeviceConfigsSwitch.getValue();
|
||||
sailingService.importMasterData(currentHost, groupNames, override, compress, exportWind,
|
||||
new AsyncCallback<UUID>() {
|
||||
exportDeviceConfigs, new AsyncCallback<UUID>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
@@ -341,6 +343,11 @@ public class MasterDataImportPanel extends VerticalPanel {
|
||||
exportWindSwitch.setTitle(stringMessages.importWindTooltip());
|
||||
exportWindSwitch.setValue(true);
|
||||
contentPanel.add(exportWindSwitch);
|
||||
|
||||
exportDeviceConfigsSwitch = new CheckBox(stringMessages.importDeviceConfigurations());
|
||||
exportDeviceConfigsSwitch.setTitle(stringMessages.importDeviceConfigurationsTooltip());
|
||||
exportDeviceConfigsSwitch.setValue(false);
|
||||
contentPanel.add(exportDeviceConfigsSwitch);
|
||||
|
||||
importLeaderboardGroupsButton = new Button(stringMessages.importSelectedLeaderboardGroups());
|
||||
importLeaderboardGroupsButton.setEnabled(false);
|
||||
|
||||
+5
-4
@@ -4395,7 +4395,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
|
||||
@Override
|
||||
public UUID importMasterData(final String urlAsString, final String[] groupNames, final boolean override,
|
||||
final boolean compress, final boolean exportWind) {
|
||||
final boolean compress, final boolean exportWind, final boolean exportDeviceConfigurations) {
|
||||
final UUID importOperationId = UUID.randomUUID();
|
||||
getService().createOrUpdateDataImportProgressWithReplication(importOperationId, 0.0, "Initializing", 0.0);
|
||||
// Create a progress indicator for as long as the server gets data from the other server.
|
||||
@@ -4412,7 +4412,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
int port = hostnameAndPort.getB();
|
||||
String query;
|
||||
try {
|
||||
query = createLeaderboardQuery(groupNames, compress, exportWind);
|
||||
query = createLeaderboardQuery(groupNames, compress, exportWind, exportDeviceConfigurations);
|
||||
} catch (UnsupportedEncodingException e1) {
|
||||
throw new RuntimeException(e1);
|
||||
}
|
||||
@@ -4502,14 +4502,15 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
return 0;
|
||||
}
|
||||
|
||||
private String createLeaderboardQuery(String[] groupNames, boolean compress, boolean exportWind)
|
||||
private String createLeaderboardQuery(String[] groupNames, boolean compress, boolean exportWind, boolean exportDeviceConfigurations)
|
||||
throws UnsupportedEncodingException {
|
||||
StringBuffer queryStringBuffer = new StringBuffer("");
|
||||
for (int i = 0; i < groupNames.length; i++) {
|
||||
String encodedGroupName = URLEncoder.encode(groupNames[i], "UTF-8");
|
||||
queryStringBuffer.append("names[]=" + encodedGroupName + "&");
|
||||
}
|
||||
queryStringBuffer.append(String.format("compress=%s&exportWind=%s", compress, exportWind));
|
||||
queryStringBuffer.append(String.format("compress=%s&exportWind=%s&exportDeviceConfigs=%s", compress,
|
||||
exportWind, exportDeviceConfigurations));
|
||||
return queryStringBuffer.toString();
|
||||
}
|
||||
|
||||
|
||||
+19
-2
@@ -7,6 +7,7 @@ import java.io.OutputStream;
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -24,6 +25,8 @@ import javax.ws.rs.core.Response.ResponseBuilder;
|
||||
import javax.ws.rs.core.StreamingOutput;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfiguration;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfigurationMatcher;
|
||||
import com.sap.sailing.domain.leaderboard.Leaderboard;
|
||||
import com.sap.sailing.domain.leaderboard.LeaderboardGroup;
|
||||
import com.sap.sailing.domain.masterdataimport.TopLevelMasterData;
|
||||
@@ -37,7 +40,7 @@ public class MasterDataResource extends AbstractSailingServerResource {
|
||||
@GET
|
||||
@Produces("application/x-java-serialized-object")
|
||||
public Response getMasterDataByLeaderboardGroups(@QueryParam("names[]") List<String> leaderboardGroupNames,
|
||||
@QueryParam("compress") Boolean compress, @QueryParam("exportWind") Boolean exportWind)
|
||||
@QueryParam("compress") Boolean compress, @QueryParam("exportWind") Boolean exportWind, @QueryParam("exportDeviceConfigs") Boolean exportDeviceConfigs)
|
||||
throws UnsupportedEncodingException {
|
||||
final long startTime = System.currentTimeMillis();
|
||||
logger.info("Masterdataexport has started");
|
||||
@@ -47,6 +50,9 @@ public class MasterDataResource extends AbstractSailingServerResource {
|
||||
if (exportWind == null) {
|
||||
exportWind = true;
|
||||
}
|
||||
if (exportDeviceConfigs == null) {
|
||||
exportDeviceConfigs = false;
|
||||
}
|
||||
logger.info(String.format("Masterdataexport gzip compression is turned %s", compress ? "on" : "off"));
|
||||
Map<String, LeaderboardGroup> allLeaderboardGroups = getService().getLeaderboardGroups();
|
||||
|
||||
@@ -73,9 +79,15 @@ public class MasterDataResource extends AbstractSailingServerResource {
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<DeviceConfigurationMatcher, DeviceConfiguration> deviceConfigurations;
|
||||
if (exportDeviceConfigs) {
|
||||
deviceConfigurations = getAllDeviceConfigs();
|
||||
} else {
|
||||
deviceConfigurations = new HashMap<>();
|
||||
}
|
||||
final TopLevelMasterData masterData = new TopLevelMasterData(groupsToExport,
|
||||
getService().getAllEvents(), getService().getPersistentRegattasForRaceIDs(), getService()
|
||||
.getAllMediaTracks(), getService().getGPSFixStore(), exportWind);
|
||||
.getAllMediaTracks(), getService().getGPSFixStore(), exportWind, deviceConfigurations);
|
||||
final StreamingOutput streamingOutput;
|
||||
if (compress) {
|
||||
streamingOutput= new CompressingStreamingOutput(masterData, competitorIds, startTime);
|
||||
@@ -92,6 +104,11 @@ public class MasterDataResource extends AbstractSailingServerResource {
|
||||
return builtResponse;
|
||||
}
|
||||
|
||||
private Map<DeviceConfigurationMatcher, DeviceConfiguration> getAllDeviceConfigs() {
|
||||
Map<DeviceConfigurationMatcher, DeviceConfiguration> configs = getService().getAllDeviceConfigurations();
|
||||
return configs;
|
||||
}
|
||||
|
||||
private abstract class AbstractStreamingOutput implements StreamingOutput {
|
||||
private final TopLevelMasterData masterData;
|
||||
private final List<Serializable> competitorIds;
|
||||
|
||||
+2
-1
@@ -7,6 +7,7 @@ import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -164,7 +165,7 @@ public class MediaMasterDataExportTest {
|
||||
Map<String, Regatta> regattaForRaceIdString = Collections.emptyMap();
|
||||
GPSFixStore gpsFixStore = mock(GPSFixStore.class);
|
||||
boolean exportWind = false;
|
||||
TopLevelMasterData topLevelMasterData = new TopLevelMasterData(groupsToExport , allEvents , regattaForRaceIdString, allMediaTracks , gpsFixStore , exportWind);
|
||||
TopLevelMasterData topLevelMasterData = new TopLevelMasterData(groupsToExport , allEvents , regattaForRaceIdString, allMediaTracks , gpsFixStore , exportWind, new HashMap<>());
|
||||
return topLevelMasterData;
|
||||
}
|
||||
|
||||
|
||||
+13
-13
@@ -307,7 +307,7 @@ public class MasterDataImportTest {
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
@@ -514,7 +514,7 @@ public class MasterDataImportTest {
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
@@ -657,7 +657,7 @@ public class MasterDataImportTest {
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
@@ -835,7 +835,7 @@ public class MasterDataImportTest {
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
@@ -997,7 +997,7 @@ public class MasterDataImportTest {
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
@@ -1196,7 +1196,7 @@ public class MasterDataImportTest {
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
@@ -1356,7 +1356,7 @@ public class MasterDataImportTest {
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
@@ -1487,7 +1487,7 @@ public class MasterDataImportTest {
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
@@ -1623,7 +1623,7 @@ public class MasterDataImportTest {
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
@@ -1720,7 +1720,7 @@ public class MasterDataImportTest {
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
@@ -1843,7 +1843,7 @@ public class MasterDataImportTest {
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
@@ -1914,7 +1914,7 @@ public class MasterDataImportTest {
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
@@ -2103,7 +2103,7 @@ public class MasterDataImportTest {
|
||||
DomainFactory domainFactory;
|
||||
MasterDataResource resource = new MasterDataResource();
|
||||
MasterDataResource spyResource = spyResource(resource, sourceService);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true);
|
||||
Response response = spyResource.getMasterDataByLeaderboardGroups(groupNamesToExport, false, true, false);
|
||||
StreamingOutput streamingOutput = (StreamingOutput) response.getEntity();
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
|
||||
+28
@@ -22,6 +22,8 @@ import com.sap.sailing.domain.base.Fleet;
|
||||
import com.sap.sailing.domain.base.RaceColumn;
|
||||
import com.sap.sailing.domain.base.RaceDefinition;
|
||||
import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfiguration;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfigurationMatcher;
|
||||
import com.sap.sailing.domain.base.impl.RegattaImpl;
|
||||
import com.sap.sailing.domain.common.DataImportProgress;
|
||||
import com.sap.sailing.domain.common.RaceIdentifier;
|
||||
@@ -119,6 +121,7 @@ public class ImportMasterDataOperation extends
|
||||
progress.setCurrentSubProgressPct(0);
|
||||
createWindTracks(toState);
|
||||
importRaceLogTrackingGPSFixes(toState);
|
||||
importDeviceConfigurations(toState);
|
||||
dataImportLock.getProgress(importOperationId).setResult(creationCount);
|
||||
return creationCount;
|
||||
} catch (Exception e) {
|
||||
@@ -129,6 +132,31 @@ public class ImportMasterDataOperation extends
|
||||
}
|
||||
}
|
||||
|
||||
private void importDeviceConfigurations(RacingEventService toState) {
|
||||
Map<DeviceConfigurationMatcher, DeviceConfiguration> existingConfigs = toState.getAllDeviceConfigurations();
|
||||
Set<DeviceConfigurationMatcher> existingKeys = existingConfigs.keySet();
|
||||
Map<DeviceConfigurationMatcher, DeviceConfiguration> newConfigs = masterData.getDeviceConfigurations();
|
||||
for(Entry<DeviceConfigurationMatcher, DeviceConfiguration> entry : newConfigs.entrySet()) {
|
||||
DeviceConfigurationMatcher key = entry.getKey();
|
||||
DeviceConfiguration value = entry.getValue();
|
||||
if (existingKeys.contains(key)) {
|
||||
if (override) {
|
||||
logger.info(String.format(
|
||||
"Device configuration [%s] already exists. Overwrite because override flag is set.",
|
||||
key.getMatcherIdentifier()));
|
||||
toState.removeDeviceConfiguration(key);
|
||||
toState.createOrUpdateDeviceConfiguration(key, value);
|
||||
} else {
|
||||
logger.info(String
|
||||
.format("Device configuration [%s] already exists. Not overwriting because override flag is not set.",
|
||||
key.getMatcherIdentifier()));
|
||||
}
|
||||
} else {
|
||||
toState.createOrUpdateDeviceConfiguration(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that all links from <code>eventReceived</code> to its leaderboard groups are established also on the
|
||||
* local event after import as long as those leaderboard groups are part of the actual import. For this subset of
|
||||
|
||||
Reference in new issue
Block a user