@Test public void fishBaseMapping() { assertThat(ExternalIdUtil.urlForExternalId("FBC:SLB:SpecCode:69195"), is("http: assertThat(ExternalIdUtil.urlForExternalId("FBC:FB:SpecCode:947"), is("http: }
public static String urlForExternalId(String externalId) { URI uri = null; String url = null; if (externalId != null) { for (Map.Entry<String, String> idPrefixToUrlPrefix : getURLPrefixMap().entrySet()) { String idPrefix = idPrefixToUrlPrefix.getKey(); if (StringUtils.startsWith(externalId, idPrefix)) { if (isIRMNG(idPrefix)) { url = urlForIRMNG(externalId, idPrefix); } else if (DOI.isCommonlyUsedDoiPrefix(idPrefix)) { try { DOI doi = DOI.create(externalId); url = doi.toURI().toString(); } catch (MalformedDOIException e) { LOG.warn("found malformed doi [" + externalId + "]", e); } } else { url = idPrefixToUrlPrefix.getValue() + externalId.replaceAll(idPrefix, ""); } String suffix = getURLSuffixMap().get(idPrefix); if (StringUtils.isNotBlank(suffix)) { url = url + suffix; } } if (url != null) { try { URIBuilder uriBuilder = new URIBuilder(url); uri = uriBuilder.build(); } catch (URISyntaxException e) { } break; } } } return uri == null ? null : uri.toString(); }
ExternalIdUtil { public static String urlForExternalId(String externalId) { URI uri = null; String url = null; if (externalId != null) { for (Map.Entry<String, String> idPrefixToUrlPrefix : getURLPrefixMap().entrySet()) { String idPrefix = idPrefixToUrlPrefix.getKey(); if (StringUtils.startsWith(externalId, idPrefix)) { if (isIRMNG(idPrefix)) { url = urlForIRMNG(externalId, idPrefix); } else if (DOI.isCommonlyUsedDoiPrefix(idPrefix)) { try { DOI doi = DOI.create(externalId); url = doi.toURI().toString(); } catch (MalformedDOIException e) { LOG.warn("found malformed doi [" + externalId + "]", e); } } else { url = idPrefixToUrlPrefix.getValue() + externalId.replaceAll(idPrefix, ""); } String suffix = getURLSuffixMap().get(idPrefix); if (StringUtils.isNotBlank(suffix)) { url = url + suffix; } } if (url != null) { try { URIBuilder uriBuilder = new URIBuilder(url); uri = uriBuilder.build(); } catch (URISyntaxException e) { } break; } } } return uri == null ? null : uri.toString(); } }
ExternalIdUtil { public static String urlForExternalId(String externalId) { URI uri = null; String url = null; if (externalId != null) { for (Map.Entry<String, String> idPrefixToUrlPrefix : getURLPrefixMap().entrySet()) { String idPrefix = idPrefixToUrlPrefix.getKey(); if (StringUtils.startsWith(externalId, idPrefix)) { if (isIRMNG(idPrefix)) { url = urlForIRMNG(externalId, idPrefix); } else if (DOI.isCommonlyUsedDoiPrefix(idPrefix)) { try { DOI doi = DOI.create(externalId); url = doi.toURI().toString(); } catch (MalformedDOIException e) { LOG.warn("found malformed doi [" + externalId + "]", e); } } else { url = idPrefixToUrlPrefix.getValue() + externalId.replaceAll(idPrefix, ""); } String suffix = getURLSuffixMap().get(idPrefix); if (StringUtils.isNotBlank(suffix)) { url = url + suffix; } } if (url != null) { try { URIBuilder uriBuilder = new URIBuilder(url); uri = uriBuilder.build(); } catch (URISyntaxException e) { } break; } } } return uri == null ? null : uri.toString(); }  }
ExternalIdUtil { public static String urlForExternalId(String externalId) { URI uri = null; String url = null; if (externalId != null) { for (Map.Entry<String, String> idPrefixToUrlPrefix : getURLPrefixMap().entrySet()) { String idPrefix = idPrefixToUrlPrefix.getKey(); if (StringUtils.startsWith(externalId, idPrefix)) { if (isIRMNG(idPrefix)) { url = urlForIRMNG(externalId, idPrefix); } else if (DOI.isCommonlyUsedDoiPrefix(idPrefix)) { try { DOI doi = DOI.create(externalId); url = doi.toURI().toString(); } catch (MalformedDOIException e) { LOG.warn("found malformed doi [" + externalId + "]", e); } } else { url = idPrefixToUrlPrefix.getValue() + externalId.replaceAll(idPrefix, ""); } String suffix = getURLSuffixMap().get(idPrefix); if (StringUtils.isNotBlank(suffix)) { url = url + suffix; } } if (url != null) { try { URIBuilder uriBuilder = new URIBuilder(url); uri = uriBuilder.build(); } catch (URISyntaxException e) { } break; } } } return uri == null ? null : uri.toString(); }  static String urlForExternalId(String externalId); static boolean isIRMNG(String idPrefix); static String urlForIRMNG(String externalId, String idPrefix); static Map<String, String> getURLPrefixMap(); static Map<String, String> getURLSuffixMap(); static boolean isSupported(String externalId); static TaxonomyProvider taxonomyProviderFor(String externalId); static String getUrlFromExternalId(String jsonString); static String buildJsonUrl(String url); static String toCitation(String contributor, String description, String publicationYear); static String selectValue(Map<String, String> link, String[] candidateIdsInIncreasingPreference); static boolean hasProperty(Map<String, String> link, String propertyName); static String stripPrefix(TaxonomyProvider provider, String externalId); static String prefixForUrl(String url); static boolean isLikelyId(String idCandidate); static boolean isUnlikelyId(String idCandidate); }
ExternalIdUtil { public static String urlForExternalId(String externalId) { URI uri = null; String url = null; if (externalId != null) { for (Map.Entry<String, String> idPrefixToUrlPrefix : getURLPrefixMap().entrySet()) { String idPrefix = idPrefixToUrlPrefix.getKey(); if (StringUtils.startsWith(externalId, idPrefix)) { if (isIRMNG(idPrefix)) { url = urlForIRMNG(externalId, idPrefix); } else if (DOI.isCommonlyUsedDoiPrefix(idPrefix)) { try { DOI doi = DOI.create(externalId); url = doi.toURI().toString(); } catch (MalformedDOIException e) { LOG.warn("found malformed doi [" + externalId + "]", e); } } else { url = idPrefixToUrlPrefix.getValue() + externalId.replaceAll(idPrefix, ""); } String suffix = getURLSuffixMap().get(idPrefix); if (StringUtils.isNotBlank(suffix)) { url = url + suffix; } } if (url != null) { try { URIBuilder uriBuilder = new URIBuilder(url); uri = uriBuilder.build(); } catch (URISyntaxException e) { } break; } } } return uri == null ? null : uri.toString(); }  static String urlForExternalId(String externalId); static boolean isIRMNG(String idPrefix); static String urlForIRMNG(String externalId, String idPrefix); static Map<String, String> getURLPrefixMap(); static Map<String, String> getURLSuffixMap(); static boolean isSupported(String externalId); static TaxonomyProvider taxonomyProviderFor(String externalId); static String getUrlFromExternalId(String jsonString); static String buildJsonUrl(String url); static String toCitation(String contributor, String description, String publicationYear); static String selectValue(Map<String, String> link, String[] candidateIdsInIncreasingPreference); static boolean hasProperty(Map<String, String> link, String propertyName); static String stripPrefix(TaxonomyProvider provider, String externalId); static String prefixForUrl(String url); static boolean isLikelyId(String idCandidate); static boolean isUnlikelyId(String idCandidate);  }