UserManager userMgr = UserManager.getInstance();
User user = identity.getUser();
HomePageConfigManager homepageMgr = HomePageConfigManagerImpl.getInstance();
HomePageConfig publishConfig = homepageMgr.loadConfigFor(identity.getName());
IdentityDocument identityDocument = new IdentityDocument();
identityDocument.setTitle(identity.getName());
identityDocument.setCreatedDate(user.getCreationDate());
// loop through all user properties and collect the content string and the last modified
List<UserPropertyHandler> userPropertyHanders = userMgr.getUserPropertyHandlersFor(IdentityDocument.class.getName(), false);
StringBuilder content = new StringBuilder();
for (UserPropertyHandler userPropertyHandler : userPropertyHanders) {
String propertyName = userPropertyHandler.getName();
// only index fields the user has published!
if (publishConfig.isEnabled(propertyName)) {
String value = user.getProperty(propertyName, I18nModule.getDefaultLocale());
if (value != null) {
content.append(value).append(" ");
}
}
}
// user text
String text = publishConfig.getTextAboutMe();
if (StringHelper.containsNonWhitespace(text)) {
text = FilterFactory.getHtmlTagsFilter().filter(text);
content.append(text).append(' ');
}
// finally use the properties as the content for this identity