Search in sources :

Example 6 with AbstractDataComponentType

use of net.opengis.swe.x20.AbstractDataComponentType in project arctic-sea by 52North.

the class InsertResultTemplateRequestEncoderTest method shouldEncodeResultStructure.

@Test
public void shouldEncodeResultStructure() throws EncodingException {
    ResultTemplateType template = ((InsertResultTemplateDocument) encoder.create(request)).getInsertResultTemplate().getProposedTemplate().getResultTemplate();
    Assert.assertThat(template.getResultStructure(), Matchers.notNullValue());
    AbstractDataComponentType abstractDataComponent = template.getResultStructure().getAbstractDataComponent();
    Assert.assertThat(abstractDataComponent, Matchers.notNullValue());
    Assert.assertThat(abstractDataComponent, Matchers.instanceOf(DataRecordType.class));
    DataRecordType xbResultStructure = (DataRecordType) abstractDataComponent;
    Assert.assertThat(xbResultStructure.getFieldArray().length, Is.is(1));
    Assert.assertThat(xbResultStructure.getFieldArray(0), Matchers.instanceOf(Field.class));
    Assert.assertThat(xbResultStructure.getFieldArray(0).getName(), Is.is(field1Name));
    Assert.assertThat(xbResultStructure.getFieldArray(0).getAbstractDataComponent(), Matchers.instanceOf(TimeType.class));
    TimeType xbTime = (TimeType) xbResultStructure.getFieldArray(0).getAbstractDataComponent();
    Assert.assertThat(xbTime.getDefinition(), Is.is(field1Definition));
    Assert.assertThat(xbTime.getUom().getCode(), Is.is(field1Uom));
}
Also used : DataRecordType(net.opengis.swe.x20.DataRecordType) SweField(org.n52.shetland.ogc.swe.SweField) Field(net.opengis.swe.x20.DataRecordType.Field) AbstractDataComponentType(net.opengis.swe.x20.AbstractDataComponentType) ResultTemplateType(net.opengis.sos.x20.ResultTemplateType) InsertResultTemplateType(net.opengis.sos.x20.InsertResultTemplateType) InsertResultTemplateDocument(net.opengis.sos.x20.InsertResultTemplateDocument) TimeType(net.opengis.swe.x20.TimeType) Test(org.junit.Test)

Example 7 with AbstractDataComponentType

use of net.opengis.swe.x20.AbstractDataComponentType in project arctic-sea by 52North.

the class SweCommonEncoderv101 method createSimpleType.

private AbstractDataComponentType createSimpleType(SweAbstractSimpleType<?> sosSimpleType, EncodingContext additionalValues) throws EncodingException {
    AbstractDataComponentType abstractDataComponentType = null;
    if (sosSimpleType instanceof SweBoolean) {
        abstractDataComponentType = createBoolean((SweBoolean) sosSimpleType);
    } else if (sosSimpleType instanceof SweCategory) {
        abstractDataComponentType = createCategory((SweCategory) sosSimpleType);
    } else if (sosSimpleType instanceof SweCount) {
        abstractDataComponentType = createCount((SweCount) sosSimpleType);
    } else if (sosSimpleType instanceof SweCountRange) {
        abstractDataComponentType = createCountRange((SweCountRange) sosSimpleType);
    } else if (sosSimpleType instanceof SweObservableProperty) {
        abstractDataComponentType = createObservableProperty((SweObservableProperty) sosSimpleType);
    } else if (sosSimpleType instanceof SweQuantity) {
        abstractDataComponentType = createQuantity((SweQuantity) sosSimpleType);
    } else if (sosSimpleType instanceof SweQuantityRange) {
        abstractDataComponentType = createQuantityRange((SweQuantityRange) sosSimpleType);
    } else if (sosSimpleType instanceof SweText) {
        abstractDataComponentType = createText((SweText) sosSimpleType);
    } else if (sosSimpleType instanceof SweTimeRange) {
        abstractDataComponentType = createTimeRange((SweTimeRange) sosSimpleType);
    } else if (sosSimpleType instanceof SweTime) {
        abstractDataComponentType = createTime((SweTime) sosSimpleType);
    } else {
        throw new NotYetSupportedEncodingException(SweAbstractSimpleType.class.getSimpleName(), sosSimpleType);
    }
    addAbstractDataComponentValues(abstractDataComponentType, sosSimpleType);
    return abstractDataComponentType;
}
Also used : SweQuantity(org.n52.shetland.ogc.swe.simpleType.SweQuantity) AbstractDataComponentType(net.opengis.swe.x101.AbstractDataComponentType) SweText(org.n52.shetland.ogc.swe.simpleType.SweText) SweTime(org.n52.shetland.ogc.swe.simpleType.SweTime) NotYetSupportedEncodingException(org.n52.svalbard.encode.exception.NotYetSupportedEncodingException) SweQuantityRange(org.n52.shetland.ogc.swe.simpleType.SweQuantityRange) SweCountRange(org.n52.shetland.ogc.swe.simpleType.SweCountRange) SweCategory(org.n52.shetland.ogc.swe.simpleType.SweCategory) SweCount(org.n52.shetland.ogc.swe.simpleType.SweCount) SweTimeRange(org.n52.shetland.ogc.swe.simpleType.SweTimeRange) SweBoolean(org.n52.shetland.ogc.swe.simpleType.SweBoolean) SweObservableProperty(org.n52.shetland.ogc.swe.simpleType.SweObservableProperty)

