enabledChanged = identifier.setEnabled(enabled);
identifier.setActivityIds(Collections.EMPTY_SET);
deferredIdentifiers.add(identifier);
getUpdateJob().schedule();
if (enabledChanged) {
return new IdentifierEvent(identifier, activityIdsChanged,
enabledChanged);
}
}
else {
boolean matchesAtLeastOneEnabled = false;
boolean matchesAtLeastOneDisabled = false;
Set activityIdsToUpdate = new HashSet(changedActivityIds);
if (identifier.getActivityIds() != null) {
activityIdsToUpdate.addAll(identifier.getActivityIds());
}
for (Iterator iterator = activityIdsToUpdate.iterator(); iterator
.hasNext();) {
String activityId = (String) iterator.next();
Activity activity = (Activity) getActivity(activityId);
if (activity.isMatch(id)) {
activityIds.add(activityId);
if (activity.isEnabled()) {
matchesAtLeastOneEnabled = true;
} else {
matchesAtLeastOneDisabled = true;
}
}
}
enabled = matchesAtLeastOneEnabled ? true : !matchesAtLeastOneDisabled;
activityIdsChanged = identifier.setActivityIds(activityIds);
enabledChanged = identifier.setEnabled(enabled);
if (activityIdsChanged || enabledChanged) {
return new IdentifierEvent(identifier, activityIdsChanged,
enabledChanged);
}
}
return null;
}