aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/gv/egiz')
-rw-r--r--src/main/java/at/gv/egiz/moazs/config/MarshallerConfig.java47
-rw-r--r--src/main/java/at/gv/egiz/moazs/scheme/Marshaller.java15
2 files changed, 15 insertions, 47 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/config/MarshallerConfig.java b/src/main/java/at/gv/egiz/moazs/config/MarshallerConfig.java
index bde33c1..38f4c1a 100644
--- a/src/main/java/at/gv/egiz/moazs/config/MarshallerConfig.java
+++ b/src/main/java/at/gv/egiz/moazs/config/MarshallerConfig.java
@@ -13,56 +13,13 @@ import java.util.HashMap;
public class MarshallerConfig {
@Bean
- public NamespacePrefixMapper msgMapper() {
- return new MoaZSPrefixMapper(false);
- }
-
- @Bean
- public NamespacePrefixMapper mzsMapper() {
- return new MoaZSPrefixMapper(true);
- }
-
- @Bean
- public Jaxb2Marshaller mzsJaxbMarshaller() {
- Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
-
- marshaller.setClassesToBeBound(
- at.gv.zustellung.app2mzs.xsd.ObjectFactory.class,
- at.gv.zustellung.app2mzs.xsd.persondata.ObjectFactory.class,
- at.gv.zustellung.msg.xsd.ObjectFactory.class);
-
- var map = new HashMap<String, Object>();
- map.put(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, true);
- map.put("com.sun.xml.bind.namespacePrefixMapper", mzsMapper());
- marshaller.setMarshallerProperties(map);
-
- return marshaller;
- }
-
- @Bean
- public Jaxb2Marshaller msgJaxbMarshaller() {
- Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
-
- marshaller.setClassesToBeBound(
- at.gv.zustellung.msg.xsd.ObjectFactory.class,
- at.gv.zustellung.msg.xsd.persondata.ObjectFactory.class);
-
- var map = new HashMap<String, Object>();
- map.put(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, true);
- map.put("com.sun.xml.bind.namespacePrefixMapper", msgMapper());
- marshaller.setMarshallerProperties(map);
-
- return marshaller;
- }
-
- @Bean
public Marshaller mzsMarshaller() {
- return new Marshaller(mzsJaxbMarshaller());
+ return new Marshaller(true);
}
@Bean
public Marshaller msgMarshaller() {
- return new Marshaller(msgJaxbMarshaller());
+ return new Marshaller(false);
}
diff --git a/src/main/java/at/gv/egiz/moazs/scheme/Marshaller.java b/src/main/java/at/gv/egiz/moazs/scheme/Marshaller.java
index 3c82419..83ace5c 100644
--- a/src/main/java/at/gv/egiz/moazs/scheme/Marshaller.java
+++ b/src/main/java/at/gv/egiz/moazs/scheme/Marshaller.java
@@ -7,6 +7,7 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import java.io.InputStream;
import java.io.StringWriter;
+import java.util.HashMap;
/**
* @author xerx593
@@ -16,8 +17,18 @@ public class Marshaller {
private final Jaxb2Marshaller jaxbMarshaller;
- public Marshaller(Jaxb2Marshaller marshaller) {
- this.jaxbMarshaller = marshaller;
+ public Marshaller(boolean isMzs) {
+ this.jaxbMarshaller = new Jaxb2Marshaller();
+
+ jaxbMarshaller.setClassesToBeBound(
+ at.gv.zustellung.app2mzs.xsd.ObjectFactory.class,
+ at.gv.zustellung.app2mzs.xsd.persondata.ObjectFactory.class,
+ at.gv.zustellung.msg.xsd.ObjectFactory.class);
+
+ var map = new HashMap<String, Object>();
+ map.put(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, true);
+ map.put("com.sun.xml.bind.namespacePrefixMapper", new MoaZSPrefixMapper(isMzs));
+ jaxbMarshaller.setMarshallerProperties(map);
}
public <T> String marshallXml(final T obj) {