@Override
public ValidationResponse doValidateChanges(ApplicationConfiguration applicationConfiguration,
CoreConfiguration owner, Xpp3Dom config)
{
ValidationResponse response = super.doValidateChanges(applicationConfiguration, owner, config);
// validate members existence
List<CRepository> allReposes = applicationConfiguration.getConfigurationModel().getRepositories();
List<String> allReposesIds = new ArrayList<String>(allReposes.size());
for (CRepository repository : allReposes) {
allReposesIds.add(repository.getId());
}
final List<String> memberRepositoryIds = getMemberRepositoryIds();
if (!allReposesIds.containsAll(memberRepositoryIds)) {
ValidationMessage message =
new ValidationMessage(MEMBER_REPOSITORIES, "Group repository points to nonexistent members!",
"The source nexus repository is not existing.");
response.addValidationError(message);
}
final Set<String> uniqueReposesIds = Sets.newHashSet(memberRepositoryIds);
if (uniqueReposesIds.size() != memberRepositoryIds.size()) {
response.addValidationError(new ValidationMessage(
MEMBER_REPOSITORIES,
"Group repository has same member multiple times!",
"Group repository has same member multiple times!"
));
}