Skip to content

Commit

Permalink
CARDS-1336: Serialize survey responses to EPIC-friendly json format
Browse files Browse the repository at this point in the history
Updated code to take into consideration the most recent changes of 1884
  • Loading branch information
veronikaslc committed Nov 9, 2022
1 parent 665b73e commit 3910b24
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ public JsonValue processChild(Node node, Node child, JsonValue input, Function<N
.filter(value -> ValueType.OBJECT.equals(value.getValueType()))
.map(JsonValue::asJsonObject)
.filter(value -> value.containsKey("jcr:primaryType")
&& "cards:IdMapping".equals(value.getString("jcr:primaryType")))
&& "cards:ExternalLink".equals(value.getString("jcr:primaryType"))
&& "epic".equals(value.getString("label")))
.map(value -> value.getString("value"))
.findFirst().orElse("");
answersObj.add("linkId", "<ID of the Question ID Type>|" + questionId);
Expand Down Expand Up @@ -167,7 +168,8 @@ public void leave(Node node, JsonObjectBuilder json, Function<Node, JsonValue> s
String questionnaireId = questionnaire.getIdentifier();
for (NodeIterator i = questionnaire.getNodes(); i.hasNext();) {
Node child = i.nextNode();
if ("cards:IdMapping".equals(child.getPrimaryNodeType().getName())) {
if ("cards:ExternalLink".equals(child.getPrimaryNodeType().getName())
&& "epic".equals(child.getProperty("label").getString())) {
questionnaireId = child.getProperty("value").getString();
}
}
Expand Down

0 comments on commit 3910b24

Please sign in to comment.