use of net.opengis.sensorml.x20.CharacteristicListPropertyType in project arctic-sea by 52North.
the class SensorMLDecoderV20 method parseCharacteristics.
/**
* Parses the characteristics
*
* @param clpts
* XML characteristics
* @return SOS characteristics
*
* @throws DecodingException
* * if an error occurs
*/
private List<SmlCharacteristics> parseCharacteristics(final CharacteristicListPropertyType[] clpts) throws DecodingException {
final List<SmlCharacteristics> sosCharacteristicsList = new ArrayList<>(clpts.length);
for (final CharacteristicListPropertyType clpt : clpts) {
final SmlCharacteristics sosCharacteristics = new SmlCharacteristics();
if (clpt.isSetCharacteristicList()) {
CharacteristicListType clt = clpt.getCharacteristicList();
if (CollectionHelper.isNotNullOrEmpty(clt.getCharacteristicArray())) {
for (Characteristic c : clt.getCharacteristicArray()) {
final SmlCharacteristic characteristic = new SmlCharacteristic(c.getName());
if (c.isSetAbstractDataComponent()) {
final Object o = decodeXmlElement(c.getAbstractDataComponent());
if (o instanceof SweAbstractDataComponent) {
characteristic.setAbstractDataComponent((SweAbstractDataComponent) o);
} else {
throw new DecodingException(XmlHelper.getLocalName(clpt), "Error while parsing the characteristics of the SensorML " + "(the characteristics' data record is not of " + "type DataRecordPropertyType)!");
}
} else if (c.isSetHref()) {
characteristic.setHref(c.getHref());
if (c.isSetTitle()) {
characteristic.setTitle(c.getTitle());
}
}
sosCharacteristics.addCharacteristic(characteristic);
}
}
}
sosCharacteristicsList.add(sosCharacteristics);
}
return sosCharacteristicsList;
}
Aggregations