use of org.knime.core.node.port.PortObject in project knime-core by knime.
the class GlobalTimerinfoNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected PortObject[] execute(final PortObject[] inData, final ExecutionContext exec) throws Exception {
BufferedDataTable result0 = NodeTimer.GLOBAL_TIMER.getGlobalStatsTable(exec);
BufferedDataContainer result1 = exec.createDataContainer(createSpecOut1());
int rowcount = 0;
for (IBundleGroupProvider provider : Platform.getBundleGroupProviders()) {
for (IBundleGroup feature : provider.getBundleGroups()) {
DataRow row = new DefaultRow(new RowKey("Row " + rowcount++), new StringCell(feature.getIdentifier()), new StringCell(feature.getVersion()));
result1.addRowToTable(row);
}
}
result1.close();
return new PortObject[] { result0, result1.getTable() };
}
use of org.knime.core.node.port.PortObject in project knime-core by knime.
the class Normalizer3NodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected PortObject[] execute(final PortObject[] inObjects, final ExecutionContext exec) throws Exception {
CalculationResult result = calculate(inObjects, exec);
NormalizerPortObject p = new NormalizerPortObject(result.getSpec(), result.getConfig());
return new PortObject[] { result.getDataTable(), p };
}
use of org.knime.core.node.port.PortObject in project knime-core by knime.
the class One2ManyCol2PMMLNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected PortObject[] execute(final PortObject[] inObjects, final ExecutionContext exec) throws Exception {
BufferedDataTable inData = (BufferedDataTable) inObjects[0];
DataTableSpec dts = inData.getDataTableSpec();
checkColumnsSpecs(dts);
String[] includes = m_includedColumns.applyTo(dts).getIncludes();
One2ManyCellFactory cellFactory = new One2ManyCellFactory(dts, Arrays.asList(includes), m_appendOrgColName);
BufferedDataTable outData = exec.createColumnRearrangeTable(inData, createRearranger(dts, cellFactory), exec);
if (m_pmmlOutEnabled) {
// the optional PMML in port (can be null)
PMMLPortObject inPMMLPort = m_pmmlInEnabled ? (PMMLPortObject) inObjects[1] : null;
PMMLOne2ManyTranslator trans = new PMMLOne2ManyTranslator(cellFactory.getColumnMapping(), new DerivedFieldMapper(inPMMLPort));
PMMLPortObjectSpecCreator creator = new PMMLPortObjectSpecCreator(inPMMLPort, outData.getDataTableSpec());
PMMLPortObject outPMMLPort = new PMMLPortObject(creator.createSpec(), inPMMLPort);
outPMMLPort.addGlobalTransformations(trans.exportToTransDict());
return new PortObject[] { outData, outPMMLPort };
} else {
return new PortObject[] { outData };
}
}
use of org.knime.core.node.port.PortObject in project knime-core by knime.
the class BinnerNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected PortObject[] execute(final PortObject[] inPorts, final ExecutionContext exec) throws Exception {
BufferedDataTable inData = (BufferedDataTable) inPorts[DATA_INPORT];
DataTableSpec spec = inData.getDataTableSpec();
ColumnRearranger colReg = createColumnRearranger(spec);
BufferedDataTable buf = exec.createColumnRearrangeTable(inData, colReg, exec);
if (!m_pmmlOutEnabled) {
return new PortObject[] { buf };
}
// handle the optional PMML in port (can be null)
PMMLPortObject inPMMLPort = m_pmmlInEnabled ? (PMMLPortObject) inPorts[1] : null;
PMMLPortObject outPMMLPort = createPMMLModel(inPMMLPort, spec, buf.getDataTableSpec());
return new PortObject[] { buf, outPMMLPort };
}
use of org.knime.core.node.port.PortObject in project knime-core by knime.
the class FilterApplyNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected PortObject[] execute(final PortObject[] inObjects, final ExecutionContext exec) throws Exception {
exec.setProgress(0);
PortObject portObject = inObjects[1];
DataTableSpec filterSpec = portObject == null ? ((BufferedDataTable) inObjects[0]).getDataTableSpec() : ((FilterDefinitionHandlerPortObject) portObject).getSpec();
final BufferedDataTableRowOutput out = new BufferedDataTableRowOutput(exec.createDataContainer(((BufferedDataTable) inObjects[0]).getDataTableSpec()));
execute(new DataTableRowInput((BufferedDataTable) inObjects[0]), out, filterSpec, exec, ((BufferedDataTable) inObjects[0]).size());
return new BufferedDataTable[] { out.getDataTable() };
}
Aggregations