Merge branch 'master' of ssh://sapsailing.com/home/trac/git

This commit is contained in:
Generic Wiki User
2020-04-17 10:20:03 +00:00
@@ -1,16 +1,12 @@
package com.sap.sailing.domain.tractracadapter.persistence.impl;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.util.HashMap;
import java.util.Map;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import com.sap.sailing.domain.racelog.RaceLogStore;
@@ -28,7 +24,6 @@ import com.sap.sse.common.impl.MillisecondsDurationImpl;
import com.sap.sse.common.impl.MillisecondsTimePoint;
import com.sap.sse.security.SecurityService;
import com.sap.sse.security.SessionUtils;
import com.sap.sse.util.HttpUrlConnectionHelper;
/**
* Handles mapping TracTrac connectivity parameters from and to a map with {@link String} keys. The
@@ -145,13 +140,7 @@ public class TracTracConnectivityParamsHandler extends AbstractRaceTrackingConne
private void updatePersistentTracTracConfiguration(RaceTrackingConnectivityParametersImpl params)
throws MalformedURLException, IOException, ParseException {
final String EVENT_MANAGER_HOSTNAME_PREFIX = "em.";
final URL paramsJsonUrl = new URL(params.getParamURL().getProtocol(),
params.getParamURL().getHost().startsWith(EVENT_MANAGER_HOSTNAME_PREFIX) ? params.getParamURL().getHost() : EVENT_MANAGER_HOSTNAME_PREFIX+params.getParamURL().getHost(),
"/events/"+params.getTractracRace().getEvent().getId().toString()+"/races/"+params.getTractracRace().getId().toString()+".json");
final URLConnection conn = HttpUrlConnectionHelper.redirectConnection(paramsJsonUrl);
final JSONObject paramsJson = (JSONObject) new JSONParser().parse(new InputStreamReader(conn.getInputStream()));
final String jsonURL = (String) paramsJson.get("eventJSON");
final String jsonURL = params.getTractracRace().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