Commit 2785b8fb authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Simplified JobSummary binding

parent c8bce2ef
Loading
Loading
Loading
Loading
Loading
+20 −16
Original line number Diff line number Diff line
@@ -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.
+0 −145
Original line number Diff line number Diff line
//
// 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);
    }

}
+0 −76
Original line number Diff line number Diff line
//
// 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;
    }

}
+12 −0
Original line number Diff line number Diff line
@@ -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());