public ValidationResponse validateHttpProxySettings( ApplicationValidationContext ctx, CHttpProxySettings settings ) { ValidationResponse response = new ApplicationValidationResponse(); if ( ctx != null ) { response.setContext( ctx ); } if ( settings.getPort() < 80 ) { settings.setPort( 8082 ); response.addValidationWarning( "The HTTP Proxy port is below 80? Settings defaulted." ); response.setModified( true ); } if ( !CHttpProxySettings.PROXY_POLICY_PASS_THRU.equals( settings.getProxyPolicy() ) && !CHttpProxySettings.PROXY_POLICY_STRICT.equals( settings.getProxyPolicy() ) ) { response.addValidationError( "The HTTP Proxy policy settings is invalid: '" + settings.getProxyPolicy() + "'. Valid policies are '" + CHttpProxySettings.PROXY_POLICY_STRICT + "' and '" + CHttpProxySettings.PROXY_POLICY_PASS_THRU + "'." ); } return response; }
public ValidationResponse validateRepositoryMirrors( ApplicationValidationContext ctx, List<CMirror> mirrors ) { ValidationResponse response = new ApplicationValidationResponse(); if ( ctx != null ) { response.setContext( ctx ); } for ( CMirror mirror : mirrors ) { if ( StringUtils.isEmpty( mirror.getId() ) ) { String newId = generateId(); mirror.setId( newId ); response .addValidationWarning( "Fixed wrong mirror ID from '" + mirror.getId() + "' to '" + newId + "'" ); response.setModified( true ); } if ( StringUtils.isEmpty( mirror.getId() ) ) { response.addValidationError( "The Mirror may have no empty/null ID!" ); } if ( StringUtils.isEmpty( mirror.getUrl() ) ) { response.addValidationError( "The Mirror may have no empty/null URL!" ); } } return response; }
response.setModified( true ); + item.getId() + "'." ); response.setModified( true );
response.setModified( true ); + item.getId() + "'." ); response.setModified( true );
response.setModified( true ); response.setModified( true );
+ "' has no name, defaulted to it's ID." ) ); response.setModified( true );
/** * 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. * * @param validationResponse */ public void append( ValidationResponse validationResponse ) { for ( ValidationMessage msg : validationResponse.getValidationErrors() ) { if ( getValidationError( msg.getKey() ) != null ) { msg.setKey( msg.getKey() + "(" + key++ + ")" ); } addValidationError( msg ); } for ( ValidationMessage msg : validationResponse.getValidationWarnings() ) { if ( getValidationWarning( msg.getKey() ) != null ) { msg.setKey( msg.getKey() + "(" + key++ + ")" ); } addValidationWarning( msg ); } setValid( isValid() && validationResponse.isValid() ); setModified( isModified() || validationResponse.isModified() ); }
.addValidationWarning( "Global connection settings block, which is mandatory, was missing. Reset with defaults." ); response.setModified( true ); response.setModified( true ); response.setModified( true );