use of com.genericworkflownodes.knime.parameter.Parameter in project GenericKnimeNodes by genericworkflownodes.
the class ParamHandler method transferValuesToConfig.
/**
* Translate all parameters extracted from the ParamXML file into the given
* INodeConfiguration.
*/
private void transferValuesToConfig() {
// add parameters
for (Entry<String, Parameter<?>> entry : m_extractedParameters.entrySet()) {
m_config.addParameter(entry.getKey(), entry.getValue());
}
// set ports
m_config.setInports(m_inputPorts);
m_config.setOutports(m_outputPorts);
// remove cli mappings of ignored parameters
if (m_config.getCLI() != null && !m_ignoredParameters.isEmpty()) {
Iterator<CLIElement> element_iterator = m_config.getCLI().getCLIElement().iterator();
while (element_iterator.hasNext()) {
CLIElement current_element = element_iterator.next();
// check the mapping elements
for (CLIMapping mapping : current_element.getMapping()) {
if (m_ignoredParameters.contains(mapping.getReferenceName())) {
// remove this element and stop the loop
element_iterator.remove();
break;
}
}
}
}
}
use of com.genericworkflownodes.knime.parameter.Parameter in project GenericKnimeNodes by genericworkflownodes.
the class CLICommandGenerator method handleListParameter.
private void handleListParameter(final List<List<? extends CommandLineElement>> extractedParameterValues, final ListParameter listParameter) {
final int nValues = listParameter.getStrings().size();
final String key = ((Parameter<?>) listParameter).getKey();
final List<CommandLineElement> tmpList = new LinkedList<CommandLineElement>();
// there's only one element in the list
if (nValues > 1) {
int sequence = 0;
for (final String value : listParameter.getStrings()) {
final CommandLineElement commandLineElement;
if (listParameter instanceof IFileParameter) {
commandLineElement = new CommandLineFile(new FileParameter(key, value));
} else {
commandLineElement = new CommandLineParameter(new StringParameter(key, value));
}
commandLineElement.setSequenceNumber(sequence++);
tmpList.add(commandLineElement);
}
} else {
// only one value in the list, no need to use sequence numbers
final String value = listParameter.getStrings().get(0);
if (listParameter instanceof IFileParameter) {
tmpList.add(new CommandLineFile(new FileParameter(key, value)));
} else {
tmpList.add(new CommandLineParameter(new StringParameter(key, value)));
}
}
extractedParameterValues.add(tmpList);
}
Aggregations