use of org.n52.svalbard.decode.exception.DecoderResponseUnsupportedException in project arctic-sea by 52North.
the class SwesDecoderv20 method parseRelatedFeature.
private List<SwesFeatureRelationship> parseRelatedFeature(final RelatedFeature[] relatedFeatureArray) throws DecodingException {
List<SwesFeatureRelationship> sosRelatedFeatures = new ArrayList<>(relatedFeatureArray.length);
for (final RelatedFeature relatedFeature : relatedFeatureArray) {
final SwesFeatureRelationship sosFeatureRelationship = new SwesFeatureRelationship();
final FeaturePropertyType fpt = relatedFeature.getFeatureRelationship().getTarget();
if (fpt.getHref() != null && !fpt.getHref().isEmpty()) {
final String identifier = fpt.getHref();
final AbstractSamplingFeature feature = new SamplingFeature(new CodeWithAuthority(identifier));
if (fpt.getTitle() != null && !fpt.getTitle().isEmpty()) {
feature.setName(Lists.newArrayList(new CodeType(fpt.getTitle())));
}
if (checkForRequestUrl(fpt.getHref())) {
feature.setUrl(fpt.getHref());
}
feature.setFeatureType(OGCConstants.UNKNOWN);
sosFeatureRelationship.setFeature(feature);
} else {
final Object decodedObject = decodeXmlElement(fpt);
if (decodedObject instanceof AbstractSamplingFeature) {
sosFeatureRelationship.setFeature((AbstractSamplingFeature) decodedObject);
} else {
throw new DecoderResponseUnsupportedException(fpt.xmlText(), decodedObject);
}
}
sosFeatureRelationship.setRole(relatedFeature.getFeatureRelationship().getRole());
sosRelatedFeatures.add(sosFeatureRelationship);
}
return sosRelatedFeatures;
}
Aggregations