final Set<String> personalSitesSet = new TreeSet<String>();
final Collator collator = Util.getCollator();
int index = 0;
while (index >= 0) {
final GetUserProfileByIndexResult result = getUserProfileByIndex(index);
if ((result == null) || (result.getUserProfile() == null)) {
break;
}
final PropertyData[] data = result.getUserProfile();
if (data == null) {
break;
}
for (PropertyData element : data) {
final String name = element.getName();
if (collator.equals(personalSpaceTag, name)) {
final String propVal = element.getValue();// e.g.
// /personal/administrator/
if (propVal == null) {
continue;
}
String strURL = Util.getWebApp(sharepointClientContext.getSiteURL())
+ propVal;
if (strURL.endsWith(SPConstants.SLASH)) {
strURL = strURL.substring(0, strURL.lastIndexOf(SPConstants.SLASH));
}
if (sharepointClientContext.isIncludedUrl(strURL, LOGGER)) {
personalSitesSet.add(strURL);
LOGGER.log(Level.CONFIG, "Personal Site: " + strURL);
}
}
}
final String next = result.getNextValue();
index = Integer.parseInt(next);
}
if (personalSitesSet.size() > 0) {
LOGGER.info("Discovered " + personalSitesSet.size()
+ " personal sites to crawl.");