@Override public String getLabelFrom(String locale) { StringBuilder sb = new StringBuilder(); sb.append(phenomenon.getLabelFrom(locale)) .append(" "); sb.append(procedure.getLabelFrom(locale)) .append(", "); sb.append(feature.getLabelFrom(locale)) .append(", "); return sb.append(offering.getLabelFrom(locale)) .toString(); }
private String createDatasetLabel(DatasetEntity dataset, String locale) { PhenomenonEntity phenomenon = dataset.getPhenomenon(); ProcedureEntity procedure = dataset.getProcedure(); OfferingEntity offering = dataset.getOffering(); AbstractFeatureEntity feature = dataset.getFeature(); String procedureLabel = procedure.getLabelFrom(locale); String phenomenonLabel = phenomenon.getLabelFrom(locale); String offeringLabel = offering.getLabelFrom(locale); String stationLabel = feature.getLabelFrom(locale); StringBuilder sb = new StringBuilder(); return sb.append(phenomenonLabel) .append(" ") .append(procedureLabel) .append(", ") .append(stationLabel) .append(", ") .append(offeringLabel) .toString(); }
private List<SearchResult> convertToResults(List<QuantityDatasetEntity> found, String locale) { List<SearchResult> results = new ArrayList<>(); for (QuantityDatasetEntity searchResult : found) { String id = searchResult.getId() .toString(); AbstractFeatureEntity feature = searchResult.getFeature(); PhenomenonEntity phenomenon = searchResult.getPhenomenon(); ProcedureEntity procedure = searchResult.getProcedure(); OfferingEntity offering = searchResult.getOffering(); String phenomenonLabel = phenomenon.getLabelFrom(locale); String procedureLabel = procedure.getLabelFrom(locale); String stationLabel = feature.getLabelFrom(locale); String offeringLabel = offering.getLabelFrom(locale); String label = createTimeseriesLabel(phenomenonLabel, procedureLabel, stationLabel, offeringLabel); results.add(new TimeseriesSearchResult(id, label)); } return results; }
private TimeseriesMetadataOutput createCondensed(QuantityDatasetEntity entity, DbQuery query, Session session) throws DataAccessException { IoParameters parameters = query.getParameters(); TimeseriesMetadataOutput result = new TimeseriesMetadataOutput(parameters); String locale = query.getLocale(); AbstractFeatureEntity feature = entity.getFeature(); OfferingEntity offering = entity.getOffering(); PhenomenonEntity phenomenon = entity.getPhenomenon(); ProcedureEntity procedure = entity.getProcedure(); String phenomenonLabel = phenomenon.getLabelFrom(locale); String procedureLabel = procedure.getLabelFrom(locale); String stationLabel = feature.getLabelFrom(locale); String offeringLabel = offering.getLabelFrom(locale); Long id = entity.getId(); String uom = entity.getUnitI18nName(locale); String label = createTimeseriesLabel(phenomenonLabel, procedureLabel, stationLabel, offeringLabel); StationOutput station = createCondensedStation(entity, query.withoutFieldsFilter(), session); result.setId(id.toString()); result.setValue(TimeseriesMetadataOutput.LABEL, label, parameters, result::setLabel); result.setValue(TimeseriesMetadataOutput.UOM, uom, parameters, result::setUom); result.setValue(TimeseriesMetadataOutput.STATION, station, parameters, result::setStation); return result; }