当前位置: 首页>>代码示例>>Java>>正文


Java FormValidation.error方法代码示例

本文整理汇总了Java中hudson.util.FormValidation.error方法的典型用法代码示例。如果您正苦于以下问题:Java FormValidation.error方法的具体用法?Java FormValidation.error怎么用?Java FormValidation.error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hudson.util.FormValidation的用法示例。


在下文中一共展示了FormValidation.error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doCheckToken

import hudson.util.FormValidation; //导入方法依赖的package包/类
/**
 * Sanity check for a Gitea access token.
 *
 * @param value the token.
 * @return the resulst of the sanity check.
 */
@Restricted(NoExternalUse.class) // stapler
@SuppressWarnings("unused") // stapler
public FormValidation doCheckToken(@QueryParameter String value) {
    Secret secret = Secret.fromString(value);
    if (secret == null) {
        return FormValidation.error(Messages.PersonalAccessTokenImpl_tokenRequired());
    }
    if (StringUtils.equals(value, secret.getPlainText())) {
        if (value.length() != 40) {
            return FormValidation.error(Messages.PersonalAccessTokenImpl_tokenWrongLength());
        }
    } else if (secret.getPlainText().length() != 40) {
        return FormValidation.warning(Messages.PersonalAccessTokenImpl_tokenWrongLength());
    }
    return FormValidation.ok();
}
 
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:23,代码来源:PersonalAccessTokenImpl.java

示例2: doTestConnection

import hudson.util.FormValidation; //导入方法依赖的package包/类
public FormValidation doTestConnection(@AncestorInPath ItemGroup context,
		@QueryParameter("credentialsId") final String credentialsId) {
	String targetAPI = chooseTargetAPI(environment);
	if (!credentialsId.equals(preCredentials) || Util.isNullOrEmpty(bluemixToken)) {
		preCredentials = credentialsId;
		try {
			String newToken = getBluemixToken(context, credentialsId, targetAPI);
			if (Util.isNullOrEmpty(newToken)) {
				bluemixToken = newToken;
				return FormValidation.warning("<b>Got empty token</b>");
			} else {
				return FormValidation.okWithMarkup("<b>Connection successful</b>");
			}
		} catch (Exception e) {
			return FormValidation.error("Failed to log in to Bluemix, please check your username/password");
		}
	} else {
		return FormValidation.okWithMarkup("<b>Connection successful</b>");
	}
}
 
开发者ID:IBM,项目名称:ibm-cloud-devops,代码行数:21,代码来源:PublishDeploy.java

示例3: doCheckQueueUuid

import hudson.util.FormValidation; //导入方法依赖的package包/类
public FormValidation doCheckQueueUuid(@QueryParameter final String value) {
    if (this.getSqsQueues().size() == 0) {
        return FormValidation.error(Messages.errorQueueUnavailable());
    }

    if (StringUtils.isEmpty(value)) {
        return FormValidation.ok(Messages.infoQueueDefault());
    }

    final SQSQueue queue = this.getSqsQueue(value);

    if (queue == null) {
        return FormValidation.error(Messages.errorQueueUuidUnknown());
    }

    return FormValidation.ok();
}
 
开发者ID:riboseinc,项目名称:aws-codecommit-trigger-plugin,代码行数:18,代码来源:SQSTrigger.java

示例4: doCheckGroupID

import hudson.util.FormValidation; //导入方法依赖的package包/类
/** 
 * Function that does form validation for the groupID field in the UI
 * @param value The value of the field
 * @return The form state depending on the value
 */
public FormValidation doCheckGroupID(@QueryParameter String value, @QueryParameter String artifactID, @QueryParameter String repo)
{
    if (value != "") 
    {   
        if (checkIfArtifactExists(repo, value, artifactID))
        {
            return FormValidation.ok();
        }
        else
        {
            return FormValidation.error("Could not find artifact: " + value + ":" + artifactID + " in repo " + repo);
        }
    }
    else
    {
        return FormValidation.error("Group ID cannot be empty");
    }
}
 
开发者ID:pason-systems,项目名称:jenkins-artifactory-polling-plugin,代码行数:24,代码来源:ArtifactoryRepository.java

示例5: doCheckTenant

