-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
APCV-913 added pagination logic. (#217)
- Loading branch information
1 parent
0d0df0b
commit 8d48ff8
Showing
8 changed files
with
310 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 6 additions & 35 deletions
41
tnt/src/main/java/org/dcsa/conformance/standards/tnt/party/DynamicScenarioParameters.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,18 @@ | ||
package org.dcsa.conformance.standards.tnt.party; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.node.ObjectNode; | ||
import lombok.NonNull; | ||
import lombok.With; | ||
import org.dcsa.conformance.core.party.ScenarioParameters; | ||
|
||
import static org.dcsa.conformance.core.toolkit.JsonToolkit.OBJECT_MAPPER; | ||
|
||
@With | ||
public record DynamicScenarioParameters( | ||
String cursor, | ||
String firstPage, | ||
String lastPage, | ||
String nextPage, | ||
String prevPage) { | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public record DynamicScenarioParameters(String cursor, String firstPage, String secondPage) | ||
implements ScenarioParameters { | ||
|
||
public static DynamicScenarioParameters fromJson(JsonNode jsonNode) { | ||
ObjectNode dspNode = (ObjectNode) jsonNode; | ||
return new DynamicScenarioParameters( | ||
dspNode.path("cursor").asText(), | ||
dspNode.path("firstPage").asText(), | ||
dspNode.path("lastPage").asText(), | ||
dspNode.path("prevPage").asText(), | ||
dspNode.path("nextPage").asText()); | ||
} | ||
|
||
public ObjectNode toJson() { | ||
ObjectNode dspNode = OBJECT_MAPPER.createObjectNode(); | ||
if (cursor != null) { | ||
dspNode.put("cursor", cursor); | ||
} | ||
if (firstPage != null) { | ||
dspNode.put("firstPage", firstPage); | ||
} | ||
if (lastPage != null) { | ||
dspNode.put("lastPage", lastPage); | ||
} | ||
if (nextPage != null) { | ||
dspNode.put("nextPage", nextPage); | ||
} | ||
if (prevPage != null) { | ||
dspNode.put("prevPage", prevPage); | ||
} | ||
return dspNode; | ||
return OBJECT_MAPPER.convertValue(jsonNode, DynamicScenarioParameters.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.