hbz/lobid-resources

Use opac link instead of web app generated link for opac link

Closed this issue · 4 comments

/**
* @param itemUri The lobid item URI
* @return The OPAC URL for the given item, or null
*/
public static String opacUrl(String itemUri) {
try (InputStream stream =
new URL(Application.CONFIG.getString("isil2opac_hbzid")).openStream()) {
JsonNode json = Json.parse(stream);
String[] hbzId_isil_sig =
itemUri.substring(itemUri.indexOf("items/") + 6).split(":");
String hbzId = hbzId_isil_sig[0];
String isil = hbzId_isil_sig[1];
Logger.debug("From item URI {}, got ISIL {} and HBZ-ID {}", itemUri, isil,
hbzId);
JsonNode urlTemplate = json.get(isil);
if (urlTemplate != null)
return urlTemplate.asText().replace("{hbzid}", hbzId);
} catch (IOException e) {
Logger.error("Could not create OPAC URL", e);
}
return null;
}

This function at least by generating the function every time is not needed anymore. It can use the link given in hasItem.seeAlso which is given in the submodule lookup-tables

dr0i commented

Resolved by #1920, closing.

@dr0i not deployed yet.

dr0i commented

Hm, I double checked that and it is still good, see e.g. http://lobid.org/resources/99371791018506441 -> Bonn lokal anzeigen . Or did I miss something?

On friday there was still the old link, today it is correct. Thanks