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


Java StandardListBoxModel.add方法代码示例

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


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

示例1: doFillPrincipalCredentialIdItems

import com.cloudbees.plugins.credentials.common.StandardListBoxModel; //导入方法依赖的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

示例2: doFillCheckoutCredentialsIdItems

import com.cloudbees.plugins.credentials.common.StandardListBoxModel; //导入方法依赖的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

示例3: doFillCredentialsIdItems

import com.cloudbees.plugins.credentials.common.StandardListBoxModel; //导入方法依赖的package包/类
/**
 * Fills in the Login Credentials selection box with applicable Jenkins credentials.
 * 
 * @param context
 *            filter for credentials
 * @param credentialsId
 *            existing login credentials; can be null
 * @param project
 *            the Jenkins project
 * 
 * @return credential selections
 */
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());

	StandardListBoxModel model = new StandardListBoxModel();
	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:jenkinsci,项目名称:compuware-scm-downloader-plugin,代码行数:37,代码来源:PdsConfiguration.java

示例4: doFillCredentialsIdItems

import com.cloudbees.plugins.credentials.common.StandardListBoxModel; //导入方法依赖的package包/类
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath Item item, @QueryParameter String credentialsId) {
    StandardListBoxModel result = new StandardListBoxModel();
    if (item == null) {
        if (!Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER)) {
            return result.add(credentialsId);
        }
    } else {
        if (!item.hasPermission(Item.EXTENDED_READ)
                && !item.hasPermission(CredentialsProvider.USE_ITEM)) {
            return result.add(credentialsId);
        }
    }

    return result
            .withEmptySelection()
            .withAll(CredentialsProvider.lookupCredentials(StandardUsernamePasswordCredentials.class, item, null, Collections.<DomainRequirement>emptyList()))
            .withMatching(CredentialsMatchers.withId(credentialsId));
}
 
开发者ID:jenkinsci,项目名称:checkmarx-plugin,代码行数:19,代码来源:CxScanBuilder.java

示例5: doFillCredentialsIdItems

import com.cloudbees.plugins.credentials.common.StandardListBoxModel; //导入方法依赖的package包/类
@Restricted(NoExternalUse.class)
@SuppressWarnings("unused") // stapler form binding
public ListBoxModel doFillCredentialsIdItems(@CheckForNull @AncestorInPath Item context,
                                             @QueryParameter String serverUrl,
                                             @QueryParameter String credentialsId) {
    StandardListBoxModel result = new StandardListBoxModel();
    if (context == null) {
        if (!Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER)) {
            // must have admin if you want the list without a context
            result.includeCurrentValue(credentialsId);
            return result;
        }
    } else {
        if (!context.hasPermission(Item.EXTENDED_READ)
                && !context.hasPermission(CredentialsProvider.USE_ITEM)) {
            // must be able to read the configuration or use the item credentials if you want the list
            result.includeCurrentValue(credentialsId);
            return result;
        }
    }
    result.add(Messages.SSHCheckoutTrait_useAgentKey(), "");
    result.includeMatchingAs(
            context instanceof Queue.Task ?
                    Tasks.getDefaultAuthenticationOf((Queue.Task) context)
                    : ACL.SYSTEM,
            context,
            StandardUsernameCredentials.class,
            URIRequirementBuilder.fromUri(serverUrl).build(),
            CredentialsMatchers.instanceOf(SSHUserPrivateKey.class)
    );
    return result;
}
 
开发者ID:jenkinsci,项目名称:gitea-plugin,代码行数:33,代码来源:SSHCheckoutTrait.java

示例6: doFillBuildStatusPublishModeItems

import com.cloudbees.plugins.credentials.common.StandardListBoxModel; //导入方法依赖的package包/类
@SuppressWarnings("unused")
@Restricted(NoExternalUse.class)
public final ListBoxModel doFillBuildStatusPublishModeItems() {
    StandardListBoxModel result = new StandardListBoxModel();
    for (BuildStatusPublishMode mode : BuildStatusPublishMode.values()) {
        result.add(mode.name());
    }

    return result;
}
 
开发者ID:Argelbargel,项目名称:gitlab-branch-source-plugin,代码行数:11,代码来源:MonitorStrategy.java

示例7: doFillCredentialsIdItems

import com.cloudbees.plugins.credentials.common.StandardListBoxModel; //导入方法依赖的package包/类
/**
 * Fills in the Login Credential selection box with applicable Jenkins credentials
 * 
 * @param context
 *            filter for credentials
 * 
 * @return credential selections
 */
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());

	StandardListBoxModel model = new StandardListBoxModel();

	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$ //$NON-NLS-2$
				c.getId(), isSelected));
	}

	return model;
}
 
开发者ID:jenkinsci,项目名称:compuware-scm-downloader-plugin,代码行数:36,代码来源:IspwConfiguration.java


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