Search in sources :

Example 21 with Type

use of org.n52.shetland.w3c.xlink.Type in project arctic-sea by 52North.

the class GmlEncoderv321 method addAbstractCRSValues.

private void addAbstractCRSValues(AbstractCRSType acrst, AbstractCRS abstractCRS) throws EncodingException {
    addDefinitonValues(acrst, abstractCRS);
    if (abstractCRS.hasDomainOfValidity()) {
        for (Referenceable<DomainOfValidity> domainOfValidity : abstractCRS.getDomainOfValidity()) {
            net.opengis.gml.x32.DomainOfValidityDocument.DomainOfValidity dov = acrst.addNewDomainOfValidity();
            if (domainOfValidity.isReference()) {
                Reference reference = domainOfValidity.getReference();
                reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(dov::setActuate);
                reference.getArcrole().ifPresent(dov::setArcrole);
                reference.getHref().map(URI::toString).ifPresent(dov::setHref);
                reference.getRole().ifPresent(dov::setRole);
                reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(dov::setShow);
                reference.getTitle().ifPresent(dov::setTitle);
                reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(dov::setType);
            } else {
                if (domainOfValidity.isInstance()) {
                    Nillable<DomainOfValidity> nillable = domainOfValidity.getInstance();
                    if (nillable.isPresent()) {
                        net.opengis.gml.x32.DomainOfValidityDocument.DomainOfValidity xml = createDomainOfValidity(nillable.get(), EncodingContext.empty());
                        if (xml != null) {
                            dov.set(xml);
                        } else {
                            dov.setNil();
                            dov.setNilReason(Nillable.missing().get());
                        }
                    } else {
                        dov.setNil();
                        if (nillable.hasReason()) {
                            dov.setNilReason(nillable.getNilReason().get());
                        } else {
                            dov.setNilReason(Nillable.missing().get());
                        }
                    }
                }
            }
        }
    }
    if (abstractCRS.hasScope()) {
        abstractCRS.getScope().forEach(scope -> acrst.addNewScope().setStringValue(scope));
    }
}
Also used : ActuateType(org.w3.x1999.xlink.ActuateType) DomainOfValidity(org.n52.shetland.ogc.gml.DomainOfValidity) Reference(org.n52.shetland.w3c.xlink.Reference) Actuate(org.n52.shetland.w3c.xlink.Actuate) EnvelopeType(net.opengis.gml.x32.EnvelopeType) MultiPointType(net.opengis.gml.x32.MultiPointType) VerticalDatumPropertyType(net.opengis.gml.x32.VerticalDatumPropertyType) CodeType(net.opengis.gml.x32.CodeType) DirectPositionListType(net.opengis.gml.x32.DirectPositionListType) CoordinateSystemAxisPropertyType(net.opengis.gml.x32.CoordinateSystemAxisPropertyType) VerticalCSType(net.opengis.gml.x32.VerticalCSType) TimePeriodPropertyType(net.opengis.gml.x32.TimePeriodPropertyType) LineStringType(net.opengis.gml.x32.LineStringType) CoordinateSystemAxisType(net.opengis.gml.x32.CoordinateSystemAxisType) FeaturePropertyType(net.opengis.gml.x32.FeaturePropertyType) TimeInstantPropertyType(net.opengis.gml.x32.TimeInstantPropertyType) TimeIndeterminateValueType(net.opengis.gml.x32.TimeIndeterminateValueType) GeometryPropertyType(net.opengis.gml.x32.GeometryPropertyType) PolygonType(net.opengis.gml.x32.PolygonType) VerticalDatumType(net.opengis.gml.x32.VerticalDatumType) MultiCurveType(net.opengis.gml.x32.MultiCurveType) AggregationType(net.opengis.gml.x32.AggregationType) AbstractCRSType(net.opengis.gml.x32.AbstractCRSType) ShowType(org.w3.x1999.xlink.ShowType) AbstractRingPropertyType(net.opengis.gml.x32.AbstractRingPropertyType) LinearRingType(net.opengis.gml.x32.LinearRingType) EXExtentType(org.isotc211.x2005.gmd.EXExtentType) TimePeriodType(net.opengis.gml.x32.TimePeriodType) ReferenceType(net.opengis.gml.x32.ReferenceType) TimeInstantType(net.opengis.gml.x32.TimeInstantType) GenericMetaDataType(net.opengis.gml.x32.GenericMetaDataType) ActuateType(org.w3.x1999.xlink.ActuateType) TimePositionType(net.opengis.gml.x32.TimePositionType) VerticalCRSType(net.opengis.gml.x32.VerticalCRSType) CurvePropertyType(net.opengis.gml.x32.CurvePropertyType) DefinitionType(net.opengis.gml.x32.DefinitionType) AbstractCoordinateSystemType(net.opengis.gml.x32.AbstractCoordinateSystemType) AbstractDatumType(net.opengis.gml.x32.AbstractDatumType) AbstractRingType(net.opengis.gml.x32.AbstractRingType) MeasureType(net.opengis.gml.x32.MeasureType) VerticalCSPropertyType(net.opengis.gml.x32.VerticalCSPropertyType) CodeWithAuthorityType(net.opengis.gml.x32.CodeWithAuthorityType) TypeType(org.w3.x1999.xlink.TypeType) Type(org.n52.shetland.w3c.xlink.Type) AbstractGeometryType(net.opengis.gml.x32.AbstractGeometryType) DirectPositionType(net.opengis.gml.x32.DirectPositionType) FeatureCollectionType(net.opengis.gml.x32.FeatureCollectionType) PointType(net.opengis.gml.x32.PointType) VerticalCRSPropertyType(net.opengis.gml.x32.VerticalCRSPropertyType) Show(org.n52.shetland.w3c.xlink.Show) TypeType(org.w3.x1999.xlink.TypeType) ShowType(org.w3.x1999.xlink.ShowType)

