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


Java QueryParameter类代码示例

本文整理汇总了Java中org.kohsuke.stapler.QueryParameter的典型用法代码示例。如果您正苦于以下问题:Java QueryParameter类的具体用法?Java QueryParameter怎么用?Java QueryParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: doFillCredentialsIdItems

import org.kohsuke.stapler.QueryParameter; //导入依赖的package包/类
/**
 * Stapler form completion.
 *
 * @param serverUrl the server URL.
 * @return the available credentials.
 */
@Restricted(NoExternalUse.class) // stapler
@SuppressWarnings("unused")
public ListBoxModel doFillCredentialsIdItems(@QueryParameter String serverUrl) {
    Jenkins.getActiveInstance().checkPermission(Jenkins.ADMINISTER);
    StandardListBoxModel result = new StandardListBoxModel();
    serverUrl = GiteaServers.normalizeServerUrl(serverUrl);
    result.includeMatchingAs(
            ACL.SYSTEM,
            Jenkins.getActiveInstance(),
            StandardCredentials.class,
            URIRequirementBuilder.fromUri(serverUrl).build(),
            AuthenticationTokens.matcher(GiteaAuth.class)
    );
    return result;
}
 
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:22,代码来源:GiteaServer.java

示例2: doCheckToken

import org.kohsuke.stapler.QueryParameter; //导入依赖的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

示例3: doFillPolicyNameItems

import org.kohsuke.stapler.QueryParameter; //导入依赖的package包/类
/**
 * This method is called to populate the policy list on the Jenkins config page.
 * @param context
 * @param orgName
 * @param credentialsId
 * @return
 */
public ListBoxModel doFillPolicyNameItems(@AncestorInPath ItemGroup context,
                                          @QueryParameter final String orgName,
                                          @QueryParameter final String toolchainName,
                                          @QueryParameter final String credentialsId) {
    String targetAPI = chooseTargetAPI(environment);
    try {
        // if user changes to a different credential, need to get a new token
        if (!credentialsId.equals(preCredentials) || Util.isNullOrEmpty(bluemixToken)) {
            bluemixToken = getBluemixToken(context, credentialsId, targetAPI);
            preCredentials = credentialsId;
        }
    } catch (Exception e) {
        return new ListBoxModel();
    }
    if(debug_mode){
        LOGGER.info("#######GATE : calling getPolicyList#######");
    }
    return getPolicyList(bluemixToken, orgName, toolchainName, environment, debug_mode);

}
 
开发者ID:IBM,项目名称:ibm-cloud-devops,代码行数:28,代码来源:EvaluateGate.java

示例4: doFillPrincipalCredentialIdItems

import org.kohsuke.stapler.QueryParameter; //导入依赖的package包/类
public ListBoxModel doFillPrincipalCredentialIdItems(
        @AncestorInPath Item item,
        @QueryParameter String credentialsId) {
    StandardListBoxModel result = new StandardListBoxModel();
    if (item == null) {
        if (!Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER)) {
            return result.includeCurrentValue(credentialsId);
        }
    } else {
        if (!item.hasPermission(Item.EXTENDED_READ)
                && !item.hasPermission(CredentialsProvider.USE_ITEM)) {
            return result.includeCurrentValue(credentialsId);
        }
    }
    List<AzureCredentials> creds = CredentialsProvider.lookupCredentials(AzureCredentials.class, item, ACL.SYSTEM, Collections.<DomainRequirement>emptyList());
    for (AzureCredentials cred
            :
            creds) {
        result.add(cred.getId());
    }
    return result.includeEmptyValue()
            .includeCurrentValue(credentialsId);
}
 
开发者ID:jenkinsci,项目名称:azure-cli-plugin,代码行数:24,代码来源:AzureCLIBuilder.java

示例5: doCheckQueueUuid

import org.kohsuke.stapler.QueryParameter; //导入依赖的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

示例6: doTestConnection

import org.kohsuke.stapler.QueryParameter; //导入依赖的package包/类
public FormValidation doTestConnection(
        @QueryParameter("mirrorGateAPIUrl") final String mirrorGateAPIUrl,
        @QueryParameter("mirrorgateCredentialsId") final String credentialsId)
        throws Descriptor.FormException {
    MirrorGateService testMirrorGateService = getMirrorGateService();
    if (testMirrorGateService != null) {
        MirrorGateResponse response
                = testMirrorGateService.testConnection();
        return response.getResponseCode() == HttpStatus.SC_OK
                ? FormValidation.ok("Success")
                : FormValidation.error("Failure<"
                        + response.getResponseCode() + ">");
    } else {
        return FormValidation.error("Failure");
    }
}
 
