added ScoringApi
This commit is contained in:
66
src/main/java/com/poststats/golf/rs/api/ScoringApi.java
Executable file
66
src/main/java/com/poststats/golf/rs/api/ScoringApi.java
Executable file
@@ -0,0 +1,66 @@
|
|||||||
|
package com.poststats.golf.rs.api;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.poststats.golf.rs.api.model.ScoringSystem;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||||
|
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.validation.constraints.Positive;
|
||||||
|
import jakarta.ws.rs.GET;
|
||||||
|
import jakarta.ws.rs.Path;
|
||||||
|
import jakarta.ws.rs.PathParam;
|
||||||
|
import jakarta.ws.rs.Produces;
|
||||||
|
import jakarta.ws.rs.QueryParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author brian.long@poststats.com
|
||||||
|
*/
|
||||||
|
@Path("/golf/scoring")
|
||||||
|
@Tag(name = "Scoring API")
|
||||||
|
public abstract class ScoringApi {
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("systems")
|
||||||
|
@Produces(Constants.V1_JSON)
|
||||||
|
@Operation(summary = "Retrieves meta-data about all scoring systems.")
|
||||||
|
@ApiResponses({
|
||||||
|
@ApiResponse(responseCode = "200", description = "Success", useReturnTypeSchema = true)
|
||||||
|
})
|
||||||
|
public abstract List<ScoringSystem> getSystems(@QueryParam("stableford") Boolean stableford);
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/system/{id}")
|
||||||
|
@Produces(Constants.V1_JSON)
|
||||||
|
@Operation(
|
||||||
|
summary = "Retrieves meta-data about a scoring system.",
|
||||||
|
description = "Retreives name and other direct meta-data about the specified scoring system."
|
||||||
|
)
|
||||||
|
@ApiResponses({
|
||||||
|
@ApiResponse(responseCode = "200", description = "Success", useReturnTypeSchema = true),
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "404",
|
||||||
|
description = "A scoring system with the specified ID could not be found"
|
||||||
|
)
|
||||||
|
})
|
||||||
|
public abstract ScoringSystem getSystemById(@PathParam("id") @Positive short id);
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/system/bySid/{sid}")
|
||||||
|
@Produces(Constants.V1_JSON)
|
||||||
|
@Operation(
|
||||||
|
summary = "Retrieves meta-data about a scoring system.",
|
||||||
|
description = "Retreives name and other direct meta-data about the specified scoring system."
|
||||||
|
)
|
||||||
|
@ApiResponses({
|
||||||
|
@ApiResponse(responseCode = "200", description = "Success", useReturnTypeSchema = true),
|
||||||
|
@ApiResponse(
|
||||||
|
responseCode = "404",
|
||||||
|
description = "A scoring system with the specified SID could not be found"
|
||||||
|
)
|
||||||
|
})
|
||||||
|
public abstract ScoringSystem getSystemBySid(@PathParam("sid") String sid);
|
||||||
|
|
||||||
|
}
|
116
src/main/java/com/poststats/golf/rs/api/model/ScoringSystem.java
Executable file
116
src/main/java/com/poststats/golf/rs/api/model/ScoringSystem.java
Executable file
@@ -0,0 +1,116 @@
|
|||||||
|
package com.poststats.golf.rs.api.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.poststats.rs.api.annotation.MapEntry;
|
||||||
|
import com.poststats.rs.api.model.BaseModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author brian.long@poststats.com
|
||||||
|
*/
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class ScoringSystem extends BaseModel<ScoringSystem> {
|
||||||
|
|
||||||
|
@JsonProperty(required = true)
|
||||||
|
@MapEntry("scoringSystemID")
|
||||||
|
private short id;
|
||||||
|
|
||||||
|
@JsonProperty(required = true)
|
||||||
|
@MapEntry("scoringSystemSID")
|
||||||
|
private String sid;
|
||||||
|
|
||||||
|
@JsonProperty(required = true)
|
||||||
|
@MapEntry("scoringSystem")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@JsonProperty(required = true)
|
||||||
|
@MapEntry
|
||||||
|
private String display;
|
||||||
|
|
||||||
|
@JsonProperty(required = true)
|
||||||
|
@MapEntry
|
||||||
|
private boolean stableford;
|
||||||
|
|
||||||
|
@JsonProperty
|
||||||
|
@MapEntry
|
||||||
|
private Short baseTarget;
|
||||||
|
|
||||||
|
public short getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(short id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScoringSystem withId(short id) {
|
||||||
|
this.id = id;
|
||||||
|
return this.withThis();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSid() {
|
||||||
|
return sid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSid(String sid) {
|
||||||
|
this.sid = sid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScoringSystem withSid(String sid) {
|
||||||
|
this.sid = sid;
|
||||||
|
return this.withThis();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScoringSystem withName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this.withThis();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDisplay() {
|
||||||
|
return display;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisplay(String display) {
|
||||||
|
this.display = display;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScoringSystem withDisplay(String display) {
|
||||||
|
this.display = display;
|
||||||
|
return this.withThis();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isStableford() {
|
||||||
|
return stableford;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStableford(boolean stableford) {
|
||||||
|
this.stableford = stableford;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScoringSystem withStableford(boolean stableford) {
|
||||||
|
this.stableford = stableford;
|
||||||
|
return this.withThis();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Short getBaseTarget() {
|
||||||
|
return baseTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBaseTarget(Short baseTarget) {
|
||||||
|
this.baseTarget = baseTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScoringSystem withBaseTarget(Short baseTarget) {
|
||||||
|
this.baseTarget = baseTarget;
|
||||||
|
return this.withThis();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user