Example 22 with Type

use of org.n52.shetland.w3c.xlink.Type in project arctic-sea by 52North.

the class SensorMLEncoderv20 method createComponents.

/**
 * Creates the components section of the SensorML description.
 *
 * @param sosComponents
 *            SOS SWE representation.
 *
 * @return encoded sml:components
 *
 * @throws EncodingException
 *             if the process encoding fails
 */
private ComponentListPropertyType createComponents(final List<SmlComponent> sosComponents) throws EncodingException {
    ComponentListPropertyType clpt = ComponentListPropertyType.Factory.newInstance(getXmlOptions());
    final ComponentListType clt = clpt.addNewComponentList();
    for (final SmlComponent sosSMLComponent : sosComponents) {
        final Component component = clt.addNewComponent();
        if (sosSMLComponent.isSetName()) {
            component.setName(sosSMLComponent.getName());
        }
        if (sosSMLComponent.isSetHref()) {
            component.setHref(sosSMLComponent.getHref());
            if (sosSMLComponent.isSetTitle()) {
                component.setTitle(sosSMLComponent.getTitle());
            }
        } else if (sosSMLComponent.isSetProcess()) {
            XmlObject xmlObject = encode(sosSMLComponent.getProcess(), EncodingContext.of(XmlBeansEncodingFlags.TYPE));
            // }
            if (xmlObject != null) {
                // AbstractProcessType xbProcess = null;
                // if (xmlObject instanceof AbstractProcessType) {
                // xbProcess = (AbstractProcessType) xmlObject;
                // } else {
                // throw new NoApplicableCodeException()
                // .withMessage("The sensor type is not supported by this
                // SOS");
                // }
                // TODO add feature/parentProcs/childProcs to component - is
                // this already done?
                // XmlObject substituteElement =
                // XmlHelper.substituteElement(component.addNewAbstractProcess(),
                // xmlObject);
                // substituteElement.set(xmlObject);
                substitute(component.addNewAbstractProcess(), xmlObject);
            }
        }
    }
    return clpt;
}
Also used : ComponentListPropertyType(net.opengis.sensorml.x20.ComponentListPropertyType) XmlObject(org.apache.xmlbeans.XmlObject) PhysicalComponent(org.n52.shetland.ogc.sensorML.v20.PhysicalComponent) SmlComponent(org.n52.shetland.ogc.sensorML.elements.SmlComponent) Component(net.opengis.sensorml.x20.ComponentListType.Component) SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent) ComponentListType(net.opengis.sensorml.x20.ComponentListType) SmlComponent(org.n52.shetland.ogc.sensorML.elements.SmlComponent)

