Search in sources :

Example 1 with Outputs

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

the class SensorMLEncoderv20 method createOutputs.

/**
 * Creates the outputs section of the SensorML description.
 *
 * @param sosOutputs
 *            SOS SWE representation.
 *
 * @return XML Outputs element
 *
 * @throws org.n52.svalbard.encode.exception.EncodingException
 *             if the encoding fails
 */
private Outputs createOutputs(final List<SmlIo> sosOutputs) throws EncodingException {
    final Outputs outputs = Outputs.Factory.newInstance(getXmlOptions());
    final OutputListType outputList = outputs.addNewOutputList();
    final Set<String> definitions = Sets.newHashSet();
    int counter = 1;
    final Set<String> outputNames = Sets.newHashSet();
    for (final SmlIo sosSMLIo : sosOutputs) {
        if (sosSMLIo.isSetValue() && !definitions.contains(sosSMLIo.getIoValue().getDefinition())) {
            if (!sosSMLIo.isSetName() || outputNames.contains(sosSMLIo.getIoName())) {
                sosSMLIo.setIoName(getValidOutputName(counter++, outputNames));
            } else {
                sosSMLIo.setIoName(NcName.makeValid(sosSMLIo.getIoName()));
            }
            outputNames.add(sosSMLIo.getIoName());
            addOutput(outputList.addNewOutput(), sosSMLIo);
            definitions.add(sosSMLIo.getIoValue().getDefinition());
        }
    }
    return outputs;
}
Also used : Outputs(net.opengis.sensorml.x20.AbstractProcessType.Outputs) OutputListType(net.opengis.sensorml.x20.OutputListType) SmlIo(org.n52.shetland.ogc.sensorML.elements.SmlIo)

Aggregations

Outputs (net.opengis.sensorml.x20.AbstractProcessType.Outputs)1 OutputListType (net.opengis.sensorml.x20.OutputListType)1 SmlIo (org.n52.shetland.ogc.sensorML.elements.SmlIo)1