import hudson.util.FormValidation; //导入方法依赖的package包/类
public FormValidation doCheckTenant(@QueryParameter final boolean ssoEnabled,
                                    @QueryParameter final String tenant) {

    if (ssoEnabled) {
        String tenantVal = Util.fixEmptyAndTrim(tenant);
        if (tenantVal == null) {
            return FormValidation.error("Please enter tenant.");
        }

        if (tenantVal.indexOf('$') >= 0) {
            // set by variable, can't validate
            return FormValidation.ok();
        }
    }

    return FormValidation.ok();
}
 
开发者ID:agovindaraju,项目名称:vmware-vrealize-orchestrator,代码行数:18,代码来源:OrchestratorBuilder.java

示例6: doCheckBaseRevision

import hudson.util.FormValidation; //导入方法依赖的package包/类
public FormValidation doCheckBaseRevision(@QueryParameter boolean analyzeBranchDiff,
                                          @QueryParameter String baseRevision) throws IOException, ServletException {
    if (analyzeBranchDiff && (baseRevision == null || baseRevision.isEmpty())) {
        return FormValidation.error("Base revision cannot be empty.");
    } else {
        return FormValidation.ok();
    }
}
 
开发者ID:empear-analytics,项目名称:codescene-jenkins-plugin,代码行数:9,代码来源:CodeSceneBuilder.java

示例7: doCheckRiskThreshold

import hudson.util.FormValidation; //导入方法依赖的package包/类
public FormValidation doCheckRiskThreshold(@QueryParameter int riskThreshold, @QueryParameter boolean markBuildAsUnstable) {
    if (markBuildAsUnstable && (riskThreshold < 1 || riskThreshold > 10)) {
        return FormValidation.error("Risk threshold must be a number between 1 and 10. The value %d is invalid.", riskThreshold);
    } else {
        return FormValidation.ok();
    }
}
 
开发者ID:empear-analytics,项目名称:codescene-jenkins-plugin,代码行数:8,代码来源:CodeSceneBuilder.java

示例8: doCheckCredentialsId

import hudson.util.FormValidation; //导入方法依赖的package包/类
public FormValidation doCheckCredentialsId(@QueryParameter String credentialsId) {
    if (credentialsId == null || credentialsId.isEmpty()) {
        return FormValidation.error("CodeScene API credentials must be set.");
    } else {
        return FormValidation.ok();
    }
}
 
开发者ID:empear-analytics,项目名称:codescene-jenkins-plugin,代码行数:8,代码来源:CodeSceneBuilder.java

示例9: doCheckDeltaAnalysisUrl

import hudson.util.FormValidation; //导入方法依赖的package包/类
public FormValidation doCheckDeltaAnalysisUrl(@QueryParameter String deltaAnalysisUrl) {
    if (deltaAnalysisUrl == null || deltaAnalysisUrl.isEmpty()) {
        return FormValidation.error("CodeScene delta analysis URL cannot be blank.");
    } else {
        try {
            new URL(deltaAnalysisUrl);
            return FormValidation.ok();
        } catch (MalformedURLException e) {
            return FormValidation.error("Invalid URL");
        }
    }
}
 
开发者ID:empear-analytics,项目名称:codescene-jenkins-plugin,代码行数:13,代码来源:CodeSceneBuilder.java

示例10: checkFieldNotEmpty

import hudson.util.FormValidation; //导入方法依赖的package包/类
private FormValidation checkFieldNotEmpty(String value, String field) {
    value = StringUtils.strip(value);
    if (value == null || value.equals("")) {
        return FormValidation.error(field + " is required.");
    }
    return FormValidation.ok();
}
 
开发者ID:warriorframework,项目名称:warrior-jenkins-plugin,代码行数:8,代码来源:WarriorPluginBuilder.java

示例11: doCheckConnectionId

import hudson.util.FormValidation; //导入方法依赖的package包/类
/**
 * Validator for the 'Host connection' field.
 * 
 * @param connectionId
 *            unique identifier for the host connection passed from the config.jelly "connectionId" field
 * 
 * @return validation message
 */
public FormValidation doCheckConnectionId(@QueryParameter String connectionId)
{
	String tempValue = StringUtils.trimToEmpty(connectionId);
	if (tempValue.isEmpty())
	{
		return FormValidation.error(Messages.checkHostConnectionError());
	}

	return FormValidation.ok();
}
 
开发者ID:Compuware-Corp,项目名称:CPWR-CodeCoverage,代码行数:19,代码来源:CodeCoverageBuilder.java

示例12: doCheckCredentialsId

