mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-15 06:49:56 +00:00
removed bundle com.sap.sailing.yachtscoring -> not needed
This commit is contained in:
1 parent
e1ce91aedd
commit
72daf65d7c
13 files changed
-520
No files matched your search
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -1,3 +0,0 @@
|
||||
bin/
|
||||
/bin/
|
||||
/bin/
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.sap.sailing.yachtscoring</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -1,12 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
@@ -1,3 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
pluginProject.extensions=false
|
||||
resolve.requirebundle=false
|
||||
@@ -1,13 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Yachtscoring
|
||||
Bundle-SymbolicName: com.sap.sailing.yachtscoring
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: SAP
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Require-Bundle: org.json.simple;bundle-version="1.1.0",
|
||||
com.sap.sailing.domain.common,
|
||||
com.sap.sailing.domain,
|
||||
com.sap.sse
|
||||
Export-Package: com.sap.sailing.yachtscoring
|
||||
@@ -1,4 +0,0 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>root</artifactId>
|
||||
<groupId>com.sap.sailing</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>com.sap.sailing.yachtscoring</artifactId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
-81
@@ -1,81 +0,0 @@
|
||||
package com.sap.sailing.yachtscoring;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Reads the list of regattas for an event with a given yachtscoring event id
|
||||
* @author Frank
|
||||
*
|
||||
*/
|
||||
public class EventResultDescriptor {
|
||||
private List<RegattaResultDescriptor> regattaResults;
|
||||
private String id;
|
||||
private String isafId;
|
||||
private String name;
|
||||
private URL xrrUrl;
|
||||
|
||||
private String trackingDataHost;
|
||||
private Integer trackingDataPort;
|
||||
|
||||
public EventResultDescriptor() {
|
||||
regattaResults = new ArrayList<RegattaResultDescriptor>();
|
||||
}
|
||||
|
||||
public List<RegattaResultDescriptor> getRegattaResults() {
|
||||
return regattaResults;
|
||||
}
|
||||
|
||||
public void setRegattaResults(List<RegattaResultDescriptor> regattaResults) {
|
||||
this.regattaResults = regattaResults;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public URL getXrrUrl() {
|
||||
return xrrUrl;
|
||||
}
|
||||
|
||||
public void setXrrUrl(URL xrrUrl) {
|
||||
this.xrrUrl = xrrUrl;
|
||||
}
|
||||
|
||||
public String getIsafId() {
|
||||
return isafId;
|
||||
}
|
||||
|
||||
public void setIsafId(String isafId) {
|
||||
this.isafId = isafId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getTrackingDataHost() {
|
||||
return trackingDataHost;
|
||||
}
|
||||
|
||||
public void setTrackingDataHost(String trackingDataHost) {
|
||||
this.trackingDataHost = trackingDataHost;
|
||||
}
|
||||
|
||||
public Integer getTrackingDataPort() {
|
||||
return trackingDataPort;
|
||||
}
|
||||
|
||||
public void setTrackingDataPort(Integer trackingDataPort) {
|
||||
this.trackingDataPort = trackingDataPort;
|
||||
}
|
||||
}
|
||||
-80
@@ -1,80 +0,0 @@
|
||||
package com.sap.sailing.yachtscoring;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class RaceResultDescriptor {
|
||||
private String id;
|
||||
private String name;
|
||||
private Integer raceColumnNumber;
|
||||
private String seriesName;
|
||||
private String fleetName;
|
||||
private Boolean isTracked;
|
||||
private Date startTime;
|
||||
|
||||
/** Possible states: Scheduled, StartSequence, Racing, Finished, GeneralRecall, Postponed, Abandoned */
|
||||
private String status;
|
||||
|
||||
public Integer getRaceColumnNumber() {
|
||||
return raceColumnNumber;
|
||||
}
|
||||
|
||||
public void setRaceColumnNumber(Integer raceColumnNumber) {
|
||||
this.raceColumnNumber = raceColumnNumber;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getSeriesName() {
|
||||
return seriesName;
|
||||
}
|
||||
|
||||
public void setSeriesName(String seriesName) {
|
||||
this.seriesName = seriesName;
|
||||
}
|
||||
|
||||
public String getFleetName() {
|
||||
return fleetName;
|
||||
}
|
||||
|
||||
public void setFleetName(String fleetName) {
|
||||
this.fleetName = fleetName;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Boolean isTracked() {
|
||||
return isTracked;
|
||||
}
|
||||
|
||||
public void setTracked(Boolean isTracked) {
|
||||
this.isTracked = isTracked;
|
||||
}
|
||||
|
||||
public Date getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(Date startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
}
|
||||
-118
@@ -1,118 +0,0 @@
|
||||
package com.sap.sailing.yachtscoring;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.common.CompetitorGenderType;
|
||||
|
||||
public class RegattaResultDescriptor {
|
||||
private String id;
|
||||
private String isafId;
|
||||
private String externalId;
|
||||
private String name;
|
||||
private String className;
|
||||
private CompetitorGenderType competitorGenderType;
|
||||
private URL pdfUrl;
|
||||
private URL xrrPreliminaryUrl;
|
||||
private URL xrrFinalUrl;
|
||||
private URL xrrEntriesUrl;
|
||||
private URL htmlUrl;
|
||||
private Date publishedAt;
|
||||
private Boolean isFinal;
|
||||
private List<RaceResultDescriptor> raceResults;
|
||||
|
||||
public RegattaResultDescriptor() {
|
||||
raceResults = new ArrayList<RaceResultDescriptor>();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getIsafId() {
|
||||
return isafId;
|
||||
}
|
||||
public void setIsafId(String isafId) {
|
||||
this.isafId = isafId;
|
||||
}
|
||||
public String getExternalId() {
|
||||
return externalId;
|
||||
}
|
||||
public void setExternalId(String externalId) {
|
||||
this.externalId = externalId;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
public void setClassName(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
public URL getPdfUrl() {
|
||||
return pdfUrl;
|
||||
}
|
||||
public void setPdfUrl(URL pdfUrl) {
|
||||
this.pdfUrl = pdfUrl;
|
||||
}
|
||||
public URL getXrrPreliminaryUrl() {
|
||||
return xrrPreliminaryUrl;
|
||||
}
|
||||
public void setXrrPreliminaryUrl(URL xrrPreliminaryUrl) {
|
||||
this.xrrPreliminaryUrl = xrrPreliminaryUrl;
|
||||
}
|
||||
public URL getXrrFinalUrl() {
|
||||
return xrrFinalUrl;
|
||||
}
|
||||
public void setXrrFinalUrl(URL xrrFinalUrl) {
|
||||
this.xrrFinalUrl = xrrFinalUrl;
|
||||
}
|
||||
public URL getHtmlUrl() {
|
||||
return htmlUrl;
|
||||
}
|
||||
public void setHtmlUrl(URL htmlUrl) {
|
||||
this.htmlUrl = htmlUrl;
|
||||
}
|
||||
public Date getPublishedAt() {
|
||||
return publishedAt;
|
||||
}
|
||||
public void setPublishedAt(Date publishedAt) {
|
||||
this.publishedAt = publishedAt;
|
||||
}
|
||||
public Boolean getIsFinal() {
|
||||
return isFinal;
|
||||
}
|
||||
public void setIsFinal(Boolean isFinal) {
|
||||
this.isFinal = isFinal;
|
||||
}
|
||||
public CompetitorGenderType getCompetitorGenderType() {
|
||||
return competitorGenderType;
|
||||
}
|
||||
public void setCompetitorGenderType(CompetitorGenderType competitorGenderType) {
|
||||
this.competitorGenderType = competitorGenderType;
|
||||
}
|
||||
|
||||
public List<RaceResultDescriptor> getRaceResults() {
|
||||
return raceResults;
|
||||
}
|
||||
|
||||
public void setRaceResults(List<RaceResultDescriptor> raceResults) {
|
||||
this.raceResults = raceResults;
|
||||
}
|
||||
|
||||
public URL getXrrEntriesUrl() {
|
||||
return xrrEntriesUrl;
|
||||
}
|
||||
|
||||
public void setXrrEntriesUrl(URL xrrEntriesUrl) {
|
||||
this.xrrEntriesUrl = xrrEntriesUrl;
|
||||
}
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package com.sap.sailing.yachtscoring;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
public interface YachtscoringEventResultsParser {
|
||||
public EventResultDescriptor getEventResult(InputStream is) throws IOException;
|
||||
}
|
||||
-151
@@ -1,151 +0,0 @@
|
||||
package com.sap.sailing.yachtscoring;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import com.sap.sailing.domain.common.CompetitorGenderType;
|
||||
import com.sap.sse.InvalidDateException;
|
||||
import com.sap.sse.util.DateParser;
|
||||
|
||||
/**
|
||||
* URLs should be of the form
|
||||
* <pre>
|
||||
* http://www.yachtscoring.com/results_xrr.cfm?Spec_Race=6&eid=1390
|
||||
* </pre>
|
||||
* where eid the event ID. Events can be discovered by the yachtscoring.com website.
|
||||
*
|
||||
* @author Frank Mittag (C5163874)
|
||||
*
|
||||
*/
|
||||
public class YachtscoringEventResultsParserImpl implements YachtscoringEventResultsParser {
|
||||
|
||||
/**
|
||||
* @param is closed before the method returns, also in case of exception
|
||||
* @throws IOException
|
||||
*/
|
||||
public EventResultDescriptor getEventResult(InputStream is) throws IOException {
|
||||
EventResultDescriptor result = null;
|
||||
try {
|
||||
JSONObject jsonRoot = (JSONObject) new JSONParser().parse(new InputStreamReader(is, "UTF-8"));
|
||||
result = new EventResultDescriptor();
|
||||
result.setId((String) jsonRoot.get("Id"));
|
||||
result.setIsafId((String) jsonRoot.get("IsafId"));
|
||||
result.setName((String) jsonRoot.get("Name"));
|
||||
result.setXrrUrl(parseURL(jsonRoot, "XrrUrl"));
|
||||
JSONObject jsonTracking = (JSONObject) jsonRoot.get("Tracking");
|
||||
if (jsonTracking != null) {
|
||||
result.setTrackingDataHost((String) jsonTracking.get("Host"));
|
||||
result.setTrackingDataPort(parseInteger(jsonTracking, "Port"));
|
||||
}
|
||||
|
||||
JSONArray jsonRegattas = (JSONArray) jsonRoot.get("Regattas");
|
||||
for (Object regattaObject: jsonRegattas) {
|
||||
RegattaResultDescriptor regattaResult = new RegattaResultDescriptor();
|
||||
JSONObject jsonRegatta = (JSONObject) regattaObject;
|
||||
regattaResult.setId((String) jsonRegatta.get("Id"));
|
||||
regattaResult.setIsafId((String) jsonRegatta.get("IsafId"));
|
||||
regattaResult.setExternalId((String) jsonRegatta.get("ExternalId"));
|
||||
regattaResult.setName((String) jsonRegatta.get("Name"));
|
||||
regattaResult.setCompetitorGenderType(parseCompetitorGenderType(jsonRegatta, "Gender"));
|
||||
regattaResult.setClassName((String) jsonRegatta.get("ClassName"));
|
||||
regattaResult.setPdfUrl(parseURL(jsonRegatta, "PdfUrl"));
|
||||
regattaResult.setXrrPreliminaryUrl(parseURL(jsonRegatta, "XrrPreliminaryUrl"));
|
||||
regattaResult.setXrrFinalUrl(parseURL(jsonRegatta, "XrrFinalUrl"));
|
||||
regattaResult.setXrrEntriesUrl(parseURL(jsonRegatta, "XrrEntriesUrl"));
|
||||
regattaResult.setHtmlUrl(parseURL(jsonRegatta, "HtmlUrl"));
|
||||
regattaResult.setPublishedAt(parseDate(jsonRegatta, "Published"));
|
||||
regattaResult.setIsFinal((Boolean) jsonRegatta.get("Final"));
|
||||
|
||||
JSONArray jsonRaces = (JSONArray) jsonRegatta.get("Races");
|
||||
if(jsonRaces != null) {
|
||||
for (Object raceObject: jsonRaces) {
|
||||
RaceResultDescriptor raceResult = new RaceResultDescriptor();
|
||||
JSONObject jsonRace = (JSONObject) raceObject;
|
||||
raceResult.setId((String) jsonRace.get("Id"));
|
||||
raceResult.setName((String) jsonRace.get("Name"));
|
||||
raceResult.setRaceColumnNumber(parseInteger(jsonRace, "RaceIndex"));
|
||||
raceResult.setStatus((String) jsonRace.get("Status"));
|
||||
raceResult.setSeriesName((String) jsonRace.get("Series"));
|
||||
raceResult.setFleetName((String) jsonRace.get("Fleet"));
|
||||
raceResult.setTracked((Boolean) jsonRace.get("IsTracked"));
|
||||
raceResult.setStartTime(parseDate(jsonRace, "StartTime"));
|
||||
regattaResult.getRaceResults().add(raceResult);
|
||||
}
|
||||
}
|
||||
result.getRegattaResults().add(regattaResult);
|
||||
}
|
||||
is.close();
|
||||
} catch(ParseException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
is.close();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private CompetitorGenderType parseCompetitorGenderType(JSONObject jsonDate, String attributeName) {
|
||||
CompetitorGenderType result = null;
|
||||
String genderTypeAsString = (String) jsonDate.get(attributeName);
|
||||
if(genderTypeAsString != null) {
|
||||
switch(genderTypeAsString) {
|
||||
case "M" : result = CompetitorGenderType.Men; break;
|
||||
case "W" : result = CompetitorGenderType.Women; break;
|
||||
case "X" : result = CompetitorGenderType.Mixed; break;
|
||||
case "Open" : result = CompetitorGenderType.Open; break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Integer parseInteger(JSONObject jsonNumber, String attributeName) {
|
||||
Integer result = null;
|
||||
Object object = jsonNumber.get(attributeName);
|
||||
if(object != null) {
|
||||
if(object instanceof Number) {
|
||||
result = ((Number) object).intValue();
|
||||
} else if (object instanceof String) {
|
||||
String numberAsString = (String) object;
|
||||
if(!numberAsString.isEmpty()) {
|
||||
try {
|
||||
result = Integer.parseInt(numberAsString);
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Date parseDate(JSONObject jsonDate, String attributeName) {
|
||||
Date result = null;
|
||||
String dateAsString = (String) jsonDate.get(attributeName);
|
||||
if(dateAsString != null && !dateAsString.isEmpty()) {
|
||||
try {
|
||||
result = DateParser.parseUTC(dateAsString);
|
||||
} catch (InvalidDateException e) {
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private URL parseURL(JSONObject jsonURL, String attributeName) {
|
||||
URL result = null;
|
||||
String urlAsString = (String) jsonURL.get(attributeName);
|
||||
if(urlAsString != null && !urlAsString.isEmpty()) {
|
||||
try {
|
||||
result = new URL(urlAsString);
|
||||
} catch (MalformedURLException e) {
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user