Skip to content

Commit

Permalink
Merge branch 'rpb-255-null' of https://github.com/hbz/rpb into main
Browse files Browse the repository at this point in the history
  • Loading branch information
fsteeg committed Feb 14, 2025
2 parents fb65fbf + 178a2bb commit b466ffc
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions app/views/TableRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,27 +111,29 @@ public String process(JsonNode doc, String property, String param,
private String label(JsonNode doc, String value, List<String> properties) {
List<String> results = new ArrayList<>();
List<String> resultValues = labelsFor(doc, value, properties);
JsonNode labelNode = doc.get(properties.get(0)).iterator().next().get("label");
for (int i = 0; i < resultValues.size(); i++) {
String currentValue = resultValues.get(i);
String[] refAndLabel =
refAndLabel(properties.get(i), currentValue, Optional.empty());
String label = labelNode != null ? labelNode.textValue() : refAndLabel[1];
String result =
properties.get(i).equals("numbering") || value.equals("--")
? currentValue
: String.format(
"<a title=\"Titeldetails anzeigen\" href=\"%s\">%s</a>",
refAndLabel[0], label);
results.add(result.replace("Band", "").trim());
if (doc.get(properties.get(0)) != null) {
JsonNode labelNode = doc.get(properties.get(0)).iterator().next().get("label");
for (int i = 0; i < resultValues.size(); i++) {
String currentValue = resultValues.get(i);
String[] refAndLabel =
refAndLabel(properties.get(i), currentValue, Optional.empty());
String label = labelNode != null ? labelNode.textValue() : refAndLabel[1];
String result =
properties.get(i).equals("numbering") || value.equals("--")
? currentValue
: String.format(
"<a title=\"Titeldetails anzeigen\" href=\"%s\">%s</a>",
refAndLabel[0], label);
results.add(result.replace("Band", "").trim());
}
}
return results.stream().collect(Collectors.joining(", Band "));
}

private List<String> labelsFor(JsonNode doc, String value,
List<String> keys) {
List<String> result = new ArrayList<>();
if (doc != null) {
if (doc != null && doc.get(keys.get(0)) != null) {
JsonNode node = doc.get(keys.get(0)).iterator().next();
JsonNode id = node.get("id");
JsonNode label = node.get("label");
Expand Down

0 comments on commit b466ffc

Please sign in to comment.