bug5609: using storedURI for non-replay/non-prefer-replay params

This commit is contained in:
Axel Uhl committed 2021-08-04 08:02:38 +09:00
1 parent 7e5221ccf6
commit 9dc1a5cf78
2 files changed
+9 -4

No files matched your search

@@ -26,6 +26,7 @@ import com.sap.sse.common.impl.MillisecondsTimePoint;
import com.sap.sse.security.SecurityService;
import com.sap.sse.security.SessionUtils;
import com.tractrac.model.lib.api.event.CreateModelException;
import com.tractrac.model.lib.api.event.IRace;
import com.tractrac.util.lib.api.exceptions.TimeOutException;
/**
@@ -143,10 +144,14 @@ public class TracTracConnectivityParamsHandler extends AbstractRaceTrackingConne
private void updatePersistentTracTracConfiguration(RaceTrackingConnectivityParametersImpl params)
throws MalformedURLException, IOException, ParseException, CreateModelException, URISyntaxException, TimeOutException {
final String jsonURL = params.getTractracRace().getParameterSet().getParameter("eventJSON");
final IRace tractracRace = params.getTractracRace();
final String jsonURL = tractracRace.getParameterSet().getParameter("eventJSON");
final String creatorName = SessionUtils.getPrincipal().toString();
final TracTracConfigurationImpl tracTracConfiguration = new TracTracConfigurationImpl(creatorName, params.getTractracRace().getEvent().getName(), jsonURL,
/* live URI */ null, /* stored URI */ null, // we mainly want to enable the user to list the event's races again in case they are removed; live/stored stuff comes from the tracking params
final TracTracConfigurationImpl tracTracConfiguration = new TracTracConfigurationImpl(creatorName, tractracRace.getEvent().getName(), jsonURL,
(params.getLiveURI() == null ? null : params.getLiveURI().toString()),
/* stored URI */ params.isPreferReplayIfAvailable() && params.isReplayRace(tractracRace)
? null // we mainly want to enable the user to list the event's races again in case they are removed;
: (params.getStoredURI() == null ? null : params.getStoredURI().toString()), // live/stored stuff comes from the tracking params
params.getCourseDesignUpdateURI()==null?null:params.getCourseDesignUpdateURI().toString(), params.getTracTracUsername(), params.getTracTracPassword());
tractracMongoObjectFactory.updateTracTracConfiguration(tracTracConfiguration);
securityService.setDefaultOwnershipIfNotSet(tracTracConfiguration.getIdentifier());
@@ -105,7 +105,7 @@ public class RaceTrackingConnectivityParametersImpl extends AbstractRaceTracking
this.preferReplayIfAvailable = preferReplayIfAvailable;
}
private boolean isReplayRace(IRace tractracRace) {
public boolean isReplayRace(IRace tractracRace) {
return tractracRace.getStoredURI() != null && tractracRace.getStoredURI().toString().toLowerCase().endsWith(".mtb");
}