// Path: common/src/main/java/com/nortal/jroad/enums/XRoadProtocolVersion.java
// public enum XRoadProtocolVersion {
// 
//   V2_0("2.0", "xtee", "http://x-tee.riik.ee/xsd/xtee.xsd"),
//   V3_0("3.0", "xrd", "http://x-rd.net/xsd/xroad.xsd"),
//   V3_1("3.1", "xrd", "http://x-road.ee/xsd/x-road.xsd"),
//   V4_0("4.0", "xrd", "http://x-road.eu/xsd/xroad.xsd");
// 
//   private final String code;
//   private final String namespacePrefix;
//   private final String namespaceUri;
// 
//   private XRoadProtocolVersion(String code, String namespacePrefix, String namespaceUri) {
//     this.code = code;
//     this.namespaceUri = namespaceUri;
//     this.namespacePrefix = namespacePrefix;
//   }
// 
//   public String getCode() {
//     return code;
//   }
// 
//   public String getNamespacePrefix() {
//     return namespacePrefix;
//   }
// 
//   public String getNamespaceUri() {
//     return namespaceUri;
//   }
// 
//   public static XRoadProtocolVersion getValueByVersionCode(String code) {
//     for (XRoadProtocolVersion version : XRoadProtocolVersion.values()) {
//       if (version.getCode().equals(code)) {
//         return version;
//       }
//     }
//     return null;
//   }
// 
//   public static XRoadProtocolVersion getValueByNamespaceURI(String uri) {
//     for (XRoadProtocolVersion version : XRoadProtocolVersion.values()) {
//       if (version.getNamespaceUri().startsWith(uri)) {
//         return version;
//       }
//     }
//     return null;
//   }
// 
// }
// 
// Path: common/src/main/java/com/nortal/jroad/model/BeanXTeeMessage.java
// @Deprecated
// public class BeanXTeeMessage<T> implements XTeeMessage<T> {
//   private List<XTeeAttachment> attachments;
//   private XTeeHeader header;
//   private T content;
// 
//   public BeanXTeeMessage(XTeeHeader header, T content, List<XTeeAttachment> attachments) {
//     this.attachments = attachments;
//     this.header = header;
//     this.content = content;
//   }
// 
//   public List<XTeeAttachment> getAttachments() {
//     return attachments;
//   }
// 
//   public XTeeHeader getHeader() {
//     return header;
//   }
// 
//   public T getContent() {
//     return content;
//   }
// 
//   public void setContent(T content) {
//     this.content = content;
//   }
// 
//   public void setAttachments(List<XTeeAttachment> attachments) {
//     this.attachments = attachments;
//   }
// 
//   public void setHeader(XTeeHeader header) {
//     this.header = header;
//   }
// }
// 
// Path: common/src/main/java/com/nortal/jroad/util/AttachmentUtil.java
// public class AttachmentUtil {
//   private static long salt = 0;
// 
//   public static String getUniqueCid() {
//     salt++;
//     return UUID.randomUUID().toString() + String.valueOf(salt);
//   }
// 
// }


