1
0
Fork 0

[graph provision]fixed wf definition, revised serialization of the usage counts measures

This commit is contained in:
Claudio Atzori 2024-05-21 13:47:05 +02:00
parent 92f018d196
commit 834461ba26
2 changed files with 9 additions and 20 deletions

View File

@ -170,30 +170,19 @@ public class XmlSerializationUtils {
return sb.toString();
}
// <measure downloads="0" views="0">infrastruct_::f66f1bd369679b5b077dcdf006089556||OpenAIRE</measure>
// <measure views="0" datasource="infrastruct_::f66f1bd369679b5b077dcdf006089556||OpenAIRE" />
// <measure downloads="0" datasource="infrastruct_::f66f1bd369679b5b077dcdf006089556||OpenAIRE" />
public static String usageMeasureAsXmlElement(String name, Measure measure) {
HashSet<String> dsIds = Optional
.ofNullable(measure.getUnit())
.map(
m -> m
.stream()
.map(KeyValue::getKey)
.collect(Collectors.toCollection(HashSet::new)))
.orElse(new HashSet<>());
StringBuilder sb = new StringBuilder();
dsIds.forEach(dsId -> {
for (KeyValue kv : measure.getUnit()) {
sb
.append("<")
.append(name);
for (KeyValue kv : measure.getUnit()) {
sb.append(" ").append(attr(measure.getId(), kv.getValue()));
}
sb
.append(name)
.append(" ")
.append(attr("datasource", dsId))
.append("/>");
});
.append(attr(measure.getId(), kv.getValue()))
.append(attr("datasource", kv.getKey()))
.append(" />");
}
return sb.toString();
}

View File

@ -15,8 +15,8 @@
</property>
<property>
<name>validateXML</name>
<description>should the payload converter validate the XMLs</description>
<value>false</value>
<description>should the payload converter validate the XMLs</description>
</property>
<property>
<name>relPartitions</name>