Changes to QR code generation to support swapping in a different model in IndividualController: fixed NPEs, and change getQrCode() to doQrCode() so it's invoked only when the template asks for it.
This commit is contained in:
parent
c15bdb8f3d
commit
d18b02782e
5 changed files with 13 additions and 13 deletions
|
@ -102,7 +102,7 @@ public class IndividualTemplateModel extends BaseIndividualTemplateModel {
|
|||
return id;
|
||||
}
|
||||
|
||||
public Map<String, String> getQrData() {
|
||||
public Map<String, String> doQrData() {
|
||||
if(qrData == null)
|
||||
qrData = generateQrData();
|
||||
return qrData;
|
||||
|
@ -120,15 +120,15 @@ public class IndividualTemplateModel extends BaseIndividualTemplateModel {
|
|||
Collection<DataPropertyStatement> phoneNumbers = wdf.getDataPropertyStatementDao().getDataPropertyStatementsForIndividualByDataPropertyURI(individual, core + "phoneNumber");
|
||||
Collection<DataPropertyStatement> emails = wdf.getDataPropertyStatementDao().getDataPropertyStatementsForIndividualByDataPropertyURI(individual, core + "email");
|
||||
|
||||
if(firstNames.size() > 0)
|
||||
if(firstNames != null && ! firstNames.isEmpty())
|
||||
qrData.put("firstName", firstNames.toArray(new DataPropertyStatement[firstNames.size()])[0].getData());
|
||||
if(lastNames.size() > 0)
|
||||
if(lastNames != null && ! lastNames.isEmpty())
|
||||
qrData.put("lastName", lastNames.toArray(new DataPropertyStatement[firstNames.size()])[0].getData());
|
||||
if(preferredTitles.size() > 0)
|
||||
if(preferredTitles != null && ! preferredTitles.isEmpty())
|
||||
qrData.put("preferredTitle", preferredTitles.toArray(new DataPropertyStatement[firstNames.size()])[0].getData());
|
||||
if(phoneNumbers.size() > 0)
|
||||
if(phoneNumbers != null && ! phoneNumbers.isEmpty())
|
||||
qrData.put("phoneNumber", phoneNumbers.toArray(new DataPropertyStatement[firstNames.size()])[0].getData());
|
||||
if(emails.size() > 0)
|
||||
if(emails != null && ! emails.isEmpty())
|
||||
qrData.put("email", emails.toArray(new DataPropertyStatement[firstNames.size()])[0].getData());
|
||||
|
||||
String tempUrl = vreq.getRequestURL().toString();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue