Search in sources :

Example 1 with SmlConnection

use of org.n52.shetland.ogc.sensorML.elements.SmlConnection in project arctic-sea by 52North.

the class SensorMLDecoderV20 method parseConnections.

private SmlConnection parseConnections(ConnectionListPropertyType connections) throws DecodingException {
    SmlConnection sosSmlConnection = new SmlConnection();
    if (connections.isSetConnectionList() && connections.getConnectionList().getConnectionArray() != null) {
        for (final Connection connection : connections.getConnectionList().getConnectionArray()) {
            if (connection.getLink() != null) {
                LinkType link = connection.getLink();
                sosSmlConnection.addConnection(new SmlLink(link.getDestination().getRef(), link.getSource().getRef()));
            }
        }
    }
    return sosSmlConnection;
}
Also used : SmlConnection(org.n52.shetland.ogc.sensorML.elements.SmlConnection) SmlLink(org.n52.shetland.ogc.sensorML.elements.SmlLink) SmlConnection(org.n52.shetland.ogc.sensorML.elements.SmlConnection) Connection(net.opengis.sensorml.x20.ConnectionListType.Connection) LinkType(net.opengis.sensorml.x20.LinkType)

Example 2 with SmlConnection

use of org.n52.shetland.ogc.sensorML.elements.SmlConnection in project arctic-sea by 52North.

the class SensorMLEncoderv101 method createConnections.

private Connections createConnections(SmlConnection connections) {
    Connections c = Connections.Factory.newInstance();
    ConnectionList cl = c.addNewConnectionList();
    for (SmlLink link : connections.getConnections()) {
        Link l = cl.addNewConnection().addNewLink();
        l.addNewDestination().setRef(link.getDestination());
        l.addNewSource().setRef(link.getSource());
    }
    return c;
}
Also used : Connections(net.opengis.sensorML.x101.ConnectionsDocument.Connections) ConnectionList(net.opengis.sensorML.x101.ConnectionsDocument.Connections.ConnectionList) SmlLink(org.n52.shetland.ogc.sensorML.elements.SmlLink) Link(net.opengis.sensorML.x101.LinkDocument.Link) SmlLink(org.n52.shetland.ogc.sensorML.elements.SmlLink)

Example 3 with SmlConnection

use of org.n52.shetland.ogc.sensorML.elements.SmlConnection in project arctic-sea by 52North.

the class SensorMLEncoderv20 method createConnections.

private ConnectionListPropertyType createConnections(SmlConnection connections) {
    ConnectionListPropertyType clpt = ConnectionListPropertyType.Factory.newInstance(getXmlOptions());
    if (!Strings.isNullOrEmpty(connections.getHref())) {
        clpt.setHref(connections.getHref());
        if (!Strings.isNullOrEmpty(connections.getTitle())) {
            clpt.setTitle(connections.getTitle());
        }
        if (!Strings.isNullOrEmpty(connections.getRole())) {
            clpt.setRole(connections.getRole());
        }
    } else {
        ConnectionListType clt = clpt.addNewConnectionList();
        for (SmlLink link : connections.getConnections()) {
            LinkType lt = clt.addNewConnection().addNewLink();
            lt.addNewDestination().setRef(link.getDestination());
            lt.addNewSource().setRef(link.getSource());
            if (!Strings.isNullOrEmpty(link.getId())) {
                lt.setId(link.getId());
            }
        }
    }
    return clpt;
}
Also used : ConnectionListType(net.opengis.sensorml.x20.ConnectionListType) ConnectionListPropertyType(net.opengis.sensorml.x20.ConnectionListPropertyType) SmlLink(org.n52.shetland.ogc.sensorML.elements.SmlLink) LinkType(net.opengis.sensorml.x20.LinkType)

Aggregations

SmlLink (org.n52.shetland.ogc.sensorML.elements.SmlLink)3 LinkType (net.opengis.sensorml.x20.LinkType)2 Connections (net.opengis.sensorML.x101.ConnectionsDocument.Connections)1 ConnectionList (net.opengis.sensorML.x101.ConnectionsDocument.Connections.ConnectionList)1 Link (net.opengis.sensorML.x101.LinkDocument.Link)1 ConnectionListPropertyType (net.opengis.sensorml.x20.ConnectionListPropertyType)1 ConnectionListType (net.opengis.sensorml.x20.ConnectionListType)1 Connection (net.opengis.sensorml.x20.ConnectionListType.Connection)1 SmlConnection (org.n52.shetland.ogc.sensorML.elements.SmlConnection)1