use of net.opengis.sos.x20.InsertResultTemplateType in project arctic-sea by 52North.
the class SosDecoderv20 method parseInsertResultTemplate.
private OwsServiceRequest parseInsertResultTemplate(final InsertResultTemplateDocument insertResultTemplateDoc) throws DecodingException {
InsertResultTemplateRequest sosInsertResultTemplate = new InsertResultTemplateRequest();
InsertResultTemplateType insertResultTemplate = insertResultTemplateDoc.getInsertResultTemplate();
sosInsertResultTemplate.setService(insertResultTemplate.getService());
sosInsertResultTemplate.setVersion(insertResultTemplate.getVersion());
ResultTemplateType resultTemplate = insertResultTemplate.getProposedTemplate().getResultTemplate();
sosInsertResultTemplate.setIdentifier(resultTemplate.getIdentifier());
OmObservationConstellation sosObservationConstellation = parseObservationTemplate(resultTemplate.getObservationTemplate());
sosObservationConstellation.addOffering(resultTemplate.getOffering());
sosInsertResultTemplate.setObservationTemplate(sosObservationConstellation);
try {
sosInsertResultTemplate.setResultStructure(parseResultStructure(XmlObject.Factory.parse(resultTemplate.getResultStructure().xmlText())));
sosInsertResultTemplate.setResultEncoding(parseResultEncoding(XmlObject.Factory.parse(resultTemplate.getResultEncoding().xmlText())));
} catch (XmlException e) {
throw new DecodingException(e, "Error while parsing InsertResultTemplate request!");
}
sosInsertResultTemplate.setExtensions(parseExtensibleRequest(insertResultTemplate));
return sosInsertResultTemplate;
}
use of net.opengis.sos.x20.InsertResultTemplateType in project arctic-sea by 52North.
the class InsertResultTemplateRequestEncoder method create.
@Override
protected XmlObject create(InsertResultTemplateRequest request) throws EncodingException {
validateInput(request);
InsertResultTemplateDocument doc = InsertResultTemplateDocument.Factory.newInstance(getXmlOptions());
InsertResultTemplateType insertResultTemplate = doc.addNewInsertResultTemplate();
insertResultTemplate.setService(request.getService());
insertResultTemplate.setVersion(request.getVersion());
// reduced element hierarchy and switched to sos:ResultTemplate level
ResultTemplateType resultTemplate = insertResultTemplate.addNewProposedTemplate().addNewResultTemplate();
addIdentifier(resultTemplate, request);
addOffering(resultTemplate, request);
addObservationTemplate(resultTemplate, request);
addResultStructure(resultTemplate, request.getResultStructure().get().get());
addResultEncoding(resultTemplate, request.getResultEncoding().get().get());
return doc;
}
use of net.opengis.sos.x20.InsertResultTemplateType in project arctic-sea by 52North.
the class InsertResultTemplateRequestEncoderTest method shouldSetRequestDefaults.
@Test
public void shouldSetRequestDefaults() throws EncodingException {
InsertResultTemplateType encodedRequest = ((InsertResultTemplateDocument) encoder.create(request)).getInsertResultTemplate();
Assert.assertThat(encodedRequest.getService(), Is.is(SosConstants.SOS));
Assert.assertThat(encodedRequest.getVersion(), Is.is(Sos2Constants.SERVICEVERSION));
}
Aggregations