@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()); }