开发者ID:BBVA,项目名称:mirrorgate-jenkins-builds-collector,代码行数:17,代码来源:MirrorGatePublisher.java

示例7: doFillMirrorgateCredentialsIdItems

import org.kohsuke.stapler.QueryParameter; //导入依赖的package包/类
public ListBoxModel doFillMirrorgateCredentialsIdItems(
        @AncestorInPath Item item,
        @QueryParameter("mirrorgateCredentialsId") String credentialsId) {

    StandardListBoxModel result = new StandardListBoxModel();
    if (item == null) {
        if (!Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER)) {
            return result.includeCurrentValue(credentialsId);
        }
    } else if (!item.hasPermission(Item.EXTENDED_READ)
            && !item.hasPermission(CredentialsProvider.USE_ITEM)) {
        return result.includeCurrentValue(credentialsId);
    }
    return result
            .includeEmptyValue()
            .includeAs(ACL.SYSTEM, item, StandardUsernamePasswordCredentials.class);
}
 
开发者ID:BBVA,项目名称:mirrorgate-jenkins-builds-collector,代码行数:18,代码来源:MirrorGatePublisher.java

示例8: doCheckMirrorgateCredentialsId

import org.kohsuke.stapler.QueryParameter; //导入依赖的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

示例9: doFillCheckoutCredentialsIdItems

import org.kohsuke.stapler.QueryParameter; //导入依赖的package包/类
@Restricted(NoExternalUse.class)
public ListBoxModel doFillCheckoutCredentialsIdItems(@AncestorInPath SCMSourceOwner context, @QueryParameter String connectionName, @QueryParameter String checkoutCredentialsId) {
    if (context == null && !Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER) ||
            context != null && !context.hasPermission(Item.EXTENDED_READ)) {
        return new StandardListBoxModel().includeCurrentValue(checkoutCredentialsId);
    }

    StandardListBoxModel result = new StandardListBoxModel();
    result.add("- anonymous -", CHECKOUT_CREDENTIALS_ANONYMOUS);
    return result.includeMatchingAs(
            context instanceof Queue.Task
                    ? Tasks.getDefaultAuthenticationOf((Queue.Task) context)
                    : ACL.SYSTEM,
            context,
            StandardUsernameCredentials.class,
            SettingsUtils.gitLabConnectionRequirements(connectionName),
            GitClient.CREDENTIALS_MATCHER
    );
}
 
开发者ID:Argelbargel,项目名称:gitlab-branch-source-plugin,代码行数:20,代码来源:GitLabSCMSourceSettings.java

示例10: doCheckCredentialsId

import org.kohsuke.stapler.QueryParameter; //导入依赖的package包/类
/**
 * Validator for the 'Login credentials' field.
 * 
 * @param credentialsId
 *            login credentials passed from the config.jelly "credentialsId" field
 * 
 * @return validation message
 */
public FormValidation doCheckCredentialsId(@QueryParameter String credentialsId)
{
	String tempValue = StringUtils.trimToEmpty(credentialsId);
	if (tempValue.isEmpty())
	{
		return FormValidation.error(Messages.checkLoginCredentialsError());
	}

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

示例11: doFillConnectionIdItems

import org.kohsuke.stapler.QueryParameter; //导入依赖的package包/类
/**
 * Fills in the Host Connection selection box with applicable connections.
 * 
 * @param context
 *            filter for host connections
 * @param connectionId
 *            an existing host connection identifier; can be null
 * @param project
 *            the Jenkins project
 * 
 * @return host connection selections
 */
public ListBoxModel doFillConnectionIdItems(@AncestorInPath Jenkins context, @QueryParameter String connectionId,
		@AncestorInPath Item project)
{
	CpwrGlobalConfiguration globalConfig = CpwrGlobalConfiguration.get();
	HostConnection[] hostConnections = globalConfig.getHostConnections();

	ListBoxModel model = new ListBoxModel();
	model.add(new Option(StringUtils.EMPTY, StringUtils.EMPTY, false));

	for (HostConnection connection : hostConnections)
	{
		boolean isSelected = false;
		if (connectionId != null)
		{
			isSelected = connectionId.matches(connection.getConnectionId());
		}

		model.add(new Option(connection.getDescription() + " [" + connection.getHostPort() + ']', //$NON-NLS-1$
				connection.getConnectionId(), isSelected));
	}

	return model;
}
 
开发者ID:Compuware-Corp,项目名称:CPWR-CodeCoverage,代码行数:36,代码来源:CodeCoverageBuilder.java

示例12: doFillCredentialsIdItems

import org.kohsuke.stapler.QueryParameter; //导入依赖的package包/类
/**
 * Fills in the Login Credentials selection box with applicable connections.
 * 
 * @param context
 *            filter for login credentials
 * @param credentialsId
 *            existing login credentials; can be null
 * @param project
 *            the Jenkins project
 * 
 * @return login credentials selection
 */
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Jenkins context, @QueryParameter String credentialsId,
		@AncestorInPath Item project)
{
	List<StandardUsernamePasswordCredentials> creds = CredentialsProvider.lookupCredentials(
			StandardUsernamePasswordCredentials.class, project, ACL.SYSTEM,
			Collections.<DomainRequirement> emptyList());

	ListBoxModel model = new ListBoxModel();
	model.add(new Option(StringUtils.EMPTY, StringUtils.EMPTY, false));

	for (StandardUsernamePasswordCredentials c : creds)
	{
		boolean isSelected = false;
		if (credentialsId != null)
		{
			isSelected = credentialsId.matches(c.getId());
		}

		String description = Util.fixEmptyAndTrim(c.getDescription());
		model.add(new Option(c.getUsername() + (description != null ? " (" + description + ')' : StringUtils.EMPTY), //$NON-NLS-1$
				c.getId(), isSelected));
	}

	return model;
}
 
