private PlatformEntity convertToPlatform(FeatureEntity entity, DbQuery query) { PlatformEntity result = new PlatformEntity(); result.setIdentifier(entity.getIdentifier()); result.setId(entity.getId()); result.setName(entity.getName()); result.setParameters(entity.getParameters()); result.setTranslations(entity.getTranslations()); result.setDescription(entity.getDescription()); result.setGeometry(getGeometry(entity.getGeometryEntity(), query)); return result; }
private Geometry createPoint(FeatureEntity featureEntity, DbQuery query) { return featureEntity.isSetGeometry() ? getGeometry(featureEntity.getGeometryEntity(), query) : null; }
public static FeatureEntity createFeature(String domainId, String name, String description, GeometryEntity geometry, ProxyServiceEntity service) { FeatureEntity feature = new FeatureEntity(); feature.setName(name); feature.setDescription(description); feature.setDomainId(domainId); feature.setGeometryEntity(geometry); feature.setService(service); return feature; }
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; }
private PlatformEntity convertToPlatform(FeatureEntity entity) { PlatformEntity result = new PlatformEntity(); result.setDomainId(entity.getDomainId()); result.setPkid(entity.getPkid()); result.setName(entity.getName()); result.setTranslations(entity.getTranslations()); result.setDescription(entity.getDescription()); result.setGeometry(entity.getGeometry()); return result; }
if (feature.isSetGeometry()) { return getContext().getGeometryHandler().switchCoordinateAxisFromToDatasourceIfNeeded(JTSConverter.convert(feature.getGeometryEntity().getGeometry())); } else { if (!feature.isSetUrl() && getContext().getSession() != null) { if (getContext().createFeatureGeometryFromSamplingGeometries()) { int srid = getContext().getGeometryHandler().getStorageEPSG(); if (getContext().getDaoFactory().getObservationDAO().getSamplingGeometriesCount(feature.getIdentifier(), getContext().getSession()) .longValue() < 100) { List<Geometry> geometries = getContext().getDaoFactory().getObservationDAO().getSamplingGeometries(feature.getIdentifier(), getContext().getSession()); if (!CollectionHelper.nullEmptyOrContainsOnlyNulls(geometries)) { List<Coordinate> coordinates = Lists.newLinkedList();
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; }
I18NDAO<I18NFeatureMetadata> i18nDAO = getContext().getI18NDAORepository().getDAO(I18NFeatureMetadata.class); if (feature.isSetName()) { abstractFeature.setHumanReadableIdentifier(feature.getName()); if (requestedLocale != null) { I18NFeatureMetadata i18n = i18nDAO.getMetadata(feature.getIdentifier(), requestedLocale); Optional<LocalizedString> name = i18n.getName().getLocalization(requestedLocale); if (name.isPresent()) { if (getContext().isShowAllLanguages()) { i18n = i18nDAO.getMetadata(feature.getIdentifier()); } else { i18n = i18nDAO.getMetadata(feature.getIdentifier(), getContext().getDefaultLanguage());
@Override public void execute() { LOGGER.debug("Executing FeatureOfInterestCacheUpdate"); startStopwatch(); try { Collection<FeatureEntity> features = new FeatureDao(getSession()).get(new DbQuery(IoParameters.createDefaults())); for (FeatureEntity featureEntity : features) { String identifier = featureEntity.getIdentifier(); getCache().addFeatureOfInterest(identifier); Collection<DatasetEntity> datasets = new DatasetDao<>(getSession()).get(createDatasetDbQuery(featureEntity)); if (datasets != null && !datasets.isEmpty()) { if (datasets.stream().anyMatch(d -> d.isPublished() || d instanceof NotInitializedDataset)) { getCache().addPublishedFeatureOfInterest(identifier); } getCache().setProceduresForFeatureOfInterest(identifier, getProcedures(datasets)); } if (featureEntity.isSetName()) { getCache().addFeatureOfInterestIdentifierHumanReadableName(identifier, featureEntity.getName()); } if (featureEntity.hasParents()) { getCache().addParentFeatures(identifier, getParents(featureEntity)); } } } catch (HibernateException he) { getErrors().add(new NoApplicableCodeException().causedBy(he).withMessage("Error while updating featureOfInterest cache!")); } LOGGER.debug("Finished executing FeatureOfInterestCacheUpdate ({})", getStopwatchResult()); }
private void addObservingCapabilities(org.n52.shetland.inspire.ef.EnvironmentalMonitoringFacility emFeature, FeatureEntity feature) { emFeature.addObservingCapability(createObservingCapability(feature.getIdentifier())); if (feature.hasChildren()) { for (AbstractFeatureEntity child : feature.getChildren()) { emFeature.addObservingCapability(createObservingCapability(child.getIdentifier())); } } }
private GeometryInfo createTrack(FeatureEntity featureEntity, DbQuery parameters, boolean expanded, Session session) throws DataAccessException { final GeometryInfo geomInfo = new GeometryInfo(PLATFORM_TRACK); GeometryInfo geometryInfo = addCondensedValues(geomInfo, featureEntity, parameters); if (expanded) { if (featureEntity.isSetGeometry()) { // track available from feature table geometryInfo.setGeometry(featureEntity.getGeometry(getDatabaseSrid())); return geometryInfo; } else { // track available as points from observation table DbQuery featureQuery = DbQuery.createFrom(parameters.getParameters() .extendWith(FEATURES, String.valueOf(featureEntity.getPkid())) ); final SamplingGeometryDao dao = new SamplingGeometryDao(session); List<GeometryEntity> samplingGeometries = dao.getGeometriesOrderedByTimestamp(featureQuery); geometryInfo.setGeometry(createLineString(samplingGeometries)); return geometryInfo; } } return geometryInfo; }
private Geometry createPoint(FeatureEntity featureEntity) { return featureEntity.isSetGeometry() ? featureEntity.getGeometry(getDatabaseSrid()) : null; }
private FeatureOutput createCondensed(FeatureEntity entity, DbQuery parameters) { FeatureOutput result = new FeatureOutput(); result.setId(Long.toString(entity.getPkid())); result.setLabel(entity.getLabelFrom(parameters.getLocale())); result.setDomainId(entity.getDomainId()); checkForHref(result, parameters); return result; }
protected boolean isStation(ProcedureEntity procedure, Session session) throws DataAccessException { List<DatasetEntity> datasets = new DatasetDao<>(session).getAllInstances(createDbQueryWithLimit(procedure)); if (datasets != null && !datasets.isEmpty()) { DatasetEntity dataset = datasets.iterator().next(); if (dataset.isInsitu() && !dataset.isMobile()) { List<FeatureEntity> features = new FeatureDao(session).getAllInstances(createDbQuery(procedure)); if (features != null && features.size() == 1) { return features.iterator().next().isSetGeometry(); } } } return false; }
@SuppressWarnings("unchecked") public List<T> getInstancesWith(FeatureEntity feature, DbQuery query) { LOGGER.debug("get instance for feature '{}'", feature); Criteria criteria = getDefaultCriteria(query); String path = QueryUtils.createAssociation(DatasetEntity.PROPERTY_FEATURE, DatasetEntity.PROPERTY_ID); return criteria.add(Restrictions.eq(path, feature.getId())) .list(); }
private StationOutput createCondensed(FeatureEntity entity, DbQuery query) { StationOutput result = new StationOutput(); IoParameters parameters = query.getParameters(); String id = Long.toString(entity.getId()); String label = entity.getLabelFrom(query.getLocale()); Geometry geometry = createPoint(entity, query); result.setId(id); result.setValue(StationOutput.PROPERTIES, label, parameters, result::setLabel); result.setValue(StationOutput.GEOMETRY, geometry, parameters, result::setGeometry); return result; }
public void add() throws OwsExceptionReport { if (feature.hasParameters()) { for (Parameter parameter : feature.getParameters()) { abstractSamplingFeature.addParameter(visitor.visit(parameter)); } } }
public FeatureEntity putFeature(FeatureEntity feature) { features.put(feature.getDomainId(), feature); return feature; }