diff --git a/productMods/templates/freemarker/body/partials/individual/individual-qrCodeFoafPerson.ftl b/productMods/templates/freemarker/body/partials/individual/individual-qrCodeFoafPerson.ftl index 83b25130..ca13b8c7 100644 --- a/productMods/templates/freemarker/body/partials/individual/individual-qrCodeFoafPerson.ftl +++ b/productMods/templates/freemarker/body/partials/individual/individual-qrCodeFoafPerson.ftl @@ -20,17 +20,18 @@ PHOTO;VALUE=URL;TYPE=JPG:https://vivo.ufl.edu/file/n34850/_main_image_491-NUCATS REV:20080424T195243Z END:VCARD --> + <#local qrData = individual.qrData > <#local core = "http://vivoweb.org/ontology/core#"> <#local foaf = "http://xmlns.com/foaf/0.1/"> <#local rdfs = "http://www.w3.org/2000/01/rdf-schema#"> - <#local firstName = (allProperties.getProperty("${foaf}firstName").firstValue)! > - <#local lastName = (allProperties.getProperty("${foaf}lastName").firstValue)! > + <#local firstName = qrData.firstName! > + <#local lastName = qrData.lastName! > <#local org = "" > - <#local title = (allProperties.getProperty("${core}preferredTitle").firstValue)! > - <#local phoneNumber = (allProperties.getProperty("${core}phoneNumber").firstValue)! > - <#local email = (allProperties.getProperty("${core}email").firstValue)! > + <#local title = qrData.preferredTitle! > + <#local phoneNumber = qrData.phoneNumber! > + <#local email = qrData.email! > <#local url = urls.currentPage! > <#local photo = individual.thumbUrl! > <#local rev = "" > diff --git a/productMods/templates/freemarker/body/partials/individual/individual-setup.ftl b/productMods/templates/freemarker/body/partials/individual/individual-setup.ftl index fd8f3b1a..fb2a2fc2 100644 --- a/productMods/templates/freemarker/body/partials/individual/individual-setup.ftl +++ b/productMods/templates/freemarker/body/partials/individual/individual-setup.ftl @@ -8,6 +8,5 @@ <#assign editable = individual.editable> <#assign propertyGroups = individual.propertyList> -<#assign allProperties = individual.fullPropertyList> <#assign core = "http://vivoweb.org/ontology/core#"> \ No newline at end of file diff --git a/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/IndividualTemplateModel.java b/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/IndividualTemplateModel.java index cebb19c9..3b5ed661 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/IndividualTemplateModel.java +++ b/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/IndividualTemplateModel.java @@ -2,14 +2,20 @@ package edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement; import edu.cornell.mannlib.vitro.webapp.beans.Individual; 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.ParamMap; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Route; +import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; public class IndividualTemplateModel extends BaseIndividualTemplateModel { @@ -59,11 +65,37 @@ public class IndividualTemplateModel extends BaseIndividualTemplateModel { public String getCoInvestigatorVisUrl() { return getPersonVisUrl(new ParamMap("vis_mode", "copi")); } - + public String getTemporalGraphUrl() { if (!isOrganization()) { return null; } return getVisUrl("vis", "entity_comparison"); } + + public Map getQrData() { + String core = "http://vivoweb.org/ontology/core#"; + String foaf = "http://xmlns.com/foaf/0.1/"; + + Map qrData = new HashMap(); + WebappDaoFactory wdf = vreq.getAssertionsWebappDaoFactory(); + Collection firstNames = wdf.getDataPropertyStatementDao().getDataPropertyStatementsForIndividualByDataPropertyURI(individual, foaf + "firstName"); + Collection lastNames = wdf.getDataPropertyStatementDao().getDataPropertyStatementsForIndividualByDataPropertyURI(individual, foaf + "lastName"); + Collection preferredTitles = wdf.getDataPropertyStatementDao().getDataPropertyStatementsForIndividualByDataPropertyURI(individual, core + "preferredTitle"); + Collection phoneNumbers = wdf.getDataPropertyStatementDao().getDataPropertyStatementsForIndividualByDataPropertyURI(individual, core + "phoneNumber"); + Collection emails = wdf.getDataPropertyStatementDao().getDataPropertyStatementsForIndividualByDataPropertyURI(individual, core + "email"); + + if(firstNames.size() > 0) + qrData.put("firstName", firstNames.toArray(new DataPropertyStatement[firstNames.size()])[0].getData()); + if(lastNames.size() > 0) + qrData.put("lastName", lastNames.toArray(new DataPropertyStatement[firstNames.size()])[0].getData()); + if(preferredTitles.size() > 0) + qrData.put("preferredTitle", preferredTitles.toArray(new DataPropertyStatement[firstNames.size()])[0].getData()); + if(phoneNumbers.size() > 0) + qrData.put("phoneNumber", phoneNumbers.toArray(new DataPropertyStatement[firstNames.size()])[0].getData()); + if(emails.size() > 0) + qrData.put("email", emails.toArray(new DataPropertyStatement[firstNames.size()])[0].getData()); + + return qrData; + } }