Compare commits

...

1 Commits

Author SHA1 Message Date
Alessia Bardi 300df8b278 serialize instance.license in the XML record 2021-07-28 14:16:13 +02:00
2 changed files with 12 additions and 0 deletions

View File

@ -1134,6 +1134,14 @@ public class XmlRecordFactory implements Serializable {
.add( .add(
XmlSerializationUtils.mapQualifier("accessright", instance.getAccessright())); XmlSerializationUtils.mapQualifier("accessright", instance.getAccessright()));
} }
if (instance.getLicense() != null
&& isNotBlank(instance.getLicense().getValue())) {
fields
.add(
XmlSerializationUtils
.asXmlElement(
"license", instance.getLicense().getValue()));
}
if (instance.getCollectedfrom() != null && kvNotBlank(instance.getCollectedfrom())) { if (instance.getCollectedfrom() != null && kvNotBlank(instance.getCollectedfrom())) {
fields fields
.add( .add(

View File

@ -7,6 +7,8 @@ import java.io.IOException;
import java.io.StringReader; import java.io.StringReader;
import java.util.List; import java.util.List;
import javax.validation.constraints.AssertTrue;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.dom4j.Document; import org.dom4j.Document;
import org.dom4j.DocumentException; import org.dom4j.DocumentException;
@ -150,6 +152,8 @@ public class XmlRecordFactoryTest {
Dataset d = OBJECT_MAPPER Dataset d = OBJECT_MAPPER
.readValue(IOUtils.toString(getClass().getResourceAsStream("enermaps.json")), Dataset.class); .readValue(IOUtils.toString(getClass().getResourceAsStream("enermaps.json")), Dataset.class);
assertNotNull(d.getInstance().get(0).getLicense().getValue());
JoinedEntity je = new JoinedEntity<>(d); JoinedEntity je = new JoinedEntity<>(d);
String xml = xmlRecordFactory.build(je); String xml = xmlRecordFactory.build(je);