changeQuery.setSingleValueProperty(true);
changeQuery.setMultiValueProperty(true);
changeQuery.setColleague(true);
final String changeToken = checkpoint.getUserProfileChangeToken();
final UserProfileChangeDataContainer changeContainer =
Util.makeWSRequest(sharepointClientContext, changeWS,
new Util.RequestExecutor<UserProfileChangeDataContainer>() {
public UserProfileChangeDataContainer onRequest(final BaseWS ws)
throws Throwable {
return ((UserProfileChangeWS) ws).getChanges(changeToken,
changeQuery);
}
public void onError(final Throwable e) {
LOGGER.log(Level.WARNING, "Call to getChanges failed.", e);
}
});
if (changeContainer != null) {
UserProfileChangeData[] changes = changeContainer.getChanges();
if (changes != null && changes.length > 0) {
for(UserProfileChangeData change : changes) {
String userAccountName = change.getUserAccountName();
if (Strings.isNullOrEmpty(userAccountName)) {
continue;
}
for(String changeType : change.getChangeType()) {
LOGGER.log(Level.INFO,
"User Profile Change Type Recevied = "+ changeType);
if (SPConstants.DELETE.equalsIgnoreCase(changeType)) {
LOGGER.log(Level.INFO,"User Profile Deleted for user = "
+ change.getUserAccountName());
updatedProfiles.put(userAccountName, ActionType.DELETE);
} else {
updatedProfiles.put(userAccountName, ActionType.ADD);
}
}
}
}
LOGGER.log(Level.INFO, "User Profile Change Token Recevied = "
+ changeContainer.getChangeToken());
if (changeContainer.isHasExceededCountLimit()) {
checkpoint.setUserProfileChangeToken(
changeContainer.getChangeToken());
} else {
try {
checkpoint.setUserProfileChangeToken(getCurrentChangeToken());
} catch (final Exception e) {
LOGGER.log(Level.WARNING,