Exemplo n.º 1
0
  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;
  }
Exemplo n.º 2
0
 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;
   }
 }
Exemplo n.º 3
0
  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);
  }