import com.nortal.jroad.enums.XRoadProtocolVersion;
import com.nortal.jroad.model.BeanXTeeMessage;
import com.nortal.jroad.model.XTeeAttachment;
import com.nortal.jroad.model.XTeeMessage;
import com.nortal.jroad.util.AttachmentUtil;
import com.nortal.jroad.util.SOAPUtil;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.activation.DataHandler;
import javax.annotation.Resource;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.attachment.AttachmentMarshaller;
import javax.xml.bind.attachment.AttachmentUnmarshaller;
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
    }

  }

  private static class XTeeAttachmentMarshaller extends AttachmentMarshaller {
    private final List<XTeeAttachment> attachments;
    private long salt = 0;

    public XTeeAttachmentMarshaller(final XTeeMessage<?> message) {
      this.attachments = message.getAttachments();
    }

    @Override
    public String addMtomAttachment(final byte[] arg0,
                                    final int arg1,
                                    final int arg2,
                                    final String arg3,
                                    final String arg4,
                                    final String arg5) {
      throw new UnsupportedOperationException("MTOM Support is disabled!");
    }

    @Override
    public String addMtomAttachment(final DataHandler arg0, final String arg1, final String arg2) {
      throw new UnsupportedOperationException("MTOM Support is disabled!");
    }

    @Override
    public String addSwaRefAttachment(final DataHandler handler) {
      salt++;
// Path: common/src/main/java/com/nortal/jroad/enums/XRoadProtocolVersion.java
// public enum XRoadProtocolVersion {
// 
//   V2_0("2.0", "xtee", "http://x-tee.riik.ee/xsd/xtee.xsd"),
//   V3_0("3.0", "xrd", "http://x-rd.net/xsd/xroad.xsd"),
//   V3_1("3.1", "xrd", "http://x-road.ee/xsd/x-road.xsd"),
//   V4_0("4.0", "xrd", "http://x-road.eu/xsd/xroad.xsd");
// 
//   private final String code;
//   private final String namespacePrefix;
//   private final String namespaceUri;
// 
//   private XRoadProtocolVersion(String code, String namespacePrefix, String namespaceUri) {
//     this.code = code;
//     this.namespaceUri = namespaceUri;
//     this.namespacePrefix = namespacePrefix;
//   }
// 
//   public String getCode() {
//     return code;
//   }
// 
//   public String getNamespacePrefix() {
//     return namespacePrefix;
//   }
// 
//   public String getNamespaceUri() {
//     return namespaceUri;
//   }
// 
//   public static XRoadProtocolVersion getValueByVersionCode(String code) {
//     for (XRoadProtocolVersion version : XRoadProtocolVersion.values()) {
//       if (version.getCode().equals(code)) {
//         return version;
//       }
//     }
//     return null;
//   }
// 
//   public static XRoadProtocolVersion getValueByNamespaceURI(String uri) {
//     for (XRoadProtocolVersion version : XRoadProtocolVersion.values()) {
//       if (version.getNamespaceUri().startsWith(uri)) {
//         return version;
//       }
//     }
//     return null;
//   }
// 
// }
// 
// Path: common/src/main/java/com/nortal/jroad/model/BeanXTeeMessage.java
// @Deprecated
// public class BeanXTeeMessage<T> implements XTeeMessage<T> {
//   private List<XTeeAttachment> attachments;
//   private XTeeHeader header;
//   private T content;
// 
//   public BeanXTeeMessage(XTeeHeader header, T content, List<XTeeAttachment> attachments) {
//     this.attachments = attachments;
//     this.header = header;
//     this.content = content;
//   }
// 
//   public List<XTeeAttachment> getAttachments() {
//     return attachments;
//   }
// 
//   public XTeeHeader getHeader() {
//     return header;
//   }
// 
//   public T getContent() {
//     return content;
//   }
// 
//   public void setContent(T content) {
//     this.content = content;
//   }
// 
//   public void setAttachments(List<XTeeAttachment> attachments) {
//     this.attachments = attachments;
//   }
// 
//   public void setHeader(XTeeHeader header) {
//     this.header = header;
//   }
// }
// 
// Path: common/src/main/java/com/nortal/jroad/util/AttachmentUtil.java
// public class AttachmentUtil {
//   private static long salt = 0;
// 
//   public static String getUniqueCid() {
//     salt++;
//     return UUID.randomUUID().toString() + String.valueOf(salt);
//   }
// 
// }


// Path: server/src/main/java/com/nortal/jroad/endpoint/AbstractXTeeJAXBEndpoint.java
import com.nortal.jroad.enums.XRoadProtocolVersion;
import com.nortal.jroad.model.BeanXTeeMessage;
import com.nortal.jroad.model.XTeeAttachment;
import com.nortal.jroad.model.XTeeMessage;
import com.nortal.jroad.util.AttachmentUtil;
import com.nortal.jroad.util.SOAPUtil;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.activation.DataHandler;
import javax.annotation.Resource;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.attachment.AttachmentMarshaller;
import javax.xml.bind.attachment.AttachmentUnmarshaller;
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

    }

  }

  private static class XTeeAttachmentMarshaller extends AttachmentMarshaller {
    private final List<XTeeAttachment> attachments;
    private long salt = 0;

    public XTeeAttachmentMarshaller(final XTeeMessage<?> message) {
      this.attachments = message.getAttachments();
    }

    @Override
    public String addMtomAttachment(final byte[] arg0,
                                    final int arg1,
                                    final int arg2,
                                    final String arg3,
                                    final String arg4,
                                    final String arg5) {
      throw new UnsupportedOperationException("MTOM Support is disabled!");
    }

    @Override
    public String addMtomAttachment(final DataHandler arg0, final String arg1, final String arg2) {
      throw new UnsupportedOperationException("MTOM Support is disabled!");
    }

    @Override
    public String addSwaRefAttachment(final DataHandler handler) {
      salt++;
      String contentId = AttachmentUtil.getUniqueCid();