NIHVIVO-1177 Generate individual urls with externally linked namespaces
This commit is contained in:
parent
f872582288
commit
e0cc7a634b
1 changed files with 16 additions and 4 deletions
|
@ -16,6 +16,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.ParamMap;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.ParamMap;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Route;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Route;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
import edu.cornell.mannlib.vitro.webapp.web.ViewFinder;
|
import edu.cornell.mannlib.vitro.webapp.web.ViewFinder;
|
||||||
import edu.cornell.mannlib.vitro.webapp.web.ViewFinder.ClassView;
|
import edu.cornell.mannlib.vitro.webapp.web.ViewFinder.ClassView;
|
||||||
|
|
||||||
|
@ -57,14 +58,21 @@ public class IndividualTemplateModel extends BaseTemplateModel {
|
||||||
|
|
||||||
URI uri = new URIImpl(individualUri);
|
URI uri = new URIImpl(individualUri);
|
||||||
String namespace = uri.getNamespace();
|
String namespace = uri.getNamespace();
|
||||||
String defaultNamespace = vreq.getWebappDaoFactory().getDefaultNamespace();
|
WebappDaoFactory wadf = vreq.getWebappDaoFactory();
|
||||||
|
String defaultNamespace = wadf.getDefaultNamespace();
|
||||||
|
|
||||||
if (defaultNamespace.equals(namespace)) {
|
if (defaultNamespace.equals(namespace)) {
|
||||||
profileUrl = getUrl(PATH + "/" + individual.getLocalName());
|
profileUrl = getUrl(PATH + "/" + individual.getLocalName());
|
||||||
|
} else {
|
||||||
|
List<String> externallyLinkedNamespaces = wadf.getApplicationDao().getExternallyLinkedNamespaces();
|
||||||
|
if (externallyLinkedNamespaces.contains(namespace)) {
|
||||||
|
log.debug("Found externally linked namespace " + namespace);
|
||||||
|
profileUrl = namespace + "/" + individual.getLocalName();
|
||||||
} else {
|
} else {
|
||||||
ParamMap params = new ParamMap("uri", individualUri);
|
ParamMap params = new ParamMap("uri", individualUri);
|
||||||
profileUrl = getUrl("/individual", params);
|
profileUrl = getUrl("/individual", params);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return profileUrl;
|
return profileUrl;
|
||||||
}
|
}
|
||||||
|
@ -189,6 +197,10 @@ public class IndividualTemplateModel extends BaseTemplateModel {
|
||||||
return models;
|
return models;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isExternallyLinkedNamespace(String namespace,List<String> externallyLinkedNamespaces) {
|
||||||
|
return externallyLinkedNamespaces.contains(namespace);
|
||||||
|
}
|
||||||
|
|
||||||
// public Map< > getPropertyList
|
// public Map< > getPropertyList
|
||||||
|
|
||||||
// public Map< > getPropertyGroupList
|
// public Map< > getPropertyGroupList
|
||||||
|
|
Loading…
Add table
Reference in a new issue