Search in sources :

Example 1 with AbstractEncodingType

use of net.opengis.swe.x101.AbstractEncodingType in project arctic-sea by 52North.

the class SweCommonEncoderv101 method createTextEncoding.

private BlockEncodingPropertyType createTextEncoding(SweTextEncoding sosTextEncoding) {
    BlockEncodingPropertyType xbTextEncodingType = BlockEncodingPropertyType.Factory.newInstance(getXmlOptions());
    TextBlock xbTextEncoding = xbTextEncodingType.addNewTextBlock();
    if (sosTextEncoding.getBlockSeparator() != null) {
        xbTextEncoding.setBlockSeparator(sosTextEncoding.getBlockSeparator());
    }
    // }
    if (sosTextEncoding.getDecimalSeparator() != null) {
        xbTextEncoding.setDecimalSeparator(sosTextEncoding.getDecimalSeparator());
    }
    if (sosTextEncoding.getTokenSeparator() != null) {
        xbTextEncoding.setTokenSeparator(sosTextEncoding.getTokenSeparator());
    }
    // cannot be cast to net.opengis.swe.x101.AbstractEncodingType
    return xbTextEncodingType;
}
Also used : BlockEncodingPropertyType(net.opengis.swe.x101.BlockEncodingPropertyType) TextBlock(net.opengis.swe.x101.TextBlockDocument.TextBlock)

Example 2 with AbstractEncodingType

use of net.opengis.swe.x101.AbstractEncodingType in project arctic-sea by 52North.

the class InsertResultTemplateRequestEncoderTest method shouldEncodeResultEncoding.

@Test
public void shouldEncodeResultEncoding() throws EncodingException, DecodingException {
    ResultTemplateType template = ((InsertResultTemplateDocument) encoder.create(request)).getInsertResultTemplate().getProposedTemplate().getResultTemplate();
    XmlHelper.validateDocument(template);
    Assert.assertThat(template.getResultEncoding(), Matchers.notNullValue());
    Assert.assertThat(template.getResultEncoding().getAbstractEncoding(), Matchers.notNullValue());
    AbstractEncodingType resultEncoding = template.getResultEncoding().getAbstractEncoding();
    Assert.assertThat(resultEncoding, Matchers.instanceOf(TextEncodingType.class));
    TextEncodingType xbTextEncoding = (TextEncodingType) resultEncoding;
    Assert.assertThat(xbTextEncoding.getBlockSeparator(), Is.is(blockSeparator));
    Assert.assertThat(xbTextEncoding.getTokenSeparator(), Is.is(tokenSeparator));
}
Also used : TextEncodingType(net.opengis.swe.x20.TextEncodingType) AbstractEncodingType(net.opengis.swe.x20.AbstractEncodingType) ResultTemplateType(net.opengis.sos.x20.ResultTemplateType) InsertResultTemplateType(net.opengis.sos.x20.InsertResultTemplateType) InsertResultTemplateDocument(net.opengis.sos.x20.InsertResultTemplateDocument) Test(org.junit.Test)

Aggregations

InsertResultTemplateDocument (net.opengis.sos.x20.InsertResultTemplateDocument)1 InsertResultTemplateType (net.opengis.sos.x20.InsertResultTemplateType)1 ResultTemplateType (net.opengis.sos.x20.ResultTemplateType)1 BlockEncodingPropertyType (net.opengis.swe.x101.BlockEncodingPropertyType)1 TextBlock (net.opengis.swe.x101.TextBlockDocument.TextBlock)1 AbstractEncodingType (net.opengis.swe.x20.AbstractEncodingType)1 TextEncodingType (net.opengis.swe.x20.TextEncodingType)1 Test (org.junit.Test)1