diff --git a/src/main/java/net/ivoa/xml/uws/v1/JobSummary.java b/src/main/java/net/ivoa/xml/uws/v1/JobSummary.java index 64dac435a553e2d86be5452ed2805be509e437fd..b755062d96cd82b22177bb8dbeb968175fac1901 100644 --- a/src/main/java/net/ivoa/xml/uws/v1/JobSummary.java +++ b/src/main/java/net/ivoa/xml/uws/v1/JobSummary.java @@ -21,6 +21,7 @@ import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlSeeAlso; @@ -108,8 +109,9 @@ public class JobSummary { @XmlElement(required = true) @XmlSchemaType(name = "string") protected ExecutionPhase phase; - @XmlElementRef(name = "quote", namespace = "http://www.ivoa.net/xml/UWS/v1.0", type = JAXBElement.class, required = false) - protected JAXBElement<XMLGregorianCalendar> quote; + // <edit> + protected XMLGregorianCalendar quote; + // </edit> @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar creationTime; @XmlElement(required = true, nillable = true) @@ -123,8 +125,11 @@ public class JobSummary { @XmlSchemaType(name = "dateTime") protected XMLGregorianCalendar destruction; protected Parameters parameters; - @XmlElement(required = true) - protected Results results; + // <edit>: replaced Results with List<ResultReference> + @XmlElement(name = "result") + @XmlElementWrapper(name = "results", required = true) + protected List<ResultReference> results; + // </edit> protected ErrorSummary errorSummary; protected JobSummary.JobInfo jobInfo; @XmlAttribute(name = "version") @@ -234,7 +239,8 @@ public class JobSummary { * {@link JAXBElement }{@code <}{@link XMLGregorianCalendar }{@code >} * */ - public JAXBElement<XMLGregorianCalendar> getQuote() { + // <edit> + public XMLGregorianCalendar getQuote() { return quote; } @@ -246,9 +252,10 @@ public class JobSummary { * {@link JAXBElement }{@code <}{@link XMLGregorianCalendar }{@code >} * */ - public void setQuote(JAXBElement<XMLGregorianCalendar> value) { + public void setQuote(XMLGregorianCalendar value) { this.quote = value; } + // </edit> /** * Gets the value of the creationTime property. @@ -400,21 +407,18 @@ public class JobSummary { * {@link Results } * */ - public Results getResults() { + // <edit> + public List<ResultReference> getResults() { + if (results == null) { + results = new ArrayList<>(); + } return results; } - /** - * Sets the value of the results property. - * - * @param value - * allowed object is - * {@link Results } - * - */ - public void setResults(Results value) { + public void setResults(List<ResultReference> value) { this.results = value; } + // </edit> /** * Gets the value of the errorSummary property. diff --git a/src/main/java/net/ivoa/xml/uws/v1/ObjectFactory.java b/src/main/java/net/ivoa/xml/uws/v1/ObjectFactory.java deleted file mode 100644 index b02d04cebe124000bc043eba764c499164925259..0000000000000000000000000000000000000000 --- a/src/main/java/net/ivoa/xml/uws/v1/ObjectFactory.java +++ /dev/null @@ -1,145 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> -// 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 -// - - -package net.ivoa.xml.uws.v1; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.XmlElementDecl; -import javax.xml.bind.annotation.XmlRegistry; -import javax.xml.datatype.XMLGregorianCalendar; -import javax.xml.namespace.QName; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the net.ivoa.xml.uws.v1 package. - * <p>An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - private final static QName _Job_QNAME = new QName("http://www.ivoa.net/xml/UWS/v1.0", "job"); - private final static QName _JobSummaryQuote_QNAME = new QName("http://www.ivoa.net/xml/UWS/v1.0", "quote"); - private final static QName _ShortJobDescriptionOwnerId_QNAME = new QName("http://www.ivoa.net/xml/UWS/v1.0", "ownerId"); - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: net.ivoa.xml.uws.v1 - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link JobSummary } - * - */ - public JobSummary createJobSummary() { - return new JobSummary(); - } - - /** - * Create an instance of {@link Jobs } - * - */ - public Jobs createJobs() { - return new Jobs(); - } - - /** - * Create an instance of {@link ShortJobDescription } - * - */ - public ShortJobDescription createShortJobDescription() { - return new ShortJobDescription(); - } - - /** - * Create an instance of {@link Results } - * - */ - public Results createResults() { - return new Results(); - } - - /** - * Create an instance of {@link ResultReference } - * - */ - public ResultReference createResultReference() { - return new ResultReference(); - } - - /** - * Create an instance of {@link Parameters } - * - */ - public Parameters createParameters() { - return new Parameters(); - } - - /** - * Create an instance of {@link Parameter } - * - */ - public Parameter createParameter() { - return new Parameter(); - } - - /** - * Create an instance of {@link ErrorSummary } - * - */ - public ErrorSummary createErrorSummary() { - return new ErrorSummary(); - } - - /** - * Create an instance of {@link JobSummary.JobInfo } - * - */ - public JobSummary.JobInfo createJobSummaryJobInfo() { - return new JobSummary.JobInfo(); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link JobSummary }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://www.ivoa.net/xml/UWS/v1.0", name = "job") - public JAXBElement<JobSummary> createJob(JobSummary value) { - return new JAXBElement<JobSummary>(_Job_QNAME, JobSummary.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link XMLGregorianCalendar }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://www.ivoa.net/xml/UWS/v1.0", name = "quote", scope = JobSummary.class) - public JAXBElement<XMLGregorianCalendar> createJobSummaryQuote(XMLGregorianCalendar value) { - return new JAXBElement<XMLGregorianCalendar>(_JobSummaryQuote_QNAME, XMLGregorianCalendar.class, JobSummary.class, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://www.ivoa.net/xml/UWS/v1.0", name = "ownerId", scope = ShortJobDescription.class) - public JAXBElement<String> createShortJobDescriptionOwnerId(String value) { - return new JAXBElement<String>(_ShortJobDescriptionOwnerId_QNAME, String.class, ShortJobDescription.class, value); - } - -} diff --git a/src/main/java/net/ivoa/xml/uws/v1/Results.java b/src/main/java/net/ivoa/xml/uws/v1/Results.java deleted file mode 100644 index b81d47038aaad90788ab2d053761f8c298c49f9a..0000000000000000000000000000000000000000 --- a/src/main/java/net/ivoa/xml/uws/v1/Results.java +++ /dev/null @@ -1,76 +0,0 @@ -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 -// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> -// 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 -// - - -package net.ivoa.xml.uws.v1; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <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="result" type="{http://www.ivoa.net/xml/UWS/v1.0}ResultReference" maxOccurs="unbounded" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "result" -}) -@XmlRootElement(name = "results") -public class Results { - - protected List<ResultReference> result; - - /** - * Gets the value of the result 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 result property. - * - * <p> - * For example, to add a new item, do as follows: - * <pre> - * getResult().add(newItem); - * </pre> - * - * - * <p> - * Objects of the following type(s) are allowed in the list - * {@link ResultReference } - * - * - */ - public List<ResultReference> getResult() { - if (result == null) { - result = new ArrayList<ResultReference>(); - } - return this.result; - } - -} diff --git a/src/test/java/net/ivoa/xml/uws/v1/JobSummaryTest.java b/src/test/java/net/ivoa/xml/uws/v1/JobSummaryTest.java index 39f0f97a78d303246db417ac794f6cda4516c530..35513b68ba990c1c49cc407c2efee25c64f19634 100644 --- a/src/test/java/net/ivoa/xml/uws/v1/JobSummaryTest.java +++ b/src/test/java/net/ivoa/xml/uws/v1/JobSummaryTest.java @@ -4,6 +4,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; import java.io.StringReader; import java.io.StringWriter; import javax.xml.bind.JAXB; +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; +import javax.xml.datatype.XMLGregorianCalendar; import net.ivoa.xml.uws.v1.JobSummary.JobInfo; import net.ivoa.xml.vospace.v2.Protocol; import net.ivoa.xml.vospace.v2.Transfer; @@ -54,6 +57,7 @@ public class JobSummaryTest { JobSummary job = new JobSummary(); job.setJobId("job_id"); job.setPhase(ExecutionPhase.PENDING); + job.setQuote(getXmlDate("2015-05-26T11:06:45.713")); JobInfo jobInfo = new JobInfo(); @@ -72,6 +76,14 @@ public class JobSummaryTest { return job; } + private XMLGregorianCalendar getXmlDate(String dateTimeString) { + try { + return DatatypeFactory.newInstance().newXMLGregorianCalendar(dateTimeString); + } catch (DatatypeConfigurationException ex) { + throw new RuntimeException(ex); + } + } + private void verifyJobsAreEquals(JobSummary deserializedJob) { assertEquals("job_id", deserializedJob.getJobId());