开发者ID:Compuware-Corp,项目名称:CPWR-CodeCoverage,代码行数:38,代码来源:CodeCoverageBuilder.java

示例13: doFillProjectItems

import org.kohsuke.stapler.QueryParameter; //导入依赖的package包/类
public ListBoxModel doFillProjectItems(@QueryParameter String serverUrl, @QueryParameter String username,
                                       @QueryParameter Secret password) throws URISyntaxException {
    ListBoxModel items = new ListBoxModel();

    if (validInputs(serverUrl, username, password)) {
        try {
            TfsClient client = getTfsClientFactory().getValidatedClient(serverUrl, username, password);
            List<TeamProjectReference> references = client.getProjectClient().getProjects();

            for (TeamProjectReference ref : references) {
                items.add(ref.getName(), String.valueOf(ref.getId()));
            }
        } catch (VssServiceException vse) {
            return items;
        }
    }

    return items;
}
 
开发者ID:Microsoft,项目名称:vsts-jenkins-build-integration-sample,代码行数:20,代码来源:TfsBuildNotifier.java

示例14: doFillBuildDefinitionItems

import org.kohsuke.stapler.QueryParameter; //导入依赖的package包/类
public ListBoxModel doFillBuildDefinitionItems(@QueryParameter String serverUrl,  @QueryParameter String username,
                                               @QueryParameter Secret password, @QueryParameter String project) throws URISyntaxException {
    ListBoxModel items = new ListBoxModel();

    if (validInputs(serverUrl, username, password, project)) {
        try {
            TfsClient client = getTfsClientFactory().getValidatedClient(serverUrl, username, password);
            List<DefinitionReference> definitions = client.getBuildClient().getDefinitions(UUID.fromString(project));

            for (DefinitionReference definition : definitions) {
                items.add(definition.getName(), String.valueOf(definition.getId()));
            }
        } catch (VssServiceException vse) {
            return items;
        }
    }

    return items;
}
 
开发者ID:Microsoft,项目名称:vsts-jenkins-build-integration-sample,代码行数:20,代码来源:TfsBuildNotifier.java

示例15: doTestIcon

import org.kohsuke.stapler.QueryParameter; //导入依赖的package包/类
/**
    * Serves the testCoverage badge image. TO DO
    * @param req
    * @param rsp
    * @param job
    * @return
    */
   @SuppressWarnings("rawtypes")
public HttpResponse doTestIcon(StaplerRequest req, StaplerResponse rsp, @QueryParameter String job) {
       Job<?, ?> project = getProject(job);
       Integer testPass = null;
       Integer testTotal = null;

       if (project.getLastCompletedBuild() != null) {
       	AbstractTestResultAction testAction =  project.getLastCompletedBuild().getAction(AbstractTestResultAction.class);
		if(testAction != null){
			int total = testAction.getTotalCount();
			int pass = total - testAction.getFailCount() - testAction.getSkipCount();
			
			testTotal = total;
			testPass = pass;
		}
       }
       return iconResolver.getTestResultImage(testPass, testTotal);
   }
 
开发者ID:SxMShaDoW,项目名称:embeddable-badges-plugin,代码行数:26,代码来源:PublicBadgeAction.java


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