From 62e122b1079aacb98a3670892820a4b51dce2e35 Mon Sep 17 00:00:00 2001 From: Robert von Burg Date: Tue, 23 Aug 2022 14:22:22 +0200 Subject: [PATCH] [Fix] Fixed writing empty Resource with version --- .../model/xml/StrolchElementToSaxWriterVisitor.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/li.strolch.model/src/main/java/li/strolch/model/xml/StrolchElementToSaxWriterVisitor.java b/li.strolch.model/src/main/java/li/strolch/model/xml/StrolchElementToSaxWriterVisitor.java index a42fa25e0..d7ef5596f 100644 --- a/li.strolch.model/src/main/java/li/strolch/model/xml/StrolchElementToSaxWriterVisitor.java +++ b/li.strolch.model/src/main/java/li/strolch/model/xml/StrolchElementToSaxWriterVisitor.java @@ -98,7 +98,8 @@ public class StrolchElementToSaxWriterVisitor implements StrolchRootElementVisit } protected void writeElement(Resource resource) throws XMLStreamException { - boolean empty = !resource.hasParameterBags() && !resource.hasTimedStates() && !resource.hasPolicyDefs(); + boolean empty = !resource.hasVersion() && !resource.hasParameterBags() && !resource.hasTimedStates() + && !resource.hasPolicyDefs(); writeStartStrolchElement(Tags.RESOURCE, empty, resource); @@ -119,7 +120,7 @@ public class StrolchElementToSaxWriterVisitor implements StrolchRootElementVisit } protected void writeElement(Order order) throws XMLStreamException { - boolean empty = !order.hasParameterBags() && !order.hasPolicyDefs(); + boolean empty = !order.hasVersion() && !order.hasParameterBags() && !order.hasPolicyDefs(); writeStartStrolchElement(Tags.ORDER, empty, order); this.writer.writeAttribute(Tags.DATE, ISO8601.toString(order.getDateZdt())); @@ -139,7 +140,7 @@ public class StrolchElementToSaxWriterVisitor implements StrolchRootElementVisit } protected void writeElement(Activity activity) throws XMLStreamException { - boolean empty = activity.hasVersion() && !activity.hasParameterBags() && !activity.hasElements() + boolean empty = !activity.hasVersion() && !activity.hasParameterBags() && !activity.hasElements() && !activity.hasPolicyDefs(); writeStartStrolchElement(Tags.ACTIVITY, empty, activity);