Removed unneeded code for externally-linked namespaces from BaseIndividualTemplateModel.getRdfUrl(). This code is never used, since in the case of an individual in an externally-linked namespace, we do not display them on the site but link to the profile on the external site.

This commit is contained in:
rjy7 2011-02-15 20:51:00 +00:00
parent 067a968a57
commit 1265a00abe
2 changed files with 6 additions and 23 deletions

View file

@ -183,7 +183,7 @@ public class IndividualController extends FreemarkerHttpServlet {
private String getRdfLinkTag(IndividualTemplateModel itm) {
String linkTag = null;
String linkedDataUrl = itm.getRdfUrl(false);
String linkedDataUrl = itm.getRdfUrl();
if (linkedDataUrl != null) {
linkTag = "<link rel=\"alternate\" type=\"application/rdf+xml\" href=\"" +
linkedDataUrl + "\" /> ";

View file

@ -2,9 +2,7 @@
package edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -87,13 +85,9 @@ public abstract class BaseIndividualTemplateModel extends BaseTemplateModel {
String thumbUrl = individual.getThumbUrl();
return thumbUrl == null ? null : getUrl(thumbUrl);
}
public String getRdfUrl() {
return getRdfUrl(true);
}
// Used to create a link to generate the individual's rdf.
public String getRdfUrl(boolean checkExternalNamespaces) {
public String getRdfUrl() {
String individualUri = getUri();
String profileUrl = getProfileUrl();
@ -104,21 +98,10 @@ public abstract class BaseIndividualTemplateModel extends BaseTemplateModel {
// Individuals in the default namespace
// e.g., http://vivo.cornell.edu/individual/n2345/n2345.rdf
// where default namespace = http://vivo.cornell.edu/individual/
// Other individuals: http://some.other.namespace/n2345?format=rdfxml
String defaultNamespace = vreq.getWebappDaoFactory().getDefaultNamespace();
if (defaultNamespace.equals(namespace)) {
return profileUrl + "/" + getLocalName() + ".rdf";
}
// An RDF url is not defined for an externally linked namespace. The data does not reside
// in the current system, and the external system may not accept a request for rdf.
if (checkExternalNamespaces && vreq.getWebappDaoFactory()
.getApplicationDao()
.isExternallyLinkedNamespace(namespace)) {
return null;
}
// http://some.other.namespace/n2345?format=rdfxml
return UrlBuilder.addParams(profileUrl, "format", "rdfxml");
return (defaultNamespace.equals(namespace)) ? profileUrl + "/" + getLocalName() + ".rdf"
: UrlBuilder.addParams(profileUrl, "format", "rdfxml");
}