Example 23 with Type

use of org.n52.shetland.w3c.xlink.Type in project arctic-sea by 52North.

the class SweCommonEncoderv101 method createFieldForSimpleDataRecord.

private AnyScalarPropertyType createFieldForSimpleDataRecord(SweField sweField) throws EncodingException {
    SweAbstractDataComponent sosElement = sweField.getElement();
    AnyScalarPropertyType xbField = AnyScalarPropertyType.Factory.newInstance(getXmlOptions());
    if (sweField.isSetName()) {
        xbField.setName(sweField.getName().getValue());
    }
    AbstractDataComponentType xbDCD;
    if (sosElement instanceof SweBoolean) {
        xbDCD = xbField.addNewBoolean();
        xbDCD.set(createSimpleType((SweBoolean) sosElement));
    } else if (sosElement instanceof SweCategory) {
        xbDCD = xbField.addNewCategory();
        xbDCD.set(createSimpleType((SweCategory) sosElement));
    } else if (sosElement instanceof SweCount) {
        xbDCD = xbField.addNewCount();
        xbDCD.set(createSimpleType((SweCount) sosElement));
    } else if (sosElement instanceof SweQuantity) {
        xbDCD = xbField.addNewQuantity();
        xbDCD.set(createSimpleType((SweQuantity) sosElement));
    } else if (sosElement instanceof SweText) {
        xbDCD = xbField.addNewText();
        xbDCD.set(createSimpleType((SweText) sosElement));
    } else if (sosElement instanceof SweTime) {
        xbDCD = xbField.addNewTime();
        xbDCD.set(createSimpleType((SweTime) sosElement));
    } else {
        throw new EncodingException("The element type '%s' of the received %s is not supported by this encoder '%s'.", new Object[] { sosElement != null ? sosElement.getClass().getName() : null, sweField.getClass().getName(), getClass().getName() });
    }
    return xbField;
}
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) AnyScalarPropertyType(net.opengis.swe.x101.AnyScalarPropertyType) EncodingException(org.n52.svalbard.encode.exception.EncodingException) NotYetSupportedEncodingException(org.n52.svalbard.encode.exception.NotYetSupportedEncodingException) SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent) SweCategory(org.n52.shetland.ogc.swe.simpleType.SweCategory) SweCount(org.n52.shetland.ogc.swe.simpleType.SweCount) XmlObject(org.apache.xmlbeans.XmlObject) SweBoolean(org.n52.shetland.ogc.swe.simpleType.SweBoolean)

Example 24 with Type

use of org.n52.shetland.w3c.xlink.Type in project arctic-sea by 52North.

the class SweCommonEncoderv20 method asPropertyType.

private XmlObject asPropertyType(AbstractDataComponentType type) throws NotYetSupportedEncodingException {
    if (type instanceof BooleanType) {
        BooleanPropertyType propertyType = BooleanPropertyType.Factory.newInstance();
        propertyType.setBoolean((BooleanType) type);
        return propertyType;
    } else if (type instanceof CountType) {
        CountPropertyType propertyType = CountPropertyType.Factory.newInstance();
        propertyType.setCount((CountType) type);
        return propertyType;
    } else if (type instanceof CountRangeType) {
        CountRangePropertyType propertyType = CountRangePropertyType.Factory.newInstance();
        propertyType.setCountRange((CountRangeType) type);
        return propertyType;
    } else if (type instanceof QuantityType) {
        QuantityPropertyType propertyType = QuantityPropertyType.Factory.newInstance();
        propertyType.setQuantity((QuantityType) type);
        return propertyType;
    } else if (type instanceof QuantityRangeType) {
        QuantityRangePropertyType propertyType = QuantityRangePropertyType.Factory.newInstance();
        propertyType.setQuantityRange((QuantityRangeType) type);
        return propertyType;
    } else if (type instanceof TimeType) {
        TimePropertyType propertyType = TimePropertyType.Factory.newInstance();
        propertyType.setTime((TimeType) type);
        return propertyType;
    } else if (type instanceof TimeRangeType) {
        TimeRangePropertyType propertyType = TimeRangePropertyType.Factory.newInstance();
        propertyType.setTimeRange((TimeRangeType) type);
        return propertyType;
    } else if (type instanceof CategoryType) {
        CategoryPropertyType propertyType = CategoryPropertyType.Factory.newInstance();
        propertyType.setCategory((CategoryType) type);
        return propertyType;
    } else if (type instanceof CategoryRangeType) {
        CategoryRangePropertyType propertyType = CategoryRangePropertyType.Factory.newInstance();
        propertyType.setCategoryRange((CategoryRangeType) type);
        return propertyType;
    } else if (type instanceof MatrixType) {
        MatrixPropertyType propertyType = MatrixPropertyType.Factory.newInstance();
        propertyType.setMatrix((MatrixType) type);
        return propertyType;
    } else if (type instanceof DataArrayType) {
        DataArrayPropertyType propertyType = DataArrayPropertyType.Factory.newInstance();
        propertyType.setDataArray1((DataArrayType) type);
        return propertyType;
    } else if (type instanceof DataChoiceType) {
        DataChoicePropertyType propertyType = DataChoicePropertyType.Factory.newInstance();
        propertyType.setDataChoice((DataChoiceType) type);
        return propertyType;
    } else if (type instanceof DataRecordType) {
        DataRecordPropertyType propertyType = DataRecordPropertyType.Factory.newInstance();
        propertyType.setDataRecord((DataRecordType) type);
        return propertyType;
    } else if (type instanceof TextType) {
        TextPropertyType propertyType = TextPropertyType.Factory.newInstance();
        propertyType.setText((TextType) type);
        return propertyType;
    } else if (type instanceof VectorType) {
        VectorPropertyType propertyType = VectorPropertyType.Factory.newInstance();
        propertyType.setVector((VectorType) type);
        return propertyType;
    } else {
        throw new NotYetSupportedEncodingException(type.getClass().getName(), type);
    }
}
Also used : DataRecordType(net.opengis.swe.x20.DataRecordType) CategoryRangeType(net.opengis.swe.x20.CategoryRangeType) MatrixPropertyType(net.opengis.swe.x20.MatrixPropertyType) NotYetSupportedEncodingException(org.n52.svalbard.encode.exception.NotYetSupportedEncodingException) CategoryType(net.opengis.swe.x20.CategoryType) DataArrayPropertyType(net.opengis.swe.x20.DataArrayPropertyType) TimeRangePropertyType(net.opengis.swe.x20.TimeRangePropertyType) CountType(net.opengis.swe.x20.CountType) TimeType(net.opengis.swe.x20.TimeType) VectorPropertyType(net.opengis.swe.x20.VectorPropertyType) CountPropertyType(net.opengis.swe.x20.CountPropertyType) CountRangeType(net.opengis.swe.x20.CountRangeType) DataChoiceType(net.opengis.swe.x20.DataChoiceType) VectorType(net.opengis.swe.x20.VectorType) QuantityPropertyType(net.opengis.swe.x20.QuantityPropertyType) TextPropertyType(net.opengis.swe.x20.TextPropertyType) CountRangePropertyType(net.opengis.swe.x20.CountRangePropertyType) BooleanPropertyType(net.opengis.swe.x20.BooleanPropertyType) DataChoicePropertyType(net.opengis.swe.x20.DataChoicePropertyType) DataArrayType(net.opengis.swe.x20.DataArrayType) QuantityRangePropertyType(net.opengis.swe.x20.QuantityRangePropertyType) CategoryRangePropertyType(net.opengis.swe.x20.CategoryRangePropertyType) BooleanType(net.opengis.swe.x20.BooleanType) DataRecordPropertyType(net.opengis.swe.x20.DataRecordPropertyType) TextType(net.opengis.swe.x20.TextType) TimeRangeType(net.opengis.swe.x20.TimeRangeType) QuantityType(net.opengis.swe.x20.QuantityType) MatrixType(net.opengis.swe.x20.MatrixType) TimePropertyType(net.opengis.swe.x20.TimePropertyType) QuantityRangeType(net.opengis.swe.x20.QuantityRangeType) CategoryPropertyType(net.opengis.swe.x20.CategoryPropertyType)

Example 25 with Type

use of org.n52.shetland.w3c.xlink.Type in project arctic-sea by 52North.

the class SweCommonEncoderv20 method asDocument.

private XmlObject asDocument(AbstractDataComponentType type) throws NotYetSupportedEncodingException {
    if (type instanceof BooleanType) {
        BooleanDocument document = BooleanDocument.Factory.newInstance();
        document.setBoolean((BooleanType) type);
        return document;
    } else if (type instanceof CountType) {
        CountDocument document = CountDocument.Factory.newInstance();
        document.setCount((CountType) type);
        return document;
    } else if (type instanceof CountRangeType) {
        CountRangeDocument document = CountRangeDocument.Factory.newInstance();
        document.setCountRange((CountRangeType) type);
        return document;
    } else if (type instanceof QuantityType) {
        QuantityDocument document = QuantityDocument.Factory.newInstance();
        document.setQuantity((QuantityType) type);
        return document;
    } else if (type instanceof QuantityRangeType) {
        QuantityRangeDocument document = QuantityRangeDocument.Factory.newInstance();
        document.setQuantityRange((QuantityRangeType) type);
        return document;
    } else if (type instanceof TimeType) {
        TimeDocument document = TimeDocument.Factory.newInstance();
        document.setTime((TimeType) type);
        return document;
    } else if (type instanceof TimeRangeType) {
        TimeRangeDocument document = TimeRangeDocument.Factory.newInstance();
        document.setTimeRange((TimeRangeType) type);
        return document;
    } else if (type instanceof CategoryType) {
        CategoryDocument document = CategoryDocument.Factory.newInstance();
        document.setCategory((CategoryType) type);
        return document;
    } else if (type instanceof CategoryRangeType) {
        CategoryRangeDocument document = CategoryRangeDocument.Factory.newInstance();
        document.setCategoryRange((CategoryRangeType) type);
        return document;
    } else if (type instanceof MatrixType) {
        MatrixDocument document = MatrixDocument.Factory.newInstance();
        document.setMatrix((MatrixType) type);
        return document;
    } else if (type instanceof DataArrayType) {
        DataArrayDocument document = DataArrayDocument.Factory.newInstance();
        document.setDataArray1((DataArrayType) type);
        return document;
    } else if (type instanceof DataChoiceType) {
        DataChoiceDocument document = DataChoiceDocument.Factory.newInstance();
        document.setDataChoice((DataChoiceType) type);
        return document;
    } else if (type instanceof DataRecordType) {
        DataRecordDocument document = DataRecordDocument.Factory.newInstance();
        document.setDataRecord((DataRecordType) type);
        return document;
    } else if (type instanceof TextType) {
        TextDocument document = TextDocument.Factory.newInstance();
        document.setText((TextType) type);
        return document;
    } else if (type instanceof VectorType) {
        VectorDocument document = VectorDocument.Factory.newInstance();
        document.setVector((VectorType) type);
        return document;
    } else {
        throw new NotYetSupportedEncodingException(type.getClass().getName(), type);
    }
}
Also used : MatrixDocument(net.opengis.swe.x20.MatrixDocument) DataRecordType(net.opengis.swe.x20.DataRecordType) CategoryRangeType(net.opengis.swe.x20.CategoryRangeType) NotYetSupportedEncodingException(org.n52.svalbard.encode.exception.NotYetSupportedEncodingException) TimeRangeDocument(net.opengis.swe.x20.TimeRangeDocument) CategoryType(net.opengis.swe.x20.CategoryType) CountType(net.opengis.swe.x20.CountType) QuantityDocument(net.opengis.swe.x20.QuantityDocument) TimeType(net.opengis.swe.x20.TimeType) VectorDocument(net.opengis.swe.x20.VectorDocument) CountRangeType(net.opengis.swe.x20.CountRangeType) DataChoiceType(net.opengis.swe.x20.DataChoiceType) VectorType(net.opengis.swe.x20.VectorType) DataChoiceDocument(net.opengis.swe.x20.DataChoiceDocument) CountRangeDocument(net.opengis.swe.x20.CountRangeDocument) DataArrayType(net.opengis.swe.x20.DataArrayType) DataArrayDocument(net.opengis.swe.x20.DataArrayDocument) TextDocument(net.opengis.swe.x20.TextDocument) BooleanType(net.opengis.swe.x20.BooleanType) BooleanDocument(net.opengis.swe.x20.BooleanDocument) DataRecordDocument(net.opengis.swe.x20.DataRecordDocument) TextType(net.opengis.swe.x20.TextType) TimeRangeType(net.opengis.swe.x20.TimeRangeType) CategoryDocument(net.opengis.swe.x20.CategoryDocument) CategoryRangeDocument(net.opengis.swe.x20.CategoryRangeDocument) CountDocument(net.opengis.swe.x20.CountDocument) QuantityType(net.opengis.swe.x20.QuantityType) MatrixType(net.opengis.swe.x20.MatrixType) QuantityRangeDocument(net.opengis.swe.x20.QuantityRangeDocument) TimeDocument(net.opengis.swe.x20.TimeDocument) QuantityRangeType(net.opengis.swe.x20.QuantityRangeType)

