NIHVIVO-1380 Use existing method of IndividualTemplateModel to produce the linked data url

This commit is contained in:
rjy7 2011-01-11 14:49:47 +00:00
parent 94b9fa9091
commit a3909c4432

View file

@ -121,8 +121,6 @@ public class IndividualController extends FreemarkerHttpServlet {
body.put("relatedSubject", getRelatedSubject(vreq)); body.put("relatedSubject", getRelatedSubject(vreq));
body.put("headContent", getRdfLinkTag(individual));
IndividualTemplateModel itm = getIndividualTemplateModel(vreq, individual); IndividualTemplateModel itm = getIndividualTemplateModel(vreq, individual);
/* We need to expose non-getters in displaying the individual's property list, /* We need to expose non-getters in displaying the individual's property list,
* since it requires calls to methods with parameters. * since it requires calls to methods with parameters.
@ -130,7 +128,9 @@ public class IndividualController extends FreemarkerHttpServlet {
* into the data model: no real data can be modified. * into the data model: no real data can be modified.
*/ */
body.put("individual", getNonDefaultBeansWrapper(BeansWrapper.EXPOSE_SAFE).wrap(itm)); body.put("individual", getNonDefaultBeansWrapper(BeansWrapper.EXPOSE_SAFE).wrap(itm));
body.put("headContent", getRdfLinkTag(itm));
body.put("localName", new IndividualLocalNameMethod()); body.put("localName", new IndividualLocalNameMethod());
String template = getIndividualTemplate(individual); String template = getIndividualTemplate(individual);
@ -194,11 +194,13 @@ public class IndividualController extends FreemarkerHttpServlet {
return map; return map;
} }
//<link rel="alternate" type="application/rdf+xml" href="http://vivo.cornell.edu/individual/n337/n337.rdf" /> private String getRdfLinkTag(IndividualTemplateModel itm) {
private String getRdfLinkTag(Individual individual) { String linkTag = null;
String href = individual.getURI() + "/" + individual.getLocalName() + ".rdf"; String linkedDataUrl = itm.getLinkedDataUrl();
String linkTag = "<link rel=\"alternate\" type=\"application/rdf+xml\" href=\"" + if (linkedDataUrl != null) {
href + "\" /> "; linkTag = "<link rel=\"alternate\" type=\"application/rdf+xml\" href=\"" +
linkedDataUrl + "\" /> ";
}
return linkTag; return linkTag;
} }