@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 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; }
I18NDAO<I18NFeatureMetadata> i18nDAO = getContext().getI18NDAORepository().getDAO(I18NFeatureMetadata.class); if (feature.isSetName()) { abstractFeature.setHumanReadableIdentifier(feature.getName());
I18NDAO<I18NFeatureMetadata> i18nDAO = getContext().getI18NDAORepository().getDAO(I18NFeatureMetadata.class); if (feature.isSetName()) { abstractFeature.setHumanReadableIdentifier(feature.getName());