use of org.n52.sos.ds.hibernate.util.observation.SweAbstractDataComponentCreator in project SOS by 52North.
the class ResultHandlingHelper method createObservedPropertyField.
private List<SweField> createObservedPropertyField(DataEntity<?> observation) throws OwsExceptionReport {
List<SweField> fields = new LinkedList<>();
PhenomenonEntity phenomenon = observation.getDataset().getPhenomenon();
if (observation.getDataset().getDatasetType().equals(DatasetType.profile) || observation.getDataset().getObservationType().equals(ObservationType.profile)) {
ProfileValue profile = (ProfileValue) new ObservationValueCreator(decoderRepository).visit(observation);
ProfileLevel level = profile.getValue().get(0);
fields.add(createVerticalParameter(level));
if (level.getValue().get(0) instanceof SweAbstractDataComponent) {
if (level.getValue().size() > 1) {
SweDataRecord record = new SweDataRecord();
for (Value<?> v : level.getValue()) {
SweAbstractDataComponent dc = (SweAbstractDataComponent) v;
record.addField(new SweField(NcName.makeValid(dc.getDefinition()), dc));
}
fields.add(new SweField(getNcNameName(phenomenon), record));
return fields;
} else {
SweAbstractDataComponent swe = (SweAbstractDataComponent) level.getValue().get(0).setValue(null);
swe.setDefinition(phenomenon.getIdentifier());
fields.add(new SweField(getNcNameName(phenomenon), swe));
return fields;
}
}
} else {
SweAbstractDataComponent value = new SweAbstractDataComponentCreator(decoderRepository, true).visit(observation);
fields.add(new SweField(getNcNameName(phenomenon), (SweAbstractDataComponent) value));
return fields;
}
throw new NoApplicableCodeException();
}
use of org.n52.sos.ds.hibernate.util.observation.SweAbstractDataComponentCreator in project SOS by 52North.
the class ObservationValueCreator method visit.
@Override
public ComplexValue visit(ComplexDataEntity o) throws OwsExceptionReport {
SweAbstractDataComponentCreator visitor = new SweAbstractDataComponentCreator(getDecoderRepository());
SweDataRecord record = visitor.visit(o);
return new ComplexValue(record);
}
Aggregations