agave-jobs/jobs-core/src/test/java/org/iplantc/service/jobs/managers/JobRequestParameterProcessorIT.java
/**
     * Creates a {@link SoftwareParameter} with teh given constraints, validator, etc.
     *
     * @param key          the key of the parameter
     * @param type         the type of the parameter
     * @param defaultValue the default value of the parameter
     * @param validator    the validator to use on job requests with this parameter
     * @param required     whether the parameter is required
     * @param visible      whether the parameter should be visible
     * @return a software parameter with the given constraints
     */
Creates a  SoftwareParameter with teh given constraints, validator, etc.
Creates a SoftwareParameter with teh given constraints validator etc .
private SoftwareParameter createParameter(String key, SoftwareParameterType type, Object defaultValue, String validator, boolean required, boolean visible) throws IOException {
        SoftwareParameter param = new SoftwareParameter();
        param.setKey(key);
        param.setType(type);
        param.setDefaultValue(defaultValue == null ? null : defaultValue.toString());
        param.setRequired(required);
        param.setVisible(visible);
        if (SoftwareParameterType.enumeration == type) {
            List<SoftwareParameterEnumeratedValue> enums = new ArrayList<SoftwareParameterEnumeratedValue>();
            if (defaultValue != null) {
                String val = null;
                if (defaultValue instanceof ArrayNode) {
                    val = ((ArrayNode) defaultValue).get(0).textValue();
                } else {
                    val = String.valueOf(defaultValue);
                }
                enums.add(new SoftwareParameterEnumeratedValue(val, val, param));
            }
            enums.add(new SoftwareParameterEnumeratedValue("BETA", "BETA", param));
            enums.add(new SoftwareParameterEnumeratedValue("GAMMA", "GAMMA", param));
            enums.add(new SoftwareParameterEnumeratedValue("DELTA", "DELTA", param));
            param.setEnumValues(enums);
        } else {
            param.setValidator(validator);
        }
        return param;
    }
private SoftwareParameter createParameter ( String key , SoftwareParameterType type , Object defaultValue , String validator , boolean required , boolean visible ) throws IOException { SoftwareParameter param = new SoftwareParameter ( ) ; param . setKey ( key ) ; param . setType ( type ) ; param . setDefaultValue ( defaultValue == null ? null : defaultValue . toString ( ) ) ; param . setRequired ( required ) ; param . setVisible ( visible ) ; if ( SoftwareParameterType . enumeration == type ) { List < SoftwareParameterEnumeratedValue > enums = new ArrayList < SoftwareParameterEnumeratedValue > ( ) ; if ( defaultValue != null ) { String val = null ; if ( defaultValue instanceof ArrayNode ) { val = ( ( ArrayNode ) defaultValue ) . get ( 0 ) . textValue ( ) ; } else { val = String . valueOf ( defaultValue ) ; } enums . add ( new SoftwareParameterEnumeratedValue ( val , val , param ) ) ; } enums . add ( new SoftwareParameterEnumeratedValue ( "BETA" , "BETA" , param ) ) ; enums . add ( new SoftwareParameterEnumeratedValue ( "GAMMA" , "GAMMA" , param ) ) ; enums . add ( new SoftwareParameterEnumeratedValue ( "DELTA" , "DELTA" , param ) ) ; param . setEnumValues ( enums ) ; } else { param . setValidator ( validator ) ; } return param ; }
Creates a {@link SoftwareParameter} with teh given constraints, validator, etc.
Creates a { @link SoftwareParameter } with teh given constraints validator etc .