private void insertCountryLinks() { final String countryUrl = getBaseUrl() + "/country/"; // main description Matcher m = COUNTRY_REG_EX.matcher(getDataset().getDescription()); StringBuffer sb = new StringBuffer(); while (m.find()) { Country c = COUNTRY_MAP.get(m.group(1).toLowerCase()); String replacement; if (c != null) { replacement = "<a href='" + countryUrl + c.getIso2LetterCode() + "'>" + m.group(1) + "</a>"; } else { replacement = m.group(1); } m.appendReplacement(sb, replacement); } m.appendTail(sb); getDataset().setDescription(sb.toString()); // spatial coverage for (GeospatialCoverage gc : getDataset().getGeographicCoverages()) { // There are not yet any links to the actual countries m = COUNTRY_REG_EX.matcher(gc.getDescription()); sb = new StringBuffer(); while (m.find()) { Country c = COUNTRY_MAP.get(m.group(1).toLowerCase()); String replacement = "<a href='" + countryUrl + c.getIso2LetterCode() + "'>" + m.group(1) + "</a>"; m.appendReplacement(sb, replacement); } m.appendTail(sb); gc.setDescription(sb.toString()); } }
@Override public String execute() { loadDetail(); insertCountryLinks(); populateContacts(member.getContacts()); populateLinks(member.getEndpoints()); // only datasets with a key (internal) can have constituents if (id != null) { constituents = datasetService.listConstituents(id, new PagingRequest(0, PAGE_SIZE)); super.loadCountWrappedDatasets(constituents); } // the map article is rendered only if the cube has indicated georeferenced records, or if there // are // coverages that are not global (they don't really warrant visualizing). renderMaps = getNumGeoreferencedOccurrences() != null && getNumGeoreferencedOccurrences() > 0; if (!renderMaps) { for (GeospatialCoverage gc : member.getGeographicCoverages()) { renderMaps = renderMaps || (gc.getBoundingBox() != null && !gc.getBoundingBox().isGlobalCoverage()); if (renderMaps) { break; // for speed } } } // get networks networks = datasetService.listNetworks(id); return SUCCESS; }