Add support for parameters to start and update gradle to compile full jar
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
public class TLWFootballMatchesUpdater {
|
||||
public TLWFootballMatchesUpdater() {
|
||||
|
||||
}
|
||||
|
||||
public String getUpdateSQL() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -4,15 +4,20 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import de.jeyp91.BaseMatch;
|
||||
import de.jeyp91.StatusHolder;
|
||||
import de.jeyp91.TeamIDMatcher;
|
||||
import de.jeyp91.apifootball.APIFootballMatch;
|
||||
import de.jeyp91.openligadb.OpenLigaDBMatch;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class TLWMatch extends BaseMatch{
|
||||
|
||||
private final Logger logger = LogManager.getLogger(TLWMatch.class);
|
||||
|
||||
public final Integer STATUS_NOTSTARTED = 0;
|
||||
public final Integer STATUS_STARTED = 1;
|
||||
public final Integer STATUS_PROVISIONAL_RESULT_AVAILABLE = 2;
|
||||
@@ -274,7 +279,8 @@ public class TLWMatch extends BaseMatch{
|
||||
private Integer getTeamIdHomeFromApiFootballMatch(APIFootballMatch match) {
|
||||
Integer id = TeamIDMatcher.getTippligaIdFromApiFootballId(match.getTeamIdHome());
|
||||
if(id == null) {
|
||||
System.out.println("Could not find id " + match.getTeamIdHome() + " for " + match.getTeamNameHome());
|
||||
logger.error("Could not find id " + match.getTeamIdHome() + " for " + match.getTeamNameHome());
|
||||
StatusHolder.setError();
|
||||
}
|
||||
return id;
|
||||
}
|
||||
@@ -282,7 +288,8 @@ public class TLWMatch extends BaseMatch{
|
||||
private Integer getTeamIdGuestFromApiFootballMatch(APIFootballMatch match) {
|
||||
Integer id = TeamIDMatcher.getTippligaIdFromApiFootballId(match.getTeamIdGuest());
|
||||
if(id == null) {
|
||||
System.out.println("Could not find id " + match.getTeamIdGuest() + " for " + match.getTeamNameGuest());
|
||||
logger.error("Could not find id " + match.getTeamIdGuest() + " for " + match.getTeamNameGuest());
|
||||
StatusHolder.setError();
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class TLWMatchdaysCreator {
|
||||
|
||||
int numberOfMatches = this.matchesPerMatchday;
|
||||
if(numberOfMatches == 0){
|
||||
numberOfMatches = Integer.parseInt(matchdayConfigJson.get("matchesPerMatchday").toString());
|
||||
numberOfMatches = Integer.parseInt(matchdayConfigJson.get("numberOfMatches").toString());
|
||||
}
|
||||
|
||||
String deliveryDate1 = null;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import com.google.common.io.Resources;
|
||||
import de.jeyp91.StatusHolder;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
@@ -13,6 +16,8 @@ import java.util.ArrayList;
|
||||
|
||||
public class TLWMatchesCreatorTipperLeague extends TLWMatchesCreatorBase {
|
||||
|
||||
private final Logger logger = LogManager.getLogger(TLWMatchesCreatorTipperLeague.class);
|
||||
|
||||
int season;
|
||||
int league;
|
||||
|
||||
@@ -84,7 +89,8 @@ public class TLWMatchesCreatorTipperLeague extends TLWMatchesCreatorBase {
|
||||
}
|
||||
}
|
||||
if(teamId == 0) {
|
||||
System.out.println("ERROR! Did not find Tipper ID for " + name);
|
||||
logger.error("ERROR! Did not find Tipper ID for " + name);
|
||||
StatusHolder.setError();
|
||||
}
|
||||
return teamId;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import com.google.common.io.Resources;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
@@ -13,6 +15,8 @@ import java.util.ArrayList;
|
||||
|
||||
public class TLWMatchesCreatorTipperPokal extends TLWMatchesCreatorBase{
|
||||
|
||||
Logger logger = LogManager.getLogger(TLWMatchesCreatorTipperPokal.class);
|
||||
|
||||
int season;
|
||||
int league;
|
||||
|
||||
@@ -74,7 +78,7 @@ public class TLWMatchesCreatorTipperPokal extends TLWMatchesCreatorBase{
|
||||
}
|
||||
}
|
||||
if(teamId == 0) {
|
||||
System.out.println("Did not find Tipper ID for " + name);
|
||||
logger.error("Did not find Tipper ID for " + name);
|
||||
}
|
||||
return teamId;
|
||||
}
|
||||
|
||||
@@ -182,4 +182,8 @@ public class TLWMatchesUpdaterFootball extends TLWMatchesManagerBase {
|
||||
}
|
||||
return matchingMatch;
|
||||
}
|
||||
|
||||
public ArrayList<TLWMatch> getTLWMatchesUpdated() {
|
||||
return this.tlwMatchesUpdated;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,13 +11,20 @@ public class TLWTeamsUpdater {
|
||||
ArrayList<TLWMatch> matchesUpdated;
|
||||
ArrayList<TLWTeam> missingTeams;
|
||||
|
||||
public TLWTeamsUpdater(int season, int league, ArrayList<TLWMatch> matchesUpdated) {
|
||||
this.season = season;
|
||||
this.league = league;
|
||||
this.matchesUpdated = matchesUpdated;
|
||||
missingTeams = new ArrayList<>();
|
||||
public TLWTeamsUpdater(int season, int league, String configFileName) throws Exception {
|
||||
|
||||
TippligaSQLConnector conn = new TippligaSQLConnector();
|
||||
|
||||
this.season = season;
|
||||
this.league = league;
|
||||
this.matchesUpdated = new ArrayList<>();
|
||||
|
||||
TLWMatchesUpdaterFootball matchesUpdaterFootball = new TLWMatchesUpdaterFootball(season, league, configFileName);
|
||||
this.matchesUpdated.addAll(matchesUpdaterFootball.getTLWMatchesUpdated());
|
||||
this.matchesUpdated.addAll(conn.getMatches(String.valueOf(season), String.valueOf(league)));
|
||||
|
||||
missingTeams = new ArrayList<>();
|
||||
|
||||
teamsOriginal = conn.getTeams(String.valueOf(season), String.valueOf(league));
|
||||
|
||||
HashSet<Integer> missingIds = this.initMissingIds();
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import de.jeyp91.StatusHolder;
|
||||
import de.jeyp91.tippliga.TLWMatch;
|
||||
import de.jeyp91.tippliga.TLWTeam;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.xml.transform.Result;
|
||||
import java.util.ArrayList;
|
||||
@@ -15,11 +18,14 @@ public class TippligaSQLConnector {
|
||||
|
||||
Connection con;
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(TippligaSQLConnector.class);
|
||||
|
||||
static {
|
||||
try {
|
||||
Class.forName("com.mysql.cj.jdbc.Driver");
|
||||
} catch (ClassNotFoundException ex) {
|
||||
System.err.println("Unable to load MySQL Driver");
|
||||
logger.error("Unable to load MySQL Driver");
|
||||
StatusHolder.setError();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +120,7 @@ public class TippligaSQLConnector {
|
||||
executeQuery(queryString);
|
||||
}
|
||||
|
||||
private ResultSet executeQuery (String queryString){
|
||||
public ResultSet executeQuery (String queryString){
|
||||
Statement stmt;
|
||||
ResultSet rset = null;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user