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;
}
Aggregations