public static String createProfile( IndividualDao indDao, DataPropertyStatementDao dpsDao, String profileClassUri, UserAccount account) throws InsertException { IndividualImpl i = new IndividualImpl(); i.setVClassURI(profileClassUri); String indUri = indDao.insertNewIndividual(i); addProp(dpsDao, indUri, URI_FOAF_FIRST_NAME, account.getFirstName()); addProp(dpsDao, indUri, URI_FOAF_LAST_NAME, account.getLastName()); String label = account.getLastName() + ", " + account.getFirstName(); addProp(dpsDao, indUri, VitroVocabulary.LABEL, label); return indUri; }
private String assembleUserAccountLabel(UserAccount ua) { String last = ua.getLastName(); String first = ua.getFirstName(); if (last.isEmpty()) { return first; } else if (first.isEmpty()) { return last; } else { return last + ", " + first; } }
public final ResponseValues showPage() { Map<String, Object> body = new HashMap<String, Object>(); if (isSubmit()) { body.put("emailAddress", emailAddress); body.put("firstName", firstName); body.put("lastName", lastName); body.put("proxies", buildOngoingProxyList()); } else { body.put("emailAddress", userAccount.getEmailAddress()); body.put("firstName", userAccount.getFirstName()); body.put("lastName", userAccount.getLastName()); body.put("proxies", buildOriginalProxyList()); } body.put("formUrls", buildUrlsMap()); body.put("myAccountUri", userAccount.getUri()); body.put("profileTypes", buildProfileTypesString()); // Could I do this without exposing this mechanism? But how to search // for an associated profile in AJAX? body.put("matchingProperty", SelfEditingConfiguration.getBean(vreq).getMatchingPropertyUri()); if (userAccount.isExternalAuthOnly()) { body.put("externalAuthOnly", Boolean.TRUE); } if (!errorCode.isEmpty()) { body.put(errorCode, Boolean.TRUE); } if (!confirmationCode.isEmpty()) { body.put(confirmationCode, Boolean.TRUE); } if (isProxyPanelAuthorized()) { body.put("showProxyPanel", Boolean.TRUE); } strategy.addMoreBodyValues(body); return new TemplateResponseValues(TEMPLATE_NAME, body); }