boolean update)
{
ValidationResponse response = new ValidationResponse();
if (ldapServerConfiguration == null) {
ValidationMessage msg = new ValidationMessage("*", "Configuration is missing.");
response.addValidationError(msg);
}
else {
if (StringUtils.isEmpty(ldapServerConfiguration.getId()) && !update) {
ValidationMessage msg = new ValidationMessage("id", "Id was generated.");
response.addValidationWarning(msg);
ldapServerConfiguration.setId(idGenerator.generateId());
}
else if (StringUtils.isEmpty(ldapServerConfiguration.getId()) && update) {
ValidationMessage msg = new ValidationMessage("id", "Id cannot be empty.");
response.addValidationWarning(msg);
}
if (StringUtils.isEmpty(ldapServerConfiguration.getName())) {
ValidationMessage msg = new ValidationMessage("name", "Name cannot be empty.");
response.addValidationError(msg);
}
if (ldapServerConfiguration.getConnectionInfo() != null) {
ValidationResponse vr = this.validateConnectionInfo(null, ldapServerConfiguration.getConnectionInfo());
response.append(vr);
}
else {
ValidationMessage msg = new ValidationMessage("*", "Connection Configuration is missing.");
response.addValidationError(msg);
}
if (ldapServerConfiguration.getUserAndGroupConfig() != null) {
ValidationResponse vr = this.validateUserAndGroupAuthConfiguration(null, ldapServerConfiguration
.getUserAndGroupConfig());
response.append(vr);
}
else {
ValidationMessage msg = new ValidationMessage("*", "User And Group Configuration is missing.");
response.addValidationError(msg);
}
}
return response;