Package hudson.model

Examples of hudson.model.ParametersAction


            if (a instanceof ParametersAction) {
                return (ParametersAction)a;
            }
        }

        return new ParametersAction();
    }
View Full Code Here


   
    List<ParameterValue> values = new ArrayList<ParameterValue>();
    for (BooleanParameterConfig config : configs) {
      values.add(new BooleanParameterValue(config.getName(), config.getValue()));
    }
    return new ParametersAction(values);
  }
View Full Code Here

                                    // be defensive as the core might change
                                } catch (InvocationTargetException e) {
                                    // be defensive as the core might change
                                }
                            }
                            return new ParametersAction(fv);
                        }
                    });
                }
            }
        } catch (IOException ex) {
View Full Code Here

  @Override
  public Action getAction(AbstractBuild<?,?> build, TaskListener listener)
      throws IOException {

    ParametersAction action = build.getAction(ParametersAction.class);
    if (action == null) {
      listener.getLogger().println("[parameterized-trigger] Current build has no parameters.");
      return null;
    } else {
      List<ParameterValue> values = new ArrayList<ParameterValue>(action.getParameters().size());
      for (ParameterValue value : action.getParameters())
        // FileParameterValue is currently not reusable, so omit these:
        if (!(value instanceof FileParameterValue))
          values.add(value);
      return new ParametersAction(values);
    }
  }
View Full Code Here

        for (ParameterValue param : a.getParameters()) {
            params.add(convertToDefinedType(parameterDefinitions, param));
        }

        /* Add default values from defined params in the target job */
        return new ParametersAction(params);
    }
View Full Code Here

        LinkedHashMap<String,ParameterValue> params = new LinkedHashMap<String,ParameterValue>();
        for (ParameterValue param : base.getParameters())
            params.put(param.getName(), param);
        for (ParameterValue param : overlay.getParameters())
            params.put(param.getName(), param);
        return new ParametersAction(params.values().toArray(new ParameterValue[params.size()]));
    }
View Full Code Here

    for (Map.Entry<Object, Object> entry : p.entrySet()) {
      values.add(new StringParameterValue(entry.getKey().toString(),
          env.expand(entry.getValue().toString())));
    }

    return new ParametersAction(values);
  }
View Full Code Here

   
    for (AbstractBuild<?,?> targetBuild: targetBuilds) {
      values.addAll(extractAllValues(targetBuild, listener, trimmedFiles));
    }
    //Values might be empty, in that case don't return anything.
    return values.size() == 0 ? null :new ParametersAction(values);
  }
View Full Code Here

    private static ParametersAction getDefaultParameters(AbstractProject<?,?> project) {
        ParametersDefinitionProperty property = project.getProperty(ParametersDefinitionProperty.class);

        if (property == null) {
            return new ParametersAction();
        }

        List<ParameterValue> parameters = new ArrayList<ParameterValue>();
        for (ParameterDefinition pd : property.getParameterDefinitions()) {
            ParameterValue param = pd.getDefaultParameterValue();
            if (param != null) {
                parameters.add(param);
            }
        }

        return new ParametersAction(parameters);
    }
View Full Code Here

    public Map<String,String> parameters = new HashMap<String, String>();

    protected int run() throws Exception {
        job.checkPermission(Item.BUILD);

        ParametersAction a = null;
        if (!parameters.isEmpty()) {
            ParametersDefinitionProperty pdp = job.getProperty(ParametersDefinitionProperty.class);
            if (pdp==null)
                throw new AbortException(job.getFullDisplayName()+" is not parameterized but the -p option was specified");

            List<ParameterValue> values = new ArrayList<ParameterValue>();

            for (Entry<String, String> e : parameters.entrySet()) {
                String name = e.getKey();
                ParameterDefinition pd = pdp.getParameterDefinition(name);
                if (pd==null)
                    throw new AbortException(String.format("\'%s\' is not a valid parameter. Did you mean %s?",
                            name, EditDistance.findNearest(name, pdp.getParameterDefinitionNames())));
                values.add(pd.createValue(this,e.getValue()));
            }
            for (ParameterDefinition pd : pdp.getParameterDefinitions()) {
                if (parameters.get(pd.getName()) == null) {
                    values.add(pd.getDefaultParameterValue());
                }
            }
            a = new ParametersAction(values);
        }

        Future<? extends AbstractBuild> f = job.scheduleBuild2(0, new CLICause(), a);
        if (!syncreturn 0;
View Full Code Here

TOP

Related Classes of hudson.model.ParametersAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.