Example 8 with AbstractDataComponentType

use of net.opengis.swe.x20.AbstractDataComponentType in project arctic-sea by 52North.

the class SensorMLEncoderv101 method addIoComponentPropertyType.

/**
 * Adds a SOS SWE simple type to a XML SML IO component.
 *
 * @param ioComponentPropertyType
 *            SML IO component
 * @param sosSMLIO
 *            SOS SWE simple type.
 *
 * @throws EncodingException
 *             if the encoding fails
 */
private void addIoComponentPropertyType(IoComponentPropertyType ioComponentPropertyType, SmlIo sosSMLIO) throws EncodingException {
    ioComponentPropertyType.setName(sosSMLIO.getIoName());
    if (sosSMLIO.isSetHref()) {
        ioComponentPropertyType.setHref(sosSMLIO.getTitle());
        if (sosSMLIO.isSetTitle()) {
            ioComponentPropertyType.setTitle(sosSMLIO.getTitle());
        }
    } else {
        XmlObject encodeObjectToXml;
        XmlObject xml = encodeObjectToXml(SweConstants.NS_SWE_101, sosSMLIO.getIoValue());
        if (xml instanceof DataArrayDocument) {
            encodeObjectToXml = ((DataArrayDocument) xml).getDataArray1();
        } else {
            encodeObjectToXml = xml;
        }
        sosSMLIO.getIoValue().accept(new SweDataComponentAdder(ioComponentPropertyType)).map(h -> (AbstractDataComponentType) h.set(encodeObjectToXml)).ifPresent(h -> sosSMLIO.getIoValue().accept(new SweDataComponentSubstituter(h)));
    }
}
Also used : PositionType(net.opengis.swe.x101.PositionType) SosConstants(org.n52.shetland.ogc.sos.SosConstants) Contact(net.opengis.sensorML.x101.ContactDocument.Contact) Time(org.n52.shetland.ogc.gml.time.Time) PointType(net.opengis.gml.PointType) Phone(net.opengis.sensorML.x101.ContactInfoDocument.ContactInfo.Phone) ComponentList(net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList) SmlLocation(org.n52.shetland.ogc.sensorML.elements.SmlLocation) SweAggregateType(org.n52.shetland.ogc.swe.SweConstants.SweAggregateType) TimeInstant(org.n52.shetland.ogc.gml.time.TimeInstant) ProcessMethod(org.n52.shetland.ogc.sensorML.ProcessMethod) Map(java.util.Map) DataArrayDocument(net.opengis.swe.x101.DataArrayDocument) SchemaType(org.apache.xmlbeans.SchemaType) CodeType(org.n52.shetland.ogc.gml.CodeType) SweDataRecord(org.n52.shetland.ogc.swe.SweDataRecord) VectorType(net.opengis.swe.x101.VectorType) SensorML(org.n52.shetland.ogc.sensorML.SensorML) EncodingException(org.n52.svalbard.encode.exception.EncodingException) IoComponentPropertyType(net.opengis.sensorML.x101.IoComponentPropertyType) Set(java.util.Set) SmlPerson(org.n52.shetland.ogc.sensorML.SmlPerson) Connections(net.opengis.sensorML.x101.ConnectionsDocument.Connections) Inputs(net.opengis.sensorML.x101.InputsDocument.Inputs) SchemaLocation(org.n52.shetland.w3c.SchemaLocation) SmlDocumentation(org.n52.shetland.ogc.sensorML.elements.SmlDocumentation) AnyScalarPropertyType(net.opengis.swe.x101.AnyScalarPropertyType) SmlClassifier(org.n52.shetland.ogc.sensorML.elements.SmlClassifier) AbstractProcessType(net.opengis.sensorML.x101.AbstractProcessType) QName(javax.xml.namespace.QName) ProcessMethodType(net.opengis.sensorML.x101.ProcessMethodType) Joiner(com.google.common.base.Joiner) ProcessModel(org.n52.shetland.ogc.sensorML.ProcessModel) ContactList(net.opengis.sensorML.x101.ContactListDocument.ContactList) SmlPosition(org.n52.shetland.ogc.sensorML.elements.SmlPosition) SweQuantity(org.n52.shetland.ogc.swe.simpleType.SweQuantity) SmlLocation2(net.opengis.sensorML.x101.SmlLocation.SmlLocation2) SweQuantityRange(org.n52.shetland.ogc.swe.simpleType.SweQuantityRange) XmlCursor(org.apache.xmlbeans.XmlCursor) ContactInfo(net.opengis.sensorML.x101.ContactInfoDocument.ContactInfo) XmlHelper(org.n52.svalbard.util.XmlHelper) MediaType(org.n52.janmayen.http.MediaType) ResponsibleParty(net.opengis.sensorML.x101.ResponsiblePartyDocument.ResponsibleParty) Components(net.opengis.sensorML.x101.ComponentsDocument.Components) Lists(com.google.common.collect.Lists) ComponentType(net.opengis.sensorML.x101.ComponentType) ConnectionList(net.opengis.sensorML.x101.ConnectionsDocument.Connections.ConnectionList) SweCount(org.n52.shetland.ogc.swe.simpleType.SweCount) Capabilities(net.opengis.sensorML.x101.CapabilitiesDocument.Capabilities) Link(net.opengis.sensorML.x101.LinkDocument.Link) Sos2Constants(org.n52.shetland.ogc.sos.Sos2Constants) AbstractSmlDocumentation(org.n52.shetland.ogc.sensorML.elements.AbstractSmlDocumentation) AbstractProcess(org.n52.shetland.ogc.sensorML.AbstractProcess) SweCountRange(org.n52.shetland.ogc.swe.simpleType.SweCountRange) SmlConnection(org.n52.shetland.ogc.sensorML.elements.SmlConnection) ProcessModelType(net.opengis.sensorML.x101.ProcessModelType) SweText(org.n52.shetland.ogc.swe.simpleType.SweText) Member(net.opengis.sensorML.x101.SensorMLDocument.SensorML.Member) SweField(org.n52.shetland.ogc.swe.SweField) XmlException(org.apache.xmlbeans.XmlException) SweSimpleDataRecord(org.n52.shetland.ogc.swe.SweSimpleDataRecord) SweDataArray(org.n52.shetland.ogc.swe.SweDataArray) DataRecordType(net.opengis.swe.x101.DataRecordType) Address(net.opengis.sensorML.x101.ContactInfoDocument.ContactInfo.Address) SmlResponsibleParty(org.n52.shetland.ogc.sensorML.SmlResponsibleParty) SweTimeRange(org.n52.shetland.ogc.swe.simpleType.SweTimeRange) LoggerFactory(org.slf4j.LoggerFactory) Documentation(net.opengis.sensorML.x101.DocumentationDocument.Documentation) SmlContact(org.n52.shetland.ogc.sensorML.SmlContact) SweBoolean(org.n52.shetland.ogc.swe.simpleType.SweBoolean) ComponentDocument(net.opengis.sensorML.x101.ComponentDocument) MethodPropertyType(net.opengis.sensorML.x101.MethodPropertyType) SensorMLDocument(net.opengis.sensorML.x101.SensorMLDocument) SmlDocumentationList(org.n52.shetland.ogc.sensorML.elements.SmlDocumentationList) ProcedureDescriptionFormat(org.n52.shetland.ogc.sos.ProcedureDescriptionFormat) SweAbstractSimpleType(org.n52.shetland.ogc.swe.simpleType.SweAbstractSimpleType) SweCategory(org.n52.shetland.ogc.swe.simpleType.SweCategory) ImmutableSet(com.google.common.collect.ImmutableSet) AbstractVoidSweDataComponentVisitor(org.n52.shetland.ogc.swe.AbstractVoidSweDataComponentVisitor) SweCoordinate(org.n52.shetland.ogc.swe.SweCoordinate) ImmutableMap(com.google.common.collect.ImmutableMap) SmlComponent(org.n52.shetland.ogc.sensorML.elements.SmlComponent) OutputList(net.opengis.sensorML.x101.OutputsDocument.Outputs.OutputList) Classifier(net.opengis.sensorML.x101.ClassificationDocument.Classification.ClassifierList.Classifier) Classification(net.opengis.sensorML.x101.ClassificationDocument.Classification) Sets(com.google.common.collect.Sets) ClassifierList(net.opengis.sensorML.x101.ClassificationDocument.Classification.ClassifierList) System(org.n52.shetland.ogc.sensorML.System) Objects(java.util.Objects) List(java.util.List) Characteristics(net.opengis.sensorML.x101.CharacteristicsDocument.Characteristics) GmlConstants(org.n52.shetland.ogc.gml.GmlConstants) Identifier(net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList.Identifier) AbstractDataComponentType(net.opengis.swe.x101.AbstractDataComponentType) Outputs(net.opengis.sensorML.x101.OutputsDocument.Outputs) SmlCharacteristics(org.n52.shetland.ogc.sensorML.elements.SmlCharacteristics) CollectionHelper(org.n52.shetland.util.CollectionHelper) Person(net.opengis.sensorML.x101.PersonDocument.Person) SupportedType(org.n52.shetland.ogc.SupportedType) TimePeriod(org.n52.shetland.ogc.gml.time.TimePeriod) SmlLink(org.n52.shetland.ogc.sensorML.elements.SmlLink) Position(net.opengis.sensorML.x101.PositionDocument.Position) SystemDocument(net.opengis.sensorML.x101.SystemDocument) AbstractSensorML(org.n52.shetland.ogc.sensorML.AbstractSensorML) Document(net.opengis.sensorML.x101.DocumentDocument.Document) SmlContactList(org.n52.shetland.ogc.sensorML.SmlContactList) Component(net.opengis.sensorML.x101.ComponentsDocument.Components.ComponentList.Component) RulesDefinition(net.opengis.sensorML.x101.ProcessMethodType.Rules.RulesDefinition) SensorMLConstants(org.n52.shetland.ogc.sensorML.SensorMLConstants) SweTime(org.n52.shetland.ogc.swe.simpleType.SweTime) SmlIdentifier(org.n52.shetland.ogc.sensorML.elements.SmlIdentifier) SystemType(net.opengis.sensorML.x101.SystemType) DataArrayType(net.opengis.swe.x101.DataArrayType) SweConstants(org.n52.shetland.ogc.swe.SweConstants) UnsupportedEncoderInputException(org.n52.svalbard.encode.exception.UnsupportedEncoderInputException) XmlObject(org.apache.xmlbeans.XmlObject) ProcessModelDocument(net.opengis.sensorML.x101.ProcessModelDocument) SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent) SweObservableProperty(org.n52.shetland.ogc.swe.simpleType.SweObservableProperty) SmlCapabilities(org.n52.shetland.ogc.sensorML.elements.SmlCapabilities) IdentifierList(net.opengis.sensorML.x101.IdentificationDocument.Identification.IdentifierList) Logger(org.slf4j.Logger) SimpleDataRecordType(net.opengis.swe.x101.SimpleDataRecordType) AbstractOptionalSweDataComponentVisitor(org.n52.shetland.ogc.swe.AbstractOptionalSweDataComponentVisitor) DocumentList(net.opengis.sensorML.x101.DocumentListDocument.DocumentList) Identification(net.opengis.sensorML.x101.IdentificationDocument.Identification) SmlIo(org.n52.shetland.ogc.sensorML.elements.SmlIo) Term(net.opengis.sensorML.x101.TermDocument.Term) XmlOptions(org.apache.xmlbeans.XmlOptions) Sos1Constants(org.n52.shetland.ogc.sos.Sos1Constants) InputList(net.opengis.sensorML.x101.InputsDocument.Inputs.InputList) CodingHelper(org.n52.svalbard.util.CodingHelper) Collections(java.util.Collections) AbstractDataComponentType(net.opengis.swe.x101.AbstractDataComponentType) XmlObject(org.apache.xmlbeans.XmlObject) DataArrayDocument(net.opengis.swe.x101.DataArrayDocument)

