Search in sources :

Example 1 with ComponentListPropertyType

use of net.opengis.sensorml.x20.ComponentListPropertyType in project arctic-sea by 52North.

the class SensorMLDecoderV20 method parseComponents.

private List<SmlComponent> parseComponents(ComponentListPropertyType components) throws DecodingException {
    final List<SmlComponent> sosSmlComponents = Lists.newLinkedList();
    if (components.isSetComponentList() && components.getComponentList().getComponentArray() != null) {
        for (final Component component : components.getComponentList().getComponentArray()) {
            if (component.isSetAbstractProcess() || component.isSetHref() || component.isSetTitle()) {
                final SmlComponent sosSmlcomponent = new SmlComponent(component.getName());
                AbstractSensorML abstractProcess;
                if (component.isSetAbstractProcess()) {
                    abstractProcess = parse(component.getAbstractProcess());
                } else {
                    if (component.isSetTitle()) {
                        sosSmlcomponent.setTitle(component.getTitle());
                    }
                    if (component.isSetHref()) {
                        sosSmlcomponent.setHref(component.getHref());
                    }
                    abstractProcess = new AbstractProcess();
                    if (sosSmlcomponent.isSetTitle()) {
                        abstractProcess.setIdentifier(sosSmlcomponent.getTitle());
                    } else if (!sosSmlcomponent.isSetTitle() && sosSmlcomponent.isSetHref()) {
                        abstractProcess.setIdentifier(sosSmlcomponent.getHref());
                    }
                }
                sosSmlcomponent.setProcess(abstractProcess);
                sosSmlComponents.add(sosSmlcomponent);
            }
        }
    }
    return sosSmlComponents;
}
Also used : AbstractSensorML(org.n52.shetland.ogc.sensorML.AbstractSensorML) AbstractProcess(org.n52.shetland.ogc.sensorML.AbstractProcess) 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) SmlComponent(org.n52.shetland.ogc.sensorML.elements.SmlComponent)

Example 2 with ComponentListPropertyType

use of net.opengis.sensorml.x20.ComponentListPropertyType 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 3 with ComponentListPropertyType

use of net.opengis.sensorml.x20.ComponentListPropertyType in project arctic-sea by 52North.

the class SensorMLEncoderv20 method addPhysicalSystemValues.

private void addPhysicalSystemValues(PhysicalSystemType pst, PhysicalSystem abstractPhysicalProcess) throws EncodingException {
    addAbstractProcessValues(pst, abstractPhysicalProcess);
    addDescribedObjectValues(pst, abstractPhysicalProcess);
    addAbstractPhysicalProcessValues(pst, abstractPhysicalProcess);
    // set components
    if (abstractPhysicalProcess.isSetComponents()) {
        List<SmlComponent> smlComponents = checkForComponents(abstractPhysicalProcess);
        if (!smlComponents.isEmpty()) {
            ComponentListPropertyType clpt = createComponents(smlComponents);
            if (clpt != null && clpt.getComponentList() != null && clpt.getComponentList().sizeOfComponentArray() > 0) {
                pst.setComponents(clpt);
            }
        }
    }
    // set connections
    if (abstractPhysicalProcess.isSetConnections() && !pst.isSetConnections()) {
        pst.setConnections(createConnections(abstractPhysicalProcess.getConnections()));
    }
}
Also used : ComponentListPropertyType(net.opengis.sensorml.x20.ComponentListPropertyType) SmlComponent(org.n52.shetland.ogc.sensorML.elements.SmlComponent)

Example 4 with ComponentListPropertyType

use of net.opengis.sensorml.x20.ComponentListPropertyType in project arctic-sea by 52North.

the class SensorMLEncoderv20 method addAggregateProcessValues.

private void addAggregateProcessValues(AggregateProcessType apt, AggregateProcess abstractProcess) throws EncodingException {
    addAbstractProcessValues(apt, abstractProcess);
    addDescribedObjectValues(apt, abstractProcess);
    // set components
    if (abstractProcess.isSetComponents()) {
        List<SmlComponent> smlComponents = checkForComponents(abstractProcess);
        if (!smlComponents.isEmpty()) {
            ComponentListPropertyType clpt = createComponents(smlComponents);
            if (clpt != null && clpt.getComponentList() != null && clpt.getComponentList().sizeOfComponentArray() > 0) {
                apt.setComponents(clpt);
            }
        }
    }
// set connections
}
Also used : ComponentListPropertyType(net.opengis.sensorml.x20.ComponentListPropertyType) SmlComponent(org.n52.shetland.ogc.sensorML.elements.SmlComponent)

Aggregations

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