private Collection<String> getParents(FeatureEntity featureEntity) { Set<String> parentFeatures = Sets.newTreeSet(); if (featureEntity.hasParents()) { for (FeatureEntity parentEntity : featureEntity.getParents()) { parentFeatures.add(parentEntity.getIdentifier()); parentFeatures.addAll(getParents(parentEntity)); } } return parentFeatures; }
private AbstractFeature createFeature(FeatureEntity feature) throws InvalidSridException, OwsExceptionReport { final SamplingFeature sampFeat = new SamplingFeature(new CodeWithAuthority(feature.getIdentifier())); if (feature.isSetName()) { sampFeat.addName(feature.getName()); } if (!Strings.isNullOrEmpty(feature.getDescription())) { sampFeat.setDescription(feature.getDescription()); } if (feature.isSetGeometry() && !feature.getGeometryEntity().isEmpty()) { if (getProcedureCreationContext().getGeometryHandler() != null) { sampFeat.setGeometry(getProcedureCreationContext().getGeometryHandler() .switchCoordinateAxisFromToDatasourceIfNeeded( JTSConverter.convert(feature.getGeometryEntity().getGeometry()))); } else { sampFeat.setGeometry(JTSConverter.convert(feature.getGeometryEntity().getGeometry())); } } final Set<FeatureEntity> parentFeatures = feature.getParents(); if (parentFeatures != null && !parentFeatures.isEmpty()) { final List<AbstractFeature> sampledFeatures = new ArrayList<>(parentFeatures.size()); for (final FeatureEntity parentFeature : parentFeatures) { sampledFeatures.add(createFeature(parentFeature)); } sampFeat.setSampledFeatures(sampledFeatures); } return sampFeat; }
public AbstractFeature createFeature(FeatureEntity f) throws OwsExceptionReport { final CodeWithAuthority identifier = getIdentifier(f); if (!SosHelper.checkFeatureOfInterestIdentifierForSosV2(f.getIdentifier(), getContext().getVersion())) { identifier.setValue(null); } final AbstractFeature absFeat = getFeatureType(identifier); addNameAndDescription(getContext().getRequestedLanguage(), f, absFeat); if (absFeat instanceof AbstractSamplingFeature) { AbstractSamplingFeature absSampFeat = (AbstractSamplingFeature) absFeat; absSampFeat.setGeometry(createGeometryFrom(f)); absSampFeat.setFeatureType(f.getFeatureType().getFormat()); absSampFeat.setUrl(f.getUrl()); if (f.isSetXml()) { absSampFeat.setXml(f.getXml()); } addParameter(absSampFeat, f); final Set<FeatureEntity> parentFeatures = f.getParents(); if (parentFeatures != null && !parentFeatures.isEmpty()) { final List<AbstractFeature> sampledFeatures = new ArrayList<AbstractFeature>(parentFeatures.size()); for (final AbstractFeatureEntity parentFeature : parentFeatures) { sampledFeatures.add(new HibernateFeatureVisitor(getContext()).visit(parentFeature)); } absSampFeat.setSampledFeatures(sampledFeatures); } } return absFeat; }
public AbstractFeature createFeature(FeatureEntity f) throws OwsExceptionReport { final CodeWithAuthority identifier = getIdentifier(f); if (!SosHelper.checkFeatureOfInterestIdentifierForSosV2(f.getIdentifier(), getContext().getVersion())) { identifier.setValue(null); } final AbstractFeature absFeat = getFeatureType(identifier); addNameAndDescription(getContext().getRequestedLanguage(), f, absFeat); if (absFeat instanceof AbstractSamplingFeature) { AbstractSamplingFeature absSampFeat = (AbstractSamplingFeature) absFeat; absSampFeat.setGeometry(createGeometryFrom(f)); absSampFeat.setFeatureType(f.getFeatureType().getFormat()); absSampFeat.setUrl(f.getUrl()); if (f.isSetXml()) { absSampFeat.setXml(f.getXml()); } addParameter(absSampFeat, f); final Set<FeatureEntity> parentFeatures = f.getParents(); if (parentFeatures != null && !parentFeatures.isEmpty()) { final List<AbstractFeature> sampledFeatures = new ArrayList<AbstractFeature>(parentFeatures.size()); for (final AbstractFeatureEntity parentFeature : parentFeatures) { sampledFeatures.add(new HibernateFeatureVisitor(getContext()).visit(parentFeature)); } absSampFeat.setSampledFeatures(sampledFeatures); } } return absFeat; }