Search in sources :

Example 1 with ComponentListType

use of net.opengis.sensorml.x20.ComponentListType 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)

Aggregations

ComponentListPropertyType (net.opengis.sensorml.x20.ComponentListPropertyType)1 ComponentListType (net.opengis.sensorml.x20.ComponentListType)1 Component (net.opengis.sensorml.x20.ComponentListType.Component)1 XmlObject (org.apache.xmlbeans.XmlObject)1 SmlComponent (org.n52.shetland.ogc.sensorML.elements.SmlComponent)1 PhysicalComponent (org.n52.shetland.ogc.sensorML.v20.PhysicalComponent)1 SweAbstractDataComponent (org.n52.shetland.ogc.swe.SweAbstractDataComponent)1