licenceNr, firstname, lastname, birthyear, gender, anonymous, licenceClubUUID and countryUUID from NUPlayerBaseDTOtop5Sum, averagePerMember, totalPoints and memberCount to MBPRaceClubDTOreferentEmail, additionalReferentEmail and rounds to DSBTournamentDTOstate to DSBClubDTOuuid to DSBPersonDTO and property eloPlayer to DSBPlayerDTOmemberships in DSBPersonDTOlatestTournamentDate and latestPoolEntryDate in NUPlayerBaseDTOmatchType in NUHiddenNoShowDTOW10, M10, X10 in LKAltersklasselicenceClubUUID in NUPlayerBaseDTOMBPRacePlayerDTOleadingPlayer in NUPlayerMergeDTO from NUPlayerDTO to NUPlayerBaseDTO/mybigpoint/protocol/dummy/statisticsmatchUUID in MBPSingeDTO > MBPDoubleDTOapprovedBy in NUGradingDTOThe DTB-LK-2.0 service, which exposes this API, uses jackson (currently version 2.10.3). In order to use the same serialization/deserializaton methods, you best include the following dependency in your maven pom.xml:
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.14.2</version>
</dependency>
You then should configure jackson by a class in your project like this:
package your-package-base.client.util;
import static org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJaxbJsonProvider.DEFAULT_ANNOTATIONS;
import javax.ws.rs.core.Feature;
import javax.ws.rs.core.FeatureContext;
import javax.ws.rs.ext.Provider;
import org.glassfish.jersey.jackson.internal.jackson.jaxrs.json.JacksonJaxbJsonProvider;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
@Provider
public class JacksonFeature implements Feature {
private static final ObjectMapper MAPPER;
static {
// Create the new object mapper.
MAPPER = new ObjectMapper();
MAPPER.registerModule(new JavaTimeModule());
// Enable/disable various configuration flags.
MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
MAPPER.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
}
@Override
public boolean configure(final FeatureContext context) {
JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider(
MAPPER, DEFAULT_ANNOTATIONS);
context.register(provider);
return true;
}
}
The JavaTimeModule and its configuration
MAPPER.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false) make LocalDate
instances to be serialized in the format "yyyy-MM-dd".
The following test class fires up a jetty, that serves the lk2020 system and then tests the client API. For tests against the productive system, you can skip starting and stopping the jetty server.
package jpa.nu.liga.lk2020.test.bigpoint.rs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.junit.Before;
import org.junit.Test;
import jpa.nu.liga.lk2020.client.mybigpoint.model.dto.MBPCalculationDTO;
import jpa.nu.liga.lk2020.client.mybigpoint.model.dto.MBPDoubleDTO;
import jpa.nu.liga.lk2020.client.mybigpoint.model.dto.MBPProtocolDTO;
import jpa.nu.liga.lk2020.client.mybigpoint.model.dto.MBPProtocolStepDTO;
import jpa.nu.liga.lk2020.client.mybigpoint.model.dto.MBPSingleDTO;
import jpa.nu.liga.lk2020.client.mybigpoint.model.dto.MBPStatisticsDTO;
import jpa.nu.liga.lk2020.client.mybigpoint.model.dto.MBPWeekDTO;
import jpa.nu.liga.lk2020.client.mybigpoint.model.dto.MBPWeekItemDTO;
import jpa.nu.liga.lk2020.client.util.LKAltersklasse;
import jpa.nu.liga.lk2020.test.AbstractRESTTest;
public class MyBigpointRESTTest extends AbstractRESTTest {
MBPProtocolDTO result;
@Before
public void init() {
result = this.getClientWithPath("/mybigpoint/protocol/dummy")
.request(MediaType.APPLICATION_JSON_TYPE).get(MBPProtocolDTO.class);
}
@Test
public void protocol_protocolOwner_isMaxMustermann() throws Exception {
assertEquals("Max Mustermann", result.getDisplayName());
}
@Test
public void protocol_LocalDateDeSerialization() throws Exception {
assertEquals(LocalDate.of(2021, 06, 14), result.getPrognosis().getDate());
}
@Test
public void protocol_allPlayerNames_areHere() throws Exception {
List expected = Arrays.asList(
"Max Mustermann", "Adam Riese", "Siegfried Schmied", "David Zwerg",
"Oliver Müller", "Franz Felder", "Gustaf Müller"
);
List collected = new ArrayList();
for (MBPProtocolStepDTO step: result.getSteps()) {
if (step instanceof MBPWeekDTO && ((MBPWeekDTO)step).getItems() != null) {
for (MBPWeekItemDTO item: ((MBPWeekDTO)step).getItems()) {
if (item instanceof MBPSingleDTO) {
MBPSingleDTO single = (MBPSingleDTO)item;
collected.add(single.getOwnName());
collected.add(single.getOtherName());
if (item instanceof MBPDoubleDTO) {
MBPDoubleDTO d = (MBPDoubleDTO)item;
collected.add(d.getOwnPartnerName());
collected.add(d.getOtherPartnerName());
}
}
}
}
}
assertTrue(expected.containsAll(collected));
assertTrue(collected.containsAll(expected));
assertEquals(14, collected.size());
}
@Test
public void protocol_matchUUIDs_forTournamntMatchesOnly() throws Exception {
for (MBPProtocolStepDTO step: result.getSteps()) {
if (step instanceof MBPWeekDTO && ((MBPWeekDTO)step).getItems() != null) {
for (MBPWeekItemDTO item: ((MBPWeekDTO)step).getItems()) {
if (item instanceof MBPSingleDTO) {
MBPSingleDTO single = (MBPSingleDTO)item;
if (single.getCompetitionId() != null) {
assertNotNull("Tournament matches (signaled by a nonnull competitionId) have a nonnull matchUUID", single.getMatchUUID());
} else if (single.getMeetingId() != null) {
assertNull("Tournament macthes (signaled by a nonnull meetingId) have no matchUUID", single.getMatchUUID());
}
}
}
}
}
}
@Test
public void calculator_forLk11AndLk13_returnsOutcome() throws Exception {
MBPCalculationDTO calc = this.getClientWithPath("/mybigpoint/calculator/single")
.queryParam("lkA", 11.0)
.queryParam("lkB", 13.0)
.queryParam("altersklasse", "M60")
.request(MediaType.APPLICATION_JSON_TYPE)
.accept(MediaType.APPLICATION_JSON_TYPE)
.post(Entity.json(null), MBPCalculationDTO.class);
assertEquals(11.0f, calc.getLkA(), 0.0f);
assertEquals(13.0f, calc.getLkB(), 0.0f);
assertEquals(LKAltersklasse.M60, calc.getAltersklasse());
assertEquals(0.6f, calc.getAltersfaktor(), 0.0f);
assertEquals(30.0f, calc.getPunkteA(), 0.0f);
assertEquals(240.25f, calc.getHuerdeA(), 0.01f);
assertEquals(0.075f, calc.getVerbesserungA(), 0.001f);
assertEquals(80.0f, calc.getPunkteB(), 0.0f);
assertEquals(200.00f, calc.getHuerdeB(), 0.01f);
assertEquals(0.240f, calc.getVerbesserungB(), 0.001f);
}
@Test
public void calculator_forDoubleLk11AndLk13AgainstLk10AndLk11_returnsOutcome() throws Exception {
MBPCalculationDTO calc = this.getClientWithPath("/mybigpoint/calculator/double")
.queryParam("lkA1", 11.0)
.queryParam("lkA2", 13.0)
.queryParam("lkB1", 10.0)
.queryParam("lkB2", 11.0)
.queryParam("altersklasse", "M60")
.request(MediaType.APPLICATION_JSON_TYPE)
.accept(MediaType.APPLICATION_JSON_TYPE)
.post(Entity.json(null), MBPCalculationDTO.class);
assertEquals(11.0f, calc.getLkA1(), 0.0f);
assertEquals(13.0f, calc.getLkA2(), 0.0f);
assertEquals(10.0f, calc.getLkB1(), 0.0f);
assertEquals(11.0f, calc.getLkB2(), 0.0f);
assertEquals(LKAltersklasse.M60, calc.getAltersklasse());
assertEquals(0.6f, calc.getAltersfaktor(), 0.0f);
assertEquals(12.0f, calc.getLkA(), 0.0f);
assertEquals(10.5f, calc.getLkB(), 0.0f);
assertEquals(69.0f, calc.getPunkteA(), 0.1f);
assertEquals(219.14f, calc.getHuerdeA(), 0.01f);
assertEquals(0.094f, calc.getVerbesserungA(), 0.001f);
assertEquals(37.3f, calc.getPunkteB(), 0.1f);
assertEquals(251.68f, calc.getHuerdeB(), 0.01f);
assertEquals(0.045f, calc.getVerbesserungB(), 0.001f);
}
@Test
public void prognosis_dummy_responds() throws Exception {
MBPWeekDTO prognosis = this.getClientWithPath("/mybigpoint/protocol/dummy/prognosis")
.request(MediaType.APPLICATION_JSON_TYPE).get(MBPWeekDTO.class);
assertEquals(11.0f, prognosis.getLkBegleitwert(), 0.0f);
assertEquals(0.003f, prognosis.getLkDelta(), 0.0f);
}
@Test
public void statistics_dummy_returnsList() throws Exception {
List stats = this.getClientWithPath("/mybigpoint/protocol/dummy/statistics")
.request(MediaType.APPLICATION_JSON_TYPE)
.get(Response.class)
.readEntity(new GenericType>() {});
assertEquals("Statistics have exactly 2 elements.", 2, stats.size());
assertFalse("1st element (total) doestn't begins after 2nd element (current year)",
stats.get(0).getPeriodStart().isAfter(stats.get(1).getPeriodStart()));
}
}
The resources use a data model that is supported by a set of client-side libraries that are made available on the files and libraries page.
There is a WADL document available that describes the resources API.
You may also enjoy the interactive interface provided for this API by Swagger.
| name | path | methods | description |
|---|---|---|---|
| DSBPersonREST |
|
|
REST resource for DSB Wertungsportal person data.
Provides access to person-centric views such as the complete DWZ tournament
history of a player. All endpoints require the Base path: |
| DSBTournamentREST |
|
|
|
| DTBRankingListREST |
|
|
REST resource for accessing DTB ranking lists, their entries and results.
Base path: /rankinglists
|
| DWZListeREST |
|
|
|
| LKServiceREST |
|
|
|
| MybigpointREST |
|
|
|
| NUSportREST |
|
|
| type | description |
|---|---|
| AgeGroup | |
| Altersklasse | Alterklassen used to determine the Altersklassenfaktor §3, Anhang A.3 |
| CalculationType | |
| ChessResult | Possible results of a DWZMatch or a DWZRestpartie. This result contains the points for player white and player black, the string representation of the result and the data base value for persistence. |
| ClubState | |
| CountryAndClubState | |
| DSBClubDTO | Data transfer object representing a chess club in the DSB Wertungsportal.
Fields
|
| DSBFederationDTO | Data transfer object representing a federation in the DSB Wertungsportal.
Fields
|
| DSBMatchDTO | Represents a single chess game within a DWZ tournament.
Fields
|
| DSBMembershipDTO | View model of a single current club membership of a person (a membership without an until date).
|
| DSBPersonDTO | View model of a person with their latest known DWZ rating and index and all current club memberships.
Identity fields
Membership fields
Evaluation fields
DWZ fields
|
| DSBPlayerDTO | View model of a player and their DWZ evaluation result within a tournament.
Identity fields
DWZ evaluation fields
|
| DSBScoresheetDTO | Scoresheet for a single player in a tournament.
Fields
|
| DSBTournamentDTO | View model of a DSB tournament.
Fields
|
| DSBTournamentDetailDTO | Extended view model of a single DSB tournament, returned only by the tournament
detail endpoint (GET /dwz/tournaments/{uuid}).
In addition to all fields of DSBTournamentDTO it carries aggregate counts that require dedicated database queries and are therefore not provided for the (potentially large) tournament list responses. Additional fields
|
| DSBTournamentEvaluationDTO | View model of a rated DSB tournament including the DWZ evaluation results for all its players.
Only available for tournaments with rating state RATED. Fields
|
| DSBTournamentHistoryDTO | View model of a player's complete DWZ tournament history.
Contains all tournament entries in which the player participated, ordered by tournament end date descending (most recent first). Fields
|
| DSBTournamentHistoryEntryDTO | A single entry in a player's tournament history, combining the tournament metadata
with the player's DWZ evaluation result within that tournament.
Fields
|
| DSBUpgradeDTO | View model of a DWZ upgrade (DWZ-Umstufung) of a person.
An upgrade is an externally imported re-grading that becomes the binding DWZ baseline from its reference date on. In contrast to a tournament entry it carries no game-level evaluation data (number of games, K-factor, performance, …) – only the rating and index before and after the upgrade. Fields
|
| DTBRankinglistDTO | |
| DTBRankinglistEntryDTO | |
| DTBRankinglistResultDTO | |
| LKAltersklasse | |
| LKBonus | Bonus for special events according to §9 "Bonus für besondere Wettbewerbe" |
| LKCountingType | |
| LKGradingType | The possible types of a GradingStep as defined in § 10 "Durchführungsbestimmungen zur Leistungsklassenordnung (LKO)" |
| LKMatchType | |
| LKNoShow | Possible "no show" states |
| LKRetired | Aufgabe eines Spielers, z.B. aufgrund einer Verletzung |
| LKSportType | |
| LKWinner | Outcome of a single or double match. |
| LicenceStateSchachDE | |
| MBPAnnualLKDTO | collection entry of the lk history of an player |
| MBPCalculationDTO | A result of the "LK Rechner". Given the LK of two players A and B and the Altersklasse, MBPCalculation gives the two possible outcomes for player A or B. |
| MBPCustomNoShowDTO | A match or Motivationsaufschlag during the week.
Instances of WeekItemDTO may contribute to the lkDelta property of a week.
|
| MBPDoubleDTO | A double match as exposed by the REST API of the DTB LK 2.0 service.
Matches (there are two types: single and double) are always contained in WeekDTO
instances (property items).
|
| MBPGradingStepDTO | A grading step in the LK 2.0 protocol like "Ersteinstufung", "Umstufung", ... (see attribute gradingType) |
| MBPHiddenNoShowDTO | A match or Motivationsaufschlag during the week.
Instances of WeekItemDTO may contribute to the lkDelta property of a week.
|
| MBPMatch | |
| MBPMotivationItemDTO | Each month, the amount of 0.1 will be added to a players LK. This amount will be split into one or more MotivationItemDTOs. |
| MBPNoShowInfoDTO | detail content of a no show entry |
| MBPPersonBase | Base class for DTOs with personal context. |
| MBPProtocolDTO | View model of a players DTB-LK-2.0 protocol. |
| MBPProtocolStepDTO | A step in the LK 2.0 protocol. LK values of a player may change only from step to step. For example, a step of the subclass WeekStepDTO contains all the matches, that contribute to the lk-change of that week. |
| MBPRaceClubDTO | A clubs position on one of the different rankings of the mybigpoint races.
Both club race results are carried at once: the classic best-5 sum (v1, top5Sum) and the
ranglistenbereinigte average per listed member (v2, averagePerMember = totalPoints /
memberCount). The |
| MBPRacePlayerDTO | A players position on one of the different rankings of the mybigpoint races. |
| MBPSingleDTO | A single match as exposed by the REST API of the DTB LK 2.0 service.
Matches (there are two types: single and double) are always contained in WeekDTO instances (property items).
Determine match source
|
| MBPStatisticsDTO | Simple statistics (won:lost for single and double matches) for a given period. |
| MBPWeekDTO | A week step in the LK 2.0 protocol. It spans from the day stored in attribute "date" (typically a Monday) to endOfWeek (typically a Sunday). Contains all the matches, that are chronologically assigned to that week (either scheduled or entered). If the week contains the last day of a month, it might contain a MotivationItemDTO as well. |
| MBPWeekItemDTO | A match or Motivationsaufschlag during the week.
Instances of WeekItemDTO may contribute to the lkDelta property of a week.
|
| NTDBSourceType | |
| NUCompetitionDTO | Competition (Konkurrenz) of a tournament, or some other set of related matches (sharing altersklasse and bonus type). |
| NUEventDTO | Superclass of NUMeetingDTO and NUCompetitionDTO,
representing an event with a set of matches sharing the same alterklasse and bonus type.
|
| NUGradingDTO | Ein- und Umstufungen laut §10.
Semantics: the referenceDate is usually a Monday and the gradedLK shall be valid for the that week.
The Ersteinstufung on 01.10.2020 according to LK-classic 2020 will not be handled as a grading.
|
| NUHiddenNoShowDTO | If a player doesn't show up at a tournament, he might be replaced by some other player.
So there won't be a noShow-typed match in the list of matches.
In this case, and only in this case, a NUHiddenNoShowDTO needs to be added
to hiddenNoShows in NUCompetitionDTO.
|
| NUMatchDTO | A single or double match. "Normal match": LKWinner.WINNER_IS_A or LKWinner.WINNER_IS_B LKNoShow.NO_NO_SHOW LKRetired.NO_RETIRED 0:1 (Player is injured in the match): LKWinner.WINNER_IS_A or LKWinner.WINNER_IS_B LKNoShow.NO_NO_SHOW LKRetired.RETIRED_A (if LKWinner.WINNER_IS_B) or LKRetired.RETIRED_B (if LKWinner.WINNER_IS_A) 0:0 (Player is injured before the match (warming up)): LKWinner.NO_WINNER LKNoShow.NO_NO_SHOW LKRetired.RETIRED_A or LKRetired.RETIRED_B One player does not show up to the match: LKWinner.NO_WINNER LKNoShow.NO_SHOW_A or LKNoShow.NO_SHOW_B LKRetired.NO_RETIRED One player does not have to play, since he has no opponent (player UUID is null) in a meeting match: LKWinner.NO_WINNER LKNoShow.NO_NO_SHOW LKRetired.NO_RETIRED Both meeting and competition matches can be configured to be LKNoShow.NO_SHOW_A or LKNoShow.NO_SHOW_B. The LK service decides whether the no show will be punished or not. At the moment meeting match no shows are not punished! |
| NUMeetingDTO | Superclass of NUMeetingDTO and NUCompetitionDTO,
representing an event with a set of matches sharing the same alterklasse and bonus type.
|
| NUPlayerBaseDTO | |
| NUPlayerDTO | NUPlayerDTO represents a person, that plays matches in LK relevant events and who is covered by the LK-system.
This DTO is used in requests pushed by nuSport, as well as responses of the lk2020 service.
When used in requests, the DTO carries the properties as they are present in the NTDB.
If In responses of the lk2020 service, the properties |
| NUPlayerMergeDTO | NUPlayerMergeDTO holds all the information about the merger of different player instances, who represent the same (natural) player.
|
| NUPlayerPatchDTO | NUPlayerPatchDTO is used to update (patch) a player. This class may hold several different DTOs for different (to be executed) operations.
|
| NURankingDTO | |
| NURankingListDTO | |
| PageNavigationLinks | Navigation links for paginated REST responses.
Each field contains an absolute URL pointing to the respective page.
Fields are
|
| PagedResponseMetadata | Metadata of a PagedResponse.
|
| PagedResponseOfDSBClubDTO | Generic REST response wrapper for endpoints that support pagination.
Contains the requested page of results alongside pagination metadata and navigation links that allow clients to move through the full result set.
|
| PagedResponseOfDSBFederationDTO | Generic REST response wrapper for endpoints that support pagination.
Contains the requested page of results alongside pagination metadata and navigation links that allow clients to move through the full result set.
|
| PagedResponseOfDSBMatchDTO | Generic REST response wrapper for endpoints that support pagination.
Contains the requested page of results alongside pagination metadata and navigation links that allow clients to move through the full result set.
|
| PagedResponseOfDSBPersonDTO | Generic REST response wrapper for endpoints that support pagination.
Contains the requested page of results alongside pagination metadata and navigation links that allow clients to move through the full result set.
|
| PagedResponseOfDSBTournamentDTO | Generic REST response wrapper for endpoints that support pagination.
Contains the requested page of results alongside pagination metadata and navigation links that allow clients to move through the full result set.
|
| PersonalGender | Gender of a player: female or male. |
| ProcessingState | Processing state of a DSB tournament, describing its current position in the workflow. |
| RankingListState | |
| RankinglistEntryResponse | |
| RankinglistResponse | |
| RatingState | Rating state of a DSB tournament, indicating whether the DWZ calculation has been performed. |