當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。