本文整理汇总了Java中com.blackducksoftware.integration.validator.AbstractValidator类的典型用法代码示例。如果您正苦于以下问题:Java AbstractValidator类的具体用法?Java AbstractValidator怎么用?Java AbstractValidator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractValidator类属于com.blackducksoftware.integration.validator包,在下文中一共展示了AbstractValidator类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkInput
import com.blackducksoftware.integration.validator.AbstractValidator; //导入依赖的package包/类
public void checkInput(final HttpServletRequest request, final ActionErrors errors) throws IllegalArgumentException, EncryptionException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
final HubServerConfigBuilder builder = getHubServerConfigBuilderFromRequest(request);
final AbstractValidator validator = builder.createValidator();
final ValidationResults results = validator.assertValid();
if (results.isSuccess()) {
final HubServerConfig config = builder.buildObject();
configPersistenceManager.setHubServerConfig(config);
configPersistenceManager.setHubWorkspaceCheck(Boolean.valueOf(request.getParameter("hubWorkspaceCheck")));
} else {
checkForErrors(HubServerConfigFieldEnum.HUBURL, "errorUrl", results, errors);
checkForErrors(HubServerConfigFieldEnum.HUBTIMEOUT, "errorTimeout", results, errors);
checkForErrors(HubCredentialsFieldEnum.USERNAME, "errorUserName", results, errors);
checkForErrors(HubCredentialsFieldEnum.PASSWORD, "errorPassword", results, errors);
checkForErrors(HubProxyInfoFieldEnum.PROXYHOST, "errorHubProxyServer", results, errors);
checkForErrors(HubProxyInfoFieldEnum.PROXYPORT, "errorHubProxyPort", results, errors);
checkForErrors(HubProxyInfoFieldEnum.NOPROXYHOSTS, "errorHubNoProxyHost", results, errors);
checkForErrors(HubProxyInfoFieldEnum.PROXYUSERNAME, "errorHubProxyUser", results, errors);
checkForErrors(HubProxyInfoFieldEnum.PROXYPASSWORD, "errorHubProxyPass", results, errors);
}
}
示例2: setConfigFromResult
import com.blackducksoftware.integration.validator.AbstractValidator; //导入依赖的package包/类
private void setConfigFromResult(final HubServerConfigSerializable config,
final AbstractValidator validator) {
final ValidationResults serverConfigResults = validator.assertValid();
if (serverConfigResults.hasErrors()) {
if (serverConfigResults.getResultString(HubServerConfigFieldEnum.HUBURL) != null) {
config.setHubUrlError(serverConfigResults.getResultString(HubServerConfigFieldEnum.HUBURL));
}
if (serverConfigResults.getResultString(HubServerConfigFieldEnum.HUBTIMEOUT) != null) {
config.setTimeoutError(serverConfigResults.getResultString(HubServerConfigFieldEnum.HUBTIMEOUT));
}
if (serverConfigResults.getResultString(HubCredentialsFieldEnum.USERNAME) != null) {
config.setUsernameError(serverConfigResults.getResultString(HubCredentialsFieldEnum.USERNAME));
}
if (serverConfigResults.getResultString(HubCredentialsFieldEnum.PASSWORD) != null) {
config.setPasswordError(serverConfigResults.getResultString(HubCredentialsFieldEnum.PASSWORD));
}
if (serverConfigResults.getResultString(HubProxyInfoFieldEnum.PROXYHOST) != null) {
config.setHubProxyHostError(serverConfigResults.getResultString(HubProxyInfoFieldEnum.PROXYHOST));
}
if (serverConfigResults.getResultString(HubProxyInfoFieldEnum.NOPROXYHOSTS) != null) {
config.setHubNoProxyHostsError(serverConfigResults.getResultString(HubProxyInfoFieldEnum.NOPROXYHOSTS));
}
if (serverConfigResults.getResultString(HubProxyInfoFieldEnum.PROXYPORT) != null) {
config.setHubProxyPortError(serverConfigResults.getResultString(HubProxyInfoFieldEnum.PROXYPORT));
}
if (serverConfigResults.getResultString(HubProxyInfoFieldEnum.PROXYUSERNAME) != null) {
config.setHubProxyUserError(serverConfigResults.getResultString(HubProxyInfoFieldEnum.PROXYUSERNAME));
}
if (serverConfigResults.getResultString(HubProxyInfoFieldEnum.PROXYPASSWORD) != null) {
config.setHubProxyPasswordError(serverConfigResults.getResultString(HubProxyInfoFieldEnum.PROXYPASSWORD));
}
}
}