Skip to content
Snippets Groups Projects
Commit 2785b8fb authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Simplified JobSummary binding

parent c8bce2ef
Branches
Tags 1.5.0
No related merge requests found
Pipeline #742 passed
...@@ -21,6 +21,7 @@ import javax.xml.bind.annotation.XmlAnyElement; ...@@ -21,6 +21,7 @@ import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlSeeAlso;
...@@ -108,8 +109,9 @@ public class JobSummary { ...@@ -108,8 +109,9 @@ public class JobSummary {
@XmlElement(required = true) @XmlElement(required = true)
@XmlSchemaType(name = "string") @XmlSchemaType(name = "string")
protected ExecutionPhase phase; protected ExecutionPhase phase;
@XmlElementRef(name = "quote", namespace = "http://www.ivoa.net/xml/UWS/v1.0", type = JAXBElement.class, required = false) // <edit>
protected JAXBElement<XMLGregorianCalendar> quote; protected XMLGregorianCalendar quote;
// </edit>
@XmlSchemaType(name = "dateTime") @XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar creationTime; protected XMLGregorianCalendar creationTime;
@XmlElement(required = true, nillable = true) @XmlElement(required = true, nillable = true)
...@@ -123,8 +125,11 @@ public class JobSummary { ...@@ -123,8 +125,11 @@ public class JobSummary {
@XmlSchemaType(name = "dateTime") @XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar destruction; protected XMLGregorianCalendar destruction;
protected Parameters parameters; protected Parameters parameters;
@XmlElement(required = true) // <edit>: replaced Results with List<ResultReference>
protected Results results; @XmlElement(name = "result")
@XmlElementWrapper(name = "results", required = true)
protected List<ResultReference> results;
// </edit>
protected ErrorSummary errorSummary; protected ErrorSummary errorSummary;
protected JobSummary.JobInfo jobInfo; protected JobSummary.JobInfo jobInfo;
@XmlAttribute(name = "version") @XmlAttribute(name = "version")
...@@ -234,7 +239,8 @@ public class JobSummary { ...@@ -234,7 +239,8 @@ public class JobSummary {
* {@link JAXBElement }{@code <}{@link XMLGregorianCalendar }{@code >} * {@link JAXBElement }{@code <}{@link XMLGregorianCalendar }{@code >}
* *
*/ */
public JAXBElement<XMLGregorianCalendar> getQuote() { // <edit>
public XMLGregorianCalendar getQuote() {
return quote; return quote;
} }
...@@ -246,9 +252,10 @@ public class JobSummary { ...@@ -246,9 +252,10 @@ public class JobSummary {
* {@link JAXBElement }{@code <}{@link XMLGregorianCalendar }{@code >} * {@link JAXBElement }{@code <}{@link XMLGregorianCalendar }{@code >}
* *
*/ */
public void setQuote(JAXBElement<XMLGregorianCalendar> value) { public void setQuote(XMLGregorianCalendar value) {
this.quote = value; this.quote = value;
} }
// </edit>
/** /**
* Gets the value of the creationTime property. * Gets the value of the creationTime property.
...@@ -400,21 +407,18 @@ public class JobSummary { ...@@ -400,21 +407,18 @@ public class JobSummary {
* {@link Results } * {@link Results }
* *
*/ */
public Results getResults() { // <edit>
public List<ResultReference> getResults() {
if (results == null) {
results = new ArrayList<>();
}
return results; return results;
} }
/** public void setResults(List<ResultReference> value) {
* Sets the value of the results property.
*
* @param value
* allowed object is
* {@link Results }
*
*/
public void setResults(Results value) {
this.results = value; this.results = value;
} }
// </edit>
/** /**
* Gets the value of the errorSummary property. * Gets the value of the errorSummary property.
......
//
// 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);
}
}
//
// 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>
* &lt;complexType>
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="result" type="{http://www.ivoa.net/xml/UWS/v1.0}ResultReference" maxOccurs="unbounded" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/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;
}
}
...@@ -4,6 +4,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; ...@@ -4,6 +4,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.StringReader; import java.io.StringReader;
import java.io.StringWriter; import java.io.StringWriter;
import javax.xml.bind.JAXB; 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.uws.v1.JobSummary.JobInfo;
import net.ivoa.xml.vospace.v2.Protocol; import net.ivoa.xml.vospace.v2.Protocol;
import net.ivoa.xml.vospace.v2.Transfer; import net.ivoa.xml.vospace.v2.Transfer;
...@@ -54,6 +57,7 @@ public class JobSummaryTest { ...@@ -54,6 +57,7 @@ public class JobSummaryTest {
JobSummary job = new JobSummary(); JobSummary job = new JobSummary();
job.setJobId("job_id"); job.setJobId("job_id");
job.setPhase(ExecutionPhase.PENDING); job.setPhase(ExecutionPhase.PENDING);
job.setQuote(getXmlDate("2015-05-26T11:06:45.713"));
JobInfo jobInfo = new JobInfo(); JobInfo jobInfo = new JobInfo();
...@@ -72,6 +76,14 @@ public class JobSummaryTest { ...@@ -72,6 +76,14 @@ public class JobSummaryTest {
return job; 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) { private void verifyJobsAreEquals(JobSummary deserializedJob) {
assertEquals("job_id", deserializedJob.getJobId()); assertEquals("job_id", deserializedJob.getJobId());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment