package at.gv.egiz.moazs.scheme; import com.sun.xml.bind.marshaller.NamespacePrefixMapper; import org.springframework.stereotype.Component; import java.util.HashMap; import java.util.Map; @Component public class MoaZSPrefixMapper extends NamespacePrefixMapper { private final Map map = new HashMap<>(); public MoaZSPrefixMapper() { map.put(NameSpace.MSG, "msg"); map.put(NameSpace.MSGP, "msgp"); map.put(NameSpace.MZS, "mzs"); map.put(NameSpace.MZSP, "mzsp"); map.put(NameSpace.DSIG, "dsig"); } public MoaZSPrefixMapper(boolean isMzs) { this(); map.put((isMzs) ? NameSpace.MZSP : NameSpace.MSGP, "p"); map.put((isMzs) ? NameSpace.MZS : NameSpace.MSG , ""); } @Override public String getPreferredPrefix(String namespaceUri, String suggestion, boolean requirePrefix) { return map.getOrDefault(namespaceUri, suggestion); } }