本文整理汇总了Java中hudson.util.ListBoxModel类的典型用法代码示例。如果您正苦于以下问题:Java ListBoxModel类的具体用法?Java ListBoxModel怎么用?Java ListBoxModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ListBoxModel类属于hudson.util包,在下文中一共展示了ListBoxModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doFillProjectVersionItems
import hudson.util.ListBoxModel; //导入依赖的package包/类
/**
* Performs a lookup of all Versions for the specified Project.
* @param project The ID of the Project to lookup
* @return a ListBoxModel which will be rendered in the select dropdown.
*/
public ListBoxModel doFillProjectVersionItems(@QueryParameter String project) {
if (StringUtils.isBlank(this.sscUrl) || StringUtils.isBlank(this.globalSscToken)) {
return null;
}
ListBoxModel m = new ListBoxModel();
if (project == null || project.equals("")) {
m.add("", "");
return m;
}
try {
FortifySsc ssc = new FortifySsc(new URL(this.sscUrl + "/fm-ws/services"), this.globalSscToken);
List<ProjectVersionLite> projectVersions = ssc.getActiveProjectVersions(Long.valueOf(project));
m.add("---- " + Messages.select() + " ---- ", "");
for (ProjectVersionLite projectVersion : projectVersions) {
m.add(projectVersion.getName(), String.valueOf(projectVersion.getId()));
}
} catch (Exception e) {
m.add(Messages.sscfailure(), e.getMessage());
}
return m;
}
示例2: doFillCredentialsIdItems
import hudson.util.ListBoxModel; //导入依赖的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;
}
示例3: doFillCredentialsIdItems
import hudson.util.ListBoxModel; //导入依赖的package包/类
public static ListBoxModel doFillCredentialsIdItems(String credentialsId) {
if (credentialsId == null) {
credentialsId = "";
}
if (!Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER)) {
// Important! Otherwise you expose credentials metadata to random
// web requests.
return new StandardListBoxModel()
.includeCurrentValue(credentialsId);
}
return new StandardListBoxModel()
.includeEmptyValue()
.includeAs(ACL.SYSTEM, Jenkins.getInstance(),
OpenShiftTokenCredentials.class)
// .includeAs(ACL.SYSTEM, Jenkins.getInstance(),
// StandardUsernamePasswordCredentials.class)
// .includeAs(ACL.SYSTEM, Jenkins.getInstance(),
// StandardCertificateCredentials.class)
// TODO: Make own type for token or use the existing token
// generator auth type used by sync plugin? or kubernetes?
.includeCurrentValue(credentialsId);
}
示例4: doFillToolchainNameItems
import hudson.util.ListBoxModel; //导入依赖的package包/类
/**
* This method is called to populate the toolchain list on the Jenkins config page.
* @param context
* @param orgName
* @param credentialsId
* @return
*/
public ListBoxModel doFillToolchainNameItems(@AncestorInPath ItemGroup context,
@QueryParameter("credentialsId") final String credentialsId,
@QueryParameter("orgName") final String orgName) {
String targetAPI = chooseTargetAPI(environment);
try {
bluemixToken = getBluemixToken(context, credentialsId, targetAPI);
} catch (Exception e) {
return new ListBoxModel();
}
if(debug_mode){
LOGGER.info("#######UPLOAD BUILD INFO : calling getToolchainList#######");
}
ListBoxModel toolChainListBox = getToolchainList(bluemixToken, orgName, environment, debug_mode);
return toolChainListBox;
}
示例5: doFillToolchainNameItems
import hudson.util.ListBoxModel; //导入依赖的package包/类
/**
* This method is called to populate the toolchain list on the Jenkins config page.
* @param context
* @param orgName
* @param credentialsId
* @return
*/
public ListBoxModel doFillToolchainNameItems(@AncestorInPath ItemGroup context,
@QueryParameter("credentialsId") final String credentialsId,
@QueryParameter("orgName") final String orgName) {
String targetAPI = chooseTargetAPI(environment);
try {
bluemixToken = getBluemixToken(context, credentialsId, targetAPI);
} catch (Exception e) {
return new ListBoxModel();
}
if(debug_mode){
LOGGER.info("#######UPLOAD DEPLOYMENT INFO : calling getToolchainList#######");
}
ListBoxModel toolChainListBox = getToolchainList(bluemixToken, orgName, environment, debug_mode);
return toolChainListBox;
}
示例6: doFillPolicyNameItems
import hudson.util.ListBoxModel; //导入依赖的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);
}
示例7: doFillPolicyNameItems
import hudson.util.ListBoxModel; //导入依赖的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,
@RelativePath("..") @QueryParameter final String orgName,
@RelativePath("..") @QueryParameter final String toolchainName,
@RelativePath("..") @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("#######UPLOAD TEST RESULTS : calling getPolicyList#######");
}
return getPolicyList(bluemixToken, orgName, toolchainName, environment, debug_mode);
}
示例8: doFillToolchainNameItems
import hudson.util.ListBoxModel; //导入依赖的package包/类
/**
* This method is called to populate the toolchain list on the Jenkins config page.
* @param context
* @param orgName
* @param credentialsId
* @return
*/
public ListBoxModel doFillToolchainNameItems(@AncestorInPath ItemGroup context,
@QueryParameter("credentialsId") final String credentialsId,
@QueryParameter("orgName") final String orgName) {
String targetAPI = chooseTargetAPI(environment);
try {
bluemixToken = getBluemixToken(context, credentialsId, targetAPI);
} catch (Exception e) {
return new ListBoxModel();
}
if(debug_mode){
LOGGER.info("#######UPLOAD TEST RESULTS : calling getToolchainList#######");
}
ListBoxModel toolChainListBox = getToolchainList(bluemixToken, orgName, environment, debug_mode);
return toolChainListBox;
}
示例9: doFillPrincipalCredentialIdItems
import hudson.util.ListBoxModel; //导入依赖的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);
}
示例10: doFillTypeItems
import hudson.util.ListBoxModel; //导入依赖的package包/类
public ListBoxModel doFillTypeItems() {
ListBoxModel r = new ListBoxModel();
r.add("<any>", "");
for (ToolDescriptor<?> desc : ToolInstallation.all()) {
String idOrSymbol = desc.getId();
Set<String> symbols = SymbolLookup.getSymbolValue(desc);
if (!symbols.isEmpty()) {
idOrSymbol = symbols.iterator().next();
}
r.add(desc.getDisplayName(), idOrSymbol);
}
return r;
}
示例11: doFillMirrorgateCredentialsIdItems
import hudson.util.ListBoxModel; //导入依赖的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);
}
示例12: doFillCredentialsIdItems
import hudson.util.ListBoxModel; //导入依赖的package包/类
public ListBoxModel doFillCredentialsIdItems(
@AncestorInPath Item context,
@QueryParameter String remote,
@QueryParameter String credentialsId) {
if (context == null && !Jenkins.getActiveInstance().hasPermission(Jenkins.ADMINISTER)
|| context != null && !context.hasPermission(Item.EXTENDED_READ)) {
return new StandardListBoxModel().includeCurrentValue(credentialsId);
}
return new StandardListBoxModel()
.includeEmptyValue()
.includeMatchingAs(
context instanceof Queue.Task
? Tasks.getAuthenticationOf((Queue.Task) context)
: ACL.SYSTEM,
context,
StandardUsernameCredentials.class,
URIRequirementBuilder.fromUri(remote).build(),
GitClient.CREDENTIALS_MATCHER)
.includeCurrentValue(credentialsId);
}
示例13: doFillCheckoutCredentialsIdItems
import hudson.util.ListBoxModel; //导入依赖的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
);
}
示例14: doFillConnectionIdItems
import hudson.util.ListBoxModel; //导入依赖的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;
}
示例15: doFillCredentialsIdItems
import hudson.util.ListBoxModel; //导入依赖的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;
}