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


Java FormValidation.warning方法代码示例

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


在下文中一共展示了FormValidation.warning方法的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,代码来源:PublishSQ.java

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

示例4: doCheckMirrorgateCredentialsId

import hudson.util.FormValidation; //导入方法依赖的package包/类
public FormValidation doCheckMirrorgateCredentialsId(
        @AncestorInPath Item item,
        @QueryParameter("mirrorgateCredentialsId") String credentialsId) {

    if (item == null) {
        if (!Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER)) {
            return FormValidation.ok();
        }
    } else if (!item.hasPermission(Item.EXTENDED_READ)
            && !item.hasPermission(CredentialsProvider.USE_ITEM)) {
        return FormValidation.ok();
    }
    if (StringUtils.isBlank(credentialsId)) {
        return FormValidation.ok();
    }
    if (credentialsId.startsWith("${") && credentialsId.endsWith("}")) {
        return FormValidation.warning(
                "Cannot validate expression based credentials");
    }
    return FormValidation.ok();
}
 
开发者ID:BBVA,项目名称:mirrorgate-jenkins-builds-collector,代码行数:22,代码来源:MirrorGatePublisher.java

示例5: checkForDuplicates

import hudson.util.FormValidation; //导入方法依赖的package包/类
@CheckForNull
private static FormValidation checkForDuplicates(String value, ModelObject context, ModelObject object) {
    for (CredentialsStore store : CredentialsProvider.lookupStores(object)) {
        if (!store.hasPermission(CredentialsProvider.VIEW)) {
            continue;
        }
        ModelObject storeContext = store.getContext();
        for (Domain domain : store.getDomains()) {
            if (CredentialsMatchers.firstOrNull(store.getCredentials(domain), CredentialsMatchers.withId(value))
                    != null) {
                if (storeContext == context) {
                    return FormValidation.error("This ID is already in use");
                } else {
                    return FormValidation.warning("The ID ‘%s’ is already in use in %s", value,
                            storeContext instanceof Item
                                    ? ((Item) storeContext).getFullDisplayName()
                                    : storeContext.getDisplayName());
                }
            }
        }
    }
    return null;
}
 
开发者ID:jenkinsci,项目名称:browserstack-integration-plugin,代码行数:24,代码来源:BrowserStackCredentials.java

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

示例7: doCheckXmlVer

import hudson.util.FormValidation; //导入方法依赖的package包/类
public FormValidation doCheckXmlVer(@QueryParameter String value)
        throws IOException, ServletException {
    if ("true".equals(value)) {
        return FormValidation.ok();
    } else {
        return FormValidation.warning("Please use the new version if you can.");
    }
}
 
开发者ID:TommyLin,项目名称:cppchecker,代码行数:9,代码来源:Cppchecker.java

示例8: doCheckName

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

    in the UI, fields for city is wrapped inside those of state, so "../name" binds
    to the name field in the state.
    */

    if (name==null || value==null || value.contains(name))             return FormValidation.ok();
    return FormValidation.warning("City name doesn't contain "+name);
}
 
开发者ID:10000TB,项目名称:Jenkins-Plugin-Examples,代码行数:16,代码来源:FormFieldValidationWithContext.java

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

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

示例11: doCheckCredentialsId

import hudson.util.FormValidation; //导入方法依赖的package包/类
public FormValidation doCheckCredentialsId(
    @AncestorInPath Item context, @QueryParameter String remote, @QueryParameter String value) {
  if (context == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER)
      || context != null && !context.hasPermission(Item.EXTENDED_READ)) {
    return FormValidation.ok();
  }

  value = Util.fixEmptyAndTrim(value);
  if (value == null) {
    return FormValidation.ok();
  }

  remote = Util.fixEmptyAndTrim(remote);
  if (remote == null)
  // not set, can't check
  {
    return FormValidation.ok();
  }

  for (ListBoxModel.Option o :
      CredentialsProvider.listCredentials(
          StandardUsernameCredentials.class,
          context,
          context instanceof Queue.Task
              ? Tasks.getAuthenticationOf((Queue.Task) context)
              : ACL.SYSTEM,
          URIRequirementBuilder.fromUri(remote).build(),
          GitClient.CREDENTIALS_MATCHER)) {
    if (StringUtils.equals(value, o.value)) {
      // TODO check if this type of credential is acceptable to the Git client or does it merit warning
      // NOTE: we would need to actually lookup the credential to do the check, which may require
      // fetching the actual credential instance from a remote credentials store. Perhaps this is
      // not required
      return FormValidation.ok();
    }
  }
  // no credentials available, can't check
  return FormValidation.warning("Cannot find any credentials with id " + value);
}
 
开发者ID:GerritForge,项目名称:gerrit-plugin,代码行数:40,代码来源:GerritSCMSource.java

示例12: doCheckIncludes

import hudson.util.FormValidation; //导入方法依赖的package包/类
@Restricted(NoExternalUse.class)
public FormValidation doCheckIncludes(@QueryParameter String includes) {
    if (includes.isEmpty()) {
        return FormValidation.warning(Messages.GitLabSCMBranchMonitorStrategy_did_you_mean_to_use_to_match_all_branches());
    }
    return FormValidation.ok();
}
 
开发者ID:Argelbargel,项目名称:gitlab-branch-source-plugin,代码行数:8,代码来源:GitLabSCMBranchMonitorStrategy.java

示例13: doCheckName

import hudson.util.FormValidation; //导入方法依赖的package包/类
public FormValidation doCheckName(@QueryParameter String value)
        throws IOException, ServletException {
    if (value.length() == 0)
        return FormValidation.error("Please set a group");
    if (value.length() < 4)
        return FormValidation.warning("Isn't the group too short?");
    return FormValidation.ok();
}
 
开发者ID:MarkusDNC,项目名称:plot-plugin,代码行数:9,代码来源:PlotBuilder.java

示例14: reportValidationIssue

import hudson.util.FormValidation; //导入方法依赖的package包/类
private FormValidation reportValidationIssue(String resolvedInput, FormValidation issue) {
  switch (issue.kind) {
    case OK:
      return issue;
    case ERROR:
      return FormValidation.error(Messages
          .AbstractCloudDeploymentDescriptor_SampleResolution(issue.getMessage(), resolvedInput));
    case WARNING:
      return FormValidation.warning(Messages
          .AbstractCloudDeploymentDescriptor_SampleResolution(issue.getMessage(), resolvedInput));
    default:
      return issue;
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:jenkins-deployment-manager-plugin,代码行数:15,代码来源:AbstractCloudDeploymentDescriptor.java

示例15: doCheckLoginTokenFilePath

import hudson.util.FormValidation; //导入方法依赖的package包/类
public FormValidation doCheckLoginTokenFilePath(@QueryParameter String value) throws IOException, InterruptedException{
	FilePath tokenPath = new FilePath(new File(value));
	if(!tokenPath.exists()){
		return FormValidation.warning(tokenPath.getName() + "is not a directory on the Jenkins master (but perhaps it exists on some slaves)");
	}
	return FormValidation.ok();
}
 
开发者ID:kevinfealey,项目名称:appscansource-scanner,代码行数:8,代码来源:AppScanSourceBuilder.java


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