public ValidationContext getContext() { if (context == null) { context = new ValidationContext(); } return context; } }
protected ValidationResponse mergeValidationResponse(ValidationResponse source, ValidationResponse dest) { for (ValidationMessage message : source.getValidationErrors()) { dest.addValidationError(message); } for (ValidationMessage message : source.getValidationWarnings()) { dest.addValidationError(message); } return dest; } }
public void addValidationError( String message ) { ValidationMessage e = new ValidationMessage( String.valueOf( key++ ), message ); addValidationError( e ); }
/** * A method to append a validation response to this validation response. The errors list and warnings list are * simply appended, and the isValid is logically AND-ed and isModified is logically OR-ed. */ public void append(ValidationResponse response) { for (ValidationMessage msg : response.getValidationErrors()) { if (getValidationError(msg.getKey()) != null) { msg.setKey(msg.getKey() + "(" + key++ + ")"); } addValidationError(msg); } for (ValidationMessage msg : response.getValidationWarnings()) { if (getValidationWarning(msg.getKey()) != null) { msg.setKey(msg.getKey() + "(" + key++ + ")"); } addValidationWarning(msg); } setValid(isValid() && response.isValid()); setModified(isModified() || response.isModified()); }
@Override public void updateUserAndGroupConfiguration(CUserAndGroupAuthConfiguration userAndGroupConfig) throws InvalidConfigurationException { lock.lock(); try { final ValidationResponse vr = validator.validateUserAndGroupAuthConfiguration(null, userAndGroupConfig); if (vr.getValidationErrors().size() > 0) { throw new InvalidConfigurationException(vr); } getConfiguration().setUserAndGroupConfig(userAndGroupConfig); } finally { lock.unlock(); } }
@Override public void updateConnectionInfo(CConnectionInfo connectionInfo) throws InvalidConfigurationException { lock.lock(); try { final ValidationResponse vr = validator.validateConnectionInfo(null, connectionInfo); if (vr.getValidationErrors().size() > 0) { throw new InvalidConfigurationException(vr); } getConfiguration().setConnectionInfo(connectionInfo); } finally { lock.unlock(); } }
public void addValidationWarning( String message ) { ValidationMessage e = new ValidationMessage( String.valueOf( key++ ), message ); addValidationWarning( e ); }
public CConnectionInfo readConnectionInfo() { CConnectionInfo connInfo = getConfiguration().getConnectionInfo(); return connInfo; }
public ValidationMessage getValidationError(String key) { if (validationErrors != null) { for (ValidationMessage vm : validationErrors) { if (vm.getKey().equals(key)) { return vm; } } } return null; }
public void addValidationError( ValidationMessage message ) { getValidationErrors().add( message ); this.valid = false; }
@Override public void clearCache() { super.clearCache(); // fire clear cache event this.eventBus.post(new LdapClearCacheEvent(null)); } }
@Override public void save() throws IOException { super.save(); // fire clear cache event this.eventBus.post(new LdapClearCacheEvent(this)); }
public AbstractLdapConfiguration(ApplicationConfiguration applicationConfiguration, ConfigurationValidator validator, PasswordHelper passwordHelper) throws IOException { checkNotNull(applicationConfiguration); this.validator = checkNotNull(validator); this.passwordHelper = checkNotNull(passwordHelper); this.configurationFile = new File(applicationConfiguration.getConfigurationDirectory(), "ldap.xml"); this.ldapModelReader = new LdapModelReader(); this.ldapModelWriter = new LdapModelWriter(); this.configuration = load(); }
protected LdapAuthConfiguration getLdapAuthConfiguration() { return this.getLdapConfiguration().getLdapAuthConfiguration(); }
protected ValidationResponse mergeValidationResponse(ValidationResponse source, ValidationResponse dest) { for ( ValidationMessage message : source.getValidationErrors() ) { dest.addValidationError( message ); } for ( ValidationMessage message : source.getValidationWarnings() ) { dest.addValidationError( message ); } return dest; } }
public void addValidationError( String message, Throwable t ) { ValidationMessage e = new ValidationMessage( String.valueOf( key++ ), message, t ); addValidationError( e ); }
public void addValidationWarning(String message) { ValidationMessage e = new ValidationMessage(String.valueOf(key++), message); addValidationWarning(e); }
public ValidationContext getContext() { if ( context == null ) { context = new ValidationContext(); } return context; } }
public void addValidationError(String message, Throwable t) { ValidationMessage e = new ValidationMessage(String.valueOf(key++), message, t); addValidationError(e); }
public void addValidationError(String message) { ValidationMessage e = new ValidationMessage(String.valueOf(key++), message); addValidationError(e); }