[downloadsAndViews] changed the serialization for downloads and views

This commit is contained in:
Miriam Baglioni 2024-06-05 16:18:46 +02:00
parent 128c143394
commit 3955ceaa76
1 changed files with 9 additions and 8 deletions

View File

@ -170,18 +170,19 @@ public class XmlSerializationUtils {
return sb.toString(); return sb.toString();
} }
// <measure views="0" datasource="infrastruct_::f66f1bd369679b5b077dcdf006089556||OpenAIRE" /> // <measure id="views" count="0" datasource="infrastruct_::f66f1bd369679b5b077dcdf006089556||OpenAIRE" />
// <measure downloads="0" datasource="infrastruct_::f66f1bd369679b5b077dcdf006089556||OpenAIRE" /> // <measure id="downloads" count="0" datasource="infrastruct_::f66f1bd369679b5b077dcdf006089556||OpenAIRE" />
public static String usageMeasureAsXmlElement(String name, Measure measure) { public static String usageMeasureAsXmlElement(String name, Measure measure) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (KeyValue kv : measure.getUnit()) { for (KeyValue kv : measure.getUnit()) {
sb sb
.append("<") .append("<")
.append(name) .append(name)
.append(" ") .append(" ")
.append(attr(measure.getId(), kv.getValue())) .append(attr("id", measure.getId()))
.append(attr("datasource", kv.getKey())) .append(attr("count", kv.getValue()))
.append(" />"); .append(attr("datasource", kv.getKey()))
.append(" />");
} }
return sb.toString(); return sb.toString();
} }