public static ResolvableIdentifier resolveCanonical(Context context, String canonicalForm) { ObjectIdentifier oi = ObjectIdentifier.parseCanonicalForm(canonicalForm); ExternalIdentifier ei = null; if (oi == null) { ei = ExternalIdentifierMint.parseCanonicalForm(context, canonicalForm); } if (oi == null && ei == null) { return null; } else { if (oi != null) { return oi; } else { return ei; } } }
public static ResolvableIdentifier resolveAsURLSubstring(Context context, String path) { ObjectIdentifier oi = ObjectIdentifier.extractURLIdentifier(path); ExternalIdentifier ei = null; if (oi == null) { ei = ExternalIdentifierMint.extractURLIdentifier(context, path); } if (oi == null && ei == null) { return null; } else { if (oi != null) { return oi; } else { return ei; } } }
public static String getCanonicalForm(DSpaceObject dso) { String cf = ""; String ns = ConfigurationManager.getProperty("identifier.url-scheme"); if (!"".equals(ns) && ns != null) { ExternalIdentifierType type = ExternalIdentifierMint.getType(ns); List<ExternalIdentifier> eids = dso.getExternalIdentifiers(); for (ExternalIdentifier eid : eids) { if (eid.getType().equals(type)) { cf = eid.getCanonicalForm(); } } } if ("".equals(cf)) { ObjectIdentifier oid = dso.getIdentifier(); if (oid == null) { return cf; } cf = oid.getCanonicalForm(); } return cf; }
public static URL getURL(DSpaceObject dso) { URL url = null; String ns = ConfigurationManager.getProperty("identifier.url-scheme"); if (!"".equals(ns) && ns != null) { ExternalIdentifierType type = ExternalIdentifierMint.getType(ns); List<ExternalIdentifier> eids = dso.getExternalIdentifiers(); for (ExternalIdentifier eid : eids) { if (eid.getType().equals(type)) { url = IdentifierFactory.getURL(eid); } } } if (url == null) { ObjectIdentifier oid = dso.getIdentifier(); if (oid == null) { return null; } url = IdentifierFactory.getURL(oid); } return url; }