Skip to content
This repository has been archived by the owner on Apr 16, 2022. It is now read-only.

Commit

Permalink
Exclude draft form definitions from Central list
Browse files Browse the repository at this point in the history
  • Loading branch information
lognaturel committed Oct 26, 2020
1 parent b55a171 commit 663627f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ public Request<List<RemoteFormDefinition>> getFormsListRequest(String token) {
.withPath("/v1/projects/" + projectId + "/forms")
.withHeader("Authorization", "Bearer " + token)
.withResponseMapper(list -> list.stream()
.filter(json -> json.get("publishedAt") != null)
.map(json -> new RemoteFormDefinition(
(String) json.get("name"),
(String) json.get("xmlFormId"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -247,11 +250,13 @@ public static String listOfFormsResponseFromCentral(FormStatus... forms) {
"\t{\n" +
"\t \"xmlFormId\": \"%s\",\n" +
"\t \"name\": \"%s\",\n" +
"\t \"version\": %s\n" +
"\t \"version\": %s\n," +
"\t \"publishedAt\": \"%s\"\n" +
"\t}",
form.getFormId(),
form.getFormName(),
form.getFormDefinition().getVersionString() == null ? "null" : "\"" + form.getFormDefinition().getVersionString() + "\""
form.getFormDefinition().getVersionString() == null ? "null" : "\"" + form.getFormDefinition().getVersionString() + "\"",
ZonedDateTime.now( ZoneOffset.UTC ).format( DateTimeFormatter.ISO_INSTANT )
))
.collect(joining(",\n"))
+ "\n]";
Expand Down

0 comments on commit 663627f

Please sign in to comment.