aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/moazs/config
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/gv/egiz/moazs/config')
-rw-r--r--src/main/java/at/gv/egiz/moazs/config/MarshallerConfig.java52
1 files changed, 47 insertions, 5 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 e6e3cc1..6fdd128 100644
--- a/src/main/java/at/gv/egiz/moazs/config/MarshallerConfig.java
+++ b/src/main/java/at/gv/egiz/moazs/config/MarshallerConfig.java
@@ -1,5 +1,9 @@
package at.gv.egiz.moazs.config;
+import at.gv.egiz.moazs.Marshaller;
+import at.gv.egiz.moazs.MoaZSPrefixMapper;
+import com.sun.xml.bind.marshaller.NamespacePrefixMapper;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.oxm.jaxb.Jaxb2Marshaller;
@@ -10,19 +14,57 @@ import java.util.HashMap;
public class MarshallerConfig {
@Bean
- public Jaxb2Marshaller jaxb2Marshaller() {
+ 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);
+
+ marshaller.setMarshallerProperties(new HashMap<String, Object>() {{
+ put(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, true);
+ put("com.sun.xml.bind.namespacePrefixMapper", mzsMapper());
+ }});
+
+ 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,
- at.gv.zustellung.app2mzs.xsd.ObjectFactory.class,
- at.gv.zustellung.app2mzs.xsd.persondata.ObjectFactory.class);
+ at.gv.zustellung.msg.xsd.ObjectFactory.class,
+ at.gv.zustellung.msg.xsd.persondata.ObjectFactory.class);
marshaller.setMarshallerProperties(new HashMap<String, Object>() {{
put(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, true);
+ put("com.sun.xml.bind.namespacePrefixMapper", msgMapper());
}});
return marshaller;
}
+ @Bean
+ public Marshaller mzsMarshaller() {
+ return new Marshaller(mzsJaxbMarshaller());
+ }
+
+ @Bean
+ public Marshaller msgMarshaller() {
+ return new Marshaller(msgJaxbMarshaller());
+ }
+
+
}