/** * Fill method for the SiteName field select box * * @return the {@link ListBoxModel} with all possible {@link JIRASite} names */ public ListBoxModel doFillSiteNameItems() { ListBoxModel model = new ListBoxModel(); for (JIRASite site : JIRABuildResultReportNotifier.DESCRIPTOR.getSites()) { model.add(site.name); } return model; }
/** * Fill method for the IssueType field list box * * @param siteName the name of the selected {@link JIRASite} * @param projectKey the key of the JIRA Project * @return the possible values for the list box in a {@link ListBoxModel} * @throws FormException in case of communication issues with JIRA */ public ListBoxModel doFillIssueTypeItems( @QueryParameter(PARAMETER_PREFIX + "siteName") String siteName, @QueryParameter(PARAMETER_PREFIX + "projectKey") String projectKey) throws FormException { ListBoxModel model = new ListBoxModel(); if (StringUtils.isBlank(siteName) || StringUtils.isBlank(projectKey)) { return model; } JIRAClient client = null; try { client = JIRASite.getSite(siteName).createClient(); for (RemoteIssueType issueType : client.getIssueTypesForProject(projectKey)) { model.add(issueType.getName(), issueType.getId()); } } catch (RemoteException e) { LOGGER.log(Level.SEVERE, "Failed to get the JIRA Projects", e); throw new FormException( "Failed to get JIRA Project IssueTypes", e, PARAMETER_PREFIX + "projectKey"); } catch (MalformedURLException e) { throw new FormException("Invalid JIRA URL provided", e, PARAMETER_PREFIX + "projectKey"); } catch (ServiceException e) { LOGGER.log(Level.SEVERE, "Failed to get the JIRA Projects", e); throw new FormException( "Failed to get JIRA Project IssueTypes", e, PARAMETER_PREFIX + "projectKey"); } finally { if (client != null) { client.logout(); } } return model; }
/** * Fill method for the Issue Priorities select box * * @param siteName the {@link JIRASite} name to get the priorities from * @return the possible priorities * @throws FormException in case of errors */ public ListBoxModel doFillIssuePriorityItems( @QueryParameter(PARAMETER_PREFIX + "siteName") String siteName) throws FormException { ListBoxModel model = new ListBoxModel(); if (StringUtils.isBlank(siteName)) { return model; } JIRAClient client = null; try { client = JIRASite.getSite(siteName).createClient(); for (Map.Entry<String, String> priority : client.getPriorities().entrySet()) { model.add(priority.getValue(), priority.getKey()); } } catch (RemoteException e) { LOGGER.log(Level.SEVERE, "Failed to get the JIRA Projects", e); throw new FormException( "Failed to get JIRA Project Keys", e, PARAMETER_PREFIX + "projectKey"); } catch (MalformedURLException e) { throw new FormException("Invalid JIRA URL provided", e, PARAMETER_PREFIX + "projectKey"); } catch (ServiceException e) { LOGGER.log(Level.SEVERE, "Failed to get the JIRA Projects", e); throw new FormException( "Failed to get JIRA Project Keys", e, PARAMETER_PREFIX + "projectKey"); } finally { if (client != null) { client.logout(); } } return model; }
public ListBoxModel doFillGpgKeyNameItems() { ListBoxModel items = new ListBoxModel(); for (GpgKey gpgKey : gpgKeys) { items.add(gpgKey.getName(), gpgKey.getName()); } return items; }
public ListBoxModel doFillCharsetItems() { ListBoxModel items = new ListBoxModel(); for (Map.Entry<String, Charset> entry : Charset.availableCharsets().entrySet()) { items.add(entry.getValue().displayName(), entry.getKey()); } return items; }
@Restricted(DoNotUse.class) public ListBoxModel doFillNetworkIdItems(@QueryParameter String networkId, @RelativePath("..") @QueryParameter String endPointUrl, @RelativePath("..") @QueryParameter String identity, @RelativePath("..") @QueryParameter String credential, @RelativePath("..") @QueryParameter String zone ) { ListBoxModel m = new ListBoxModel(); m.add("None specified", ""); try { Openstack openstack = JCloudsCloud.getOpenstack(endPointUrl, identity, credential, zone); for (org.openstack4j.model.network.Network network: openstack.getSortedNetworks()) { m.add(String.format("%s (%s)", network.getName(), network.getId()), network.getId()); } return m; } catch (AuthenticationException _) { // Incorrect credentials - noop } catch (Exception ex) { LOGGER.log(Level.SEVERE, ex.getMessage(), ex); } if (Util.fixEmpty(networkId) != null) { m.add(networkId); } return m; }
@Restricted(DoNotUse.class) public ListBoxModel doFillSlaveTypeItems() { ListBoxModel items = new ListBoxModel(); items.add("SSH", "SSH"); items.add("JNLP", "JNLP"); return items; }
// NOTE: The following Getters are used to return saved values in the global.jelly. Intellij // marks them unused, but they actually are used. // These getters are also named in the following format: doFill<JellyField>Items. @SuppressWarnings("unused") public ListBoxModel doFillApplicationIdItems() { ListBoxModel listBox = new ListBoxModel(); for (ApplicationDTO app : applications) { final String value = String.valueOf(app.getApplicationId()); listBox.add(new ListBoxModel.Option(app.getApplicationName(), value, false)); } return listBox; }
public ListBoxModel doFillNexusNameItems() { ListBoxModel items = new ListBoxModel(); if (nexusMap != null) { for (String name : nexusMap.keySet()) { items.add(name + " [" + nexusMap.get(name).getUrl() + "]", name); } } return items; }
public ListBoxModel doFillSolrCollectionItems(@QueryParameter String solrUrl) { ListBoxModel items = new ListBoxModel(); try { for (String collection : getCollections(solrUrl)) { items.add(collection); } } catch (IOException e) { items.add("URL invalid"); } return items; }
@SuppressWarnings("unused") public ListBoxModel doFillReleaseIdItems(@QueryParameter(APPLICATION_ID) int applicationId) { ListBoxModel listBox = new ListBoxModel(); api.authenticate(); releases = api.getReleaseController().getReleases(applicationId); for (ReleaseDTO release : releases) { final String value = String.valueOf(release.getReleaseId()); listBox.add(new ListBoxModel.Option(release.getReleaseName(), value, false)); } return listBox; }
public ListBoxModel doFillSizeIdItems(@RelativePath("..") @QueryParameter String authToken) throws Exception { List<Size> availableSizes = DigitalOcean.getAvailableSizes(authToken); ListBoxModel model = new ListBoxModel(); for (Size size : availableSizes) { model.add(DigitalOcean.buildSizeLabel(size), size.getSlug()); } return model; }
public ListBoxModel doFillRegionIdItems(@RelativePath("..") @QueryParameter String authToken) throws Exception { List<Region> availableSizes = DigitalOcean.getAvailableRegions(authToken); ListBoxModel model = new ListBoxModel(); for (Region region : availableSizes) { model.add(region.getName(), region.getSlug()); } return model; }
@Restricted(DoNotUse.class) public ListBoxModel doFillUserDataIdItems() { ListBoxModel m = new ListBoxModel(); m.add("None specified", ""); ConfigProvider provider = getConfigProvider(); for(Config config : provider.getAllConfigs()) { m.add(config.name, config.id); } return m; }
public static ListBoxModel fillAuthenticationItems() { ListBoxModel items = new ListBoxModel(); items.add(""); for (BasicDigestAuthentication basicDigestAuthentication : HttpRequestGlobalConfig.get().getBasicDigestAuthentications()) { items.add(basicDigestAuthentication.getKeyName()); } for (FormAuthentication formAuthentication : HttpRequestGlobalConfig.get().getFormAuthentications()) { items.add(formAuthentication.getKeyName()); } return items; }
public ListBoxModel doFillImageIdItems(@RelativePath("..") @QueryParameter String authToken) throws Exception { SortedMap<String, Image> availableImages = DigitalOcean.getAvailableImages(authToken); ListBoxModel model = new ListBoxModel(); for (Map.Entry<String, Image> entry : availableImages.entrySet()) { final Image image = entry.getValue(); // For non-snapshots, use the image ID instead of the slug (which isn't available anyway) // so that we can build images based upon backups. final String value = DigitalOcean.getImageIdentifier(image); model.add(entry.getKey(), value); } return model; }
public static ListBoxModel fillZoneItems( AWSCredentialsProvider credentialsProvider, String region) { ListBoxModel model = new ListBoxModel(); if (AmazonEC2Cloud.testMode) { model.add(TEST_ZONE); return model; } if (!StringUtils.isEmpty(region)) { AmazonEC2 client = EC2Cloud.connect(credentialsProvider, AmazonEC2Cloud.getEc2EndpointUrl(region)); DescribeAvailabilityZonesResult zones = client.describeAvailabilityZones(); List<AvailabilityZone> zoneList = zones.getAvailabilityZones(); model.add("<not specified>", ""); for (AvailabilityZone z : zoneList) { model.add(z.getZoneName(), z.getZoneName()); } } return model; }
@SuppressWarnings("unused") public ListBoxModel doFillAssessmentTypeIdItems(@QueryParameter(RELEASE_ID) int releaseId) { ListBoxModel listBox = new ListBoxModel(); api.authenticate(); assessments = FilterNegativeEntitlements(api.getReleaseController().getAssessmentTypeIds(releaseId)); for (ReleaseAssessmentTypeDTO assessmentType : assessments) { final String value = String.valueOf(assessmentType.getAssessmentTypeId()); String infoText; if (assessmentType.getFrequencyTypeId() == EntitlementFrequencyType.Subscription.getValue()) { infoText = "Subscription"; } else { infoText = String.format("Single Scan: %s Unit(s) left", assessmentType.getUnitsAvailable()); } final String name = String.format("%s (%s)", assessmentType.getName(), infoText); listBox.add(new ListBoxModel.Option(name, value, false)); } return listBox; }
@SuppressWarnings("unused") public ListBoxModel doFillEntitlementIdItems( @QueryParameter(ASSESSMENT_TYPE_ID) final String assessmentTypeId) { // Get entitlements on load ListBoxModel listBox = new ListBoxModel(); Set<ReleaseAssessmentTypeDTO> applicableAssessments = new HashSet<>(); for (ReleaseAssessmentTypeDTO assessment : assessments) { if (assessment.getAssessmentTypeId() == Integer.parseInt(assessmentTypeId) && Integer.parseInt(assessmentTypeId) > 0) applicableAssessments.add(assessment); } for (ReleaseAssessmentTypeDTO entitlement : applicableAssessments) { String val = String.valueOf(entitlement.getEntitlementId()); boolean addIt = true; for (ListBoxModel.Option option : listBox) { addIt = !option.value.equals(val); } if (addIt) listBox.add(new ListBoxModel.Option(val, val, false)); } return listBox; }
public ListBoxModel doFillClusterItems( @QueryParameter String credentialsId, @QueryParameter String regionName) { try { final AmazonECSClient client = getAmazonECSClient(credentialsId, regionName); final ListBoxModel options = new ListBoxModel(); for (String arn : client.listClusters().getClusterArns()) { options.add(arn); } return options; } catch (RuntimeException e) { // missing credentials will throw an "AmazonClientException: Unable to load AWS credentials // from any provider in the chain" LOGGER.log( Level.INFO, "Exception searching clusters for credentials=" + credentialsId + ", regionName=" + regionName, e); return new ListBoxModel(); } }
public ListBoxModel doFillValueItems( @AncestorInPath AbstractProject<?, ?> project, @QueryParameter String param) throws IOException, InterruptedException { ListBoxModel items = new ListBoxModel(); scm = getProjectSCM(project); if (scm == null) { items.add("!No Git repository configured in SCM configuration"); return items; } ParametersDefinitionProperty prop = project.getProperty(ParametersDefinitionProperty.class); if (prop != null) { ParameterDefinition def = prop.getParameterDefinition(param); if (def instanceof GitParameterDefinition) { GitParameterDefinition paramDef = (GitParameterDefinition) def; Map<String, String> paramList = paramDef.generateContents(project, scm); for (Map.Entry<String, String> entry : paramList.entrySet()) { items.add(entry.getValue(), entry.getKey()); } } } return items; }
@SuppressWarnings("UnusedDeclaration") public ListBoxModel doFillWorseThanOrEqualToItems() { ListBoxModel items = new ListBoxModel(); items.add("Success", Result.SUCCESS.toString()); items.add("Unstable", Result.UNSTABLE.toString()); items.add("Failure", Result.FAILURE.toString()); items.add("Not Built", Result.NOT_BUILT.toString()); items.add("Aborted", Result.ABORTED.toString()); return items; }
public ListBoxModel doFillTestTypeItems(String testType) { ListBoxModel model = new ListBoxModel(); model.add(HygieiaConstants.UNIT_TEST_DISPLAY, TestSuiteType.Unit.toString()); model.add(HygieiaConstants.INTEGRATION_TEST_DISPLAY, TestSuiteType.Integration.toString()); model.add(HygieiaConstants.FUNCTIONAL_TEST_DISPLAY, TestSuiteType.Functional.toString()); model.add(HygieiaConstants.REGRESSION_TEST_DISPLAY, TestSuiteType.Regression.toString()); model.add(HygieiaConstants.PERFORMANCE_TEST_DISPLAY, TestSuiteType.Performance.toString()); model.add(HygieiaConstants.SECURITY_TEST_DISPLAY, TestSuiteType.Security.toString()); return model; }
@SuppressWarnings("unused") public ListBoxModel doFillLanguageLevelItems( @QueryParameter(TECHNOLOGY_STACK) String technologyStack) { ListBoxModel items = new ListBoxModel(); if (technologyStack == null || technologyStack.isEmpty()) technologyStack = defaultTechStack; switch (technologyStack) { case TS_JAVA_KEY: items.add(new ListBoxModel.Option("1.2", "1.2", false)); items.add(new ListBoxModel.Option("1.3", "1.3", false)); items.add(new ListBoxModel.Option("1.4", "1.4", false)); items.add(new ListBoxModel.Option("1.5", "1.5", false)); items.add(new ListBoxModel.Option("1.6", "1.6", false)); items.add(new ListBoxModel.Option("1.7", "1.7", false)); items.add(new ListBoxModel.Option("1.8", "1.8", false)); break; case TS_DOT_NET_KEY: items.add(new ListBoxModel.Option("1.0", "1.0", false)); items.add(new ListBoxModel.Option("1.1", "1.1", false)); items.add(new ListBoxModel.Option("2.0", "2.0", false)); items.add(new ListBoxModel.Option("3.0", "3.0", false)); items.add(new ListBoxModel.Option("3.5", "3.5", false)); items.add(new ListBoxModel.Option("4.0", "4.0", false)); items.add(new ListBoxModel.Option("4.5", "4.5", false)); break; case TS_PYTHON_KEY: items.add(new ListBoxModel.Option("Standard Python", "Standard Python", false)); items.add(new ListBoxModel.Option("Django", "Django", false)); break; default: // support for no language level, must be null for correct API call items.add(new ListBoxModel.Option("N/A", null, false)); break; } return items; }
@SuppressWarnings("unused") public ListBoxModel doFillTechnologyStackItems() { ListBoxModel items = new ListBoxModel(); items.add(new ListBoxModel.Option(TS_DOT_NET_KEY, TS_DOT_NET_KEY, false)); items.add(new ListBoxModel.Option(TS_ABAP_KEY, TS_ABAP_KEY, false)); items.add(new ListBoxModel.Option(TS_ASP_KEY, TS_ASP_KEY, false)); items.add(new ListBoxModel.Option(TS_ANDROID_KEY, TS_ANDROID_KEY, false)); items.add(new ListBoxModel.Option(TS_CFML_KEY, TS_ABAP_KEY, false)); items.add(new ListBoxModel.Option(TS_COBOL_KEY, TS_COBOL_KEY, false)); items.add(new ListBoxModel.Option(TS_JAVA_KEY, TS_JAVA_KEY, false)); items.add(new ListBoxModel.Option(TS_OBJECTIVE_C_KEY, TS_OBJECTIVE_C_KEY, false)); items.add(new ListBoxModel.Option(TS_PHP_KEY, TS_PHP_KEY, false)); items.add(new ListBoxModel.Option(TS_PLSQL_TSQL_KEY, TS_PLSQL_TSQL_KEY, false)); items.add(new ListBoxModel.Option(TS_PYTHON_KEY, TS_PYTHON_KEY, false)); items.add(new ListBoxModel.Option(TS_RUBY_KEY, TS_RUBY_KEY, false)); items.add(new ListBoxModel.Option(TS_VB6_KEY, TS_VB6_KEY, false)); items.add(new ListBoxModel.Option(TS_VB_SCRIPT_KEY, TS_VB_SCRIPT_KEY, false)); items.add(new ListBoxModel.Option(TS_XML_HTML_KEY, TS_XML_HTML_KEY, false)); defaultTechStack = items.get(0).name; return items; }
/** * Fills the interval list box. * * @return the interval list box. */ @SuppressWarnings("unused") // used by Jelly public ListBoxModel doFillIntervalItems() { ListBoxModel model = new ListBoxModel(); model.add("1 minute", "1m"); model.add("2 minutes", "2m"); model.add("5 minutes", "5m"); model.add("10 minutes", "10m"); model.add("15 minutes", "15m"); model.add("20 minutes", "20m"); model.add("25 minutes", "25m"); model.add("30 minutes", "30m"); model.add("1 hour", "1h"); model.add("2 hours", "2h"); model.add("4 hours", "4h"); model.add("8 hours", "8h"); model.add("12 hours", "12h"); model.add("1 day", "1d"); model.add("2 days", "2d"); model.add("1 week", "7d"); model.add("2 weeks", "14d"); model.add("4 weeks", "28d"); return model; }
@Override public ListBoxModel doFillScopeItems() { ListBoxModel m = new ListBoxModel(); m.add(CredentialsScope.GLOBAL.getDisplayName(), CredentialsScope.GLOBAL.toString()); return m; }