@SuppressWarnings("unchecked") public List<String> getEmails(List<? extends Entry> entries, String commentAuthorEmail) { if (entries == null) { return null; } if (commentAuthorEmail == null) { commentAuthorEmail = CoreConstants.EMPTY; } List<String> emails = new ArrayList<String>(); List<Person> authors = null; String email = null; for (Entry entry : entries) { authors = entry.getAuthors(); if (authors != null) { for (Person author : authors) { email = author.getEmail(); if (email != null) { email = CoreUtil.getDecodedValue(email); if (!email.equals(commentAuthorEmail) && !emails.contains(email)) { emails.add(email); } } } } } return emails; }
private Person parsePerson(Element ePerson) { Person person = new Person(); Element e = ePerson.getChild("name", getAtomNamespace()); if (e != null) { person.setName(e.getText()); } e = ePerson.getChild("url", getAtomNamespace()); if (e != null) { person.setUrl(e.getText()); } e = ePerson.getChild("email", getAtomNamespace()); if (e != null) { person.setEmail(e.getText()); } return person; }
private Person generatePerson(String username) { String product = applicationProperties.getDisplayName(); Person person = new Person(); // don't want to get a default UserProfile when the "user" is anon or the product, // and anyway there could be a user with the username "anonymous" or "Confluence" etc if (i18nResolver.getText("upm.auditLog.anonymous").equals(username) || product.equals(username)) { person.setName(username); } else { UserProfile userProfile = userManager.getUserProfile(username); final String userFullname = userProfile == null ? null : userProfile.getFullName(); person.setName((userFullname != null) ? userFullname : username); URI userUri = uriBuilder.buildAbsoluteProfileUri(userProfile); if (userUri != null) { person.setUrl(userUri.toString()); } } return person; }
protected void fillPersonElement(Element element, Person person) { if (person.getName() != null) { element.addContent(generateSimpleElement("name", person.getName())); } if (person.getUri() != null) { element.addContent(generateSimpleElement("uri", person.getUri())); } if (person.getEmail() != null) { element.addContent(generateSimpleElement("email", person.getEmail())); } generatePersonModules(person.getModules(), element); }
private Person parsePerson(final String baseURI, final Element ePerson, final Locale locale) { final Person person = new Person(); Element e = ePerson.getChild("name", getAtomNamespace()); if (e != null) { person.setName(e.getText()); } e = ePerson.getChild("uri", getAtomNamespace()); if (e != null) { person.setUri(e.getText()); if (isRelativeURI(e.getText())) { person.setUriResolved(resolveURI(baseURI, ePerson, e.getText())); } } e = ePerson.getChild("email", getAtomNamespace()); if (e != null) { person.setEmail(e.getText()); } person.setModules(parsePersonModules(ePerson, locale)); return person; }