highsource / ogc-schemas

XML<->Java and XML<->JS for OGC XSDs.
BSD 2-Clause "Simplified" License
82 stars 49 forks source link

XJC generated GetObservationType.TemporalFilter Java API is incorrect #199

Open charlesmoore99 opened 6 years ago

charlesmoore99 commented 6 years ago

The xjc generated Java interface for SOS GetObservation accepts arguments of type:

“JAXBElement< TemporalOpsType >“

It needs to instead accepts arguments of type:

“JAXBElement< ? extends TemporalOpsType >”

Consider the following query:

<sos:GetObservation version="2.0.0" service="SOS" 
 xmlns:sos="http://www.opengis.net/sos/2.0" 
xmlns:fes="http://www.opengis.net/fes/2.0" 
xmlns:gml="http://www.opengis.net/gml/3.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" >
    <sos:temporalFilter>
        <fes:During>
            <fes:ValueReference>phenomenonTime</fes:ValueReference>
            <gml:TimePeriod gml:id="tp1">
                <gml:beginPosition>2010-06-25T00:00:00.000Z</gml:beginPosition>
                <gml:endPosition>2010-08-02T00:00:00.000Z</gml:endPosition>
            </gml:TimePeriod>
        </fes:During>
    </sos:temporalFilter>
</sos:GetObservation>

The current implementation unmarshalls this into the object model, and is able to remarshall it back into an XML document. However, it is not possible to create create the above query through the XJC generated API, as attempting to create a temporal filter with a 'duration' type BinaryTemporalObject results in a compilation error. The error received is

The method setTemporalOps(JAXBElement) in the type GetObservationType.TemporalFilter is not applicable for the arguments (JAXBElement)

charlesmoore99 commented 6 years ago

Here's a pull request with a unit test demonstrating the syntax error

https://github.com/highsource/ogc-schemas/pull/200