@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 createSeriesLabel(DatasetEntity<?> series, String locale) { String station = series.getFeature().getLabelFrom(locale); String procedure = series.getProcedure().getLabelFrom(locale); String phenomenon = series.getPhenomenon().getLabelFrom(locale); String offering = series.getOffering().getLabelFrom(locale); StringBuilder sb = new StringBuilder(); sb.append(phenomenon).append(" "); sb.append(procedure).append(", "); sb.append(station).append(", "); return sb.append(offering).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<MeasurementDatasetEntity> found, String locale) { List<SearchResult> results = new ArrayList<>(); for (MeasurementDatasetEntity searchResult : found) { String pkid = searchResult.getPkid().toString(); String phenomenonLabel = searchResult.getPhenomenon().getLabelFrom(locale); String procedureLabel = searchResult.getProcedure().getLabelFrom(locale); String stationLabel = searchResult.getFeature().getLabelFrom(locale); String offeringLabel = searchResult.getOffering().getLabelFrom(locale); String label = createTimeseriesLabel(phenomenonLabel, procedureLabel, stationLabel, offeringLabel); results.add(new TimeseriesSearchResult(pkid, label)); } return results; }
private ProcedureOutput createCondensed(ProcedureEntity entity, DbQuery parameters) { ProcedureOutput result = new ProcedureOutput(); result.setLabel(entity.getLabelFrom(parameters.getLocale())); result.setId(Long.toString(entity.getPkid())); result.setDomainId(entity.getDomainId()); checkForHref(result, parameters); return result; }
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(MeasurementDatasetEntity entity, DbQuery query) throws DataAccessException { TimeseriesMetadataOutput output = new TimeseriesMetadataOutput() ; String locale = query.getLocale(); String phenomenonLabel = entity.getPhenomenon().getLabelFrom(locale); String procedureLabel = entity.getProcedure().getLabelFrom(locale); String stationLabel = entity.getFeature().getLabelFrom(locale); String offeringLabel = entity.getOffering().getLabelFrom(locale); output.setLabel(createTimeseriesLabel(phenomenonLabel, procedureLabel, stationLabel, offeringLabel)); output.setId(entity.getPkid().toString()); output.setUom(entity.getUnitI18nName(locale)); output.setStation(createCondensedStation(entity, query)); return output; }
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; }