use of com.genericworkflownodes.knime.parameter.IntegerParameter in project GenericKnimeNodes by genericworkflownodes.
the class GalaxyNodeConfigurationReader method processParameter.
private void processParameter(Node n) throws Exception {
Parameter<?> ret = null;
String type = n.valueOf("@type");
if (type.equals("")) {
throw new Exception("type information for parameter not set");
}
String key = n.valueOf("@name");
String val = n.valueOf("@value");
System.out.println("processing param " + key + " type:" + type + " value: " + val);
if (type.equals("integer")) {
ret = new IntegerParameter(key, val);
}
if (type.equals("float")) {
ret = new DoubleParameter(key, val);
}
if (type.equals("boolean")) {
ret = new BoolParameter(key, val);
}
if (type.equals("text")) {
ret = new StringParameter(key, val);
}
if (type.equals("select")) {
List<Node> options = DOMHelper.selectNodes(n, "option");
List<String> opts = new ArrayList<String>();
List<String> labs = new ArrayList<String>();
for (Node option : options) {
String optval = option.valueOf("@value");
String label = option.valueOf("text()");
opts.add(optval);
labs.add(label);
}
ret = new StringChoiceParameter(key, opts, labs);
((StringChoiceParameter) ret).setValue(val);
ret.setIsOptional(false);
}
String descr = n.valueOf("label/text()");
if (ret != null) {
ret.setKey(key);
ret.setDescription(descr);
}
config.addParameter(key, ret);
}
Aggregations