Aggregations

DataRecordType (net.opengis.swe.x20.DataRecordType)4 TimeType (net.opengis.swe.x20.TimeType)4 AbstractDataComponentType (net.opengis.swe.x101.AbstractDataComponentType)3 BooleanType (net.opengis.swe.x20.BooleanType)3 CategoryType (net.opengis.swe.x20.CategoryType)3 CountRangeType (net.opengis.swe.x20.CountRangeType)3 CountType (net.opengis.swe.x20.CountType)3 DataArrayType (net.opengis.swe.x20.DataArrayType)3 QuantityRangeType (net.opengis.swe.x20.QuantityRangeType)3 QuantityType (net.opengis.swe.x20.QuantityType)3 TextType (net.opengis.swe.x20.TextType)3 TimeRangeType (net.opengis.swe.x20.TimeRangeType)3 VectorType (net.opengis.swe.x20.VectorType)3 NotYetSupportedEncodingException (org.n52.svalbard.encode.exception.NotYetSupportedEncodingException)3 AbstractDataComponentType (net.opengis.swe.x20.AbstractDataComponentType)2 BooleanPropertyType (net.opengis.swe.x20.BooleanPropertyType)2 CategoryPropertyType (net.opengis.swe.x20.CategoryPropertyType)2 CategoryRangeType (net.opengis.swe.x20.CategoryRangeType)2 CountPropertyType (net.opengis.swe.x20.CountPropertyType)2 DataArrayDocument (net.opengis.swe.x20.DataArrayDocument)2