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


Java FormValidation.ok方法代码示例

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


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

示例1: 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

示例2: doTestConnection

import hudson.util.FormValidation; //导入方法依赖的package包/类
public FormValidation doTestConnection(
		 @QueryParameter("url") final String url,
		 @QueryParameter("user") final String user,
		 @QueryParameter("password") final String password,
		 @QueryParameter("room") final String room
		)  {
	try {
		RocketChatClient rcClient = new RocketChatClient(url, user, password);
		Set<Room> publicRooms = rcClient.getPublicRooms();
		StringBuilder message = new StringBuilder("available rooms are: ");
		boolean comma = false;
		for (Room r : publicRooms) {
			if(r.name.equals(room))
				return FormValidation.ok("Server version is "+rcClient.getRocketChatVersion());
			if(comma) message.append(", ");							
			comma = true;
			message.append("'"+r.name+"'");
		}
		return FormValidation.error("available rooms are "+message);
	} catch (Exception e) {
		return FormValidation.error(e.getMessage());
	}
}
 
开发者ID:baloise,项目名称:rocket-chat-notifier,代码行数:24,代码来源:RocketChatNotifier.java

示例3: doLoginCheck

import hudson.util.FormValidation; //导入方法依赖的package包/类
/**
* This method validates the current entered Aptly site configuration data.
* @param request the current {@link javax.servlet.http.HttpServletRequest}
*/
public FormValidation doLoginCheck(
                                   @QueryParameter("aptly.profileName") final String sitename,
                                   @QueryParameter("aptly.url") final String url,
                                   @QueryParameter("aptly.enableSelfSigned") final String enableselfsigned,
                                   @QueryParameter("aptly.timeOut") final String timeout,
                                   @QueryParameter("aptly.username") final String username,
                                   @QueryParameter("aptly.password") final String password)
{
    LOG.info("Login check for " + sitename);
    PrintStream logstream = new PrintStream(new LogOutputStream(), true);
    try {
        AptlySite site = new AptlySite(url,enableselfsigned,timeout,username,password);
        AptlyRestClient client =  new AptlyRestClient(logstream, site);
        final String ver = client.getAptlyServerVersion();
        LOG.info("got version " + ver);
        return FormValidation.ok("Success, Aptly version: " + ver);
    } catch (Exception e) {
        return FormValidation.error(e.getMessage());
    }
}
 
开发者ID:zgyarmati,项目名称:aptly-plugin,代码行数:25,代码来源:AptlyPublisher.java

示例4: 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

示例5: doCheckUploadServerIp

import hudson.util.FormValidation; //导入方法依赖的package包/类
public FormValidation doCheckUploadServerIp(@QueryParameter String value, @QueryParameter boolean uploadExecLog)
        throws IOException, ServletException {
    if (uploadExecLog){
        return checkFieldNotEmpty(value, "Server name/IP");
    }
    return FormValidation.ok();
}
 
开发者ID:warriorframework,项目名称:warrior-jenkins-plugin,代码行数:8,代码来源:WarriorPluginBuilder.java

示例6: 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

示例7: 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

示例8: doCheckRepository

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

示例9: doCheckCouplingThresholdPercent

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

示例10: doCheckName

import hudson.util.FormValidation; //导入方法依赖的package包/类
public FormValidation doCheckName(@QueryParameter String value,
                                       @RelativePath("capital") @QueryParameter String name) {
    /*
    @RelativePath("capital") @QueryParameter
     ... is short for
    @RelativePath("capital") @QueryParameter("name")
     ... and thus can be thought of "capital/name"

    so this matches the current city name entered as the capital of this state
    */

    return FormValidation.ok("Are you sure " + name + " is a capital of " + value + "?");
}
 
开发者ID:10000TB,项目名称:Jenkins-Plugin-Examples,代码行数:14,代码来源:FormFieldValidationWithContext.java

示例11: 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.GiteaSCMNavigator_selectedCredentialsMissing());
    }
    return FormValidation.ok();
}
 
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:38,代码来源:GiteaSCMNavigator.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: doCheckGitConfigUname

import hudson.util.FormValidation; //导入方法依赖的package包/类
public FormValidation doCheckGitConfigUname(@QueryParameter String value, @QueryParameter boolean gitConfigCredentials)
        throws IOException, ServletException {
    if (gitConfigCredentials){
        return checkFieldNotEmpty(value, "Username");
    }
    return FormValidation.ok();
}
 
开发者ID:warriorframework,项目名称:warrior-jenkins-plugin,代码行数:8,代码来源:WarriorPluginBuilder.java

示例14: doCheckName

import hudson.util.FormValidation; //导入方法依赖的package包/类
public FormValidation doCheckName(@QueryParameter String value, @QueryParameter boolean useFrench)
        throws IOException, ServletException {
    if (value.length() == 0)
        return FormValidation.error(Messages.HelloWorldBuilder_DescriptorImpl_errors_missingName());
    if (value.length() < 4)
        return FormValidation.warning(Messages.HelloWorldBuilder_DescriptorImpl_warnings_tooShort());
    if (!useFrench && value.matches(".*[éáàç].*")) {
        return FormValidation.warning(Messages.HelloWorldBuilder_DescriptorImpl_warnings_reallyFrench());
    }
    return FormValidation.ok();
}
 
开发者ID:10000TB,项目名称:Jenkins-Plugin-Examples,代码行数:12,代码来源:HelloWorldBuilder.java

示例15: doCheckToolchainName

import hudson.util.FormValidation; //导入方法依赖的package包/类
public FormValidation doCheckToolchainName(@QueryParameter String value)
        throws IOException, ServletException {
    if (value == null || value.equals("empty")) {
        return FormValidation.errorWithMarkup("Could not retrieve list of toolchains. Please check your username and password. If you have not created a toolchain, create one <a target='_blank' href='https://console.ng.bluemix.net/devops/create'>here</a>.");
    }
    return FormValidation.ok();
}
 
开发者ID:IBM,项目名称:ibm-cloud-devops,代码行数:8,代码来源:PublishSQ.java


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