// TODO: allow for dynamic user url building classes to be injected private void addUsers(Element element, Group suppliedGroup, ThemeDisplay themeDisplay) throws PortalException, SystemException { // get all users List<User> users = UserLocalServiceUtil.getGroupUsers(suppliedGroup.getGroupId()); // we're only displaying users with blogs for now for (User u : users) { Group usersOwnGroup = GroupLocalServiceUtil.getUserGroup(suppliedGroup.getCompanyId(), u.getUserId()); int count = BlogsEntryLocalServiceUtil.getGroupEntriesCount(usersOwnGroup.getGroupId()); List<BlogsEntry> entries = BlogsEntryLocalServiceUtil.getGroupEntries(usersOwnGroup.getGroupId(), 0, count); // only add if the user has blogs if (entries != null && entries.size() > 0) { // index the user, as well StringBuffer baseUrl = new StringBuffer(themeDisplay.getPortalURL()); // TODO figure out where web comes from baseUrl.append("/web"); baseUrl.append(usersOwnGroup.getFriendlyURL()); Element userUrlElement = element.addElement("url"); userUrlElement.addElement("loc").addText(encodeXML(baseUrl.toString())); userUrlElement.addElement("changefreq").addText("daily"); } } }
@Override protected int getNotInTrashBaseModelsCount(BaseModel<?> parentBaseModel) throws Exception { QueryDefinition<BlogsEntry> queryDefinition = new QueryDefinition<>(WorkflowConstants.STATUS_ANY); return BlogsEntryLocalServiceUtil.getGroupEntriesCount( (Long) parentBaseModel.getPrimaryKeyObj(), queryDefinition); }