import hudson.util.FormValidation; //导入方法依赖的package包/类
/**
 * Validation for checkout credentials.
 *
 * @param context   the context.
 * @param serverUrl the server url.
 * @param value     the current selection.
 * @return the validation results
 */
@Restricted(NoExternalUse.class)
@SuppressWarnings("unused") // stapler form binding
public FormValidation doCheckCredentialsId(@CheckForNull @AncestorInPath Item context,
                                           @QueryParameter String serverUrl,
                                           @QueryParameter String value) {
    if (context == null
            ? !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER)
            : !context.hasPermission(Item.EXTENDED_READ)) {
        return FormValidation.ok();
    }
    if (StringUtils.isBlank(value)) {
        // use agent key
        return FormValidation.ok();
    }
    if (CredentialsMatchers.firstOrNull(CredentialsProvider
                    .lookupCredentials(SSHUserPrivateKey.class, context, context instanceof Queue.Task
                            ? Tasks.getDefaultAuthenticationOf((Queue.Task) context)
                            : ACL.SYSTEM, URIRequirementBuilder.fromUri(serverUrl).build()),
            CredentialsMatchers.withId(value)) != null) {
        return FormValidation.ok();
    }
    if (CredentialsMatchers.firstOrNull(CredentialsProvider
                    .lookupCredentials(StandardUsernameCredentials.class, context, context instanceof Queue.Task
                            ? Tasks.getDefaultAuthenticationOf((Queue.Task) context)
                            : ACL.SYSTEM, URIRequirementBuilder.fromUri(serverUrl).build()),
            CredentialsMatchers.withId(value)) != null) {
        return FormValidation.error(Messages.SSHCheckoutTrait_incompatibleCredentials());
    }
    return FormValidation.warning(Messages.SSHCheckoutTrait_missingCredentials());
}
 
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:39,代码来源:SSHCheckoutTrait.java

示例13: doCheckCredentialsId

import hudson.util.FormValidation; //导入方法依赖的package包/类
public FormValidation doCheckCredentialsId(@AncestorInPath SCMSourceOwner context,
                                           @QueryParameter String serverUrl,
                                           @QueryParameter String value)
        throws IOException, InterruptedException{
    if (context == null) {
        if (!Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER)) {
            return FormValidation.ok();
        }
    } else {
        if (!context.hasPermission(Item.EXTENDED_READ)
                && !context.hasPermission(CredentialsProvider.USE_ITEM)) {
            return FormValidation.ok();
        }
    }
    GiteaServer server = GiteaServers.get().findServer(serverUrl);
    if (server == null) {
        return FormValidation.ok();
    }
    if (StringUtils.isBlank(value)) {
        return FormValidation.ok();
    }
    if (CredentialsProvider.listCredentials(
            StandardCredentials.class,
            context,
            context instanceof Queue.Task ?
                    Tasks.getDefaultAuthenticationOf((Queue.Task) context)
                    : ACL.SYSTEM,
            URIRequirementBuilder.fromUri(serverUrl).build(),
            CredentialsMatchers.allOf(
                    CredentialsMatchers.withId(value),
                    AuthenticationTokens.matcher(GiteaAuth.class)

            )).isEmpty()) {
        return FormValidation.error(Messages.GiteaSCMSource_selectedCredentialsMissing());
    }
    return FormValidation.ok();
}
 
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:38,代码来源:GiteaSCMSource.java

示例14: doCheckUrl

import hudson.util.FormValidation; //导入方法依赖的package包/类
public FormValidation doCheckUrl(@QueryParameter final String url) {
    if (StringUtils.isBlank(url)) {
        return FormValidation.warning(Messages.warningBlankUrl());
    }
    return com.ribose.jenkins.plugin.awscodecommittrigger.utils.StringUtils.isCodeCommitRepo(url)
        ? FormValidation.ok()
        : FormValidation.error(Messages.errorCodeCommitUrlInvalid());
}
 
开发者ID:riboseinc,项目名称:aws-codecommit-trigger-plugin,代码行数:9,代码来源:SQSScmConfig.java

示例15: doCheckName

import hudson.util.FormValidation; //导入方法依赖的package包/类
public FormValidation doCheckName(@QueryParameter String name) {

        if (name.isEmpty()) {
            return FormValidation.error("Please insert a name for the instance.");
        }

        return FormValidation.ok();
    }
 
开发者ID:jenkinsci,项目名称:sonar-quality-gates-plugin,代码行数:9,代码来源:GlobalConfig.java


注:本文中的hudson.util.FormValidation.error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。