Aggregations

XmlObject (org.apache.xmlbeans.XmlObject)27 DecodingException (org.n52.svalbard.decode.exception.DecodingException)15 Actuate (org.n52.shetland.w3c.xlink.Actuate)14 Reference (org.n52.shetland.w3c.xlink.Reference)14 Show (org.n52.shetland.w3c.xlink.Show)14 Type (org.n52.shetland.w3c.xlink.Type)14 ActuateType (org.w3.x1999.xlink.ActuateType)14 ShowType (org.w3.x1999.xlink.ShowType)14 TypeType (org.w3.x1999.xlink.TypeType)14 SweAbstractDataComponent (org.n52.shetland.ogc.swe.SweAbstractDataComponent)13 AbstractCRSType (net.opengis.gml.x32.AbstractCRSType)10 CodeType (net.opengis.gml.x32.CodeType)10 EXExtentType (org.isotc211.x2005.gmd.EXExtentType)10 Test (org.junit.Test)10 XmlException (org.apache.xmlbeans.XmlException)9 TimeInstant (org.n52.shetland.ogc.gml.time.TimeInstant)9 CIResponsiblePartyPropertyType (org.isotc211.x2005.gmd.CIResponsiblePartyPropertyType)8 CIResponsiblePartyType (org.isotc211.x2005.gmd.CIResponsiblePartyType)8 BaseUnitType (net.opengis.gml.x32.BaseUnitType)6 SupportedType (org.n52.shetland.ogc.SupportedType)6