Expand task-related models with new task types and flight-related entities
- Added `TaskJDG`, `TaskPDG`, and a re-implemented `TaskHWZ` class, enhancing task abstraction with rule, abbreviation, and serialization methods. - Introduced `Pilot`, `Track`, `MarkerDrop`, and `Declaration` classes for detailed flight representation. - Made structural improvements across several classes for better clarity and maintainability.
This commit is contained in:
@@ -28,6 +28,7 @@ public class Competition {
|
|||||||
private String website;
|
private String website;
|
||||||
private AltitudeSource altitudeSource;
|
private AltitudeSource altitudeSource;
|
||||||
private Altitude seperationAltitude;
|
private Altitude seperationAltitude;
|
||||||
|
private boolean publishCurrentStandings;
|
||||||
private HashMap<String, Coordinate> commonLaunchPoints;
|
private HashMap<String, Coordinate> commonLaunchPoints;
|
||||||
private HashSet<CompetitionContact> contacts;
|
private HashSet<CompetitionContact> contacts;
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class CompetitionProvider implements Provider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createDatabaseTables(Query query) {
|
public void createDatabaseTables(Query query) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -6,6 +6,6 @@ public enum CompetitionType {
|
|||||||
CONTINENTAL_CHAMPIONSHIP,
|
CONTINENTAL_CHAMPIONSHIP,
|
||||||
NATIONAL_CHAMPIONSHIP,
|
NATIONAL_CHAMPIONSHIP,
|
||||||
STATE_OR_REGIONAL_CHAMPIONSHIP,
|
STATE_OR_REGIONAL_CHAMPIONSHIP,
|
||||||
OTHER;
|
OTHER
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package dev.coph.flightscore.backend.coordinate;
|
package dev.coph.flightscore.backend.coordinate;
|
||||||
|
|
||||||
public enum PositionValid {
|
public enum PositionValid {
|
||||||
|
|
||||||
FIX_3D,
|
FIX_3D,
|
||||||
NO_FIX_OR_2D;
|
NO_FIX_OR_2D
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class FlightPublicData {
|
|||||||
private String pZsInForce;
|
private String pZsInForce;
|
||||||
private String searchPeriod;
|
private String searchPeriod;
|
||||||
private String nextBriefing;
|
private String nextBriefing;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Additional notes for the flight. E.g., for reduced time periods or temporary change of blue pz altitudes, ...
|
Additional notes for the flight. E.g., for reduced time periods or temporary change of blue pz altitudes, ...
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -12,5 +12,5 @@ public class FlightScoringData {
|
|||||||
private Instant launchPeriodStart;
|
private Instant launchPeriodStart;
|
||||||
private Instant launchPeriodEnd;
|
private Instant launchPeriodEnd;
|
||||||
private Integer minimumILPToGoalsInMeter;
|
private Integer minimumILPToGoalsInMeter;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package dev.coph.flightscore.backend.flight;
|
package dev.coph.flightscore.backend.flight;
|
||||||
|
|
||||||
public enum FlightStatus {
|
public enum FlightStatus {
|
||||||
|
|
||||||
DRAFT,
|
DRAFT,
|
||||||
LIVE,
|
LIVE,
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package dev.coph.flightscore.backend.pilot;
|
||||||
|
|
||||||
|
public class Pilot {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,13 +3,7 @@ package dev.coph.flightscore.backend.provider;
|
|||||||
import dev.coph.flightscore.backend.Backend;
|
import dev.coph.flightscore.backend.Backend;
|
||||||
import dev.coph.simplesql.query.Query;
|
import dev.coph.simplesql.query.Query;
|
||||||
|
|
||||||
import java.util.ArrayDeque;
|
import java.util.*;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Deque;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class ProviderManager {
|
public class ProviderManager {
|
||||||
private final Backend backend;
|
private final Backend backend;
|
||||||
@@ -25,20 +19,6 @@ public class ProviderManager {
|
|||||||
query.execute();
|
query.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enableAllProviders() {
|
|
||||||
Query query = new Query(backend.databaseAdapter());
|
|
||||||
resolveOrder().forEach(provider -> provider.onEnable(query));
|
|
||||||
query.execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerProvider(Provider provider) {
|
|
||||||
providers.put(provider.key(), provider);
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T extends Provider> T provider(String key) {
|
|
||||||
return (T) providers.get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<Provider> resolveOrder() {
|
private List<Provider> resolveOrder() {
|
||||||
HashMap<String, Integer> inDegree = new HashMap<>();
|
HashMap<String, Integer> inDegree = new HashMap<>();
|
||||||
HashMap<String, Set<String>> dependents = new HashMap<>();
|
HashMap<String, Set<String>> dependents = new HashMap<>();
|
||||||
@@ -84,4 +64,18 @@ public class ProviderManager {
|
|||||||
return ordered;
|
return ordered;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void enableAllProviders() {
|
||||||
|
Query query = new Query(backend.databaseAdapter());
|
||||||
|
resolveOrder().forEach(provider -> provider.onEnable(query));
|
||||||
|
query.execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerProvider(Provider provider) {
|
||||||
|
providers.put(provider.key(), provider);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T extends Provider> T provider(String key) {
|
||||||
|
return (T) providers.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public enum PublicationState {
|
|||||||
FINAL(true);
|
FINAL(true);
|
||||||
|
|
||||||
final boolean versionable;
|
final boolean versionable;
|
||||||
|
|
||||||
PublicationState(boolean versionable) {
|
PublicationState(boolean versionable) {
|
||||||
this.versionable = versionable;
|
this.versionable = versionable;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public class PublicationTask {
|
|||||||
private final Instant timestamp;
|
private final Instant timestamp;
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
|
|
||||||
public PublicationTask(PublicationState state, Instant timestamp) {
|
public PublicationTask(PublicationState state, Instant timestamp) {
|
||||||
this.state = state;
|
this.state = state;
|
||||||
this.timestamp = timestamp;
|
this.timestamp = timestamp;
|
||||||
|
|||||||
@@ -1,24 +1,37 @@
|
|||||||
package dev.coph.flightscore.backend.task;
|
package dev.coph.flightscore.backend.task;
|
||||||
|
|
||||||
import dev.coph.flightscore.backend.flight.Flight;
|
import dev.coph.flightscore.backend.flight.Flight;
|
||||||
import dev.coph.flightscore.backend.flight.FlightScoringData;
|
|
||||||
import dev.coph.simpleutilities.ulid.ULID;
|
import dev.coph.simpleutilities.ulid.ULID;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
|
||||||
|
@Setter
|
||||||
@Getter
|
@Getter
|
||||||
@Accessors(fluent = true)
|
@Accessors(fluent = true)
|
||||||
public abstract class Task {
|
public abstract class Task {
|
||||||
private Flight flight;
|
private final ULID id;
|
||||||
private ULID id;
|
private final Flight flight;
|
||||||
private int taskNumber;
|
private int taskNumber;
|
||||||
private TaskStatus status;
|
private TaskStatus status;
|
||||||
private Instant scoringPeriodeEnd;
|
private Instant scoringPeriodeEnd;
|
||||||
private Integer separationAltitudeOverride;
|
private Integer separationAltitudeOverride;
|
||||||
|
|
||||||
public abstract JSONObject serialize();
|
protected Task(ULID id, Flight flight) {
|
||||||
public abstract Task deserialize(JSONObject json);
|
this.id = id;
|
||||||
|
this.flight = flight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract String rule();
|
||||||
|
|
||||||
|
public abstract String abbreviation();
|
||||||
|
|
||||||
|
public abstract JSONObject serialize();
|
||||||
|
|
||||||
|
public abstract Task deserialize(JSONObject json);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ public enum TaskStatus {
|
|||||||
LIVE,
|
LIVE,
|
||||||
SCORING,
|
SCORING,
|
||||||
COMPLETED,
|
COMPLETED,
|
||||||
CANCELED;
|
CANCELED
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
package dev.coph.flightscore.backend.task.impl;
|
|
||||||
|
|
||||||
import dev.coph.flightscore.backend.task.Task;
|
|
||||||
|
|
||||||
public class TaskHWZ extends Task {
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* TaskNumber INT (UNSIGNED)
|
|
||||||
* ScoringPeriod TIMESTAMP
|
|
||||||
* Status STRING
|
|
||||||
* Data JSON
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package dev.coph.flightscore.backend.task.type;
|
||||||
|
|
||||||
|
import dev.coph.flightscore.backend.flight.Flight;
|
||||||
|
import dev.coph.flightscore.backend.task.Task;
|
||||||
|
import dev.coph.simpleutilities.ulid.ULID;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
public class TaskHWZ extends Task {
|
||||||
|
|
||||||
|
public TaskHWZ(ULID id, Flight flight) {
|
||||||
|
super(id, flight);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String rule() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String abbreviation() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject serialize() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Task deserialize(JSONObject json) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package dev.coph.flightscore.backend.task.type;
|
||||||
|
|
||||||
|
import dev.coph.flightscore.backend.flight.Flight;
|
||||||
|
import dev.coph.flightscore.backend.task.Task;
|
||||||
|
import dev.coph.simpleutilities.ulid.ULID;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
public class TaskJDG extends Task {
|
||||||
|
|
||||||
|
|
||||||
|
protected TaskJDG(ULID id, Flight flight) {
|
||||||
|
super(id, flight);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String rule() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String abbreviation() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject serialize() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Task deserialize(JSONObject json) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package dev.coph.flightscore.backend.task.type;
|
||||||
|
|
||||||
|
import dev.coph.flightscore.backend.flight.Flight;
|
||||||
|
import dev.coph.flightscore.backend.task.Task;
|
||||||
|
import dev.coph.simpleutilities.ulid.ULID;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
public class TaskPDG extends Task {
|
||||||
|
|
||||||
|
|
||||||
|
protected TaskPDG(ULID id, Flight flight) {
|
||||||
|
super(id, flight);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String rule() {
|
||||||
|
return "15.1";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String abbreviation() {
|
||||||
|
return "PDG";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject serialize() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Task deserialize(JSONObject json) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package dev.coph.flightscore.backend.track;
|
||||||
|
|
||||||
|
import dev.coph.flightscore.backend.coordinate.Coordinate;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Accessors(fluent = true)
|
||||||
|
public class Declaration {
|
||||||
|
private int number;
|
||||||
|
private Coordinate declaration;
|
||||||
|
private Coordinate positionAtDeclaration;
|
||||||
|
|
||||||
|
private boolean isHeightPilotDeclared;
|
||||||
|
private String originalDeclarationEasting, originalDeclarationNorthing;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package dev.coph.flightscore.backend.track;
|
||||||
|
|
||||||
|
import dev.coph.flightscore.backend.coordinate.Coordinate;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Accessors(fluent = true)
|
||||||
|
public class MarkerDrop {
|
||||||
|
private int number;
|
||||||
|
private Coordinate location;
|
||||||
|
private Instant timestamp;
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package dev.coph.flightscore.backend.track;
|
||||||
|
|
||||||
|
import dev.coph.flightscore.backend.coordinate.Coordinate;
|
||||||
|
import dev.coph.flightscore.backend.pilot.Pilot;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Accessors(fluent = true)
|
||||||
|
public class Track {
|
||||||
|
|
||||||
|
private Pilot pilot;
|
||||||
|
private List<Coordinate> trackPoints;
|
||||||
|
|
||||||
|
private List<Declaration> declarations;
|
||||||
|
private List<MarkerDrop> markerDrops;
|
||||||
|
private File trackFile;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -17,8 +17,8 @@ public class User {
|
|||||||
private final String email;
|
private final String email;
|
||||||
private final String phoneNumber;
|
private final String phoneNumber;
|
||||||
private final Locale country;
|
private final Locale country;
|
||||||
private Role role;
|
|
||||||
private final boolean blocked;
|
private final boolean blocked;
|
||||||
|
private Role role;
|
||||||
|
|
||||||
public User(ULID id, String firstname, String lastname, String email, String phoneNumber, Locale country, boolean blocked) {
|
public User(ULID id, String firstname, String lastname, String email, String phoneNumber, Locale country, boolean blocked) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
|||||||
@@ -4,14 +4,7 @@ import dev.coph.simpleutilities.ulid.ULID;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Accessors(fluent = true)
|
@Accessors(fluent = true)
|
||||||
public class Permission {
|
public record Permission(ULID id, String name) {
|
||||||
private final ULID id;
|
|
||||||
private final String name;
|
|
||||||
public Permission(ULID id, String name) {
|
|
||||||
this.id = id;
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ public class Role {
|
|||||||
private final String name;
|
private final String name;
|
||||||
private final boolean defaultRole;
|
private final boolean defaultRole;
|
||||||
private final HashSet<Permission> permissions = new HashSet<>();
|
private final HashSet<Permission> permissions = new HashSet<>();
|
||||||
|
|
||||||
public Role(ULID id, String name, boolean defaultRole) {
|
public Role(ULID id, String name, boolean defaultRole) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|||||||
Reference in New Issue
Block a user