Package hudson.model

Examples of hudson.model.ParameterDefinition


            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()));
            }
           
            a = new ParametersAction(values);
        }
View Full Code Here


        List<ParameterDefinition> parameterDefinitions = new ArrayList<ParameterDefinition>();

        // TODO parsing checks
        for(DBObject dbObject : list) {
            ParameterDefinition definition = (ParameterDefinition) getMapper()
                    .fromDBObject(ParameterDefinition.class, dbObject, getMapper().createEntityCache());

            parameterDefinitions.add(definition);
        }
View Full Code Here

    public ListBoxModel doFillTagItems(@AncestorInPath Job<?,?> context, @QueryParameter String param) {
        ListBoxModel model = new ListBoxModel();
        if (context != null) {
            ParametersDefinitionProperty prop = context.getProperty(ParametersDefinitionProperty.class);
            if (prop != null) {
                ParameterDefinition def = prop.getParameterDefinition(param);
                if (def instanceof ListSubversionTagsParameterDefinition) {
                    for (String tag : ((ListSubversionTagsParameterDefinition) def).getTags(context)) {
                        if (tag.startsWith("!")) {
                            model.add(tag.substring(1), "");
                        } else {
View Full Code Here

        if (params!=null) {
            for (Object o : JSONArray.fromObject(params)) {
                JSONObject jo = (JSONObject) o;
                String name = jo.getString("name");

                ParameterDefinition d=null;
                for (ParameterDefinition def : defs) {
                    if (def.getName().equals(name))
                        d = def;
                }
                if (d == null)
                    throw new IllegalArgumentException("No such parameter definition: " + name);

                ParameterValue v = d.createValue(request, jo);
                if (v == null) {
                    continue;
                }
                mapResult.put(name, convert(name, v));
            }
View Full Code Here

    }

    List<ParameterValue> values = Lists.<ParameterValue>newArrayList();
    for (ParameterValue value : action.getParameters()) {
      String name = value.getName();
      ParameterDefinition pd = pdp.getParameterDefinition(name);
      if (pd == null) {
        continue; // This project does not have this parameter
      }

      // File parameters are special
      if (value instanceof FileParameterValue) {
        final String location = pd.getName();
        File file = new File(
            masterBuild.getRootDir(),
            "fileParameters/" + location);
        String originalFileName =
            ((FileParameterValue) value).getOriginalFileName();
View Full Code Here

      List<ParameterValue> values = Lists.<ParameterValue>newArrayList();

      for (Map.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()));
       }

       // handle missing parameters by adding as default values ISSUE JENKINS-7162
       for (ParameterDefinition pd :  pdp.getParameterDefinitions()) {
         if (parameters.containsKey(pd.getName()))
           continue;

         // not passed in use default
         values.add(pd.getDefaultParameterValue());
       }

       a = new ParametersAction(values);
     }
View Full Code Here

    private static ParameterValue convertToDefinedType(Map<String, ParameterDefinition> defs, ParameterValue pv) {
        String name = pv.getName();

        if (defs.containsKey(name)) {
            ParameterDefinition def = defs.get(name);

            if(canConvert(def, pv)) {
                try {
                    return ((SimpleParameterDefinition)def).createValue(((StringParameterValue)pv).value);
                } catch (RuntimeException e) {
View Full Code Here

            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);
        }
View Full Code Here

TOP

Related Classes of hudson.model.ParameterDefinition

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.