mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-20 12:45:35 +00:00
- Made some core result import class more robust againt inconsistent data
- Updated the yachtscoring URL'S to the lastest changes - removed some unused test files
This commit is contained in:
+1
-1
@@ -133,6 +133,6 @@ public class ScoreCorrectionProviderImpl implements ScoreCorrectionProvider, Res
|
||||
|
||||
@Override
|
||||
public String getOptionalSampleURL() {
|
||||
return "http://www.yachtscoring.com/xrr/1220_ys_xrr.xml";
|
||||
return "http://www.yachtscoring.com/results_xrr_auto.cfm?eid=1220";
|
||||
}
|
||||
}
|
||||
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
package com.sap.sailing.yachtscoring.resultimport;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
|
||||
import com.sap.sailing.domain.common.CompetitorGenderType;
|
||||
import com.sap.sailing.resultimport.ResultDocumentDescriptor;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public class UrlResultDocumentDescriptorImpl implements ResultDocumentDescriptor {
|
||||
private URL documentURL;
|
||||
private String documentName;
|
||||
private TimePoint lastModified;
|
||||
private String eventName;
|
||||
private String regattaName;
|
||||
private String boatClass;
|
||||
private CompetitorGenderType competitorGenderType;
|
||||
|
||||
public UrlResultDocumentDescriptorImpl(URL documentURL, String documentName, TimePoint lastModified) {
|
||||
this(documentURL, documentName, lastModified, null, null, null, null);
|
||||
}
|
||||
|
||||
public UrlResultDocumentDescriptorImpl(URL documentURL, String documentName, TimePoint lastModified,
|
||||
String eventName) {
|
||||
this(documentURL, documentName, lastModified, eventName, null, null, null);
|
||||
}
|
||||
|
||||
public UrlResultDocumentDescriptorImpl(URL documentURL, String documentName, TimePoint lastModified,
|
||||
String eventName, String regattaName) {
|
||||
this(documentURL, documentName, lastModified, eventName, regattaName, null, null);
|
||||
}
|
||||
|
||||
public UrlResultDocumentDescriptorImpl(URL documentURL, String documentName, TimePoint lastModified,
|
||||
String eventName, String regattaName, String boatClass) {
|
||||
this(documentURL, documentName, lastModified, eventName, regattaName, boatClass, null);
|
||||
}
|
||||
|
||||
public UrlResultDocumentDescriptorImpl(URL documentURL, String documentName, TimePoint lastModified,
|
||||
String eventName, String regattaName, String boatClass, CompetitorGenderType competitorGenderType) {
|
||||
this.lastModified = lastModified;
|
||||
this.documentName = documentName;
|
||||
this.documentURL = documentURL;
|
||||
this.eventName = eventName;
|
||||
this.regattaName = regattaName;
|
||||
this.boatClass = boatClass;
|
||||
this.competitorGenderType = competitorGenderType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventName() {
|
||||
return eventName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRegattaName() {
|
||||
return regattaName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBoatClass() {
|
||||
return boatClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimePoint getLastModified() {
|
||||
return lastModified;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream() {
|
||||
try {
|
||||
URLConnection eventResultConn = documentURL.openConnection();
|
||||
InputStream inputStream = (InputStream) eventResultConn.getContent();
|
||||
return inputStream;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDocumentName() {
|
||||
return documentName;
|
||||
}
|
||||
|
||||
public CompetitorGenderType getCompetitorGenderType() {
|
||||
return competitorGenderType;
|
||||
}
|
||||
}
|
||||
+2
-8
@@ -1,16 +1,13 @@
|
||||
package com.sap.sailing.yachtscoring.resultimport;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.resultimport.ResultDocumentDescriptor;
|
||||
import com.sap.sailing.resultimport.ResultUrlProvider;
|
||||
import com.sap.sailing.resultimport.impl.ResultDocumentDescriptorImpl;
|
||||
import com.sap.sailing.xrr.resultimport.ParserFactory;
|
||||
import com.sap.sailing.xrr.resultimport.impl.UrlBasedXRRResultDocumentProvider;
|
||||
import com.sap.sailing.xrr.resultimport.impl.XRRParserUtil;
|
||||
@@ -44,12 +41,9 @@ public class YachtscoringResultDocumentProvider extends UrlBasedXRRResultDocumen
|
||||
String regattaName = division.getTitle();
|
||||
String boatClass = division.getTitle();
|
||||
try {
|
||||
String requestUrl = url.toString() + "?Class=" + URLEncoder.encode(boatClass, "UTF-8");
|
||||
String requestUrl = url.toString() + "&Class=" + URLEncoder.encode(boatClass, "UTF-8");
|
||||
URL urlByClass = new URL(requestUrl);
|
||||
URLConnection eventResultConn = urlByClass.openConnection();
|
||||
InputStream is = (InputStream) eventResultConn.getContent();
|
||||
|
||||
result.add(new ResultDocumentDescriptorImpl(is, requestUrl, xrrDocumentDateAndTime,
|
||||
result.add(new UrlResultDocumentDescriptorImpl(urlByClass, requestUrl, xrrDocumentDateAndTime,
|
||||
eventName, regattaName, boatClass));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
Reference in New Issue
Block a user