Ejemplo n.º 1
0
    /**
     * This method provides auto-completion items for the 'state' field. Stapler finds this method
     * via the naming convention.
     *
     * @param value The text that the user entered.
     */
    public AutoCompletionCandidates doAutoCompleteTestApplicationName(
        @QueryParameter String value,
        @QueryParameter("hygieiaAPIUrl") final String hygieiaAPIUrl,
        @QueryParameter("hygieiaToken") final String hygieiaToken,
        @QueryParameter("hygieiaJenkinsName") final String hygieiaJenkinsName,
        @QueryParameter("useProxy") final String sUseProxy) {

      String hostUrl = hygieiaAPIUrl;
      if (StringUtils.isEmpty(hostUrl)) {
        hostUrl = this.hygieiaAPIUrl;
      }
      String targetToken = hygieiaToken;
      if (StringUtils.isEmpty(targetToken)) {
        targetToken = this.hygieiaToken;
      }
      String niceName = hygieiaJenkinsName;
      if (StringUtils.isEmpty(niceName)) {
        niceName = this.hygieiaJenkinsName;
      }
      boolean bProxy = "true".equalsIgnoreCase(sUseProxy);
      if (StringUtils.isEmpty(sUseProxy)) {
        bProxy = this.useProxy;
      }
      AutoCompletionCandidates c = new AutoCompletionCandidates();
      if (CollectionUtils.isEmpty(deployAppNames))
        fillApplicationNames(hostUrl, targetToken, niceName, bProxy);
      for (String aN : deployAppNames) {
        if (aN.toLowerCase().startsWith(value.toLowerCase())) {
          c.add(aN);
        }
      }
      return c;
    }
Ejemplo n.º 2
0
    /**
     * This method provides auto-completion items for the 'state' field. Stapler finds this method
     * via the naming convention.
     *
     * @param value The text that the user entered.
     */
    public AutoCompletionCandidates doAutoCompleteTestEnvironmentName(
        @QueryParameter String value,
        @QueryParameter("hygieiaAPIUrl") final String hygieiaAPIUrl,
        @QueryParameter("hygieiaToken") final String hygieiaToken,
        @QueryParameter("hygieiaJenkinsName") final String hygieiaJenkinsName,
        @QueryParameter("useProxy") final String sUseProxy) {
      String hostUrl = hygieiaAPIUrl;
      if (StringUtils.isEmpty(hostUrl)) {
        hostUrl = this.hygieiaAPIUrl;
      }
      String targetToken = hygieiaToken;
      if (StringUtils.isEmpty(targetToken)) {
        targetToken = this.hygieiaToken;
      }
      String niceName = hygieiaJenkinsName;
      if (StringUtils.isEmpty(niceName)) {
        niceName = this.hygieiaJenkinsName;
      }
      boolean bProxy = "true".equalsIgnoreCase(sUseProxy);
      if (StringUtils.isEmpty(sUseProxy)) {
        bProxy = this.useProxy;
      }
      if (!StringUtils.isEmpty(testApplicationNameSelected)) {
        deployEnvNames =
            getHygieiaService(hostUrl, targetToken, niceName, bProxy)
                .getDeploymentEnvironments(testApplicationNameSelected);
      }

      AutoCompletionCandidates c = new AutoCompletionCandidates();
      for (String eN : deployEnvNames) {
        if (eN.toLowerCase().startsWith(value.toLowerCase())) {
          c.add(eN);
        }
      }
      return c;
    }
 public AutoCompletionCandidates doAutoCompleteJobs(
     @QueryParameter String value,
     @AncestorInPath Item self,
     @AncestorInPath ItemGroup container) {
   return AutoCompletionCandidates.ofJobNames(Job.class, value, self, container);
 }
Ejemplo n.º 4
0
 public AutoCompletionCandidates doAutoCompleteChildProjects(@QueryParameter String value) {
   return AutoCompletionCandidates.ofJobNames(
       AbstractProject.class, value, null, Jenkins.getInstance());
 }