Loading pom.xml +12 −0 Original line number Original line Diff line number Diff line Loading @@ -44,6 +44,18 @@ <version>5.6.0</version> <version>5.6.0</version> <scope>test</scope> <scope>test</scope> </dependency> </dependency> <dependency> <groupId>com.jayway.jsonpath</groupId> <artifactId>json-path</artifactId> <version>2.4.0</version> <scope>test</scope> </dependency> <dependency> <groupId>com.jayway.jsonpath</groupId> <artifactId>json-path-assert</artifactId> <version>2.4.0</version> <scope>test</scope> </dependency> </dependencies> </dependencies> <build> <build> <finalName>${finalName}</finalName> <finalName>${finalName}</finalName> Loading src/main/java/it/inaf/oats/vospace/datamodel/NodeTypeSetter.javadeleted 100644 → 0 +0 −30 Original line number Original line Diff line number Diff line package it.inaf.oats.vospace.datamodel; import com.fasterxml.jackson.databind.util.StdConverter; import net.ivoa.xml.vospace.v2.Node; /** * Fills the type field at the end of the JSON deserialization. * Node implementations must be annotated with * @JsonDeserialize(converter = NodeTypeAdder.<NodeType>.class) */ public class NodeTypeSetter<T extends Node> extends StdConverter<T, T> { @Override public T convert(T node) { node.setType("vos:" + node.getClass().getSimpleName()); return node; } public static class UnstructuredDataNode extends NodeTypeSetter<net.ivoa.xml.vospace.v2.UnstructuredDataNode> { } public static class StructuredDataNode extends NodeTypeSetter<net.ivoa.xml.vospace.v2.StructuredDataNode> { } public static class ContainerNode extends NodeTypeSetter<net.ivoa.xml.vospace.v2.ContainerNode> { } public static class LinkNode extends NodeTypeSetter<net.ivoa.xml.vospace.v2.LinkNode> { } } src/main/java/net/ivoa/xml/vospace/v2/ContainerNode.java +27 −98 Original line number Original line Diff line number Diff line Loading @@ -4,29 +4,28 @@ // Any modifications to this file will be lost upon recompilation of the source schema. // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2020.10.24 at 09:39:16 AM CEST // Generated on: 2020.10.24 at 09:39:16 AM CEST // // package net.ivoa.xml.vospace.v2; package net.ivoa.xml.vospace.v2; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import it.inaf.oats.vospace.datamodel.NodeTypeSetter; import java.util.ArrayList; import java.util.ArrayList; import java.util.List; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType; /** /** * * * A container node containing any type of node. * A container node containing any type of node. * * * * * <p>Java class for ContainerNode complex type. * <p> * Java class for ContainerNode complex type. * * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * The following schema fragment specifies the expected content contained within * this class. * * * <pre> * <pre> * <complexType name="ContainerNode"> * <complexType name="ContainerNode"> Loading Loading @@ -58,96 +57,26 @@ import javax.xml.bind.annotation.XmlType; }) }) // <edit> // <edit> @XmlRootElement(name = "node") @XmlRootElement(name = "node") @JsonDeserialize(converter = NodeTypeSetter.ContainerNode.class) // </edit> // </edit> public class ContainerNode public class ContainerNode extends DataNode extends DataNode { { @XmlElement(required = true) // <edit> protected ContainerNode.Nodes nodes; // Auto-generated class defined an inner ContainerNode.Nodes wrapper class. // This should simplify usage and JSON compatibility. @XmlElement(name = "node") @XmlElementWrapper(name = "nodes", required = true) protected List<Node> nodes; /** public List<Node> getNodes() { * Gets the value of the nodes property. if (nodes == null) { * nodes = new ArrayList<>(); * @return } * possible object is * {@link ContainerNode.Nodes } * */ public ContainerNode.Nodes getNodes() { return nodes; return nodes; } } /** public void setNodes(List<Node> value) { * Sets the value of the nodes property. * * @param value * allowed object is * {@link ContainerNode.Nodes } * */ public void setNodes(ContainerNode.Nodes value) { this.nodes = value; this.nodes = value; } } // </edit> /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * <complexType> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element name="node" type="{http://www.ivoa.net/xml/VOSpace/v2.0}Node" maxOccurs="unbounded" minOccurs="0"/> * </sequence> * </restriction> * </complexContent> * </complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "node" }) public static class Nodes { protected List<Node> node; /** * Gets the value of the node property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the node property. * * <p> * For example, to add a new item, do as follows: * <pre> * getNode().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Node } * * */ public List<Node> getNode() { if (node == null) { node = new ArrayList<Node>(); } return this.node; } } } } src/main/java/net/ivoa/xml/vospace/v2/DataNode.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -11,6 +11,7 @@ package net.ivoa.xml.vospace.v2; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType; Loading Loading @@ -52,6 +53,9 @@ import javax.xml.bind.annotation.XmlType; ContainerNode.class, ContainerNode.class, UnstructuredDataNode.class UnstructuredDataNode.class }) }) // <edit> @XmlRootElement(name = "node") // </edit> public class DataNode public class DataNode extends Node extends Node { { Loading src/main/java/net/ivoa/xml/vospace/v2/LinkNode.java +0 −3 Original line number Original line Diff line number Diff line Loading @@ -8,8 +8,6 @@ package net.ivoa.xml.vospace.v2; package net.ivoa.xml.vospace.v2; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import it.inaf.oats.vospace.datamodel.NodeTypeSetter; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement; Loading Loading @@ -47,7 +45,6 @@ import javax.xml.bind.annotation.XmlType; }) }) // <edit> // <edit> @XmlRootElement(name = "node") @XmlRootElement(name = "node") @JsonDeserialize(converter = NodeTypeSetter.LinkNode.class) // </edit> // </edit> public class LinkNode public class LinkNode extends Node extends Node Loading Loading
pom.xml +12 −0 Original line number Original line Diff line number Diff line Loading @@ -44,6 +44,18 @@ <version>5.6.0</version> <version>5.6.0</version> <scope>test</scope> <scope>test</scope> </dependency> </dependency> <dependency> <groupId>com.jayway.jsonpath</groupId> <artifactId>json-path</artifactId> <version>2.4.0</version> <scope>test</scope> </dependency> <dependency> <groupId>com.jayway.jsonpath</groupId> <artifactId>json-path-assert</artifactId> <version>2.4.0</version> <scope>test</scope> </dependency> </dependencies> </dependencies> <build> <build> <finalName>${finalName}</finalName> <finalName>${finalName}</finalName> Loading
src/main/java/it/inaf/oats/vospace/datamodel/NodeTypeSetter.javadeleted 100644 → 0 +0 −30 Original line number Original line Diff line number Diff line package it.inaf.oats.vospace.datamodel; import com.fasterxml.jackson.databind.util.StdConverter; import net.ivoa.xml.vospace.v2.Node; /** * Fills the type field at the end of the JSON deserialization. * Node implementations must be annotated with * @JsonDeserialize(converter = NodeTypeAdder.<NodeType>.class) */ public class NodeTypeSetter<T extends Node> extends StdConverter<T, T> { @Override public T convert(T node) { node.setType("vos:" + node.getClass().getSimpleName()); return node; } public static class UnstructuredDataNode extends NodeTypeSetter<net.ivoa.xml.vospace.v2.UnstructuredDataNode> { } public static class StructuredDataNode extends NodeTypeSetter<net.ivoa.xml.vospace.v2.StructuredDataNode> { } public static class ContainerNode extends NodeTypeSetter<net.ivoa.xml.vospace.v2.ContainerNode> { } public static class LinkNode extends NodeTypeSetter<net.ivoa.xml.vospace.v2.LinkNode> { } }
src/main/java/net/ivoa/xml/vospace/v2/ContainerNode.java +27 −98 Original line number Original line Diff line number Diff line Loading @@ -4,29 +4,28 @@ // Any modifications to this file will be lost upon recompilation of the source schema. // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2020.10.24 at 09:39:16 AM CEST // Generated on: 2020.10.24 at 09:39:16 AM CEST // // package net.ivoa.xml.vospace.v2; package net.ivoa.xml.vospace.v2; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import it.inaf.oats.vospace.datamodel.NodeTypeSetter; import java.util.ArrayList; import java.util.ArrayList; import java.util.List; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType; /** /** * * * A container node containing any type of node. * A container node containing any type of node. * * * * * <p>Java class for ContainerNode complex type. * <p> * Java class for ContainerNode complex type. * * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * The following schema fragment specifies the expected content contained within * this class. * * * <pre> * <pre> * <complexType name="ContainerNode"> * <complexType name="ContainerNode"> Loading Loading @@ -58,96 +57,26 @@ import javax.xml.bind.annotation.XmlType; }) }) // <edit> // <edit> @XmlRootElement(name = "node") @XmlRootElement(name = "node") @JsonDeserialize(converter = NodeTypeSetter.ContainerNode.class) // </edit> // </edit> public class ContainerNode public class ContainerNode extends DataNode extends DataNode { { @XmlElement(required = true) // <edit> protected ContainerNode.Nodes nodes; // Auto-generated class defined an inner ContainerNode.Nodes wrapper class. // This should simplify usage and JSON compatibility. @XmlElement(name = "node") @XmlElementWrapper(name = "nodes", required = true) protected List<Node> nodes; /** public List<Node> getNodes() { * Gets the value of the nodes property. if (nodes == null) { * nodes = new ArrayList<>(); * @return } * possible object is * {@link ContainerNode.Nodes } * */ public ContainerNode.Nodes getNodes() { return nodes; return nodes; } } /** public void setNodes(List<Node> value) { * Sets the value of the nodes property. * * @param value * allowed object is * {@link ContainerNode.Nodes } * */ public void setNodes(ContainerNode.Nodes value) { this.nodes = value; this.nodes = value; } } // </edit> /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * <complexType> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element name="node" type="{http://www.ivoa.net/xml/VOSpace/v2.0}Node" maxOccurs="unbounded" minOccurs="0"/> * </sequence> * </restriction> * </complexContent> * </complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "node" }) public static class Nodes { protected List<Node> node; /** * Gets the value of the node property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the node property. * * <p> * For example, to add a new item, do as follows: * <pre> * getNode().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link Node } * * */ public List<Node> getNode() { if (node == null) { node = new ArrayList<Node>(); } return this.node; } } } }
src/main/java/net/ivoa/xml/vospace/v2/DataNode.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -11,6 +11,7 @@ package net.ivoa.xml.vospace.v2; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType; Loading Loading @@ -52,6 +53,9 @@ import javax.xml.bind.annotation.XmlType; ContainerNode.class, ContainerNode.class, UnstructuredDataNode.class UnstructuredDataNode.class }) }) // <edit> @XmlRootElement(name = "node") // </edit> public class DataNode public class DataNode extends Node extends Node { { Loading
src/main/java/net/ivoa/xml/vospace/v2/LinkNode.java +0 −3 Original line number Original line Diff line number Diff line Loading @@ -8,8 +8,6 @@ package net.ivoa.xml.vospace.v2; package net.ivoa.xml.vospace.v2; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import it.inaf.oats.vospace.datamodel.NodeTypeSetter; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement; Loading Loading @@ -47,7 +45,6 @@ import javax.xml.bind.annotation.XmlType; }) }) // <edit> // <edit> @XmlRootElement(name = "node") @XmlRootElement(name = "node") @JsonDeserialize(converter = NodeTypeSetter.LinkNode.class) // </edit> // </edit> public class LinkNode public class LinkNode extends Node extends Node Loading