private void loadPluginOptions() { if (clientId != null && clientSecret != null && baseUrl != null) { api = new FodApi(clientId, clientSecret, baseUrl); api.authenticate(); applications = api.getApplicationController().getApplications(); releases = api.getReleaseController().getReleases(applications.get(0).getApplicationId()); assessments = FilterNegativeEntitlements( api.getReleaseController().getAssessmentTypeIds(releases.get(0).getReleaseId())); } }
@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; }
@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; }